Skip to content

Conversation

@kminsu-google
Copy link
Member

cloudrunv2: fixed a perpetual diff on the `google_cloud_run_v2_worker_pool` resource where `scaling.scaling_mode` would show a change from `"MANUAL"` to `null` even when no changes were made to the configuration. The resource now correctly handles the API's default value of `"MANUAL"` for this field.

…as the field is not applicable to the resource.
The `google_cloud_run_v2_worker_pool` resource showed a perpetual diff
on the `scaling.scaling_mode` field. When the `scaling` block was
configured (e.g., with `manual_instance_count`) but `scaling_mode` was
omitted, Terraform would try to remove the `scaling_mode` attribute
on subsequent plans.

This occurred because the Cloud Run API defaults `scaling_mode` to "MANUAL"
if not specified, but the Terraform resource schema did not account for
this server-side default.

This commit adds `default_from_api: true` to the `scaling.scaling_mode`
field in the magic-modules YAML definition. This informs the provider
that the API may return a default value for this field, preventing
Terraform from detecting a diff when the API provides the "MANUAL" value
that isn't explicitly in the configuration.
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Jan 3, 2026
@kminsu-google kminsu-google marked this pull request as draft January 3, 2026 04:29
@github-actions
Copy link

github-actions bot commented Jan 3, 2026

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@hao-nan-li, 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.

@github-actions github-actions bot requested a review from hao-nan-li January 3, 2026 04:29
@kminsu-google kminsu-google marked this pull request as ready for review January 7, 2026 06:50
@modular-magician modular-magician added service/run and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Jan 7, 2026
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 1 file changed, 1 insertion(+))
google-beta provider: Diff ( 1 file changed, 1 insertion(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_cloud_run_v2_worker_pool (28 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_cloud_run_v2_worker_pool" "primary" {
  scaling {
    scaling_mode = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 85
Passed tests: 76
Skipped tests: 9
Affected tests: 0

Click here to see the affected service packages
  • cloudrunv2

🟢 All tests passed!

View the build log

Copy link
Contributor

@hao-nan-li hao-nan-li left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you attach the bug ID this PR tries to fix?

type: Enum
description: |
The scaling mode for the worker pool. It defaults to MANUAL.
default_from_api: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test that covers what you'd like to fix?
If not could you add one?

@github-actions
Copy link

@kminsu-google, this PR is waiting for action from you. If no action is taken, this PR will be closed in 28 days.

Please address any comments or change requests, or re-request review from a core reviewer if no action is required.

Image showing the re-request review button

This notification can be disabled with the disable-automatic-closure label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants