Skip to content

mmv1: migrate existing writeOnly fields to non-legacy version#18325

Open
BBBmau wants to merge 13 commits into
GoogleCloudPlatform:FEATURE-BRANCH-major-release-8.0.0from
BBBmau:mmv1-write-only-TEST
Open

mmv1: migrate existing writeOnly fields to non-legacy version#18325
BBBmau wants to merge 13 commits into
GoogleCloudPlatform:FEATURE-BRANCH-major-release-8.0.0from
BBBmau:mmv1-write-only-TEST

Conversation

@BBBmau

@BBBmau BBBmau commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Fixes hashicorp/terraform-provider-google#25965

This PR does the following:

  1. introduces PropertyPath, the issue with write-only was the use of type.Lineage() which represents the Terraform path and not the MM path, this becomes important when dealing with fields inside a NestedObject marked as flatten_object: true
  2. separation of constraint logic into it's own method - this refactors was to separate the constraints logic out of the buildWriteOnlyField
  3. performs the migration of write_only_legacy -> write_only - this was trivial to do with the only extra logic needed was to resolve the flatten_object: true issue with payload within secret_version resource

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

`mmv1`: migrate existing `writeOnly` fields to non-legacy version

BBBmau added 13 commits July 16, 2026 08:54
… lists

ExactlyOneOf (and similar schema attributes) require that all path
segments go through TypeList blocks with MaxItems:1. Arrays without
MaxSize:1 generate TypeList blocks without MaxItems:1, making any
ExactlyOneOf reference through them invalid per the Terraform SDK.

Previously, GetPropertySchemaPath used slices.IndexFunc which failed to
find properties inside flatten_object nested objects, returning "" and
accidentally making ExactlyOneOf lists empty (and thus valid). Fixing
that lookup to use findPropByNameInFlattenedList (which searches through
flatten_object nested props) exposed the latent issue: paths like
template.0.spec.0.containers.0.liveness_probe.0.grpc go through
containers (Array without MaxSize:1) and are now correctly found but
produce invalid paths.

This commit:
- Ports findPropByNameInFlattenedList to support flatten_object lookups
- Adds a guard that returns "" when any path segment is an Array type
  without MaxSize:1, preventing invalid ExactlyOneOf references from
  being emitted (e.g. those inside probe blocks in google_cloud_run_service)
- Moves the guard before calling NestedProperties to avoid panics on
  uninitialized ItemTypes
Keep terminal multi-item array fields like budget_filter.0.projects in
GetPropertySchemaPath output so AtLeastOneOf lists remain valid, while
still rejecting non-terminal multi-item array segments such as
containers.0.* that produce invalid nested ExactlyOneOf paths.

Adds a regression test covering terminal array fields used by billing
budget filter AtLeastOneOf.
Move GetPropertySchemaPath checks out of resource_test and into concise,
focused tests in type_test. Keep only three behavior assertions:
- resolve through flatten_object
- drop non-terminal repeated list segments
- preserve terminal repeated list fields

This reduces bulky setup while retaining coverage for the path conversion
logic used by ExactlyOneOf/AtLeastOneOf/ConflictsWith/RequiredWith.
@modular-magician

modular-magician commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

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

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 11 files changed, 77 insertions(+), 84 deletions(-)
google-beta provider View Diff 11 files changed, 77 insertions(+), 84 deletions(-)
terraform-google-conversion View Diff 8 files changed, 10 insertions(+), 121 deletions(-)

Breaking Change(s) Detected

The following breaking change(s) were detected within your pull request.

  • Field http_check.auth_info.password_wo within resource google_monitoring_uptime_check_config was added to exactly one of - reference
  • Field http_check.auth_info.password within resource google_monitoring_uptime_check_config was added to exactly one of - reference
  • Field secret_data_wo_version changed from TypeInt to TypeString on google_secret_manager_secret_version - reference
  • Field secret_data_wo_version default value changed from 0 to <nil> on google_secret_manager_secret_version - reference
  • Field sensitive_params.secret_access_key_wo_version changed from TypeInt to TypeString on google_bigquery_data_transfer_config - reference
  • Field sensitive_params.secret_access_key_wo within resource google_bigquery_data_transfer_config was added to exactly one of - reference
  • Field sensitive_params.secret_access_key within resource google_bigquery_data_transfer_config was added to exactly one of - reference

If you believe this detection to be incorrect please raise the concern with your reviewer.
If you intend to make this change you will need to wait for a major release window.
An override-breaking-change label can be added to allow merging.

Missing test report

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

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

resource "google_bigquery_data_transfer_config" "primary" {
  sensitive_params {
    secret_access_key            = # value needed
    secret_access_key_wo         = # value needed
    secret_access_key_wo_version = # value needed
  }
}

Test report

Analytics

Total Tests Passed Skipped Affected
197 183 11 3
Affected Service Packages
  • alloydb
  • bigquerydatatransfer
  • monitoring
  • secretmanager

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
  • TestAccDatasourceSecretManagerSecretVersion_basic
  • TestAccMonitoringUptimeCheckConfig_update_wo
  • TestAccMonitoringUptimeCheckConfig_uptimeCheckConfigHttpPasswordWoExample

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
✅ Log TestAccDatasourceSecretManagerSecretVersion_basic
✅ Log TestAccMonitoringUptimeCheckConfig_update_wo
✅ Log TestAccMonitoringUptimeCheckConfig_uptimeCheckConfigHttpPasswordWoExample

🟢 All tests passed!

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

@BBBmau, @melinath VCR tests complete for b9b7357!

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.

2 participants