GoogleCloudPlatform / terraform-google-examples

Collection of examples for using Terraform with Google Cloud Platform.
Apache License 2.0
606 stars 332 forks source link

Receiving a "element() may not be used with an empty list in" error #8

Open cepefernando opened 6 years ago

cepefernando commented 6 years ago

I'm receiving this error message after trying to spawn the multi region cluster, the only difference between the actual example is that I have two nodepools attached to the "google_container_cluster" resource.

${element(module.k8s_primary_cluster.instance_groups, 0)}

Once I run again apply it works normally as it is able to get the module.k8s_primary_cluster.instance_groups elements. As for the moment 4 instances are being provisiones.

danisla commented 6 years ago

This might be an upstream terraform issue as it sounds like it may not be waiting for the associated node pools to be created before updating it's instance_group_urls state.

Can you try again with the latest provider and terraform version? If it's still an issue, my suggestion would be to submit and issue to the terraform-provider-google repo.