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

Zonal enabled + module disabled throws error #14

Closed AndrewFarley closed 6 years ago

AndrewFarley commented 6 years ago

Problem

With zonal enabled and this module disabled, it would throw the following error...

* module.nat-zone-3.module.nat-gateway.data.google_compute_instance_group.zonal: Resource 'google_compute_instance_group_manager.default' not found for variable 'google_compute_instance_group_manager.default.name'

Fix

The problem is an inherent problem lower level in Terraform, not "fully" respecting the count on a data resource to not try to resolve all dependencies inside an unused (count = 0) data stanza. This is a well known problem, and the workaround is to have a cascading value to fall back onto, hence the concat+element trick.

danisla commented 6 years ago

LGTM, thank you.