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

Implement templatefile() in addition to the file() function within jobspecs #24749

Open
Freddo3000 opened this issue Dec 21, 2024 · 0 comments
Open

Comments

@Freddo3000
Copy link

Proposal

Implement Terraform's templatefile() function for Nomad job specs, or equivalent with support for templating as part of HCL spec.

Use-cases

While Nomad has support for importing whole files as part of the file() function, it would be useful to be able to more directly combine it with for example HCL2 input variables and/or client attribute. This would reduce the need for using an external file templating tool to generate the jobspec, or in the case of Terraform templating, stacking both templatefile() and Nomad variable interpolation on top of each other. I've encountered cases where I've had to write $$${var}, first to escape Terraform, then Nomad, then lastly render a file used for templating within the task.

Attempted Solutions

It is possible to work around this limitation by passing variables to the meta block, and then accessing it via {{ env "NOMAD_META_var" }}, however it is a messy solution in comparsion to simply passing ${var} to the file directly, especially if you want to do any more complex operations such as iterating over a list.

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

No branches or pull requests

1 participant