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

internal: use (URN, ID) pairs in self-references #191

Open
t0yv0 opened this issue Mar 6, 2025 · 5 comments
Open

internal: use (URN, ID) pairs in self-references #191

t0yv0 opened this issue Mar 6, 2025 · 5 comments

Comments

@t0yv0
Copy link
Member

t0yv0 commented Mar 6, 2025

In #164 we improved the code for attaching provider Resource Option for self-referencing RegisterResource calls emanating from the pulumi-terraform-module provider. These currently use self-URN captured in CheckConfig/Configure. But in reality in full generality of Pulumi, provider self-references are (URN, ID) pairs.

This is a reminder to fix the code to include self-ID in these.

Possibly like this:

type wrap struct {
   pulumi.ProviderResourceState
   id pulumi.ID
}

func (*wrap) ID() pulumi.IDOutput{
   return toOutput(pulumi.ID)
}
@pulumi-bot pulumi-bot added the needs-triage Needs attention from the triage team label Mar 6, 2025
@t0yv0 t0yv0 removed the needs-triage Needs attention from the triage team label Mar 7, 2025
@Frassle
Copy link
Member

Frassle commented Mar 11, 2025

These currently use self-URN captured in CheckConfig/Configure. But in reality in full generality of Pulumi, provider self-references are (URN, ID) pairs.

They're actually ignored unless they are "URN::ID". I think that ignoring is an engine bug and it should have actually been erroring that the provider reference was malformed.

@t0yv0
Copy link
Member Author

t0yv0 commented Mar 11, 2025

To be honest I'm not sure how to interpret that comment, because we are currently sending URN-only self references and that fixes significant issues for us. Perhaps there is a lot of detail here that is hard to summarize.

@Frassle
Copy link
Member

Frassle commented Mar 11, 2025

So I tracked it down to your grabbing the URN and then using RegisterResource to read the URN to get the ID then sending that as the provider field, so it all works out.

@Frassle
Copy link
Member

Frassle commented Mar 11, 2025

You'll get the wrong providers in cases of provider replacements though, so should look at fixing this with something like pulumi/pulumi-dotnet#533

@t0yv0
Copy link
Member Author

t0yv0 commented Mar 11, 2025

What is an example of a provider replacement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants