pulumi / pulumi-terraform-bridge

A library allowing Terraform providers to be bridged into Pulumi.
Apache License 2.0
199 stars 43 forks source link

Build-time panic in MustApplyAutoAliases #2533

Open t0yv0 opened 3 weeks ago

t0yv0 commented 3 weeks ago

What happened?

@ringods reports:

error: exit status 2:
panic: interface conversion: shim.Resource is *schemashim.schemaOnlyDataSource, not sdkv2.v2Resource

goroutine 1 [running]:
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.v2ResourceMap.Set(0x140015e25b0?, {0x14001591ac0?, 0x1a?}, {0x107459ac0?, 0x140017f32b0?})
        /Users/ringods/Projects/golang/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.93.1/pkg/tfshim/sdk-v2/resource.go:157 +0xa4
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/internal/muxer.(*unionMap[...]).Set(0x1050d1300, {0x14001591ac0?, 0x1a}, {0x107459ac0, 0x140017f32b0})
        /Users/ringods/Projects/golang/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.93.1/pkg/pf/internal/muxer/union.go:108 +0x130
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/info.(*Provider).RenameDataSource(0x14001608008, {0x10654bd86, 0x13}, {0x108f41b7d, 0x29}, {0x14001590ba0, 0x1e}, {0x108f41b85, 0x13}, {0x14001590ba8, ...}, ...)
        /Users/ringods/Projects/golang/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.93.1/pkg/tfbridge/info/rename.go:87 +0x404
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.autoDataSourceSettings.apply({{0x1400177f610, 0x1, 0x1}, 0x0}, 0x14001608008, {0x10654bd86, 0x13})
        /Users/ringods/Projects/golang/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.93.1/pkg/tfbridge/auto_aliasing.go:603 +0x138
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.(*autoSettings).apply(0x1400153f470, 0x14001608008)
        /Users/ringods/Projects/golang/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.93.1/pkg/tfbridge/auto_aliasing.go:565 +0x120
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.ApplyAutoAliases(0x14001608008)
        /Users/ringods/Projects/golang/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.93.1/pkg/tfbridge/auto_aliasing.go:91 +0x2b0
github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/info.(*Provider).MustApplyAutoAliases(0x14001608008?)
        /Users/ringods/Projects/golang/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.93.1/pkg/tfbridge/info/external_methods.go:39 +0x1c
github.com/pulumiverse/pulumi-grafana/provider.Provider()
        /Users/ringods/Projects/pulumiverse/pulumi-grafana/provider/resources.go:1036 +0x8758
main.main()
        /Users/ringods/Projects/pulumiverse/pulumi-grafana/provider/cmd/pulumi-tfgen-grafana/main.go:10 +0x24
make: *** [tfgen] Error 2

Example

Codebase: https://github.com/pulumiverse/pulumi-grafana Upgrade command used:

$GOPATH/bin/upgrade-provider pulumiverse/pulumi-grafana --kind=all --target-version="v3.8.0"

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 commented 3 weeks ago

https://github.com/pulumiverse/pulumi-grafana/blob/ac666889df3164d0f625c7380c6e7a44023b41dd/provider/resources.go#L1036

iwahbe commented 3 weeks ago

I'm marking a P1 since this is a user (provider author) visible panic.