I have a template the generates dns zone files. We have been using the timestamp function to generated the new serial. Unfortunately, this causes the template to be continuously rendered. Makes sense. The in-memory version is different than the file on the filesystem
Essentially, I would like to generated a new file when a key changes and increment the serial number. Any thoughts on how someone might work around this issue?
The template I’m using:
{- $ts := timestamp "unix" -}}
{{- $dc := index (env "DC" -}}
{{- $zonekey := printf "service/app/%s/zone/example.com@%s" (env "ENVIRONMENT") $dc -}}
{{- $out := key $zonekey -}}
{{- $out = $out | replaceAll "[[TIMESTAMP]]" $ts -}}
{{- $out -}}
Cheers