Created
May 1, 2024 18:20
-
-
Save vishnups1/42d22a7a35c67f6650f886d2e199fabf to your computer and use it in GitHub Desktop.
eks.hcl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| terraform { | |
| required_providers { | |
| aws = { | |
| source = "hashicorp/aws" | |
| version = "5.47.0" | |
| } | |
| } | |
| } | |
| provider "aws" { | |
| region = "us-east-1" | |
| } | |
| data "aws_availability_zones" "available" {} | |
| locals { | |
| eks_cluster_name = "hello-world" | |
| } | |
| module "vpc" { | |
| source = "terraform-aws-modules/vpc/aws" | |
| name = "helloworld-vpc" | |
| cidr = "10.0.0.0/16" | |
| azs = data.aws_availability_zones.available.names | |
| private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"] | |
| public_subnets = ["10.0.4.0/24", "10.0.5.0/24", "10.0.6.0/24"] | |
| enable_nat_gateway = true | |
| single_nat_gateway = true | |
| enable_dns_hostnames = true | |
| public_subnet_tags = { | |
| "kubernetes.io/cluster/${local.eks_cluster_name}" = "shared" | |
| "kubernetes.io/role/elb" = "1" | |
| } | |
| private_subnet_tags = { | |
| "kubernetes.io/cluster/${local.eks_cluster_name}" = "shared" | |
| "kubernetes.io/role/internal-elb" = "1" | |
| } | |
| } | |
| # output "vpc_id" { | |
| # value = module.vpc.vpc_id | |
| # } | |
| module "eks" { | |
| source = "terraform-aws-modules/eks/aws" | |
| version = "~> 20.0" | |
| cluster_name = local.eks_cluster_name | |
| cluster_version = "1.29" | |
| cluster_endpoint_public_access = true | |
| cluster_addons = { | |
| coredns = { | |
| most_recent = true | |
| } | |
| kube-proxy = { | |
| most_recent = true | |
| } | |
| vpc-cni = { | |
| most_recent = true | |
| } | |
| } | |
| vpc_id = module.vpc.vpc_id | |
| subnet_ids = module.vpc.private_subnets | |
| control_plane_subnet_ids = module.vpc.private_subnets | |
| # EKS Managed Node Group(s) | |
| eks_managed_node_group_defaults = { | |
| instance_types = ["t2.small"] | |
| } | |
| eks_managed_node_groups = { | |
| example = { | |
| min_size = 1 | |
| max_size = 5 | |
| desired_size = 4 | |
| instance_types = ["t2.small"] | |
| } | |
| } | |
| # Cluster access entry | |
| # To add the current caller identity as an administrator | |
| enable_cluster_creator_admin_permissions = true | |
| tags = { | |
| Environment = "dev" | |
| Terraform = "true" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment