Open naftulikay opened 6 years ago
I see this behavior in our setup as well. When the gateway instances are recreated the routes do not get updated on the first Terraform run. Only when Terraform is run again it notices that the routes are outdated and updates them accordingly.
On the off chance you're still using this and facing this issue, we had the same thing.
In the end, we changed the MIG to assign a static internal IP to the instances and changed the route rules to use the IP as the next hop rather than the instance name. That way even if the machine is relaunched it will retain the same internal IP and the route will continue to be valid
In the NAT module, the following is used for creating zonal routes (source):
One question that comes to mind is this: if the instance in the MIG is killed, is the route invalidated? Does it need to be recreated? I'd imagine that the ID of the instance would change on being created again, and this would break the routes or at least cause Terraform to show changes.
I am investigating this and updates to what I find will be posted to that pull request.