For CI/CD checking validity: consul-template -parse-only would be a nice feature

Consul Template version: consul-template v0.27.2 (0400fa21)

Expected behavior: ability to know if a template is well formed

What should have happened?
consul-template -parse-only -template haproxy.conf.ctmpl:/dev/null

Actual behavior: is not implemented.

This is a feature request. I would like the ability to only parse the input template and have exit value of 0 if there is no error and non-zero if there is an error. My use case is in an integration pipeline. A template could get updated and one might forget a {{end}} in a complex template. It would be nice to be able to catch this early. consul-template -once -dry does fail fast if the file is invalid, but in a CI/CD situation there would be no consul available. I’d like to only check that the template parses.

I took a stab at implementing this and would love feedback: add -parse-only option by jrwren · Pull Request #1545 · hashicorp/consul-template · GitHub

Thanks for the feature request! I would suggest you submit it as a github ticket, but you’ve already jumped over that to a PR. I’ll see you there.