![](/img/trans.png)
[英]How to create a transi gateway attachement in a VPC to a transit gateway created in another account (with Cloudformation)
[英]How to create attachments in transit gateway module terraform
我使用 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 su.net_ids = module.vpc.private_su.nets 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 附件時出錯:DuplicateSu.netsInSameZone:相同 AZ 的重復 Su.nets ”
我在 ap-south-1 中有 2 個私有的 su.net,在 ap-south-1 中有 1 個公共的。
AWS 文檔寫道,您只能在每個 AZ 的一個子網中使用網關:
您必須 select 至少一個子網。 每個可用區只能 select 一個子網。
您的錯誤消息表明您的module.vpc.private_subnets
在同一個 AZ 中。 您必須重新定義您的 VPC,以便module.vpc.private_subnets
位於兩個不同的 AZ 中,或者僅在您的subnet_ids
中使用一個子網。
要使用一個子網:
subnet_ids = [module.vpc.private_subnets[0]]
我能得到任何幫助嗎
1.existing vpc is out of ip addresses 我需要使用 terraform 添加輔助 cidr - 可以完成
2.create a new su.net to new secondary cidr - 可以完成
3.可以創建路由表和到已經存在的transit gateway的路由
4.TGW-ATTACHMENT 已經存在並且已經與現有的 su.net 相關聯,我正在嘗試與新的 su.net 相關聯,該新的 su.net 是在之前的 su.nets 1a,1b AZs 3a 中新創建的,所以我需要相關聯3a 使用 terraform 關聯到現有的 tgw 附件
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.