variable "eks_cluster_name" {} variable "region" {} variable "instance_type" { default = "m5.large" } variable "workers_additional_policies" { default = [] } variable "sys_worker_group_name" {} variable "sys_instance_type" {} variable "sys_asg_capacity" {} variable "sys_kubelet_args" {} variable "infra_worker_group_name" {} variable "infra_instance_type" {} variable "infra_asg_min_size" {} variable "infra_asg_max_size" {} variable "infra_kubelet_args" {} variable "infra_spot_price" {} data "aws_availability_zones" "available" {} module "vpc" { source = "terraform-aws-modules/vpc/aws" version = "2.21.0" name = "ekstf-vpc" cidr = "192.168.0.0/16" azs = data.aws_availability_zones.available.names private_subnets = ["192.168.160.0/19", "192.168.128.0/19", "192.168.96.0/19"] public_subnets = ["192.168.64.0/19", "192.168.32.0/19", "192.168.0.0/19"] enable_nat_gateway = true single_nat_gateway = true enable_dns_hostnames = true tags = { "kubernetes.io/cluster/${var.eks_cluster_name}" = "shared", } public_subnet_tags = { "kubernetes.io/cluster/${var.eks_cluster_name}" = "shared" "kubernetes.io/role/elb" = "1" } private_subnet_tags = { "kubernetes.io/cluster/${var.eks_cluster_name}" = "shared" "kubernetes.io/role/internal-elb" = "1" } } module "eks" { source = "terraform-aws-modules/eks/aws" cluster_name = var.eks_cluster_name cluster_version = "1.16" subnets = module.vpc.private_subnets vpc_id = module.vpc.vpc_id workers_additional_policies = var.workers_additional_policies worker_groups = [ { name = var.sys_worker_group_name instance_type = var.sys_instance_type asg_desired_capacity = var.sys_asg_capacity kubelet_extra_args = var.sys_kubelet_args suspended_processes = ["AZRebalance"] }, { name = var.infra_worker_group_name instance_type = var.infra_instance_type asg_min_size = var.infra_asg_min_size asg_max_size = var.infra_asg_max_size kubelet_extra_args = var.infra_kubelet_args suspended_processes = ["AZRebalance"] spot_price = var.infra_spot_price } ] }