You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 10, 2021. It is now read-only.
I am creating a nat, based on the gke-nat-gateway example, in my own terraform templates. The core code is below. I am (re-)creating the network and subnetwork in the same set of terraform templates and I think I see a race condition.
First I tried with network = "${var.network}" and same for subnetwork, but this fails with:
* module.nat.google_compute_firewall.nat-gateway: 1 error(s) occurred:
* google_compute_firewall.nat-gateway: Error creating Firewall: googleapi: Error 404: The resource 'projects/<hidden>-edge/global/networks/network-v2' was not found, notFound
* module.nat.module.nat-gateway.google_compute_instance_template.default: 1 error(s) occurred:
* google_compute_instance_template.default: Error creating instance template: googleapi: Error 404: The resource 'projects/<hidden>-edge/regions/europe-west1/subnetworks/subnetwork-v2-a' was not found, notFound
* module.nat.module.nat-gateway.google_compute_firewall.default-ssh: 1 error(s) occurred:
* google_compute_firewall.default-ssh: Error creating Firewall: googleapi: Error 404: The resource 'projects/<hidden>-edge/global/networks/network-v2' was not found, notFound
I presume that is because some nat.module resources want to be created before the network and subnetwork are fully created (using the name does not create a terraform dependency on the existance of the (sub)network ?).
Then I tried to use the self_link to force this dependency on the existence of the (sub)network, before starting to create the nat resources. This worked better, but failed on this error where a value with dns compatible regex is required (and not a self_link).
1 error(s) occurred:
* module.nat.data.google_compute_network.network: data.google_compute_network.network: Error reading Network Not Found : https://www.googleapis.com/compute/v1/projects/<hidden>-edge/global/networks/network-v2: googleapi: Error 400: Invalid value 'https://www.googleapis.com/compute/v1/projects/<hidden>-edge/global/networks/network-v2'. Values must match the following regular expression: '[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?', invalidParameter
I presume I can fix this with forcing hard dependencies on the pre-existence of the network and subnetwork in some other way?
I am creating a nat, based on the
gke-nat-gatewayexample, in my own terraform templates. The core code is below. I am (re-)creating the network and subnetwork in the same set of terraform templates and I think I see a race condition.network = "${var.network}"and same for subnetwork, but this fails with:I presume that is because some nat.module resources want to be created before the network and subnetwork are fully created (using the
namedoes not create a terraform dependency on the existance of the (sub)network ?).I presume I can fix this with forcing hard dependencies on the pre-existence of the network and subnetwork in some other way?
Is there a proper fix for this case ? Thanks :-)