This project uses Terraform to provision an Amazon EKS Cluster on AWS. By leveraging Infrastructure as Code (IaC), we automate the deployment of Kubernetes clusters with modular and reusable Terraform configurations.
๐ Deploy an EKS Cluster with Terraform โ Like a Boss!

๐ Project Overview

This project uses Terraform to provision an Amazon EKS Cluster on AWS. By leveraging Infrastructure as Code (IaC), we automate the deployment of Kubernetes clusters with modular and reusable Terraform configurations.
๐น Kubernetes (K8s) manages containerized applications efficiently. ๐น EKS (Elastic Kubernetes Service) is a managed K8s solution on AWS. ๐น Terraform simplifies infrastructure provisioning with reusable modules.
With this setup, you can deploy, manage, and scale Kubernetes workloads seamlessly!
๐ Project Structure
The repository follows a modular structure for better organization and reusability:
EKS-CLUSTER-TERRAFORM/
โโโ modules/ # Terraform modules
โ โโโ eks/ # EKS module
โ โ โโโ main.tf # Defines EKS cluster
โ โ โโโ outputs.tf # Outputs for EKS cluster
โ โ โโโ variables.tf # Variables for EKS cluster
โ โโโ vpc/ # VPC module
โ โ โโโ main.tf # Defines networking resources
โ โ โโโ outputs.tf # Outputs for VPC
โ โ โโโ variables.tf # Variables for VPC
โ
โโโ .gitignore # Git ignore file
โโโ LICENSE # License file
โโโ kubectl.sha256 # Checksum for kubectl
โโโ .terraform.lock.hcl # Terraform lock file
โโโ kubernetes.tf # Kubernetes resources definition
โโโ main.tf # Root Terraform configuration
โโโ outputs.tf # Root outputs
โโโ provider.tf # Provider configurations
โโโ README.md # Documentation (this file)
๐น modules/eks โ Manages EKS cluster deployment. ๐น modules/vpc โ Handles VPC and networking setup. ๐น provider.tf โ Defines the AWS provider. ๐น main.tf โ Root Terraform script to call modules. ๐น outputs.tf โ Stores and displays useful deployment details.
๐ฏ Why Terraform for EKS?
Using Terraform for EKS offers several advantages over manual provisioning:
โ Automated & Repeatable Deployments โ Reduce human error. โ Infrastructure as Code (IaC) โ Easily track changes. โ Dependency Awareness โ Ensures resources are created in the correct order. โ Scalability & Reusability โ Modular design for better maintainability.
โก Prerequisites
Before you begin, ensure you have the following installed:
โ AWS Account โ Sign up at AWS if you donโt have one. โ Terraform โ Install from Terraform's official site. โ AWS CLI โ Install and configure credentials (guide). โ kubectl โ Kubernetes CLI tool (installation guide). โ VS Code (Optional) โ Recommended IDE for managing Terraform code.
๐ Deployment Steps
1๏ธโฃ Clone the Repository
git clone https://github.com/NotHarshhaa/eks-cluster-terraform
cd eks-cluster-terraform
2๏ธโฃ Initialize, Plan & Apply Terraform
Run the following Terraform commands:
terraform init # Initialize Terraform backend
terraform plan # Preview infrastructure changes
terraform apply # Deploy infrastructure
๐ Expected Outputs:
- EKS Cluster Name
- Node IP Addresses
- VPC ID
3๏ธโฃ Connect to Your EKS Cluster
After deployment, retrieve cluster credentials:
aws eks update-kubeconfig --name <EKSCLUSTERNAME> --region <AWS_REGION>
Verify cluster connectivity:
kubectl get nodes
4๏ธโฃ Terraform Cloud Integration (Optional)
If you want to integrate with Terraform Cloud:
1๏ธโฃ Go to Terraform Cloud 2๏ธโฃ Create a new Workspace and connect your GitHub repository. 3๏ธโฃ Add the following environment variables:
AWSACCESSKEY_ID
AWSSECRETACCESS_KEY
AWSDEFAULTREGION
CONFIRM_DESTROY
4๏ธโฃ Run the Terraform plan & apply in Terraform Cloud.
5๏ธโฃ Destroy the Infrastructure
To delete the deployed resources, run:
terraform destroy
Alternatively, if using Terraform Cloud, go to: Settings โ Destruction & Deletion โ Queue destroy plan.
๐ Congratulations! You've Successfully Deployed an EKS Cluster with Terraform!

โญ Hit the Star!
If you find this repository helpful and plan to use it for learning, please consider giving it a star โญ. Your support motivates me to keep improving and adding more valuable content! ๐
๐ ๏ธ Author & Community
This project is crafted with passion by Harshhaa ๐ก.
Iโd love to hear your feedback! Feel free to open an issue, suggest improvements, or just drop by for a discussion. Letโs build a strong DevOps community together!
๐ง Let's Connect!
Stay connected and explore more DevOps content with me:
๐ข Stay Updated!
Want to stay up to date with the latest DevOps trends, best practices, and project updates? Follow me on my blogs and social channels!
