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

Panic when working with types.Dynamic #1988

Open
dirien opened this issue May 17, 2024 · 4 comments
Open

Panic when working with types.Dynamic #1988

dirien opened this issue May 17, 2024 · 4 comments
Labels
awaiting-feedback Blocked on input from the author impact/panic This bug represents a panic or unexpected crash kind/bug Some behavior is incorrect or out of spec needs-repro Needs repro steps before it can be triaged or fixed

Comments

@dirien
Copy link

dirien commented May 17, 2024

What happened?

The newest version of the azapi provider introduced this TF datatype called:

Body                  types.Dynamic  `tfsdk:"body"`

This leads during the bridging to this error panic:

panic: fatal: A failure has occurred: impossible: sch.Type() should be one of TypeMap, TypeList, TypeSet at this point path: resource[key="azapi_data_plane_resource",token="azapi:index/dataPlaneResource:DataPlaneResource"].outputs.body, type: 

goroutine 1 [running]:
github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.failfast(...)
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.114.0/go/common/util/contract/failfast.go:23
github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.Failf({0x101c39532?, 0x6e?}, {0x14000c4f008?, 0x14000693b84?, 0x9d?})
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.114.0/go/common/util/contract/fail.go:32 +0xbc
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen.(*Generator).makePropertyType(0x1400074a008, {0x10f9cb9c8, 0x140007c3f50}, {0x101b4d79d, 0x4}, {0x10f9effe0, 0x14000834480}, 0x0, 0x1, {{0x14000ac2000, ...}, ...})
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.0/pkg/tfgen/generate.go:427 +0x4b8
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen.(*Generator).propertyVariable(0x1400074a008, {0x10f9cb908, 0x140008e9db0}, {0x101b4d79d, 0x4}, {0x10f9ddf50, 0x140008e9dc0}, 0x14000bb0000, {0x140009bab60, 0x61}, ...)
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.0/pkg/tfgen/generate.go:1687 +0x290
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen.(*Generator).gatherResource(0x1400074a008, {0x140001ce800, 0x19}, {0x10f9de8b0, 0x140008e94d0}, 0x140001fcc00, 0x0)
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.0/pkg/tfgen/generate.go:1272 +0x568
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen.(*Generator).gatherResources(0x1400074a008)
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.0/pkg/tfgen/generate.go:1174 +0x274
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen.(*Generator).gatherPackage(0x1400074a008)
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.0/pkg/tfgen/generate.go:1032 +0x1cc
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen.(*Generator).Generate(0x1400074a008)
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.0/pkg/tfgen/generate.go:890 +0x54
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen.Main.func1({{0x101b4e105, 0x5}, {0x10f3d6cc0, 0x26}, {0x16f7f746e, 0x6}, {{0x10f9edb10, 0x14000870da0}, {0x101b4e105, 0x5}, ...}, ...})
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.0/pkg/tfgen/main.go:51 +0x50
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen.newTFGenCmd.func1(0x0?, {0x140002aefc0, 0x1, 0x0?})
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.0/pkg/tfgen/main.go:167 +0x450
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen.newTFGenCmd.RunFunc.func4(0x0?, {0x140002aefc0?, 0x0?, 0x0?})
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.114.0/go/common/util/cmdutil/exit.go:99 +0x28
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen.newTFGenCmd.RunFunc.RunResultFunc.func6(0x140001b3508, {0x140002aefc0, 0x1, 0x4})
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.114.0/go/common/util/cmdutil/exit.go:115 +0x34
github.com/spf13/cobra.(*Command).execute(0x140001b3508, {0x140001dc010, 0x4, 0x4})
        /Users/dirien/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0x828
github.com/spf13/cobra.(*Command).ExecuteC(0x140001b3508)
        /Users/dirien/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/dirien/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen.MainWithCustomGenerate({_, _}, {_, _}, {{0x10f9edb10, 0x14000870da0}, {0x101b4e105, 0x5}, {0x0, 0x0}, ...}, ...)
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.0/pkg/tfgen/main.go:64 +0x54
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen.Main({_, _}, {_, _}, {{0x10f9edb10, 0x14000870da0}, {0x101b4e105, 0x5}, {0x0, 0x0}, ...})
        /Users/dirien/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.0/pkg/tfgen/main.go:43 +0xe0
main.main()
        /Users/dirien/Tools/repos/pulumi-azapi/provider/cmd/pulumi-tfgen-azapi/main.go:24 +0x8c
make: *** [tfgen] Error 2

Example

Output of pulumi about

Additional context

No response

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

@dirien dirien added needs-triage Needs attention from the triage team kind/bug Some behavior is incorrect or out of spec labels May 17, 2024
@iwahbe iwahbe added the impact/panic This bug represents a panic or unexpected crash label May 20, 2024
@iwahbe
Copy link
Member

iwahbe commented May 20, 2024

Hey @dirien. Can you open a PR/branch in pulumi-azapi that replicates this panic. We'll take a look at addressing it.

@iwahbe
Copy link
Member

iwahbe commented May 20, 2024

types.Dynamic should be translated to any in Pulumi's type system. I expect this to be quick to resolve.

@iwahbe iwahbe added needs-repro Needs repro steps before it can be triaged or fixed awaiting-feedback Blocked on input from the author and removed needs-triage Needs attention from the triage team labels May 21, 2024
@mikhailshilkov
Copy link
Member

@dirien Do you still experience the issue and do you still have an example handy?

@dirien
Copy link
Author

dirien commented May 28, 2024

@mikhailshilkov yes still and will do create the example, had no time (PTO 🙈)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-feedback Blocked on input from the author impact/panic This bug represents a panic or unexpected crash kind/bug Some behavior is incorrect or out of spec needs-repro Needs repro steps before it can be triaged or fixed
Projects
None yet
Development

No branches or pull requests

3 participants