https://pulumi.com logo
#typescript
Title
# typescript
b

breezy-butcher-78604

05/06/2020, 5:31 AM
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

steep-caravan-65104

05/06/2020, 12:35 PM
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
2 Views