GoogleCloudPlatform / terraform-google-managed-instance-group

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

conditional resources result in errors #2

Closed antimius closed 6 years ago

antimius commented 6 years ago

I'm getting errors when using this simple config:

module "mig1" {
  source            = "GoogleCloudPlatform/managed-instance-group/google"
  region            = "europe-west2"
  zone              = "europe-west2-b"
  name              = "group1"
  size              = 2
  service_port      = 80
  service_port_name = "http"
}

Errors:

* module.mig1.output.region_depends_id: Resource 'null_resource.region_dummy_dependency' not found for variable 'null_resource.region_dummy_dependency.id'
* module.mig1.output.region_instance_group: Resource 'google_compute_region_instance_group_manager.default' not found for variable 'google_compute_region_instance_group_manager.default.instance_group'
* module.mig1.output.region_instances: Resource 'data.google_compute_instance_group.regional' not found for variable 'data.google_compute_instance_group.regional.instances'

I believe it's because of the 'zonal' variable resulting in a count of 0 for resources that are always in the output.

Terraform v0.11.0
+ provider.google v1.2.0
+ provider.null v1.0.0
danisla commented 6 years ago

@antimius I update the module to support the breaking changes in v0.11.0, in master and tagged as 1.1.6. Please re-test after updating the modules terraform get -update=true

antimius commented 6 years ago

@danisla This works, thank you. I see it's in the upgrade guide for 0.11 (https://www.terraform.io/upgrade-guides/0-11.html) and wow, that's a bad breaking change. I also had to do 'terraform init -upgrade' to get the latest google provider plugin for the 'network_ip' to 'address' change. Maybe add a provider version requirement?