provision-eks-with-terraform / vpc.tf
vpc.tf
Raw
data "aws_availability_zones" "avail_zones" {}

module "eks-vpc" {
  source = "terraform-aws-modules/vpc/aws"

  name = "eks-vpc"
  cidr = var.vpc_cidr_block

  azs             = data.aws_availability_zones.avail_zones.names
  private_subnets = var.private_subnet_cidr_blocks
  public_subnets  = var.public_subnet_cidr_blocks

  enable_nat_gateway = true
  single_nat_gateway = true
  enable_dns_hostnames = true

  tags = {
    Terraform = "true"
    Environment = var.env
    Name: "${var.env}-vpc"
    "kubernetes.io/cluster/demo-cluster" = "shared"
  }

  private_subnet_tags = {
    "kubernetes.io/cluster/demo-cluster" = "shared"
    "kubernetes.io/role/internal-elb" = 1
  }

  public_subnet_tags = {
    "kubernetes.io/cluster/eks-cluster" = "shared"
    "kubernetes.io/role/elb" = 1
  }
}