Storing and rendering a template from consul value

is it possible to store templates as consul values (within the 512k size limit)? our use case has more updates to the template itself than the values stored in it.

after poking around a little it would seem like the best way would be to have a consul-template process execute on a wrapper template with a variable to write out the stored template, then have a separate consul-template process to read that, and perform the actual output.

that process seems fragile

  • theres a race condition on startup, if the first process hasnt written out yet the second render will fail
  • the second process will need something to trigger it to rerun on the new template on update. could be a version value or a signal from the wrapper process, maybe

is there a better way to do this?

Seems to me you should be able to get something working using executetemplate.

I haven’t tried this myself, but seems like you could read in the template text and then evaluate it with that.

1 Like