为aws_vpc中每个route_table中的每个peering_connection添加路由?

时间:2019-05-15 12:24:58

标签: terraform terraform-provider-aws

我在VPC中有几个peering connections和几十个route tables

我要实现的伪代码如下:

subnet = x.x.x.x/x
for conn in peering_conns:
  for table in route_tables:
     In the {table} create route to the {subnet} via {conn}

terraform中,我将尝试以下操作:

resource "aws_route" "peer_routes_to_master_vpc" {
  count                     = "${length(data.aws_route_tables.peer_vpc_rts.ids)}"
  route_table_id            = "${data.aws_route_tables.peer_vpc_rts.ids[count.index]}"
  destination_cidr_block    = "${var.destination_cidr_block}"
  vpc_peering_connection_id = "${var.vpc_peering_connection_id}"
}

但是因为我有多个vpc_peering_connection_id,所以这根本行不通...

有什么想法吗?

0 个答案:

没有答案