mmv1: migrate existing writeOnly fields to non-legacy version#18325
mmv1: migrate existing writeOnly fields to non-legacy version#18325BBBmau wants to merge 13 commits into
mmv1: migrate existing writeOnly fields to non-legacy version#18325Conversation
… 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.
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit b9b7357: Diff reportYour PR generated the following diffs in downstream repositories:
Breaking Change(s) DetectedThe following breaking change(s) were detected within your pull request.
If you believe this detection to be incorrect please raise the concern with your reviewer. Missing test reportYour PR includes resource fields which are not covered by any test. Resource: 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 reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the replaying VCR build log Step 2: Recording Mode
🟢 All tests passed! View the recording VCR build log or the debug logs folder for detailed results. |
Fixes hashicorp/terraform-provider-google#25965
This PR does the following:
PropertyPath, the issue with write-only was the use oftype.Lineage()which represents the Terraform path and not the MM path, this becomes important when dealing with fields inside a NestedObject marked asflatten_object: truewrite_only_legacy -> write_only- this was trivial to do with the only extra logic needed was to resolve theflatten_object: trueissue withpayloadwithinsecret_versionresourceRelease Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.