A small demo of using Terraform with AWS, created for educational purposes.
Go to file
2022-09-07 12:31:36 +02:00
backend Move backend to S3 2022-09-07 12:31:36 +02:00
modules Add dynamic resources naming and tfvars example 2022-08-26 15:24:01 +02:00
prod Move backend to S3 2022-09-07 12:31:36 +02:00
.gitignore Initial commit 2022-08-24 16:25:55 +02:00
LICENSE Initial commit 2022-08-24 16:25:55 +02:00
README.md Move backend to S3 2022-09-07 12:31:36 +02:00

mr-vercetti/tf-aws-demo

Simple demo of using Terraform in an AWS environment created for learning purposes.

Used AWS services

Operation

This terraform configuration creates VPC and public and private networks with Internet access via IGW and NAT Gateway. A bastion host is created in one of the public networks, from which we can access an autoscaling group of EC2 instances located in the private network. The group hosts a simple web application and scales according to CPU usage. In front of the application is an ALB that directs traffic appropriately. The main infrastructure configuration uses the S3 remote backend with DynamoDB state locking.

Usage

Prerequirements

  • EC2 key pair created in AWS console

Infra setup

  1. Complete terraform.tfvars files (./backend/terraform.tfvars and ./prod/terraform.tfvars)
  2. Initialize and apply terraform config from the backend dir. This will create an S3 bucket and DynamoDB table to use remote state.
  3. Complete backend block in prod/versions.tf with the data you saw in the output from the previous step.
  4. Initialize and apply terraform config from the prod dir. This will create the rest of infrastructure.

Future work

[x] Move state to S3 bucket and create state locking via DynamoDB