terraform-provider-google icon indicating copy to clipboard operation
terraform-provider-google copied to clipboard

google_compute_region_instance_group_manager does not allow changing distribution_policy_shape

Open askubis opened this issue 4 months ago • 1 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

Terraform v1.7.1

  • provider registry.terraform.io/hashicorp/google v5.7.0

Affected Resource(s)

google_compute_region_instance_group_manager

Terraform Configuration

resource "google_compute_instance_template" "default" {
  name         = "example-template66"
  machine_type = "e2-medium"
  disk {
    source_image = "debian-cloud/debian-11"
  }
  network_interface {
    network = "default"
  }
}

resource "google_compute_region_instance_group_manager" "default" {
  name                      = "example-rmig66"
  region                    = "us-east1"
  update_policy {
    type                         = "PROACTIVE"
    minimal_action               = "REFRESH"
    instance_redistribution_type = "NONE"
    max_unavailable_fixed        = 3
  }
  target_size        = 30
  base_instance_name = "instance"
  version {
    instance_template = google_compute_instance_template.default.id
  }
}

->

resource "google_compute_instance_template" "default" {
  name         = "example-template66"
  machine_type = "e2-medium"
  disk {
    source_image = "debian-cloud/debian-11"
  }
  network_interface {
    network = "default"
  }
}

resource "google_compute_region_instance_group_manager" "default" {
  name                      = "example-rmig66"
  region                    = "us-east1"
  distribution_policy_shape = "BALANCED"
  update_policy {
    type                         = "PROACTIVE"
    minimal_action               = "REFRESH"
    instance_redistribution_type = "NONE"
    max_unavailable_fixed        = 3
  }
  target_size        = 30
  base_instance_name = "instance"
  version {
    instance_template = google_compute_instance_template.default.id
  }
}

Debug Output

google_compute_region_instance_group_manager.default: Modifying... [id=projects/estest0/regions/us-east1/instanceGroupManagers/example-rmig] 2024-10-17T12:08:21.362Z [INFO] Starting apply for google_compute_region_instance_group_manager.default 2024-10-17T12:08:21.363Z [DEBUG] google_compute_region_instance_group_manager.default: applying the planned Update change 2024-10-17T12:08:21.367Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: 2024/10/17 12:08:21 [INFO] Instantiating GCE client for path https://compute.googleapis.com/compute/v1/ 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: 2024/10/17 12:08:21 [DEBUG] Retry Transport: starting RoundTrip retry loop 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: 2024/10/17 12:08:21 [DEBUG] Retry Transport: request attempt 0 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: 2024/10/17 12:08:21 [DEBUG] Google API Request Details: 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: ---[ REQUEST ]--------------------------------------- 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: PATCH /compute/v1/projects/estest0/regions/us-east1/instanceGroupManagers/example-rmig?alt=json&prettyPrint=false HTTP/1.1 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: Host: compute.googleapis.com 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: User-Agent: google-api-go-client/0.5 Terraform/1.7.1 (+https://www.terraform.io) Terraform-Plugin-SDK/2.33.0 terraform-provider-google/6.7.0 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: Content-Length: 168 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: Content-Type: application/json 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: X-Goog-Api-Client: gl-go/1.21.13 gdcl/0.193.0 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: Accept-Encoding: gzip 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: { 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "distributionPolicy": { 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "targetShape": "ANY", 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "zones": [ 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: { 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "zone": "zones/us-east1-d" 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: }, 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: { 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "zone": "zones/us-east1-b" 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: }, 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: { 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "zone": "zones/us-east1-c" 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: } 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: ] 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: }, 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "fingerprint": "61qJp19lhHc=" 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: } 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5 2024-10-17T12:08:21.368Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: ----------------------------------------------------- 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: 2024/10/17 12:08:21 [DEBUG] Google API Response Details: 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: ---[ RESPONSE ]-------------------------------------- 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: HTTP/2.0 400 Bad Request 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: Cache-Control: private /** 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: Content-Type: application/json; charset=UTF-8 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: Date: Thu, 17 Oct 2024 12:08:21 GMT 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: Server: ESF 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: Vary: Origin 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: Vary: X-Origin 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: Vary: Referer 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: X-Content-Type-Options: nosniff 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: X-Frame-Options: SAMEORIGIN 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: X-Xss-Protection: 0 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: { 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "error": { 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "code": 400, 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "message": "Invalid value for field 'resource.distributionPolicy.zones[0].zone': 'zones/us-east1-d'. Zone configuration is immutable.", 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "errors": [ 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: { 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "message": "Invalid value for field 'resource.distributionPolicy.zones[0].zone': 'zones/us-east1-d'. Zone configuration is immutable.", 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "domain": "global", 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: "reason": "invalid" 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: } 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: ] 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: } 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5: } 2024-10-17T12:08:21.991Z [DEBUG] provider.terraform-provider-google_v6.7.0_x5

Expected Behavior

Change is possible. TF should NOT send the distribution_policy_zones if that field hasn't been changed.

Actual Behavior

the patch is rejected due to distribution_policy.zones

Steps to reproduce

  1. terraform apply on 1st config, then terraform apply on 2nd config

Important Factoids

No response

References

https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.tmpl#L1155-L1163

askubis avatar Oct 17 '24 12:10 askubis