簡體   English   中英

未找到 Terraform AWS VCPe 路由創建端點

[英]Terraform AWS VCPe Route Creation Endpoint Not Found

當我創建到端點的路由時,我收到以下錯誤:

InvalidVpcEndpointId.NotFound: The vpcEndpoint ID 'vpce-044e0beXXXXXXXX' does not exist.

但是在輸出(和控制台上)的更深處,我可以看到端點已創建:

module.sec.aws_vpc_endpoint.s3[0]: Creation complete after 6s [id=vpce-044e0beXXXXXXXXX]

這是我必須創建的路線:

resource "aws_route" "s3_route" {
  count = length(var.s3_routes)

  route_table_id         = aws_route_table.main.id
  destination_cidr_block = var.s3_routes[count.index]
  vpc_endpoint_id        = var.s3_endpoint_ID[0]

}

這個模塊是一個調用它的例子:

module "sec-route-NATGW-ifw-a" {

  source = "./route"
  depends_on = [module.i-dmz, module.t-dmz, module.cde, module.tgw-core, module.tgw-ifw]

  vpc_id = module.sec.vpc_id
  subnet_association = [for s in range(0, length(module.sec.natgw_subnet_IDs)) : module.sec.natgw_subnet_IDs[s] if module.sec.natgw_subnet_AZs[s] == "${local.region}a"]
  s3_endpoint_ID = module.sec.s3_endpoint_ID

  s3_routes = local.s3_ips      
}

這是 ID 的輸出:

output "s3_endpoint_ID" {
  value = aws_vpc_endpoint.s3[*].id
  description = "ID for S3 Endpoint"
}

以及創建端點的資源:

resource "aws_vpc_endpoint" "s3" {
  count = var.s3_servicename == "" ? 0 : 1

  vpc_id       = aws_vpc.SEC.id
  service_name = var.s3_servicename
}

僅供參考 VPCE ID 已從腳本更改。

問題是我的路由資源上的配置,我將其替換為以下內容:

resource "aws_vpc_endpoint_route_table_association" "s3" {
  count = length(var.s3_endpoint_ID) == 0 ? 0 : 1

  route_table_id = aws_route_table.main.id
  vpc_endpoint_id = tostring(var.s3_endpoint_ID[0])
} 

我認為不需要 tostring() 並且我稍微改變了 count 的工作方式,但是添加 destination_cidr_block 參數是問題所在。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM