This Terraform project automates the provisioning of AWS infrastructure components, including networking, compute, databases, caching, and load balancing.
-
network/
Contains Terraform configurations for the AWS networking layer:vpc.tf— VPC definitionsubnets.tf— Public and private subnetsinternet-gateway.tf— Internet Gateway resourcenat.tf— NAT Gateway for private subnet outbound accesspub-route-table.tf— Route table for public subnetspriv-route-table.tf— Route table for private subnetsSGs.tf— Security Groups definitionsvariables.tf— Variables used in the network configsoutputs.tf— Network outputs like VPC ID, subnet IDs, etc.
-
Root directory
Contains Terraform configurations for core services and resources:ami.tf— AMI data source definitionsbackend.tf— Remote backend configuration for Terraform stateEC2s.tf— EC2 instances definitions (application servers, bastion, etc.)elasticache.tf— AWS ElastiCache Redis cluster configurationkey.tf— SSH key pair resource for EC2 accessmain.tf— Main Terraform file (calls modules or main resources)outputs.tf— Outputs for root-level resourcesprovider.tf— AWS provider and version configprivate_alb.tf— Private Application Load Balancer setuppublic_alb.tf— Public Application Load Balancer setupRDS.tf— AWS RDS (MySQL/PostgreSQL) instance configurationterraform.tfvars— Terraform variable values filevariables.tf— Root variables definitionREADME.md— This documentation fileNotes.md— Additional notes and explanations
- Terraform installed (version compatible with your AWS provider)
- AWS CLI configured with appropriate credentials and permissions
- SSH key pair for EC2 instance access
-
Initialize Terraform working directory:
terraform init
-
Review planned infrastructure changes:
terraform plan -var-file="terraform.tfvars" -
Apply changes to provision infrastructure:
terraform apply -var-file="terraform.tfvars" -
Destroy infrastructure when no longer needed:
terraform destroy -var-file="terraform.tfvars"
-
The infrastructure is designed with a multi-tier architecture, separating public and private subnets for security and scalability.
-
Load balancers are deployed both publicly (for frontend access) and privately (for backend services).
-
ElastiCache and RDS are provisioned for caching and relational database services, respectively.
-
Security groups control access between layers.
-
Variables and sensitive information should be managed carefully (use of .tfvars and optionally secrets management).
