我使用terraform tgw模块创建了一个传输网关,如下所示。
module "transit-gateway" {
source = "terraform-aws-modules/transit-gateway/aws"
version = "1.4.0"
name = "tgw-nprod"
description = "My TGW shared with several other AWS accounts"
amazon_side_asn = 64532
enable_auto_accept_shared_attachments = true
vpc_attachments = {
vpc1 = {
vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnets
dns_support = true
ipv6_support = false
transit_gateway_default_route_table_association = false
transit_gateway_default_route_table_propagation = false
}
}
ram_allow_external_principals = true
ram_principals = [1234567890, 0987654321]
tags = {
Purpose = "tgw-testing"
}
}
我使用terraform vpc模块创建了vpc。
当我运行上面的terraform时,我得到了错误“错误:创建EC2传输网关VPC附件: DuplicateSubnetsInSameZone: AZ的重复子网”
我有两个私人子网在ap-南方-1和一个公共在ap-南方-1。
发布于 2021-03-17 05:43:07
AWS博士写到,您只能在每个AZ的一个子网中拥有网关:
您必须至少选择一个子网。您可以在每个可用性区域只选择一个子网。
错误信息提示您的module.vpc.private_subnets位于相同的AZ中。您必须使用重新定义VPC,以便module.vpc.private_subnets处于两个不同的AZs中,或者只需在subnet_ids中使用one子网即可。
使用一个子网:
subnet_ids = [module.vpc.private_subnets[0]]https://stackoverflow.com/questions/66667530
复制相似问题