Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/walkersumida/tf-aws-sample
https://github.com/walkersumida/tf-aws-sample
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/walkersumida/tf-aws-sample
- Owner: walkersumida
- Created: 2018-10-22T12:37:20.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-22T12:51:04.000Z (about 6 years ago)
- Last Synced: 2024-10-23T02:12:53.943Z (2 months ago)
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# install
```
brew install tfenv
tfenv install 0.11.7
brew install ansible
brew install terraform-inventory
```# Create S3 bucket for tfstate file
Create `tf-sample-files` bucket.# Create access key
# Add aws credentials
```
mkdir ~/.aws
touch ~/.aws/config
``````
[profile tf-sample]
aws_access_key_id = hogehoeg
aws_secret_access_key = hogehoge
```# init command
```
cd terraform
terraform init \
-backend-config "bucket=tf-sample-files" \
-backend-config "key=terraform/terraform.tfstate.aws" \
-backend-config "region=ap-northeast-1" \
-backend-config "profile=tf-sample"
```# Copy files
```
cp terraform/variables.tf.sample terraform/variables.tf
cp ansible/wp/group_vars_all.sample ansible/wp/group_vars/all
cp ansible/ansible.cfg.sample ansible/ansible.cfg
```# create key pair
```
cd ~/.ssh
ssh-keygen -t rsa -f tf-sample
```# Apply
```
cd terraform
terraform apply
```# Exec Ansible
```shell
cd terraform
terraform state pull > .terraform/local.tfstatecd ansible/wp
TF_STATE=../../terraform/.terraform/local.tfstate ansible-playbook --inventory-file=/usr/local/bin/terraform-inventory playbook.ymlcd terraform
terraform destroy
```