This Terraform configuration demonstrates the deployment of an EC2 instance with an Application Load Balancer using env0 as the deployment platform. This lab is part of the Develeap training program.
The infrastructure consists of three main components:
-
Networking Module
- Custom VPC with public subnets
- Internet Gateway for public access
- Route tables and network ACLs
-
Compute Module
- EC2 instance in a public subnet
- Security group for instance access
- Instance profile and IAM roles
-
Load Balancer Module
- Application Load Balancer (ALB)
- Target group configuration
- Security group for ALB access
- An env0 account with appropriate permissions
- Basic understanding of AWS EC2 and Load Balancing
- Supported AWS regions: us-east-1
The following tags MUST be applied to all resources to comply with AWS policies:
Objective
: Must be set to "true"Expiration
: Must be set to "true"Email
: Must be set to "true"
owner
: Your email addressstage
: Environment stage (production/dev/test)project
: Project identifier
Failure to include these tags will result in deployment failures due to AWS IAM policies.
Update your terraform.tfvars
with appropriate values:
vpc_cidr = "10.0.0.0/16"
project = "your-project-name"
instance_type = "t3.micro"
owner = "[email protected]"
stage = "dev"
# Required AWS tags
tags = {
Objective = "true"
Expiration = "true"
Email = "true"
}
- In env0, create a new template pointing to this repository
- Configure the required AWS credentials in env0
- Set the necessary variables in your env0 template
- Ensure all required tags are configured
- Deploy the environment through env0's UI
.
├── main.tf # Main configuration
├── variables.tf # Input variables
├── outputs.tf # Output values
├── providers.tf # Provider configurations
├── terraform.tfvars # Variable values
└── modules/
├── networking/ # VPC and subnet configurations
│ ├── main.tf
│ ├── variables.tf
│ └── outputs.tf
├── compute/ # EC2 instance configurations
│ ├── main.tf
│ ├── variables.tf
│ └── outputs.tf
└── loadbalancer/# ALB configurations
├── main.tf
├── variables.tf
└── outputs.tf
After successful deployment, you'll have access to:
alb_dns_name
: The DNS name of the Application Load Balancerinstance_id
: The ID of the deployed EC2 instancevpc_id
: The ID of the created VPCpublic_subnet_ids
: List of public subnet IDs
This repository implements strict code quality standards and commit message conventions using Husky and commitlint.
To set up the project dependencies:
make install
Follow the Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer]
feat
: New featurefix
: Bug fixdocs
: Documentation changesstyle
: Code styling changesrefactor
: Code refactoringperf
: Performance improvementstest
: Adding/updating testsbuild
: Build process changesci
: CI configuration changeschore
: Other changesrevert
: Reverting commits
- Type: Indicates commit purpose (required)
- Scope: Affected component/module (required)
- Description: Brief change summary (required)
- Body: Detailed explanation (optional)
- Footer: References/breaking changes (optional)
feat(networking): add custom VPC configuration
fix(compute): resolve instance startup issue
docs(readme): update deployment instructions
For any issues or questions, please contact:
- Develeap Support Team
No requirements.
No providers.
Name | Source | Version |
---|---|---|
compute | ./modules/compute | n/a |
loadbalancer | ./modules/loadbalancer | n/a |
networking | ./modules/networking | n/a |
No resources.
Name | Description | Type | Default | Required |
---|---|---|---|---|
aws_region | AWS region for the resources | string |
"us-east-1" |
no |
default_root_object | Default root object for the CloudFront distribution | string |
"index.html" |
no |
end_date | Project end date (dd/mm/yyyy) | string |
n/a | yes |
instance_type | EC2 instance type | string |
"t3.micro" |
no |
owner | Owner's develeap email ([email protected]) | string |
n/a | yes |
project | Project name (must be descriptive) | string |
n/a | yes |
stage | Environment stage (production, dev, or test) | string |
n/a | yes |
start_date | Project start date (dd/mm/yyyy) | string |
n/a | yes |
vpc_cidr | CIDR block for VPC | string |
"10.0.0.0/16" |
no |
Name | Description |
---|---|
alb_dns_name | DNS name of the ALB |
instance_public_ip | Public IP of the EC2 instance |
vpc_id | ID of the VPC |
Copyright © 2024 Develeap. All rights reserved.