Gomplate erroring out #2031
-
Hello, I've been trying to generate below file using gomplate with combination of aws+sm datasource.
I am trying to run below command
However, it's erroring out with the below error :
I want the file to be rendered as it is with only slack_api_url fetched from AWS SM |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
@hairyhenderson Can you please help here? I tried the same thing using --context, but failing without luck. |
Beta Was this translation helpful? Give feedback.
-
The alerting template syntax is meddling with the gomplate expected syntax There are a couple of options in this case:
title: |-
[{{ "{{" }} .Status | toUpper {{ "}}" }}{{ "{{" }} if eq .Status "firing" {{ "}}" }}
gomplate .. --left-delim "<<" --right-delim ">>" ( or via Then update the datasource line accordingly - api_url: '<< (ds "config" | json).slack_api_url >>'
[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.alertname }} for {{ .CommonLabels.job }} `}}
{{- if gt (len .CommonLabels) (len .GroupLabels) -}}
.... etc - api_url: '{{ (ds "config" | json).slack_api_url }}'
channel: test-alerts
title: |-
{{ file.Read "template-file" | indent 6 | trimSpace }} |
Beta Was this translation helpful? Give feedback.
-
2nd approach of adding a delimiter helped. Thanks a lot. |
Beta Was this translation helpful? Give feedback.
The alerting template syntax is meddling with the gomplate expected syntax
There are a couple of options in this case:
{{ "{{" }}
( or via
GOMPLATE_LEFT_DELIM
andGOMPLATE_RIGHT_DELIM
environment variables )Then update the datasource line accordingly
[{{ .Status | toUpp…