Keep your terraform code DRY
summary
A migration replaces duplicated per-environment Terraform directories with a single codebase plus per-environment config files, using Terraform, Terragrunt, generated templates, an S3/DynamoDB remote state and Atlantis automation, and it covers about 45 services × 5 envs. Results cut examples from 3,300→256 lines and from 1,600→135 lines, speeds PR review and cross‑env comparison, and lets non‑experts change simple config. Tradeoffs are an upfront rebuild, trickier template debugging, and limits when environments are not identical.
AI-written summary · about
chapters (12)
- 0:00Introduction and background
- 1:47SayNow product and challenges
- 4:56Original Terraform structure issues
- 7:06Motivation for DRY principles
- 11:27DRY approach explained
- 15:46Demo setup and configuration
- 21:27Practical implementation
- 28:22Results and code reduction
- 29:05Advantages of DRY code
- 31:36Disadvantages and edge cases
- 33:44Applying changes with Atlantis
- 37:23Conclusion and Q&A
