consul-template
consul-template copied to clipboard
Add check command for templates
Hi, would it be possible to add a check command for rendered templates? I imagine something like
- If check command is configured, render template first to a temporary location
- Run check command with the temporary location as first argument
- If the check command returns with rc 0, render the template to the destination
- Otherwise log a warning and do not render the template to the destination
Hi @alvaroaleman realized we need to update the README but consul-template has a "dry run" mode that will print the templates to stdout and check that they are properly formed:
-dry
Print generated templates to stdout instead of rendering
Hey, thanks for the info, however it doesn't help for the actual use case: Testing the validity of a rendered template like conf does: check_cmd = "/usr/sbin/nginx -t -c {{.src}}"
There may be several ways to work around this by rendering multiple templates, piping the dry run to stdout and validating that, or various other methods, but going to tag this as an enhancement as first-class support would be a new feature as described.
Are there any plans to support this after 2 years?
Hey @ShimiTaNaka,
I apologize for the lack of progress on the backlog, consul-template didn't have any dedicated resources when this was submitted and now that it does we're still catching up.
If you would like to see this implemented please consider adding a :+1: to the original issue as we use those to gauge community priorities.