https://pulumi.com logo
Title
s

stale-vase-87890

03/24/2022, 7:00 PM
Is there a way to merge outputs into one using typescript? I have several outputs that are arrays that I would like to be able to merge all of the values into a single flat array. Since these are outputs things like concat or flat do not work. so I have an out put called foo:
[ 'bar', 'cat'] and one called bar: ['abc,' '123]. that I would like to make into flat: ['bar", "cat", "abc", "123"]
f

freezing-van-87649

03/24/2022, 7:05 PM
can use concat or flat in an output.all ?
s

stale-vase-87890

03/24/2022, 7:20 PM
I don't think there is an all on output, but I can try
p

prehistoric-activity-61023

03/24/2022, 7:21 PM
I think you should be able to do that using pulumi functions that operate on outputs
just as Adrew said,
output.all
should do the trick
(I don’t know how it’s called in TS but there must be a counterpart in every language pulumi supports)
based on the docs:
let flat = pulumi.all([foo, bar]).apply(([foo, bar]) => [...foo, ...bar]);
s

stale-vase-87890

03/24/2022, 7:24 PM
oh i see!
going to give it a go
It worked! Thank you so much
👍 1
🙌 1