55 lines
2.0 KiB
HCL
55 lines
2.0 KiB
HCL
# Create VPC and subnets
|
|
|
|
module "vpc-subnets" {
|
|
source = "../../../modules/networking/vpc_subnets"
|
|
|
|
application = var.application
|
|
aws-region = var.aws-region
|
|
customer-name = var.customer-name
|
|
default-tags = local.default-tags
|
|
environment = var.environment
|
|
project = var.project
|
|
vpc-cidr = "192.168.123.0/24"
|
|
vpcflowlog-cwl-loggroup-key-arn = ""
|
|
number-of-private-subnets-per-az = 1
|
|
number-of-public-subnets-per-az = 1
|
|
create-nat-gateway = true
|
|
create-free-vpc-endpoints = true
|
|
enable-flow-log = false
|
|
}
|
|
|
|
# secondary CIDR for EKS
|
|
# https://aws.amazon.com/premiumsupport/knowledge-center/eks-multiple-cidr-ranges/
|
|
resource "aws_vpc_ipv4_cidr_block_association" "secondary_cidr" {
|
|
vpc_id = module.vpc-subnets.vpc_id
|
|
cidr_block = "100.64.0.0/16"
|
|
}
|
|
|
|
resource "aws_subnet" "cidr2-subnet1a" {
|
|
vpc_id = module.vpc-subnets.vpc_id
|
|
cidr_block = "100.64.0.0/21"
|
|
tags = merge(local.default-tags, {"Name" : "${local.resource-prefix}-private-1a-eks"})
|
|
}
|
|
|
|
resource "aws_route_table_association" "cidr2-subnet1a-rtb-asso" {
|
|
subnet_id = aws_subnet.cidr2-subnet1a.id
|
|
route_table_id = module.vpc-subnets.private-rtb-id
|
|
}
|
|
|
|
resource "aws_subnet" "cidr2-subnet1c" {
|
|
vpc_id = module.vpc-subnets.vpc_id
|
|
cidr_block = "100.64.8.0/21"
|
|
tags = merge(local.default-tags, {"Name" : "${local.resource-prefix}-private-1c-eks"})
|
|
}
|
|
|
|
resource "aws_route_table_association" "cidr2-subnet1c-rtb-asso" {
|
|
subnet_id = aws_subnet.cidr2-subnet1c.id
|
|
route_table_id = module.vpc-subnets.private-rtb-id
|
|
}
|
|
|
|
resource "aws_vpc_endpoint" "eks-vpcep" {
|
|
vpc_id = module.vpc-subnets.vpc_id
|
|
service_name = "com.amazonaws.${var.aws-region}.eks"
|
|
vpc_endpoint_type = "Interface"
|
|
tags = merge(local.default-tags, { "Name" : "${local.resource-prefix}-vpcep-eks" })
|
|
} |