I’m trying to loop over an array returned from a s...
# typescript
b
I’m trying to loop over an array returned from a stack reference, but from what I’ve read this isn’t possible. is there another way to achieve the same goal here?
Copy code
const vpcStackRef = new pulumi.StackReference("main-vpc", { name: cfg.require("vpcStack") });

for (const routeTableId of vpcStackRef.requireOutput("privateRouteTableIds")) {
    // create new aws.ec2.Route resource
}
s
I usually json stringify the output and then json parse to recover the desired data structure. The only gotcha is with
Map
where you'll have to use a hack like this to make it work with JSON stringify/parse. https://stackoverflow.com/a/56150320