hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.36k stars 1.75k forks source link

Cannot remove or update max_utilization field of backend service #7169

Closed hyww closed 4 years ago

hyww commented 4 years ago

Community Note

Terraform Version

Terraform v0.13.1
+ provider registry.terraform.io/hashicorp/google v3.37.0

Affected Resource(s)

Terraform Configuration Files

resource "google_compute_backend_service" "default" {
    health_checks                   = [
        "<heath check>",
    ]
    name                            = "google-http-backend-test-2"
    port_name                       = "port-name"
    protocol                        = "HTTP"

    backend {
        balancing_mode               = "RATE"
        capacity_scaler              = 1
        group                        = "projects/<project>/zones/asia-east1-b/instanceGroups/hyww-test-b"
        max_rate                     = 9999
        max_utilization                     = null
    }
}

Debug Output

https://gist.github.com/hyww/0661f64290198e4909cce437ab148bef

Panic Output

Expected Behavior

  1. being able to remove max_utilization field by setting it to null

    This is an optional parameter if the backend's balancingMode is UTILIZATION. https://cloud.google.com/compute/docs/reference/rest/v1/backendServices

  2. triggering diff and update when max_utilization field has been changed

Actual Behavior

  1. get default value 0.8 if we set it to null
  2. no diff/update is triggered if only max_utilization field has been updated in config

Steps to Reproduce

  1. terraform apply with config provided above
  2. use the API and see max_utilization with value 0.8
  3. change max_utilization to 1
  4. terraform apply and get no diff, no update

Important Factoids

References

hyww commented 4 years ago

After doing some experiments today, I could say that whether max_utilization exists or not doesn't affect the behavior of RATE mode backends. Thus, I think cannot update max_utilization will be the only problem left for this issue.

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error πŸ€– πŸ™‰ , please reach out to my human friends πŸ‘‰ hashibot-feedback@hashicorp.com. Thanks!