https://github.com/exodes/terraform-aws
Provisioning 3-tier application on AWS with Terraform modules
https://github.com/exodes/terraform-aws
Last synced: 4 months ago
JSON representation
Provisioning 3-tier application on AWS with Terraform modules
- Host: GitHub
- URL: https://github.com/exodes/terraform-aws
- Owner: eXodes
- Created: 2022-04-25T16:29:35.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-26T19:53:55.000Z (about 4 years ago)
- Last Synced: 2025-08-20T06:25:29.376Z (9 months ago)
- Language: HCL
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Requirements
Write IaC script for provision of a 3-tier application in AWS. You can choose Terraform or CloudFormation to provide
the infrastructure. Terraform is most preferred tool. Your code should provision the following:
- VPC with a public and private subnet.
- Route tables for each subnet, private subnet shall have a NAT gateway.
- Application tier and data tier shall be launched in private subnet.
- Web-tier shall be launched in public subnet.
- Web-tier and application-tier both must have autoscaling enabled and shall be behind an ALB
- Proper security groups attached across all the tiers for proper communication.
Bonus points will be given to the assignment with following items:
- Proper DNS mappings with a privately hosted zone in Route53 for application and data-tier.
- IAM roles attached to the application tier to access RDS, CloudWatch and s3 bucket.
Delivery Outcome:
- Once the IaC script is executed, it should create a VPC with valid CIDR block, which contains all VPC related
Resources such as valid subnets, route tables (public, private), security groups, NAT gateway, Internet Gateway etc.
- It should also create EC2 servers for application-tier and web-tier with autoscaling groups and ALB, and RDS instances
for data-tier.
- Proper security groups and IAM roles should be in place.
## Manual Provisioning
Multiple environment state can be manage through Terraform workspace.
1. Create a new workspace for your project environment.
```bash
terraform workspace new
```
2. Initialize the Terraform environment.
```bash
terraform init
```
3. Create new variables file for your new environment with the command below and update the value.
```bash
cp terraform.tfvars.example terraform.tfvars
```
4. Apply the Terraform configuration to provision the infrastructure.
```bash
terraform apply -var="name=" -var="environment="
```
> Note: You can use `-auto-approve` to skip the interactive confirmation.
3. Tear down the infrastructure with Terraform destroy command.
```bash
terraform destroy -var="name=" -var="environment="
```
## Automated Provisioning
Automated provisioning can be done through Github Actions workflow.