Skip to content

Handle custom decoders as part of setting fields in post_create #9752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

modular-magician
Copy link
Collaborator

GoogleCloudPlatform/magic-modules#12939 started triggering generation of post-create code, but it missed adding support for decoders (which are already used by the equivalent code for pulling computed fields from operation responses.) I also added setting of fields for resources that use PollAsync on create.

Decoder support is necessary to properly handle some resources, like bigqueryanalyticshub_listing_subscription. In this specific case, we do end up just moving some code around from one custom code template to another; however, this may reduce the need for post_create custom code on other resources as well.

However, we can't run decoders for PollAsync resources (because the decoder returns nil until the resource exists).

(I think we should split this logic into a separate function & use it for post-create for OpAsync resources as well - they currently rely on "identity" fields - but I'm leaving that for a separate PR.)

I had to mark monitored project as using async for create to prevent it trying to decode the operation that it gets on Create.

Part of hashicorp/terraform-provider-google#22214

Fixed hashicorp/terraform-provider-google#22239

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.


Derived from GoogleCloudPlatform/magic-modules#13520

[upstream:6ffd5b247273eba14f6197a3de024e3cb434a381]

Signed-off-by: Modular Magician <[email protected]>
@modular-magician modular-magician requested a review from a team as a code owner April 10, 2025 17:45
@modular-magician modular-magician merged commit f360645 into hashicorp:main Apr 10, 2025
4 checks passed
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.

Set computed id fields on post_create when creation uses pollasync
1 participant