Render template variables stored in KV

Hello everyone,

Is it possible using consul-template to render a template stored in consul KV?

I have YAML coming from a current workflow stored in KV. I’m able to render a configuration file from that YAML, but I’d like to interpolate the variables (references to services) present in that YAML.

It looks like consul-templaterb is able to do that, using render_from_string (https://github.com/criteo/consul-templaterb/blob/master/TemplateAPI.md#render_from_stringtemplate_to_render-params

Thanks!
Nicolas

Currently consul-template doesn’t support templates stored in Consul’s KV store. It works with local (to it) files. There is nothing theoretically preventing some level of support for storing templates in Consul. Please consider filing a feature request ticket or a PR for this functionality.

You might be able to get what you’re after with consul-template by layering it. Have one consul-template grab that value and render it to a file, then have another consul-template monitor that file and render it again to interpolate those variables.

Hope this helps and thanks for your interest!

Thanks for your nice solution! I won’t file a feature request, since it’s only a temporary need and the workaround is sufficient.