Terraform AWS Foundations Module
Opinionated Terraform root module: VPC, IAM roles, S3 remote state backend, and DynamoDB lock table with documented variable inputs.
Stop Copying Terraform Boilerplate Between Projects
Every new AWS project starts the same way: create a VPC, set up an S3 backend, configure IAM, add a DynamoDB lock table. This Terraform module handles all of it with sensible defaults and documented variables for every environment-specific value.
What's Covered
- VPC with public/private subnets, NAT Gateway, and flow logs
- S3 remote state bucket with versioning and server-side encryption
- DynamoDB lock table for state locking
- IAM roles: deployment role, read-only audit role, cross-account trust
- Default security groups blocking unrestricted inbound
- Tagging strategy enforced via variables
Usage
module "foundations" {
source = "./modules/aws-foundations"
environment = "prod"
aws_region = "us-east-1"
vpc_cidr = "10.0.0.0/16"
}Included Files
modules/aws-foundations/— reusable moduleenvironments/prod/andenvironments/staging/— example root configsbootstrap/— one-time backend setup scriptREADME.md— variable reference, backend setup, and module composition guide