DEV Community

Jack Pelorus
Jack Pelorus

Posted on

AWS ECS Terragrunt Boilerplate

A production-derived, multi-layer Terraform + Terragrunt setup for running containerized services on AWS ECS Fargate, behind an ALB, with blue/green deploys via CodeDeploy, a Grafana observability stack, and RDS-backed data services.

This is a sanitized boilerplate extracted from a real client deployment: the architecture, module boundaries, and CI/CD pattern are used as-is in production; all account IDs, domains, credentials, and client-specific naming have been replaced with placeholders. Ports, service names, and a couple of example task definitions (SuiteCRM, pgAdmin) are kept in because they're useful reference points for wiring up your own services, not because you need them.
Why this structure

Terraform modules describe what a resource looks like; they don't know about environments, state, or dependency ordering between layers. Terragrunt is used here to keep environment configuration (env.yaml, region.yaml) out of the modules entirely, wire up remote state automatically per layer, and express the dependency graph between layers (services depends on ecs-base and database, etc.) without copy-pasting backend blocks or duplicating variables across environments.

Github repo : https://github.com/jacksmartv/AWS-ECS-Terragrunt-Boilerplate

Top comments (0)