Handle custom decoders as part of setting fields in post_create #9752
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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