属性“ route_table_id”的值不合适:需要字符串

时间:2019-12-22 21:02:49

标签: terraform

在尝试定义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.

0 个答案:

没有答案