Hello, I’ve a route table in main
module, it creates default gateway, and etc.
I’ve also second module which is creates a peering
connection with routes as well.
–
Problem Is: When for example I run again terraform plan
in main
module, it’s going to delete all routes which were created by peering
module. Only ignore changes
comes to my mind. Maybe anyone can help me solve this issue, or can provide a solution for ignore changes
block, here is the code:
resource "aws_route_table" "private" {
count = length(var.subnet)
vpc_id = var.network
depends_on = [ ]
dynamic "route" {
for_each = var.ipv4
content {
# Other content
vpc_peering_connection_id = lookup(route.value, "peering", "" )
}
}
lifecycle {
create_before_destroy = true
ignore_changes = [ tags, route ]
}
tags = merge(
{
"Name" = var.name
},
lookup(var.tags[0], "resource", null),
lookup(var.tags[0], "optional", null)
)
}
–
How can I ignore vpc_peering_connection_id
and lookup(var.tags[0], "optional", null)
P.S. Also I’m trying to ignore this variable lookup(var.tags[0], "optional", null)
can you show an example how can I ignore this as well.