Skip to content

Add a self reference to CallRequest and ConstructRequest - #533

Draft
Frassle wants to merge 1 commit into
mainfrom
fraser/selfref
Draft

Add a self reference to CallRequest and ConstructRequest#533
Frassle wants to merge 1 commit into
mainfrom
fraser/selfref

Conversation

@Frassle

@Frassle Frassle commented Mar 8, 2025

Copy link
Copy Markdown
Member

Part of pulumi/pulumi#18823

This adds a new ProviderResource property to CallRequest and ConstructRequest that the runtime fills in with a DependencyProviderResource if the engine told us our URN and ID in Configure.


public sealed class ConstructRequest
{
public ProviderResource? Provider { get; init; }

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably this should be non-nullable and throw with a message like "self provider references aren't supported update your pulumi CLI", that would match how we handle other cases like this that depend on engine support.

private string? engineAddress;
// More recent versions of the engine send URN and ID of the provider to `Configure`. With that we can construct
// a `DependencyProviderResource` to use in `Construct` and `Call` to refer to the provider itself.
private string? providerSelfReference;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no value in sending a ProviderResource to any of the normal CRUD methods, but maybe we should send the URN for logging reasons? That would allow you to log a message to the provider resource, while performing a Create/Update for another resource.

@t0yv0

t0yv0 commented Mar 11, 2025

Copy link
Copy Markdown
Contributor

The change assists with this particular issue but is it worth to keep this internal?

internal sealed class DependencyResource : CustomResource

If URN+ID can be hydrated to a provider reference why not make sure it is accessible in code. That'd be a bit more orthogonal.

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

Successfully merging this pull request may close these issues.

2 participants