does pulumi yaml have a for_each
/ count
(terraform) equivalent?
#12560
-
Moving my infrastructure to use pulumi instead of terraform, not a fan of any of the provided languages, so I'm using pulumi yaml. Is there any equivalent to terraform's |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@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 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 |
Beta Was this translation helpful? Give feedback.
-
Glad you have a path forward. |
Beta Was this translation helpful? Give feedback.
@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/