Add cpu_utilization and concurrency_utilization to Cloud Run v2 service revision scaling (beta)#18291
Open
yotamobol wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Googlers: For automatic test runs see go/terraform-auto-test-runs. @rileykarson, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
…ce revision scaling (beta) Cloud Run custom scaling controls (Preview, April 2026) expose template.scaling.cpuUtilization and template.scaling.concurrencyUtilization in the Cloud Run Admin API v2, letting users configure the utilization thresholds at which the autoscaler starts new instances. Adds both fields as beta-only Double properties on the revision scaling block of google_cloud_run_v2_service, plus a beta acceptance test covering create and update.
cb352d6 to
709d72d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes hashicorp/terraform-provider-google#28324
Cloud Run added custom scaling controls in Preview on April 16, 2026 (release note). The Cloud Run Admin API v2 exposes them as
template.scaling.cpuUtilizationandtemplate.scaling.concurrencyUtilization(GoogleCloudRunV2RevisionScaling, per the v2 discovery document), but the provider's revisionscalingblock only supportsmin_instance_count/max_instance_count, and the v2 API rejects the v1-stylerun.googleapis.com/scaling-*annotations — so these targets currently cannot be managed with Terraform at all.This PR adds both fields to
google_cloud_run_v2_service:template.scaling.cpu_utilization(Double, beta-only)template.scaling.concurrency_utilization(Double, beta-only)Design notes for review:
min_version: 'beta'— the underlying feature is in Preview (configured viagcloud beta run services update --scaling-cpu-target/--scaling-concurrency-target).send_empty_value— the API uses0.0to disable a scaling driver and rejects requests where both drivers are disabled. Sending zero values for unset fields would therefore break every existing configuration that omits them. Consequence: explicitly setting0.0in config to disable a driver is not expressible with this change; happy to add custom expand logic if maintainers prefer supporting that case.default_from_api: true— the server controls the effective default (0.6) and the fields are part of an opt-in surface; this avoids permadiffs when unset.google_cloud_run_v2_serviceonly; the gcloud/docs surface for this Preview is services-only (worker pools are not mentioned).TestAccCloudRunV2Service_cloudrunv2ServiceWithScalingUtilizationTargets) covering create (0.5/0.5), update (0.8/0.7), and import, modeled on the existing manual-scaling test in the same file.Release Note Template for Downstream PRs (will be copied)