This project provides a Terraform configuration for setting up infrastructure across multiple environments (development, staging, and production) in AWS. It follows best practices for infrastructure as code, allowing for scalable and repeatable deployments.
- Multi-environment support (Dev, Staging, Prod)
- Amazon VPC setup with private and public subnets
- EC2 instance provisioning
- Elastic Load Balancer (ELB) configuration
- Secure access with Security Groups
├── modules/ # Reusable Terraform modules
│ ├── ec2/ # EC2 module
│ ├── elb/ # ELB module
│ ├── vpc/ # VPC module
├── main.tf # Main configuration
├── providers.tf # Provider configuration
├── variables.tf # Variables configuration
├── terraform.tfstate # State file (managed remotely)
├── terraform.dev.tfvars # Dev vars file (managed locally)
├── terraform.staging.tfvars # Staging vars file (managed locally)
├── terraform.prod.tfvars # Prod vars file (managed locally)
├── README.md # Project documentation
- Terraform installed (Install Guide)
- AWS CLI configured with appropriate credentials
- Remote backend (S3 + DynamoDB) for state management
-
Initialize Terraform:
terraform init
-
Select the desired environment (e.g.,
dev
,staging
, orprod
):terraform workspace new dev # Change directory to the desired environment
-
Plan the deployment:
terraform plan
-
Apply the deployment:
terraform apply -var-file=terraform.dev.tfvars
-
Destroy the infrastructure if needed:
terraform destroy
Below are the key AWS resources provisioned by this Terraform setup:
- VPC: A dedicated Virtual Private Cloud with private and public subnets
- ELB: Load balancer to distribute traffic
- EC2: Virtual machines for application workloads
- Security Groups: Firewall rules for secure access
Replace the placeholders below with actual AWS architecture images
- Modular Terraform code for reusability
- Remote backend for state management
- Environment separation to ensure isolated deployments
- Parameterized configurations for flexibility
- Add auto-scaling for EC2 instances
- Implement IAM roles and policies for fine-grained access control
- Enhance monitoring with CloudWatch and logging setup
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by Eduardo Bernardino 👋 See my linkedin