我使用注册表中的 terraform vpc 模块来创建 vpc 和子网,如下所示:
#https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/latest
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "2.77.0"
# insert the 49 required variables here
name = "${var.vpc_name}"
cidr = "${var.vpc_cidr}"
azs = "${var.azs}"
private_subnets = ["10.0.0.64/26", "10.0.0.128/26"]
public_subnets = "${var.public_subnets}"
enable_dns_hostnames = true
enable_dns_support = true
enable_nat_gateway = true
single_nat_gateway = true
private_subnet_tags = {
Name = "nprod-net"
}
}
如您所见,我有 2 个带有标签“nprod-net”的私有子网,但我想用不同的名称命名每个私有子网,例如“nprod-net-app-1a”和“nprod-net-vpce-1a”。任何帮助,将不胜感激。