Is there any way I can access or filter for a service tag with a certain prefix?
{{ range .Tags }}{{ if hasPrefix "worker-version" . }}{{ trimPrefix "worker-version-" . }}{{ end }}{{ end }}
hasPrefix
or sprig_hasPrefix
are not defined…
Any {{ if ...}}
would work, but {{ if eq ... }}
is the only working example I’ve found.
trimPrefix
is explicitly listed in the documentation but is not defined either. What does work?
consul-template/templating-language.md at main · hashicorp/consul-template · GitHub mentions sprig, but it doesn’t seem like any of the following work.
{{ "hello!" | upper | repeat 5 }}
{{ "hello!" | sprig_upper | sprig_repeat 5 }}
Error in Nomad:
Template failed: (dynamic): parse: template: :1: function “sprig_upper” not defined