简体   繁体   English

描述中转网关对等连接

[英]Describe transit gateway peering attachment

I am getting following errors while describe the transit gateway peering attachments more than one and not getting the error while describe the transit gateway peering attachments with single peering attachment.我在描述不止一个中转网关对等连接时出现以下错误,而在描述具有单个对等连接的中转网关对等连接时没有收到错误。

Code代码

data "aws_ec2_transit_gateway_attachment" "example" {
  
  filter {
     name    = "state"
     values  = ["pendingAcceptance","available"]
  }

  filter {
     name   = "transit-gateway-id"
     values = ["<Transit_gateway_id>"]
  }
}

Error错误

Error: multiple EC2 Transit Gateway Attachments matched;错误:多个 EC2 Transit Gateway 附件匹配; use additional constraints to reduce matches to a single EC2 Transit Gateway Attachment │ │ with data.aws_ec2_transit_gateway_attachment.example, │ on main.tf line 5, in data "aws_ec2_transit_gateway_attachment" "example": │ 5: data "aws_ec2_transit_gateway_attachment" "example" {使用额外的约束来减少与单个 EC2 中转网关附件的匹配 │ 与 data.aws_ec2_transit_gateway_attachment.example,│ 在 main.tf 第 5 行,在数据“aws_ec2_transit_gateway_attachment”“示例”中:│5:数据“aws_ec2_transit_gateway_attachment”“示例”{

Apparently, as error tells, you have multiple attachments matching filter.显然,如错误所述,您有多个附件匹配过滤器。 You should make filter more precise.你应该使过滤器更精确。 If you create tgw attachment in terraform just add it's id to filter .如果您在 terraform 中创建 tgw 附件,只需将其 id 添加到 filter 即可 If you are looking only for pending attachments remove "available" from state's values.如果您只查找待定附件,请从状态值中删除“可用”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM