Can't tell if I'm being silly but is there anyway ...
# general
c
Can't tell if I'm being silly but is there anyway to iterate a pulumi.Output<string[]> and create resources using each iterated value?
s
@clean-eve-27532 You can access the inner string-array with
.apply()
(see doc). Then I think it’s obvious, or?
c
Yeah I thought about that but I thought creating resources in .apply() was a bad practice
Every other type gets lifted fine but string[] doesnt seem to lift correctly 😕
Copy code
Type 'Output<string[]>' must have a '[Symbol.iterator]()' method that returns an iterator
s
I thought creating resources in .apply() was a bad practice
Good point. I think it should work to just return the string-array inside the
apply()
and save it in a variable. Then you could iterate on this afterwards. Hmm, but then it doesn’t work on preview-time, AFAIU.
c
Yeah that's my backup plan but just feels like I'm misusing the type, might try a different approach. Thanks for your help 👍
s
You’re welcome 🙂