Skip to content

cloudrunv2: fix perpetual diff in templates.container.resources.limits block#18399

Open
BBBmau wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
BBBmau:cloud_run_service_null_permadiff
Open

cloudrunv2: fix perpetual diff in templates.container.resources.limits block#18399
BBBmau wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
BBBmau:cloud_run_service_null_permadiff

Conversation

@BBBmau

@BBBmau BBBmau commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Release Note Template for Downstream PRs (will be copied)

When a google_cloud_run_v2_service container sets only memory in resources.limits, the Cloud Run v2 API automatically populates a default cpu value server-side. On subsequent plans, Terraform sees cpu in state but not in config and proposes to remove it — a perpetual diff with no way for the user to resolve it.

The fix adds a DiffSuppressFunc on the limits field that silently accepts any key the API added but the user did not configure. A regression test deploys a service with memory-only limits, imports it, then asserts the second plan produces no diff.

Fixes: hashicorp/terraform-provider-google#20399

See Write release notes for guidance.

cloudrunv2: fix perpetual diff in `templates.container.resources.limits` block in `google_cloud_run_v2_service` resource

@BBBmau BBBmau changed the title cloudrunv2: fix perpetual diff when only memory is set in container resources.limits cloudrunv2: fix perpetual diff in templates.container.resources.limits block Jul 24, 2026
@modular-magician

modular-magician commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

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

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 3 files changed, 161 insertions(+), 5 deletions(-)
google-beta provider View Diff 3 files changed, 161 insertions(+), 5 deletions(-)

Test report

Analytics

Total Tests Passed Skipped Affected
94 82 9 3
Affected Service Packages
  • cloudrunv2

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccCloudRunV2Service_cloudrunv2ServiceWithResourcesRequirements
  • TestAccCloudRunV2Service_noPermadiffWithMemoryLimitOnly
  • TestAccCloudRunV2Service_noPermadiffWithMinInstanceCount

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
✅ Log TestAccCloudRunV2Service_noPermadiffWithMemoryLimitOnly
❌ Error · Log - TestAccCloudRunV2Service_cloudrunv2ServiceWithResourcesRequirements
❌ Error · Log - TestAccCloudRunV2Service_noPermadiffWithMinInstanceCount

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@BBBmau, @zhengruan VCR tests complete for 3e17452!

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.

cloud_run_v2_service: attributes updated with null on every plan

2 participants