Enterprise-grade AWS infrastructure scaffold using Terraform and Terragrunt with a layered architecture based on Domain-Driven Design (DDD) principles.
The project implements four infrastructure layers with strict dependency ordering:
Foundation → Platform → Application → Observability
stacks/
├── foundation/
│ ├── network/
│ │ ├── vpc/ # VPC, subnets, NAT gateways
│ │ └── security-groups/ # Security group definitions
│ └── iam/
│ ├── roles/ # IAM roles
│ └── policies/ # IAM policies
├── platform/
│ ├── containers/
│ │ ├── eks/ # EKS cluster and node groups
│ │ └── ecr/ # Container registry
│ └── data/
│ ├── rds/ # RDS PostgreSQL/MySQL
│ └── elasticache/ # ElastiCache Redis/Memcached
├── application/
│ ├── compute/
│ │ ├── alb/ # Application Load Balancer
│ │ └── asg/ # Auto Scaling Groups
│ └── storage/
│ ├── s3/ # S3 buckets
│ └── efs/ # Elastic File System
└── observability/
└── monitoring/
├── cloudwatch/ # CloudWatch dashboards and alarms
└── prometheus/ # Prometheus monitoring
- Terraform >= 1.0
- Terragrunt >= 0.50
- AWS CLI configured with appropriate profiles
- TFLint (optional, for linting)
# 1. Clone and configure
git clone <repository-url>
cd terraform_terragrunt_scaffold_project
# 2. Set environment
export TF_VAR_ENVIRONMENT=dev # dev | qa | prd
# 3. Initialize and plan a stack
cd stacks/foundation/network/vpc
terragrunt init
terragrunt plan
# 4. Apply
terragrunt apply# Plan all stacks (respects dependency order)
terragrunt run --all plan
# Apply a specific layer
terragrunt run --all --working-dir stacks/foundation -- apply
# Destroy (reverse dependency order)
terragrunt run --all destroy.
├── root.hcl # Root Terragrunt config (remote state, providers)
├── common/
│ ├── common.hcl # Shared locals and provider generation
│ ├── common.tfvars # Common variable values
│ └── variables.tf # Shared variable definitions
├── environments/
│ ├── dev/ # Dev environment overrides
│ ├── qa/ # QA environment overrides
│ └── prd/ # Production environment overrides
├── stacks/ # Infrastructure stacks (see Architecture)
├── docs/ # Documentation and catalog
└── .kiro/
├── steering/ # AI agent steering rules
├── skills/ # AI agent skills
│ └── iac-versioning-commits/ # Commit and versioning standards
├── agents/ # Agent configurations
└── settings/ # MCP settings
Configuration follows a hierarchical precedence (highest to lowest):
environments/{env}/*.tfvars— Environment-specific overridescommon/common.tfvars— Shared values- Stack-level
variables.tfdefaults
Each environment directory contains layer-specific tfvars:
environments/dev/
├── foundations.tfvars
├── platform.tfvars
├── applications.tfvars
└── observability.tfvars
Every stack contains:
| File | Purpose |
|---|---|
terragrunt.hcl |
Dependencies, includes, inputs |
main.tf |
Resource/module definitions |
variables.tf |
Input variables |
outputs.tf |
Output values |
This project uses IaC Tagging Code (MAJOR.MINOR.PATCH):
- MAJOR — Environment additions/removals, framework changes
- MINOR — New stacks, modules, or resources (backward compatible)
- PATCH — Bug fixes, config tuning, documentation
Commits follow Conventional Commits extended with contextual action lines. See .kiro/skills/iac-versioning-commits/ for the full specification.
# Lint
tflint --recursive
# Pre-commit hooks
pre-commit run --all-files
# Validate syntax
terragrunt validateSee LICENSE for details.