I see, would be good, because the stack exports ju...
# general
a
I see, would be good, because the stack exports just Output<string[]>
l
How did you export the values?
a
@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
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
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
Note, the 'as unknown' shouldn't be necessary
e
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