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

Add a self reference to CallRequest and ConstructRequest #533

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Frassle
Copy link
Member

@Frassle Frassle commented Mar 8, 2025

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.

@@ -363,13 +363,15 @@ public DeleteRequest(Urn urn, string id, ImmutableDictionary<string, PropertyVal

public sealed class ConstructRequest
{
public ProviderResource? Provider { get; init; }
Copy link
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.

@@ -611,6 +615,9 @@ class ResourceProviderService : ResourceProvider.ResourceProviderBase, IDisposab
private Provider? implementation;
private readonly string version;
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
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
Copy link
Member

t0yv0 commented Mar 11, 2025

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