Hi,
I have a hard time to provision a template from yaml file.
I have a definition like this:
{{ define "__text_values_list" }}{{ if len .Values }}{{ $first := true }}{{ range $refID, $value := .Values -}}
{{ if $first }}{{ $first = false }}{{ else }}, {{ end }}{{ $refID }}={{ $value }}{{ end -}}
{{ else }}[no value]{{ end }}{{ end }}
That can be easily save via GUI.
But when I try to provision that via YAML
# config file version
apiVersion: 1
# List of templates to import or update
templates:
# <int> organization ID, default = 1
- orgId: 1
# <string, required> name of the template, must be unique
name: log_error_template
# <string, required> content of the template
template: |
{{ define "__text_values_list" }}{{ if len .Values }}{{ $first := true }}{{ range $refID, $value := .Values -}}
{{ if $first }}{{ $first = false }}{{ else }}, {{ end }}{{ $refID }}={{ $value }}{{ end -}}
{{ else }}[no value]{{ end }}{{ end }}
I got this:
ERROR[05-31|18:10:19] Failed to provision alerting logger=provisioning error="text templates: invalid object specification: invalid template: template: log_error_template:1: unexpected \":=\" in command"
Error: ✗ text templates: invalid object specification: invalid template: template: log_error_template:1: unexpected ":=" in command
Any ideas?
I’m using grafana 11.0.0 via oficial docker image.
Thanks!