Managing infrastructure across multiple AWS accounts can be challenging. In this post, I demonstrate how to use Terraform and Terragrunt to manage a multi-account AWS Organization efficiently.
Directory Structure
Here's the repository structure I use for managing 20+ AWS accounts:
infra/
├── modules/
│ ├── vpc/
│ ├── ecs-cluster/
│ └── rds/
├── environments/
│ ├── dev/
│ │ ├── us-east-1/
│ │ └── eu-west-1/
│ ├── staging/
│ └── prod/
├── accounts/
│ ├── landing-zone.hcl
│ ├── security.hcl
│ └── shared-services.hcl
└── terragrunt.hclTerragrunt's DRY principle means you define shared configuration once and override only what differs per environment.