This repository contains Infrastructure as Code (IaC) for setting up a production-ready EKS cluster in multiple environments, using Terraform.
The codebase is organized into several modules, each serving a specific purpose:
-
EKS: This module deploys an Amazon Elastic Kubernetes Service (EKS) cluster in your AWS environment. It provides a managed Kubernetes platform, eliminating the need to set up, operate, and maintain your own Kubernetes control plane or worker nodes.
-
Apps (Helm-Apps): This module is responsible for deploying applications on the EKS cluster using Helm, a package manager for Kubernetes. It ensures that the correct configurations are applied, and manages the lifecycle of the applications.
-
LB (Application Load Balancer): This module provisions an AWS Application Load Balancer (ALB) for your EKS cluster. The ALB automatically distributes incoming application traffic across multiple targets, such as Amazon EC2 instances, containers, and IP addresses.
-
TLS (Certificate for ALB): This module generates and manages a TLS certificate for your Application Load Balancer, using AWS Certificate Manager (ACM). It provides secure, encrypted connections for your websites and applications.
-
VPC: This module sets up a Virtual Private Cloud (VPC) in your AWS environment. It provides an isolated, virtual network where you can launch AWS resources in a network that you define.
Before using the code in this repository, make sure you have the following:
- An AWS account
- Terraform installed on your local machine
- AWS CLI configured with appropriate permissions
aws s3api create-bucket --bucket terraform-state-multienv-test --create-bucket-configuration LocationConstraint=eu-west-1 --region eu-west-1
aws dynamodb create-table --table-name multienv-eks-terraform-state-lock --attribute-definitions AttributeName=LockID,AttributeType=S --key-schema AttributeName=LockID,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
aws ec2 create-key-pair --key-name terraform_non_prod_keypair
# copy key from output to ~/.ssh/terraform_non_prod_keypair.pem
To deploy your infrastructure, follow these steps:
- Clone this repository:
git clone https://github.com/your-github-username/terraform-multienv-eks.git
- Navigate to the project directory:
cd terraform-multienv-eks
- Initialize your Terraform workspace:
terraform init
- Create a new workspace (if required):
terraform workspace new <workspace_name>
- Plan your changes:
terraform plan
- Apply your changes:
terraform apply
Please read the individual README files in each module directory for more specific details.
Contributions are welcome! Please read the contributing guidelines before getting started.
This project is licensed under the terms of the MIT license.