https://pulumi.com logo
#general
Title
# general
a

adamant-dress-73325

07/22/2019, 9:23 PM
I see, would be good, because the stack exports just Output<string[]>
l

lemon-spoon-91807

07/22/2019, 9:32 PM
How did you export the values?
a

adamant-dress-73325

07/22/2019, 9:42 PM
@lemon-spoon-91807
Copy code
export const vpcId = vpc.id;
export const vpcPrivateSubnetIds = vpc.privateSubnetIds;
export const vpcPublicSubnetIds = vpc.publicSubnetIds;
Then I typecast from Output<any> to Output<string[]>, using
as pulumi.Output<string[]>
, maybe I can cast it differently?
lol,
as pulumi.Output<string>[]
leads to typescript err TS2352, which can be type asserted away I think, https://github.com/Microsoft/TypeScript/issues/28067
Tried type casting but still coming up empty on the subnets,
Copy code
const vpcPrivateSubnetIds= qaInfrastructure.getOutput('vpcPrivateSubnetIds') as unknown as pulumi.Output<string>[];

const qaVpc = awsx.ec2.Vpc.fromExistingIds("blah-qa-vpc", {
    vpcId: qaVpcId,
    privateSubnetIds: vpcPrivateSubnetIds,
    publicSubnetIds: vpcPublicSubnetIds,
});

export const blahVpcPrivateSubnetIds = qaVpc.privateSubnetIds;
l

lemon-spoon-91807

07/22/2019, 9:58 PM
Your exports should be typed as Output<string>[]
Which should pass in fine
Can you link me to your code?
I'm not in the office. But I can look when I get home
a

adamant-dress-73325

07/22/2019, 10:04 PM
Alright, I will DM you the relevant snippets, and maybe more if needed
For others with a similar issue, I had to use the following code when referencing the stack outputs to get it to work:
Copy code
qaInfrastructure.getOutputSync('vpcPrivateSubnetIds') as unknown as pulumi.Output<string>[];
l

lemon-spoon-91807

07/23/2019, 5:02 PM
Note, the 'as unknown' shouldn't be necessary
e

early-musician-41645

09/03/2019, 9:14 PM
Thanks @adamant-dress-73325 for this - I couldn't find any documentation about stack referencing array outputs. Worked using
as unknown as pulumi.Output<string>[]
per the thread discussion. The
as unknown
was explicitly required as per the error message output