This repository was archived by the owner on Dec 10, 2021. It is now read-only.

Description
In the NAT module, the following is used for creating zonal routes (source):
resource "google_compute_route" "nat-gateway" {
name = "${var.name}nat-${var.zone == "" ? lookup(var.region_params["${var.region}"], "zone") : var.zone}"
project = "${var.project}"
dest_range = "0.0.0.0/0"
network = "${data.google_compute_network.network.self_link}"
next_hop_instance = "${element(split("/", element(module.nat-gateway.instances[0], 0)), 10)}"
next_hop_instance_zone = "${var.zone == "" ? lookup(var.region_params["${var.region}"], "zone") : var.zone}"
tags = ["${compact(concat(list("${var.name}nat-${var.region}"), var.tags))}"]
priority = "${var.route_priority}"
}
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.