Day 118: Project: Terraform a full environment from zero
Phase 19 capstone: a real environment from zero
Provision, entirely from Terraform: a VPC with public/private subnets, a managed Kubernetes cluster (or a small VM cluster if avoiding cloud cost), a managed database, and a DNS record pointing at it. This is the infrastructure counterpart to Phase 8's "deploy the stack" project — but one layer down, at the infrastructure level itself.
terraform init
terraform plan -out=tfplan # review carefully
terraform apply tfplan
# Later, tear it down cleanly:
terraform plan -destroy
terraform destroyStructure it like a real team would
Split the config into modules (network, cluster, database), use remote state with locking, and write it so a second environment (staging vs prod) is just a different set of module inputs — not duplicated resource blocks. Then deliberately cause drift (manually change one tag in the console) and confirm terraform plan detects it.
Phase 19 complete — you should now be able to
Why should staging and production environments ideally use the same Terraform modules with different input variables, rather than separate copy-pasted configurations?