-
-
Save hotsen/13b143c87478cf3ae18be6767b20dfb4 to your computer and use it in GitHub Desktop.
terraform environment init.sh
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
| #!/bin/bash | |
| # Usage: ./init.sh once to initialize remote storage for this environment. | |
| # Subsequent tf actions in this environment don't require re-initialization, | |
| # unless you have completely cleared your .terraform cache. | |
| # | |
| # terraform plan -var-file=./production.tfvars | |
| # terraform apply -var-file=./production.tfvars | |
| tf_env="production" | |
| terraform remote config -backend=s3 \ | |
| -backend-config="bucket=hound-terraform-state" \ | |
| -backend-config="key=$tf_env.tfstate" \ | |
| -backend-config="region=us-east-1" | |
| echo "set remote s3 state to $tf_env.tfstate" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment