pulumi / pulumi-dotnet

.NET support for Pulumi
Apache License 2.0
26 stars 23 forks source link

Handle Outputs in derived Stacks #251

Closed starkpl closed 5 months ago

starkpl commented 5 months ago

I want to be able to write a base class for a stack, which will be reused for a few projects which have separate, but similar infrastructures. Currently, the Output properties defined on the base class are not being registered in the derived stacks because of the BindingFlags.DeclaredOnly flag used in the Stack.RegisterPropertyOutputs method.

In this PR I remove this flag. Instead, I explicitly cut off properties from ancestors of the Stack class (currently the Resource class has Urn output property and I believe this was the reason to add the DeclaredOnly flag in the first place).

Check the test I added to see exactly what I wanted to achieve.

starkpl commented 5 months ago

@Frassle thanks for the approve. It looks like some checks failed in the Merge Queue (same that passed in the PR, doesn't look correlated with my changes). Any idea what happened and how can we merge this PR?

Frassle commented 5 months ago

Odd, we'll try another merge if that fails I'll dig into what's up. The PR test passed so it probably isn't due to this change.

Frassle commented 5 months ago

Yeh that test is failing on main now, something must have changed in the CLI. Raised https://github.com/pulumi/pulumi-dotnet/issues/252 to fix it.

Frassle commented 5 months ago

Thanks, got this merged now!

starkpl commented 5 months ago

Thanks, can't wait to use it 👍