Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for at least some simple statements like IF and FOR #191

Open
typoworx-de opened this issue May 5, 2022 · 5 comments
Open

Support for at least some simple statements like IF and FOR #191

typoworx-de opened this issue May 5, 2022 · 5 comments
Labels
area/expr Syntax, expressions, and functions in YAML kind/enhancement Improvements or new features language/yaml

Comments

@typoworx-de
Copy link

Today I found pulumi and I really like the way Pulumi works.

As far as I understand Pulumi YAML only supports very "rudimentary" templating, I really would like to see at least some simple statements like IF and FOR to use in any line where it seems to be needed. I think about some expressions like those used by Jinja2 [https://palletsprojects.com/p/jinja/].

There already seems to be an implementation for Golang [https://github.com/noirbizarre/gonja] which I think could technically fit to Pulumi as it also uses Golang?

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)
@typoworx-de typoworx-de added the kind/enhancement Improvements or new features label May 5, 2022
@mikhailshilkov
Copy link
Member

Hi @typoworx-de - great to have you join the Pulumi community!

For now, we decided not to add loops and conditionals to YAML:

  • You could use external YAML templating tools to generate Pulumi YAML if you want to. See this Cue example.
  • If your YAML programs grow beyond what's expressible with our current constructs, it may be a sign that you should switch to another Pulumi language

I will leave the issue open for future discussions.

@Frassle
Copy link
Member

Frassle commented May 5, 2022

If you wanted to use jinja you could use a standalone jinja compiler such as https://github.com/mattrobenolt/jinja2-cli and put that as your runtime: compiler: option in the Pulumi project.

@AaronFriel AaronFriel added language/yaml area/expr Syntax, expressions, and functions in YAML labels May 15, 2022
@GhzTNFj2b19HRNAJBDKSGFYqIctv4

I would be very much interested in this feature. I generally prefer YAML as it's easier to read, it does not require package management, language runtime. The only downtime of yaml is they can become long but if we get some IF/FOR/etc this would help a lot.

@jondkelley
Copy link

jondkelley commented Jan 12, 2024

Ansible has a when: structure for definitions which can take jinja style conditions. If there was a way to add a similar construct to Pulumi then it would be incredibly useful.

I know Pulumi is pushing language bindings but the yaml runtime could be much more powerful.

@nafg
Copy link

nafg commented Sep 8, 2024

It finally passes environment to the compiler, including PULUMI_ORGANIZATION, PULUMI_PROJECT, PULUMI_STACK, and PULUMI_CONFIG. However PULUMI_CONFIG masks secrets; is it possible to change that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/expr Syntax, expressions, and functions in YAML kind/enhancement Improvements or new features language/yaml
Projects
None yet
Development

No branches or pull requests

7 participants