我正在创建两个中转网关 vpc 附件。我正在尝试将附件 ID 存储在一个变量中并调用它们以在路由表中创建多个路由。
错误:
Error: Invalid value for module argument
, in module "routes":
199: transit_gateway_attachment_id = "${local.ec2_transit_gateway_vpc_attachment_id[count.index]}"
The given value is not suitable for child module variable
"transit_gateway_attachment_id" defined at
../modules/routes/variables.tf:25,1-41: string required.
locals {
ec2_transit_gateway_vpc_attachment_id = [concat(module.tgw.ec2_transit_gateway_vpc_attachment_ids, module.tgw_peer.ec2_transit_gateway_vpc_attachment_ids)]
}
module "routes" {
source = "../modules/routes"
count = length(local.ec2_transit_gateway_vpc_attachment_id)
blackhole = false
destination_cidr_block = var.destination_cidr_block_route[count.index]
transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.route.id
transit_gateway_attachment_id = "${local.ec2_transit_gateway_vpc_attachment_id[count.index]}"
}