Last active
October 26, 2020 05:53
-
-
Save yyoda/22157b7d9803dc9a0f56f1c40a357565 to your computer and use it in GitHub Desktop.
How to setup terraform execution environment by AWS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # see: https://www.terraform.io/docs/backends/types/s3.html | |
| export AWS_PROFILE=xxx | |
| export AWS_REGION=xxx | |
| # AWS S3 Bucket (to persist tfstate) | |
| export AWS_BUCKET=xxx | |
| aws s3api create-bucket --bucket $AWS_BUCKET --create-bucket-configuration LocationConstraint=$AWS_REGION | |
| aws s3api put-bucket-versioning --bucket $AWS_BUCKET --versioning-configuration Status=Enabled | |
| aws s3api put-public-access-block --bucket $AWS_BUCKET --public-access-block-configuration "BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true" | |
| # AWS DynamoDB (terraform locking) | |
| aws dynamodb create-table \ | |
| --table-name terraform.tfstate.lockinfo \ | |
| --attribute-definitions AttributeName=LockID,AttributeType=S \ | |
| --key-schema AttributeName=LockID,KeyType=HASH \ | |
| --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment