https://pulumi.com logo
k

kind-addition-90773

11/15/2020, 1:25 AM
for (let i = 0; i < pulumi.output(subnets).apply(x => x.length); i++ ) {
// do something with subnets[i]
}
d

dazzling-sundown-39670

11/15/2020, 4:00 AM
Copy code
pulumi.output(subnets).apply(subnets => {
  for (let i = 0; i < subnets.length; i++ ) {
    // do something with subnets[i]
  }
})
this should work
👍 1
apply<U>(func: (t: T) => Promise<U>): Output<U>
it's still an output outside the callback
The result remains a Output so that dependent resources can be properly tracked.
👍 1
k

kind-addition-90773

11/16/2020, 4:43 AM
Thanks @dazzling-sundown-39670!