This repository demonstrates a production-style Infrastructure as Code (IaC) setup using Terraform on AWS.
The project shows how to build clean, reusable Terraform modules and compose multiple environments (dev and prod) without duplicating resources.
The infrastructure is built using reusable Terraform modules:
- VPC
- Public subnets
- Internet Gateway
- Route tables
- Reusable security group
- Configurable SSH access
- VPC-based isolation
- EC2 instance provisioning
- Environment-specific instance types
- Subnet and security group injection
Each environment composes these modules and provides its own configuration values.
terraform-aws-multi-env/
├── README.md
├── modules/
│ ├── vpc/
│ ├── security-group/
│ └── ec2/
└── environments/
├── dev/
└── prod/
modules/contains reusable Terraform modulesenvironments/devdefines the development environmentenvironments/proddefines the production environment
No AWS resources are created directly inside environment folders.
All infrastructure resources are defined inside modules
and composed at the environment level.
- Used for development and testing
- Smaller EC2 instance types
- More permissive SSH access
- Production-ready configuration
- Larger EC2 instance types
- Restricted SSH access
Both environments reuse the same Terraform modules.
- Infrastructure as Code (IaC)
- Terraform modules
- Multi-environment architecture (dev / prod)
- Clean dependency management using outputs and inputs
- Reusable and scalable Terraform design
- AWS infrastructure provisioning