Skip to content

cloudquotas: allow ignoring multiple quota safety checks at once - #18685

Open
mfreymuth wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
mfreymuth:feat/cloudquotas-ignore-safety-checks-set
Open

cloudquotas: allow ignoring multiple quota safety checks at once #18685
mfreymuth wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
mfreymuth:feat/cloudquotas-ignore-safety-checks-set

Conversation

@mfreymuth

Copy link
Copy Markdown

Fixes hashicorp/terraform-provider-google#19276
Fixes hashicorp/terraform-provider-google#25454

The API declares ignoreSafetyChecks as a repeated enum query parameter, but the provider models it as a single string. When a quota change trips both QUOTA_DECREASE_BELOW_USAGE and QUOTA_DECREASE_PERCENTAGE_TOO_HIGH (for example lowering a quota to 0 while there is recent usage), no single value is sufficient and the change cannot be applied with Terraform at all.

Two commits:

  1. Prerequisite refactor (no behavior change): build the ignoreSafetyChecks query parameter in pre_create/pre_update instead of interpolating it in the URLs. URL templating cannot express a repeated parameter, and it must be built in exactly one place: otherwise the URL-injected default would be sent alongside the new values.
  2. Feature: add ignore_safety_checks_set, sent as a repeated parameter via transport_tpg.AddArrayQueryParams (same mechanism as aspectKeys in dataplex_entry); deprecate ignore_safety_checks; update the acceptance test so the quota decrease exercises both checks at once.

Reviewer notes: the mutual exclusion uses a CustomizeDiff because conflicts is silently dropped for url_param_only parameters (GetPropertySchemaPath only resolves against properties). The new enum omits QUOTA_SAFETY_CHECK_UNSPECIFIED per the field-reference guidance, and I am open to a different field name.

Release Note Template for Downstream PRs (will be copied)

cloudquotas: added `ignore_safety_checks_set` field to `google_cloud_quotas_quota_preference` resource, allowing multiple quota safety checks to be ignored at once
cloudquotas: deprecated `ignore_safety_checks` field on `google_cloud_quotas_quota_preference` resource. Use `ignore_safety_checks_set` instead.

Martin Freymuth added 2 commits August 17, 2026 23:05
…ead of URL templates

The ignoreSafetyChecks query parameter was interpolated directly in
create_url and update_url, which only supports a single scalar value.
Move its construction to pre_create/pre_update custom code so it can
later support the repeated form accepted by the API. No behavior
change: the parameter is now omitted when the field is unset or
QUOTA_SAFETY_CHECK_UNSPECIFIED, which the API treats identically.
…deprecate ignore_safety_checks

The QuotaPreferences API declares ignoreSafetyChecks as a repeated
enum query parameter, but the provider modeled it as a single string.
When a change trips both QUOTA_DECREASE_BELOW_USAGE and
QUOTA_DECREASE_PERCENTAGE_TOO_HIGH (for example lowering a quota to 0
with recent usage), no single value works and the change cannot be
applied with Terraform at all.

Add ignore_safety_checks_set, a set of enum values sent as a repeated
query parameter, and deprecate ignore_safety_checks. The mutual
exclusion is enforced with a CustomizeDiff because ConflictsWith is
not generated for url_param_only parameters.

Fixes hashicorp/terraform-provider-google#19276
Fixes hashicorp/terraform-provider-google#25454
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Aug 17, 2026
@github-actions

Copy link
Copy Markdown

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.

@mfreymuth

Copy link
Copy Markdown
Author

The tgc unit test failure is a transient network error: terraform init got connection resets from releases.hashicorp.com while downloading providers, on tests unrelated to this change (folder_iam_member, compute_image). A re-run should clear it.

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

Labels

awaiting-approval Pull requests that need reviewer's approval to run presubmit tests

Projects

None yet

2 participants