pulumi / pulumi-terraform-bridge

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

Unexpected duplicate module member #710

Open jaxxstorm opened 1 year ago

jaxxstorm commented 1 year ago

What happened?

I am bridging a provider that has resources in the following format:

twilio_chat_credentials_v1
twilio_chat_credentials_v2

I'm trying to follow the google-native pattern of ending up with a schema like so:

twilio:chat/v1:Credential
twilio:chat/v2:Credential

Steps to reproduce

I'm namespacing the members like so:

Tok: twilioResource(chatMod, "Credentials"),
Tok: twilioResource(chatv2Mod, "Credentials"),

Where the module is defined like so

chatMod = "chat/v1"
chatv2Mod = "chat/v2"

the twilioMember function is defined like so:

func twilioMember(mod string, mem string) tokens.ModuleMember {
    return tokens.ModuleMember(mainPkg + ":" + mod + ":" + mem)
}

Expected Behavior

I'm expecting a schema result like so:

twilio:chat/v1:Credential
twilio:chat/v2:Credential

Actual Behavior

What I actually seem to get is:

panic: fatal: An assertion has failed: unexpected duplicate module member ServicesChannelsMembers

Output of pulumi about

No response

Additional context

You can get a repro of this here: https://github.com/lbrlabs/pulumi-twilio/

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

mikhailshilkov commented 1 year ago

We probably assume the token structure provider:module/resource:Resource right now, so this would be a change to make if we needed to support anything else.

twilio_chat_credentials_v1 twilio_chat_credentials_v2

I suppose our current approach is to have resources CredentialsV1 and CredentialsV2 in the same module. But, of course, I can see why it's not great...