I have a google_compute_region_instance_group_manager
without a zone (regional MIG) and want to use google_compute_per_instance_config
to set some per-instance settings.
The documentation states that zone is optional for google_compute_per_instance_config
, but when I attempt to plan/apply I’m getting this error:
│ Error: Failed to retrieve zone, pid: , err: zone: required field is not set
│
│ with module.test_mongodb.google_compute_per_instance_config.per_instance_settings[0],
│ on ../../modules/gcp-mongodb-nodes/main.tf line 238, in resource "google_compute_per_instance_config" "per_instance_settings":
│ 238: resource "google_compute_per_instance_config" "per_instance_settings" {
Using hashicorp/google v5.24.0
If I do specify a zone (one of the ones in the region) I’m getting this error: (the plan then succeeds, the apply fails)
│ Error: Error creating PerInstanceConfig: googleapi: Error 404: The resource 'projects/redacted/zones/us-central1-a/instanceGroupManagers/gcptest-mongod-mig' was not found, notFound
│
│ with module.test_mongodb.google_compute_per_instance_config.per_instance_settings[2],
│ on ../../modules/gcp-mongodb-nodes/main.tf line 239, in resource "google_compute_per_instance_config" "per_instance_settings":
│ 239: resource "google_compute_per_instance_config" "per_instance_settings" {
If I specify the region as the zone I’m getting: (plan succeeds, apply fails)
│ Error: Error creating PerInstanceConfig: googleapi: Error 400: Invalid value for field 'zone': 'us-central1'. Unknown zone., invalid
│
│ with module.test_mongodb.google_compute_per_instance_config.per_instance_settings[0],
│ on ../../modules/gcp-mongodb-nodes/main.tf line 239, in resource "google_compute_per_instance_config" "per_instance_settings":
│ 239: resource "google_compute_per_instance_config" "per_instance_settings" {
What do I specify for the zone?
This bug seems potentially related (on a different resource type, same error message, but it was fixed) (I tried testing provider version < 4.80, but some other parameters that I use are then unsupported, so I’m not sure if it older versions fix the problem)
(resource name in title is wrong, I get a ~ “contains too long word” error if I use the correct one)