This repository contains the Terraform modules and Terragrunt configurations used to manage cloud infrastructure on AWS.
Before you get started, ensure you have the following installed:
- Terraform (v1.8 or higher recommended).
- Terragrunt (v0.58 or higher recommended).
Development tools:
- Terraform-docs (v0.17 or higher recommended).
/deployments
: This directory contains Terragrunt configurations which reference the modules defined in/modules
to deploy actual cloud resources./modules
: This directory contains reusable Terraform modules, each specifying a part of the AWS cloud infrastructure./modules_wip
: This directory contains work-in-progress Terraform modules that are not yet ready for production use. (They probably don't run as-is)/scripts
: This directory contains scripts that can be used to automate tasks such as building Docker images and pushing them to ECR, or building documentation./containers
: This directory contains Dockerfiles for building Docker images that can be deployed to ECS.
Terragrunt is a thin wrapper that provides extra tools for keeping your Terraform configurations DRY, working with multiple Terraform modules, and managing remote state. To use Terragrunt with the configurations in this repo:
-
Navigate to a specific environment configuration under the
./deployments
directory.cd deployments/<environment>
-
Initialize the Terragrunt configuration:
terragrunt run-all init
-
Apply the Terragrunt configuration:
terragrunt run-all apply
Terragrunt has a tool that lets you easily browse and scaffold modules in this repository. To use this tool, run the following command from the root of the repository:
terragrunt catalog
Provider | Module Name | Description |
---|---|---|
hashicorp/aws | app_load_balancer | Application Load Balancer (ALB) module |
hashicorp/aws | cloudFront | Cloudfront module (Handles Route53 and SSL certificate creation) |
hashicorp/aws | ecs | Orchestrates container deployments, ensuring they're running and managing interactions with other AWS services |
hashicorp/aws | network | Network resources (e.g., VPC, Subnets, etc.) |
Provider | Module Name | Description |
---|---|---|
hashicorp/aws | _eks | Elastic Kubernetes Service (EKS) cluster |
hashicorp/helm | _eks-addons | EKS Addons module |
hashicorp/aws | _kinesis | Kinesis stream handler |
hashicorp/aws | _route53 | Route53 domain management and DNS services |
To build the documentation, run the following command from the project root directory:
./scripts/build_docs.sh
This demo deploys a docker image to an ECS cluster. To test the deployment, run the following commands:
-
Retrieve the Authentication Token and Authenticate Docker to ECR:
aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <account_id>.dkr.ecr.<region>.amazonaws.com
-
Navigate to the demo image directory:
cd containers/demo
-
Build the Docker image:
npm run build:docker
-
Push the Docker image to ECR:
npm run push:docker (TODO)