Hi, I am trying to write a base class for a stack,...
# dotnet
b
Hi, I am trying to write a base class for a stack, which will be reused for a few projects which have separate, but similar infrastructures. Unfortunately, it looks like the outputs defined on the base class are not being registered in the derived stacks. From what I found, the reason is the
BindingFlags.DeclaredOnly
in this line of the
Stack.RegisterPropertyOutputs
method: https://github.com/pulumi/pulumi-dotnet/blob/main/sdk/Pulumi/Stack.cs#L82 Is there some reasoning behind this flag? Maybe the presence of the
Urn
output property in the Resource class which is a base class to a Stack. The ComponentResource has similar
RegisterOutputs
method, but instead of using
DeclaredOnly
flag, it explicitly ignores the
Urn
property: https://github.com/pulumi/pulumi-dotnet/blob/main/sdk/Pulumi/Resources/ComponentResource.cs#L70 Do you think it would make sense to make it consistent and support implementing stack class hierarchies (including outputs from base classes) same as with ComponentResource?
I created a PR which implements this behavior and gives an example of such derived stack in tests: https://github.com/pulumi/pulumi-dotnet/pull/251 I would be grateful for a feedback 🙂