If you use Terraform in the corporate environment your company most likely has multiple AWS accounts. One for pre-production, one for production.
To be able to work in multiple AWS accounts, add those keys to the credentials file at C:\Users\YOUR_USERNAME\.aws
[aws01] aws_access_key_id = MY_ACCESS_KEY_FOR_AWS01 aws_secret_access_key = MY_SECRET_KEY_FOR_AWS01 [aws02] aws_access_key_id = MY_ACCESS_KEY_FOR_AWS02 aws_secret_access_key = MY_SECRET_KEY_FOR_AWS02 [default] aws_access_key_id = MY_ACCESS_KEY_FOR_AWS01 aws_secret_access_key = MY_SECRET_KEY_FOR_AWS01
We will use Terraform to create security groups and load balancers in AWS.
- Create a folder on your workstation for the Git repositories C:\Git
- In the Git folder create a folder for the Terraform Configurations Terraform Configs
- In the Terraform Configs folder create a sub-folder for the
When you are reusing existing Terraform configurations
- Make a copy of the existing Terraform Config folder
- Rename the folder
- Rename the .tf files to match the name of the folder name
- Delete the .tfstate and .tfstate.backup files
- Update the .tf files with the new values
- Open a Bash window in the new folder
- Get the Terraform modules with
terraform get -update
- Test the script with
- Execute the script with
More info on Terraform at https://www.terraform.io/docs/providers/index.html
Launching production instances in the cloud in Beginner’s Guide to DevOps Engineering part 7.
to the Tutorials page