Hello, I am new to C# looking to see if anyone her...
# dotnet
c
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
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
@bored-activity-40468 This works.
👍 1