Open juandiegopalomino opened 3 years ago
I am able to create compute instances through IGM based out of the zones with the following config. However your error message shows google_compute_network_endpoint_group
resource which doesn't have count
attribute and its working as expected. If you are trying to use count
attribute in IGM, please refer the config below.
resource "google_compute_instance_group_manager" "foo" {
count = length(data.google_compute_zones.available.names)
name = "terraform-test-${count.index}"
version {
instance_template = google_compute_instance_template.instance_template.self_link
}
base_instance_name = "foobar-${count.index}"
zone = data.google_compute_zones.available.names[count.index]
target_size = 2
}
Count is a meta argument available to all terraform resources: https://www.terraform.io/docs/language/meta-arguments/count.html
I am able to create 4 network end point groups (for the 4 zones) with your config. I am using terraform version 13.x, can you check the same on your end. If its happening only on terraform 14.x then its upstream terraform core issue
Terraform v0.13.4
+ provider registry.terraform.io/hashicorp/google v3.62.0
+ provider registry.terraform.io/hashicorp/google-beta v3.54.0
+ provider registry.terraform.io/hashicorp/random v3.1.0
Plan output
google_compute_network_endpoint_group.foo[3] will be created
+ resource "google_compute_network_endpoint_group" "foo" {
+ id = (known after apply)
+ name = "terraform-test-3"
+ network = "default"
+ network_endpoint_type = "GCE_VM_IP_PORT"
+ project = (known after apply)
+ self_link = (known after apply)
+ size = (known after apply)
+ zone = "us-central1-f"
}
can you try registry.terraform.io/hashicorp/google v3.63.0 instead of 62?
v3.63.0
also works fine, try downgrading your terraform version . If it works then the issue is on TF core
Can't use the google compute zones to iterate through data to fetch even though example
Tried to use it exactly like in the docs: https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_zones
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
I can use terraform to loop over resources to create in each zone
Actual Behavior
See original error
Steps to Reproduce
terraform plan
Important Factoids
References