Terraform-provider-google: Max utilization is not supported for Serverless network endpoint groups.

Created on 18 Aug 2020  ·  9Comments  ·  Source: hashicorp/terraform-provider-google


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 the 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 to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v0.13.0
+ provider registry.terraform.io/-/google v3.35.0
+ provider registry.terraform.io/-/google-beta v3.35.0
+ provider registry.terraform.io/-/null v2.1.2
+ provider registry.terraform.io/-/random v2.3.0
+ provider registry.terraform.io/hashicorp/google v3.35.0
+ provider registry.terraform.io/hashicorp/google-beta v3.35.0
+ provider registry.terraform.io/hashicorp/null v2.1.2
+ provider registry.terraform.io/hashicorp/random v2.3.0

Affected Resource(s)

  • google_compute_backend_service
  • google_compute_region_network_endpoint_group

Terraform Configuration Files


This is a simplified config that triggers the bug. A full example can be found at https://github.com/google/exposure-notifications-verification-server/pull/248

resource "google_compute_region_network_endpoint_group" "cloudrun_neg" {
  provider              = google-beta
  name                  = "cloudrun-neg"
  network_endpoint_type = "SERVERLESS"
  region                = "us-central1"
  cloud_run {
    service = google_cloud_run_service.cloudrun_neg.name
  }
}

resource "google_cloud_run_service" "cloudrun_neg" {
  provider = google-beta
  name     = "cloudrun-neg"
  location = "us-central1"

  template {
    spec {
      containers {
        image = "gcr.io/cloudrun/hello"
      }
    }
  }

  traffic {
    percent         = 100
    latest_revision = true
  }
}

resource "google_compute_backend_service" "example" {
  provider   = google-beta
  name       = "example"
  project    = var.project

  backend {
    group = google_compute_region_network_endpoint_group.cloudrun_neg.id
  }
}

Debug Output


https://gist.github.com/icco/0e29297c1cb2e8e47b9c0759c1f84c87

Panic Output

Expected Behavior

Actual Behavior

Error: Error creating BackendService: googleapi: Error 400: Invalid value for field 'resource.backends[0].maxUtilization': '0.8'. Max utilization is not supported for Serverless network endpoint groups., invalid

  on main.tf line 78, in resource "google_compute_backend_service" "example":
  78: resource "google_compute_backend_service" "example" {

Steps to Reproduce

  1. terraform apply

Important Factoids

With the new serverless endpoint type, the default values we send are no longer valid.

References

  • #0000
bug

Most helpful comment

I attempted setting max_utilization (which is documented as being optional) to null (from its default value of 0.8), but to no avail.

All 9 comments

Ah yeah, I made this work specifically for global NEGs based on inferring type from their URL. A similar check will be needed for regional NEGs

I attempted setting max_utilization (which is documented as being optional) to null (from its default value of 0.8), but to no avail.

This is still happening in 3.36 @slevenick

@icco it looks like this was merged just after the 3.36 release was cut. It will be in the 3.37 release expected next monday

Is there any way I can test it or use it before then? I ask because we have a big release next week, and if there are bugs I'd love to not wait another week.

Yes! You can build the provider from source and use it locally.

Directions are here: https://github.com/hashicorp/terraform-provider-google#building-the-provider
and here: https://github.com/hashicorp/terraform-provider-google/blob/master/.github/CONTRIBUTING.md#running-a-local-copy-of-the-provider

Small note on this: while it works, the maxUtilization etc values are still shown in the terraform plan output.

Yeah, that's due to maxUtilization having a default value. It's tricky to remove without causing a breaking change, so I went with leaving it in the plan but stripping it from the request for serverless NEGs

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 👉 [email protected]. Thanks!

Was this page helpful?
0 / 5 - 0 ratings