mirror of
https://github.com/sidpalas/devops-directive-terraform-course.git
synced 2025-12-10 12:51:14 +00:00
This change updates the s3 bucket resource syntax to use the newer resource types for specifying versioning and encryption configs. We also enable auto_minor_version_upgrade for the RDS instance and switch to only asking for major version 12. This will just use the default/latest RDS PostgreSQL v12 minor version. Upside, the specific engine_version provided here will take longer before it becomes invalid. Minor downside, we are saying its OK for this RDS instance to undergo minor version upgrades, which while fine for a toy example like this, is often not great in prod.
03 - Basics
Remote Backends
Remote backends enable storage of TF state in a remote, location to enable secure collaboration.
Terraform Cloud
https://www.terraform.io/cloud
./terraform-cloud-backend/main.tf
AWS S3 + Dynamo DB
Steps to initialize backend in AWS and manage it with Terraform:
- Use config from
./aws-backend/(init, plan, apply) to provision s3 bucket and dynamoDB table with local state - Uncomment the remote backend configuration
- Reinitialize with
terraform init:
Do you want to copy existing state to the new backend?
Pre-existing state was found while migrating the previous "local" backend to the
newly configured "s3" backend. No existing state was found in the newly
configured "s3" backend. Do you want to copy this state to the new "s3"
backend? Enter "yes" to copy and "no" to start with an empty state.
Enter a value: yes
Now the S3 bucket and dynamoDB table are mam and are able to be used as the state backend!
Web-App
Generic web application architecture including:
- EC2 instances
- S3 bucket
- RDS instance
- Load balancer
- Route 53 DNS config
This example will be refined and improved in later modules.
