GoogleCloudPlatform / terraform-google-managed-instance-group

Modular Google Compute Engine managed instance group for Terraform.
Apache License 2.0
63 stars 139 forks source link

Module doesn't allow multiple NATs in the same AZ #3

Closed vincepri closed 6 years ago

vincepri commented 6 years ago

Our project has the following structure:

When trying to create NAT instances, the following error is reported from terraform:

* module.mgmt-nat-us-west-1-a.module.nat-gateway.google_compute_firewall.default-ssh: 1 error(s) occurred:

* google_compute_firewall.default-ssh: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-gateway-us-west1-a-vm-ssh' already exists, alreadyExists
* module.stg-nat-us-west-1-a.module.nat-gateway.google_compute_health_check.mig-health-check: 1 error(s) occurred:

* google_compute_health_check.mig-health-check: Error creating HealthCheck: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/healthChecks/nat-gateway-us-west1-a' already exists, alreadyExists
* module.mgmt-nat-us-west-1-a.google_compute_firewall.nat-gateway: 1 error(s) occurred:

* google_compute_firewall.nat-gateway: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-us-west1-a' already exists, alreadyExists
* module.prd-nat-us-east-1-c.google_compute_address.default: 1 error(s) occurred:

* google_compute_address.default: Cannot determine region: set in this resource, or set provider-level 'region' or 'zone'.
* module.int-nat-us-west-1-a.module.nat-gateway.google_compute_firewall.mig-health-check: 1 error(s) occurred:

* google_compute_firewall.mig-health-check: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-gateway-us-west1-a-vm-hc' already exists, alreadyExists
* module.stg-nat-us-west-1-a.google_compute_address.default: 1 error(s) occurred:

* google_compute_address.default: Cannot determine region: set in this resource, or set provider-level 'region' or 'zone'.
* module.mgmt-nat-us-east-1-c.google_compute_address.default: 1 error(s) occurred:

* google_compute_address.default: Cannot determine region: set in this resource, or set provider-level 'region' or 'zone'.
* module.int-nat-us-west-1-a.module.nat-gateway.google_compute_firewall.default-ssh: 1 error(s) occurred:

* google_compute_firewall.default-ssh: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-gateway-us-west1-a-vm-ssh' already exists, alreadyExists
* module.prd-nat-us-west-1-a.module.nat-gateway.google_compute_firewall.default-ssh: 1 error(s) occurred:

* google_compute_firewall.default-ssh: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-gateway-us-west1-a-vm-ssh' already exists, alreadyExists
* module.mgmt-nat-us-west-1-a.module.nat-gateway.google_compute_health_check.mig-health-check: 1 error(s) occurred:

* google_compute_health_check.mig-health-check: Error creating HealthCheck: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/healthChecks/nat-gateway-us-west1-a' already exists, alreadyExists
* module.int-nat-us-west-1-a.google_compute_address.default: 1 error(s) occurred:

* google_compute_address.default: Cannot determine region: set in this resource, or set provider-level 'region' or 'zone'.
* module.prd-nat-us-east-1-c.module.nat-gateway.google_compute_firewall.default-ssh: 1 error(s) occurred:

* google_compute_firewall.default-ssh: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-gateway-us-east1-c-vm-ssh' already exists, alreadyExists
* module.mgmt-nat-us-east-1-c.module.nat-gateway.google_compute_firewall.mig-health-check: 1 error(s) occurred:

* google_compute_firewall.mig-health-check: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-gateway-us-east1-c-vm-hc' already exists, alreadyExists
* module.mgmt-nat-us-west-1-a.google_compute_address.default: 1 error(s) occurred:

* google_compute_address.default: Cannot determine region: set in this resource, or set provider-level 'region' or 'zone'.
* module.int-nat-us-east-1-c.google_compute_firewall.nat-gateway: 1 error(s) occurred:

* google_compute_firewall.nat-gateway: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-us-east1-c' already exists, alreadyExists
* module.int-nat-us-east-1-c.module.nat-gateway.google_compute_firewall.mig-health-check: 1 error(s) occurred:

* google_compute_firewall.mig-health-check: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-gateway-us-east1-c-vm-hc' already exists, alreadyExists
* module.int-nat-us-west-1-a.google_compute_firewall.nat-gateway: 1 error(s) occurred:

* google_compute_firewall.nat-gateway: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-us-west1-a' already exists, alreadyExists
* module.prd-nat-us-west-1-a.module.nat-gateway.google_compute_health_check.mig-health-check: 1 error(s) occurred:

* google_compute_health_check.mig-health-check: Error creating HealthCheck: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/healthChecks/nat-gateway-us-west1-a' already exists, alreadyExists
* module.prd-nat-us-west-1-a.google_compute_firewall.nat-gateway: 1 error(s) occurred:

* google_compute_firewall.nat-gateway: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-us-west1-a' already exists, alreadyExists
* module.int-nat-us-east-1-c.google_compute_address.default: 1 error(s) occurred:

* google_compute_address.default: Cannot determine region: set in this resource, or set provider-level 'region' or 'zone'.
* module.mgmt-nat-us-west-1-a.module.nat-gateway.google_compute_firewall.mig-health-check: 1 error(s) occurred:

* google_compute_firewall.mig-health-check: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-gateway-us-west1-a-vm-hc' already exists, alreadyExists
* module.mgmt-nat-us-east-1-c.module.nat-gateway.google_compute_firewall.default-ssh: 1 error(s) occurred:

* google_compute_firewall.default-ssh: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-gateway-us-east1-c-vm-ssh' already exists, alreadyExists
* module.prd-nat-us-west-1-a.google_compute_address.default: 1 error(s) occurred:

* google_compute_address.default: Cannot determine region: set in this resource, or set provider-level 'region' or 'zone'.
* module.stg-nat-us-east-1-c.module.nat-gateway.google_compute_health_check.mig-health-check: 1 error(s) occurred:

* google_compute_health_check.mig-health-check: Error creating HealthCheck: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/healthChecks/nat-gateway-us-east1-c' already exists, alreadyExists
* module.prd-nat-us-east-1-c.google_compute_firewall.nat-gateway: 1 error(s) occurred:

* google_compute_firewall.nat-gateway: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-us-east1-c' already exists, alreadyExists
* module.stg-nat-us-east-1-c.google_compute_address.default: 1 error(s) occurred:

* google_compute_address.default: Cannot determine region: set in this resource, or set provider-level 'region' or 'zone'.
* module.mgmt-nat-us-east-1-c.google_compute_firewall.nat-gateway: 1 error(s) occurred:

* google_compute_firewall.nat-gateway: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-us-east1-c' already exists, alreadyExists
* module.prd-nat-us-east-1-c.module.nat-gateway.google_compute_firewall.mig-health-check: 1 error(s) occurred:

* google_compute_firewall.mig-health-check: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-gateway-us-east1-c-vm-hc' already exists, alreadyExists
* module.mgmt-nat-us-east-1-c.module.nat-gateway.google_compute_health_check.mig-health-check: 1 error(s) occurred:

* google_compute_health_check.mig-health-check: Error creating HealthCheck: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/healthChecks/nat-gateway-us-east1-c' already exists, alreadyExists
* module.int-nat-us-east-1-c.module.nat-gateway.google_compute_firewall.default-ssh: 1 error(s) occurred:

* google_compute_firewall.default-ssh: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-gateway-us-east1-c-vm-ssh' already exists, alreadyExists
* module.int-nat-us-east-1-c.module.nat-gateway.google_compute_health_check.mig-health-check: 1 error(s) occurred:

* google_compute_health_check.mig-health-check: Error creating HealthCheck: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/healthChecks/nat-gateway-us-east1-c' already exists, alreadyExists
* module.prd-nat-us-west-1-a.module.nat-gateway.google_compute_firewall.mig-health-check: 1 error(s) occurred:

* google_compute_firewall.mig-health-check: Error creating firewall: googleapi: Error 409: The resource 'projects/<<project-redacted>>/global/firewalls/nat-gateway-us-west1-a-vm-hc' already exists, alreadyExists

It seems that the zone is used as a name in different places, making it non-unique across different networks. I'd be happy to contribute a patch.

vincepri commented 6 years ago

Sorry, opened in the wrong repository