https://pulumi.com logo
Title
q

quiet-hairdresser-18834

07/16/2020, 7:23 PM
Can StackReference outputs only be simple strings or can they be complex types? If they can be complex, how do I convert it to a strong type? I have a collection of base azure.types.input.network.NetworkSecurityGroupSecurityRule[] that I export from my core stack and want that available in my dev/test stacks
l

lemon-agent-27707

07/16/2020, 7:50 PM
running
pulumi stack output --json
will give you the serialized outputs. You can experiment with parsing them from there. You can probably start with
JSON.parse()
q

quiet-hairdresser-18834

07/16/2020, 7:56 PM
I meant more in code but figured it out:
const infra = new pulumi.StackReference(`[account]/core/dev`);
let groups = infra.getOutput("rdpRules");
var finalGroups = groups.apply<azure.types.input.network.NetworkSecurityGroupSecurityRule[]>(g => {
    g.push(allowHttp);
    g.push(denyHttp);
    return g
});