Skip to content
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

Panics when importing Plugin Framework based resources #1329

Closed
t0yv0 opened this issue Aug 4, 2023 · 0 comments
Closed

Panics when importing Plugin Framework based resources #1329

t0yv0 opened this issue Aug 4, 2023 · 0 comments
Assignees
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

Comments

@t0yv0
Copy link
Member

t0yv0 commented Aug 4, 2023

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).

@t0yv0 t0yv0 added kind/bug Some behavior is incorrect or out of spec area/plugin-framework Support for Plugin Framework based providers labels Aug 4, 2023
@t0yv0 t0yv0 added the impact/panic This bug represents a panic or unexpected crash label Aug 4, 2023
@t0yv0 t0yv0 added this to the 0.92 milestone Aug 7, 2023
@t0yv0 t0yv0 added the resolution/fixed This issue was fixed label Aug 7, 2023
@t0yv0 t0yv0 closed this as completed Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants