我正在使用 terraform vpc 模块创建 vpc,我的 vpc 没有 igw 和 nat 网关。现在的问题是不同的子网有不同的路由表。我想将所有私有子网附加到单个私有 rt 和公共子网到公共 rt。
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "2.77.0"
name = "${var.vpc_name}"
cidr = "${var.vpc_cidr}"
azs = "${var.azs}"
private_subnets = "${var.private_subnets}"
public_subnets = "${var.public_subnets}"
enable_dns_hostnames = true
enable_dns_support = true
enable_nat_gateway = false
# single_nat_gateway = true
create_igw = false
vpc_tags = {
Environment = "${var.env}"
}
private_subnet_tags = {
Environment = "${var.env}"
}
public_subnet_tags = {
Name = "${var.public_subnet_dmz_tag}"
Environment = "${var.env}"
}
private_route_table_tags = {
Name = "${var.private_route_table_tags}"
Environment = "${var.env}"
}
public_route_table_tags = {
Name = "${var.public_route_table_tags}"
Environment = "${var.env}"
}
}