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

`cloud_run_service`'s `container_concurrency` documentation is unclear

Open jeremad opened this issue 3 years ago • 3 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 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 v1.3.2
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v4.40.0

Affected Resource(s)

  • google_cloud_run_service

Terraform Configuration Files

resource "google_cloud_run_service" "service" {
  autogenerate_revision_name = true
  name = "service"
  location = "europe-west4"
  template {
    spec {
      containers {
        image = "gcr.io/project/service"
        resources {
          limits = {
            cpu    = "1000m"
            memory = "512Mi"
          }
        }
      }
      container_concurrency = 0
      timeout_seconds       = 30
    }
  }
}

Expected Behavior

The documentation about the container_concurrency setting is unclear. A value of 0 is documented as "thread-safe, the system should manage the max concurrency." However I did not find any reference to this behavior in the GCP documentation. There is no reference to thread safety there either.

Actual Behavior

The documentation has cloudy statements, without any reference to the GCP documentation.

The commit making this statement is 3 years old, (basically a old as Cloud Run), so my uneducated guess is that this feature has been removed. However I did not find evidence of that in the changelog.

References

https://cloud.google.com/run/docs/about-concurrency https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services#Service https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_service#container_concurrency https://cloud.google.com/run/docs/release-notes

b/272369303

jeremad avatar Oct 12 '22 08:10 jeremad

Here is what the provider's doc is based on. I guess the API has updated its part.

https://cloud.google.com/run/docs/reference/rest/v1/RevisionSpec

ContainerConcurrency specifies the maximum allowed in-flight (concurrent) requests per container instance of the Revision. If not specified, defaults to 80.

Note that it has a default (80) now. Adding a default to a field is a breaking-change

edwardmedia avatar Oct 12 '22 11:10 edwardmedia

On top of this, from experimentation, it's not the same to set up 80 than to set up 0.

Setting up 0 will allow for cpu_limit < 1. However setting 80 explicitly will give an error if cpu_limit < 1. I have created a maybe related bug to this, #13361

txomon avatar Dec 29 '22 14:12 txomon

Service team is planning to treat this as a documentation-only change while addressing the change in https://github.com/hashicorp/terraform-provider-google/issues/13361

c2thorn avatar Jun 25 '24 16:06 c2thorn

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Aug 20 '24 02:08 github-actions[bot]