This Terraform module provisions a production-ready Amazon Elastic Kubernetes Service (EKS) cluster. It sets up the necessary infrastructure components including VPC, subnets, security groups, and IAM roles, providing a solid foundation for deploying and managing containerized applications on AWS.
- Creates a new VPC optimized for EKS
- Sets up both internal and external security groups
- Configures public and private subnets across multiple Availability Zones
- Establishes necessary IAM roles and policies
- Provisions an EKS cluster with configurable node groups
- AWS CLI configured with appropriate credentials
- Terraform v0.12+
- kubectl installed (for cluster management post-deployment)
- Creates a new VPC with specified CIDR block
- Sets up Internet Gateway for public subnets
- Configures NAT Gateways for private subnets
- Creates public and private subnets across multiple AZs
- Configures route tables for each subnet type
- External: Allows inbound traffic on ports 80 and 443
- Internal: Permits all traffic within the VPC
- Creates IAM roles for EKS cluster and node groups
- Attaches necessary policies for EKS operation
Name | Description | Type | Default | Required |
---|---|---|---|---|
cluster_name | Name of the EKS cluster | string | n/a | yes |
vpc_cidr | CIDR block for the VPC | string | "10.0.0.0/16" | no |
region | AWS region to deploy the cluster | string | n/a | yes |
instance_types | List of EC2 instance types for the node groups | list(string) | ["t3.medium"] | no |
desired_capacity | Desired number of worker nodes | number | 2 | no |
max_size | Maximum number of worker nodes | number | 5 | no |
min_size | Minimum number of worker nodes | number | 1 | no |
Name | Description |
---|---|
cluster_endpoint | Endpoint for your Kubernetes API server |
cluster_name | Name of the EKS cluster |
vpc_id | ID of the VPC created for EKS |
After applying the Terraform configuration, you can configure kubectl to interact with your new cluster:
aws eks --region <your-region> update-kubeconfig --name <your-cluster-name>
Contributions to improve the module are welcome. Please follow these steps:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This module is released under the MIT License. See the LICENSE file for details.