Terraform code to deploy a production-grade, multi-environment (Admin, Dev, Prod) Hub-and-Spoke architecture on AWS.
- AWS CLI (configured)
- Terraform CLI
- An SSH
.pemkey file
First, create the S3 bucket that will store the Terraform state.
Note: After this runs, copy the s3_bucket_name from the output.
Now, build the main architecture.
-
Navigate back to the root directory:
-
Open
backend.tfand paste the S3 bucket name you copied. -
Create a
terraform.tfvarsfile with the path to your key:
private_key_path = "path/to/your/key.pem"
- Initialize and deploy:
Run the destroy commands in the reverse order of creation.
In the root directory
In the backend-setup directory