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

Enable output marshaling in .NET #8316

Merged
merged 30 commits into from
Nov 12, 2021

Conversation

iwahbe
Copy link
Member

@iwahbe iwahbe commented Oct 30, 2021

Description

Fixes #8157

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

@iwahbe iwahbe marked this pull request as draft October 30, 2021 00:03
@iwahbe iwahbe self-assigned this Oct 30, 2021
@iwahbe iwahbe requested review from justinvp and a team October 30, 2021 07:40
@iwahbe iwahbe marked this pull request as ready for review October 30, 2021 07:40
propResources.UnionWith(urnDeps);
this.DependentResources.UnionWith(urnDeps);

var depencdencies = await Deployment.GetAllTransitivelyReferencedResourceUrnsAsync(propResources);
Copy link
Member

Choose a reason for hiding this comment

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

Do we need the transitive closure here? Is that how the other SDKs do it?

I also wonder if this leads to hangs with cycles, exacerbating https://github.com/pulumi/pulumi/issues/7900

Copy link
Member Author

Choose a reason for hiding this comment

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

This is how the other SDKs do it:

const dependencies = await getAllTransitivelyReferencedResourceURNs(propResources);
. GetAllTransitivelyReferencedResourceUrnsAsync should handle cycles:

$"call:{token}",
argsDict, _ => true,
keepResources: true,
keepOutputValues: true).ConfigureAwait(false);
Copy link
Member

Choose a reason for hiding this comment

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

So Call assumes the monitor supports output values? If memory serves me correctly this might be reasonable but good to double-check.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is my understanding. It is how it works in the other SDKs.

Copy link
Member

@t0yv0 t0yv0 left a comment

Choose a reason for hiding this comment

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

LGTM with some questions.

Copy link
Member

@justinvp justinvp left a comment

Choose a reason for hiding this comment

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

I have some questions about the serialization/deserialization that I'll spend a little time looking into in more detail and report back.

Otherwise, looking good, aside from a bunch of nitpicky suggestions.

sdk/dotnet/Pulumi/Serialization/Serializer.cs Outdated Show resolved Hide resolved
sdk/dotnet/Pulumi/Serialization/Serializer.cs Outdated Show resolved Hide resolved
sdk/dotnet/Pulumi/Serialization/Serializer.cs Outdated Show resolved Hide resolved
sdk/dotnet/Pulumi/Serialization/Serializer.cs Outdated Show resolved Hide resolved
sdk/dotnet/Pulumi/Serialization/Serializer.cs Outdated Show resolved Hide resolved
Remove the TestValue struct and some other simplification
Plain values set on properties typed as `Input<T>` are eagerly converted to `Output<T>` inside the `Input<T>`. To avoid these from being serialized as output values, when an output is known, not a secret, and has no deps, just return the value itself rather than an output value.
For consistency with the other Serialize* methods.
@justinvp
Copy link
Member

justinvp commented Nov 12, 2021

Ian looked over the commits I added and is happy with them, so I'm going to merge this. I'll open an issue that tracks addressing the issue with Input<T> et. al. Edit: Opened pulumi/pulumi-dotnet#22.

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

Successfully merging this pull request may close these issues.

Output Values: .NET SDK marshaling (used in SDK)
3 participants