Consul Template to read all services registered in Consul and create a BIND zone file.
The dns.tmpl
file is the base for your zone file. Include your SOA
information, NS, MX and other static records for your zone.
The template uses the unix timestamp as the serial number so you get automatic incrementing.
Update the template.hcl
file to include your Consul ACL token, if needed. And
if desired a post-exec command or script validate your zone file and reload
bind.
Once ready this can be run via the following command, with debug logging
consul-template -config=template.hcl -log-level=debug