Skip to content

Fixed TF<>API mapping for nested_query fine-grained resources#16591

Merged
melinath merged 2 commits into
GoogleCloudPlatform:mainfrom
melinath:fix-acm-service-perimeter-mappings
Mar 5, 2026
Merged

Fixed TF<>API mapping for nested_query fine-grained resources#16591
melinath merged 2 commits into
GoogleCloudPlatform:mainfrom
melinath:fix-acm-service-perimeter-mappings

Conversation

@melinath
Copy link
Copy Markdown
Member

@melinath melinath commented Mar 3, 2026

Also fixed ordering of the resource.go to expect api_resource_field to live alongside the other api-related fields

Technically the mapping for etag will be wrong after this, but that's less wrong than the current state. Fixing that will require more thought than I want to (or can) put in right now.

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.


Also fixed ordering of the resource.go to expect api_resource_field to live alongside the other api-related fields

Technically the mapping for etag will be wrong after this, but that's less wrong than the current state
@melinath melinath requested a review from ScottSuarez March 3, 2026 19:39
---
name: 'ServicePerimeterEgressPolicy'
api_resource_type_kind: ServicePerimeter
api_resource_field: status.egressPolicies
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What not source this information from

nested_query

Feels like we are duplicating this information in the config

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fair point. I'll see if I can just pull this from nested_query instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

(For context, I think the reason I didn't do that in the first place was because not all the cases where this is needed have nested_query... but it may still be possible to pull from that when it is set.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yeah -- i think some resources do it in the decoder step -- which a bit frustrating. Ideally we would get rid of decoders where it can be implemented like a nested_query.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've made this change in de31560. It turns out there are two types of nested_query usage: fine-grained fields on resources, and resources that only have list endpoints instead of get. Pulling nested_query in automatically means that there needs to be a way to explicitly ignore nested_query. I've opted for api_resource_field: ".". (I also added a special-case to ignore "items" in nested_query, since that seems to always be an indication of list-type nested_query.) Let me know what you think!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we bake the distinction into the nested_query object instead? Like object in list? I am find with your current solution but it is introducing some non-intuitive behavior.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For now I'm going to keep this as-is... nested_query is very rarely used, so I'd prefer to avoid adding more flags to it if possible.

@melinath melinath requested a review from ScottSuarez March 3, 2026 23:26
@modular-magician
Copy link
Copy Markdown
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 ( 19 files changed, 239 insertions(+), 122 deletions(-))
google-beta provider: Diff ( 19 files changed, 239 insertions(+), 122 deletions(-))

@melinath melinath changed the title Fixed TF<>API mapping for ACM service perimiter fine-grained resources Fixed TF<>API mapping for nested_query fine-grained resources Mar 3, 2026
@melinath melinath added this pull request to the merge queue Mar 5, 2026
Merged via the queue into GoogleCloudPlatform:main with commit ecf214e Mar 5, 2026
24 checks passed
@melinath melinath deleted the fix-acm-service-perimeter-mappings branch March 5, 2026 23:57
aditikumarii-google pushed a commit to aditikumarii-google/magic-modules that referenced this pull request Mar 10, 2026
ChuAmberZhang pushed a commit to ChuAmberZhang/magic-modules that referenced this pull request Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants