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

[Question] Levant exit on conditional #406

Open
evaisman-tc opened this issue Apr 5, 2021 · 0 comments
Open

[Question] Levant exit on conditional #406

evaisman-tc opened this issue Apr 5, 2021 · 0 comments

Comments

@evaisman-tc
Copy link

Description

Hi, i'm new to levant/nomad and was following along with https://learn.hashicorp.com/tutorials/nomad/levant-abstract-jobs?in=nomad/templates. I was wondering if it's possible to forcibly exit or error out during rendering of a template.

For example, we have a few variables such as $Values.zookeeper.job_namethat should be provided by either our defaults or the user. But if I wanted to make this field required I might set something like

[[ if $Values.zookeeper.job_name -]]
          job "[[ $Values.zookeeper.job_name ]]" {
[[ else -]]
          [[- "No job_name provided. Please include a value for zookeeper.job_name in your json file." | printf | exit -]]
[[ end -]]

Then calling Levant render would error out on that print statement.

Any help would be appreciated.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant