Describe the Feature
Current code for adding routes is based on count
|
# Create routes from requestor to acceptor |
|
resource "aws_route" "requestor" { |
|
count = module.this.enabled ? length(distinct(sort(data.aws_route_tables.requestor.0.ids))) * length(data.aws_vpc.acceptor.0.cidr_block_associations) : 0 |
|
route_table_id = element(distinct(sort(data.aws_route_tables.requestor.0.ids)), ceil(count.index / length(data.aws_vpc.acceptor.0.cidr_block_associations))) |
|
destination_cidr_block = data.aws_vpc.acceptor.0.cidr_block_associations[count.index % length(data.aws_vpc.acceptor.0.cidr_block_associations)]["cidr_block"] |
|
vpc_peering_connection_id = join("", aws_vpc_peering_connection.default.*.id) |
|
depends_on = [data.aws_route_tables.requestor, aws_vpc_peering_connection.default] |
|
} |
|
|
|
# Create routes from acceptor to requestor |
|
resource "aws_route" "acceptor" { |
|
count = module.this.enabled ? length(distinct(sort(data.aws_route_tables.acceptor.0.ids))) * length(data.aws_vpc.requestor.0.cidr_block_associations) : 0 |
|
route_table_id = element(distinct(sort(data.aws_route_tables.acceptor.0.ids)), ceil(count.index / length(data.aws_vpc.requestor.0.cidr_block_associations))) |
|
destination_cidr_block = data.aws_vpc.requestor.0.cidr_block_associations[count.index % length(data.aws_vpc.requestor.0.cidr_block_associations)]["cidr_block"] |
|
vpc_peering_connection_id = join("", aws_vpc_peering_connection.default.*.id) |
|
depends_on = [data.aws_route_tables.acceptor, aws_vpc_peering_connection.default] |
|
} |
Changing tags can possible result in changing count order and removal of actually using peering routing.
Expected Behavior
If matching pattern tag for a route is changed then only associated route table for this exact peering should be changed.
Use Case
It's possible that downtime will happen during terraform apply when tags will be changed on route.
Describe Ideal Solution
aws_route inside this module should use for_each which would prevent temporary routing changes
Describe the Feature
Current code for adding routes is based on
countterraform-aws-vpc-peering/main.tf
Lines 51 to 67 in 47c6e51
Changing tags can possible result in changing count order and removal of actually using peering routing.
Expected Behavior
If matching pattern tag for a route is changed then only associated route table for this exact peering should be changed.
Use Case
It's possible that downtime will happen during terraform apply when tags will be changed on route.
Describe Ideal Solution
aws_routeinside this module should usefor_eachwhich would prevent temporary routing changes