Panics when importing Plugin Framework based resources #1329
Labels
area/plugin-framework
Support for Plugin Framework based providers
impact/panic
This bug represents a panic or unexpected crash
kind/bug
Some behavior is incorrect or out of spec
resolution/fixed
This issue was fixed
Milestone
What happened?
The problem got reported for the CloudFlare provider pulumi/pulumi-cloudflare#460
Context: part of the import functionality is to try to build out a minimal set of resource inputs to show to the user. This results in a nice minimal program. The algorithm has resource outputs available and is trying to reconstruct minimal inputs, and as part of doing so it tries to check if the outputs values are Default values. IN case they are default values, they can be skipped from the minimal inputs to make a shorter program that still works, because Default value application will substitute an empty value with the same Default value again.
Now the panic reflects a structural problem with this codebase. In the case of a Plugin Framework-based provider is powering a resource that the user is trying to import, the shim.Provider implementation is incomplete. There is a shortcut taken to reuse the tfbridge.ExtractInputsFromOutputs function from older code, but that function assumes that shim.Provider is complete. Invalidating this leads to a panic during import. In particular, it currently has no way to reconstruct the Default value for properties, causing a panic.
The issue affects up to pf/v0.15.0 and is specific to resources that use Blocks or deeply tested types.
Expected Behavior
No panics when importing resources.
The suggested solution in #1327 proceeds as if the property had no default values. This may result in non-optimal programs shown to the user but should be safe.
Steps to reproduce
pulumi/pulumi-cloudflare#460
Output of
pulumi about
N/A
Additional context
N/A
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
The text was updated successfully, but these errors were encountered: