provision-eks-with-terraform / eks.tf
eks.tf
Raw
module "eks"{
    source = "terraform-aws-modules/eks/aws"
    version = "17.18.0"
    cluster_name = "demo-cluster"
    cluster_version = "1.27"
    subnets = module.eks-vpc.private_subnets
    tags = {
        Name = "DEMO-EKS-Cluster"
    }
    vpc_id = module.eks-vpc.vpc_id
    workers_group_defaults = {
        root_volume_type = "gp3"
    }
    worker_groups = [
        {
            name = "Worker-Group-1"
            instance_type = "t2.micro"
            asg_desired_capacity = 1
            additional_security_group_ids = [aws_security_group.worker_group_one.id]
        },
        {
            name = "Worker-Group-2"
            instance_type = "t2.micro"
            asg_desired_capacity = 1
            additional_security_group_ids = [aws_security_group.worker_group_two.id]
        },
    ]
}

data "aws_eks_cluster" "my_cluster" {
    name = module.eks.cluster_id
}

data "aws_eks_cluster_auth" "my_cluster_auth" {
    name = module.eks.cluster_id
}