Interview Prep/Terraform/Repository Structure, Environments and Module Strategy

How do you lay out environments in a repo?

BeginnerProductionRepository Structure, Environments and Module Strategy
Answer
live/
  dev/ap-south-1/network/  main.tf  backend.hcl  terraform.tfvars
  prod/ap-south-1/network/
modules/
  vpc/  eks/  rds/

Each leaf directory is a stack with its own state. Environments differ in values, not in code, and modules are consumed by version. The extra files are repetitive but explicit and safe to review.

All Terraform questions Roadmap: Terraform in production

More on Repository Structure, Environments and Module Strategy