Skip to content

does pulumi yaml have a for_each / count (terraform) equivalent? #12560

Discussion options

You must be logged in to vote

@foxydevloper thanks for asking. No, Pulumi YAML does not have any for loop or conditional logic. You have a few options, including your workaround.

You could use a tool to generate YAML, such as cue, jsonnet, or even a shell script. The compiler option allows you to specify an external command to generate the program:

https://www.pulumi.com/blog/extending-pulumi-languages-with-yaml-cue-jsonnet-rust/

https://leebriggs.co.uk/blog/2022/05/04/deploying-kubernetes-clusters-in-absurd-languages

You could also convert the YAML program to another language and use the looping functionality in it, via pulumi convert:

https://www.pulumi.com/docs/reference/cli/pulumi_convert/

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@foxydevloper
Comment options

Answer selected by AaronFriel
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Questions about existing features resolution/by-design This issue won't be fixed because the functionality is working as designed
3 participants