https://pulumi.com logo
#dotnet
Title
# dotnet
c

chilly-hairdresser-56259

07/14/2020, 3:05 PM
Hello, I am new to C# looking to see if anyone here can help with using a StackReference for inputs. I am getting a deserialization error that I am stuck on.
t

tall-librarian-49374

07/15/2020, 9:23 AM
As of today, you can’t use
object
in the types of stack outputs. So, you have to declare the subnets output as strings:
Copy code
[Output("private_subnets")]
    public Output<ImmutableArray<string>> PrivateSubnets { get; set; }
At the same time, you get an array of objects when you retrieve outputs from another stack, so you’d have to cast one to the other:
Copy code
this.PrivateSubnets = 
    vpcStack
        .RequireOutput("private_subnets")
        .Apply(o => 
            ((ImmutableArray<object>)o)
                .Select(o => (string)o)
                .ToImmutableArray());
I realize this is confusing. Please file an issue on github if you have ideas how to improve this flow that would make sense for your use case.
c

chilly-hairdresser-56259

07/15/2020, 3:08 PM
@bored-activity-40468 This works.
👍 1