在尝试定义Internet网关时,遇到以下错误。我查找了不同的解决方案,以在定义路由表ID时显式使用索引0,但错误结果相同。我在这里想念什么?
resource "aws_route_table" "subnet" {
vpc_id = "${var.vpc_id}"
count = "${length(var.cidrs)}"
tags = {
Name = "${var.name}_${element(var.availability_zones, count.index)}"
Environment = "${var.environment}"
}
}
output "route_table_ids" {
value = [
"${aws_route_table.subnet.*.id}",
]
}
and
resource "aws_route" "public_igw_route" {
count = "${length(var.public_subnet_cidrs)}"
route_table_id = "${element(module.public_subnet.route_table_ids, count.index)}"
gateway_id = "${module.vpc.igw}"
destination_cidr_block = "${var.destination_cidr_block}"
}
Inappropriate value for attribute "route_table_id": string required.