https://pulumi.com logo
Title
p

prehistoric-london-9917

07/12/2021, 11:45 PM
G’day. I have a stack that outputs an array of subnet IDs:
export const privateSubnetIds = vpc.privateSubnetIds;
I have another stack that reads the first stack’s outputs:
const privateSubnetIds = vpcStack.requireOutput("privateSubnetIds");
The
requireOutput
function returns an
Output<any>
type. What’s the proper way to cast this back to something like a
string[]
? I searched Slack and found someone else who asked a similar question, but it remained unanswered. Any thoughts?
FWIW, I have this as a workaround:
const privateSubnetIds = vpcStack.requireOutput("privateSubnetIds") as unknown as string[];
but that seems kind of hacky..
h

helpful-tent-95136

07/13/2021, 5:17 AM
iirc doesn't requireOutput accept a generic argument i.e.
const privateSubnetIds = vpcStack.requireOutput<string[]>("privateSubnetIds")
(Sorry haven't got a pulumi project in front of me atm)
p

prehistoric-london-9917

07/14/2021, 1:48 AM
Hi @helpful-tent-95136, thanks for your suggestion. I attempted that, but my IDE is producing a warning. And it still thinks it’s an
any
type when referenced later.