/xyz-infrastructure

Code repository for infrastructure as code for XYZ, inc.

Primary LanguageHCLApache License 2.0Apache-2.0

XYZ Demo Infrastructure

This repository contains the Terraform code to generate a Virtual Private Cloud (VPC) and Elastic Kubernetes Cluster in Amazon Web Services. The default region is us-east-2. State is stored in an S3 bucket with a locking DynamoDB table.

Diagram

Infrastructure

This code provsiions several resources when used. They include:

  • Virtual Private Cloud (VPC)
  • 3 Public Subnets
  • 3 Private Subnets
  • NAT Gateway
  • Internet Gateway
  • Elastic Kubernetes Service (EKS) Cluster
  • 2 EKS Node Groups, backed by AutoScaling Groups
  • Default Security Group
  • Route Table for Private Subnets

The projected infrastructure costs for this workload is $133.34 per month.

Local Usage

  1. Clone the repository.
  2. In AWS, create a DynamoDB table. Use LockID for the partition key.
  3. In AWS, create an S3 bucket to store Terraform state.
  4. Modify lines 34 - 37 in teraform.tf to match the name of your S3 bucket and DyanmoDB table.
  5. Modify the varialbes in variables.tf to match your region and other settings.
  6. Run terraform init to initialize Terraform.
  7. Run terraform apply to launch the infrastructure.
  8. Run terraform destroy to dear down the infrastructure when you are done.

GitHub Actions

Merges and pushes to the main branch of this repository will initiate a build using GitHub Actions. The workflow runs several terraform commands: terraform init, terraform plan, then terraform apply.