Skip to content

Commit dbd2f36

Browse files
authored
feat: add Runbook URL on alertmanager template (#124)
* feat: add Runbook URL on alertmanager template * docs(terraform-docs): generate docs and write to README.adoc --------- Co-authored-by: omohammed95 <omohammed95@users.noreply.github.com>
1 parent c4fd2aa commit dbd2f36

2 files changed

Lines changed: 24 additions & 21 deletions

File tree

README.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ The following providers are used by this module:
4040

4141
- [[provider_random]] <<provider_random,random>> (>= 3)
4242

43+
- [[provider_null]] <<provider_null,null>> (>= 3)
44+
4345
- [[provider_kubernetes]] <<provider_kubernetes,kubernetes>> (>= 2)
4446

4547
- [[provider_utils]] <<provider_utils,utils>> (>= 1)
4648

4749
- [[provider_argocd]] <<provider_argocd,argocd>> (>= 5)
4850

49-
- [[provider_null]] <<provider_null,null>> (>= 3)
50-
5151
=== Resources
5252

5353
The following resources are used by this module:
@@ -358,10 +358,10 @@ Description: The admin password for Grafana.
358358
[cols="a,a",options="header,autowidth"]
359359
|===
360360
|Name |Version
361+
|[[provider_random]] <<provider_random,random>> |>= 3
361362
|[[provider_null]] <<provider_null,null>> |>= 3
362363
|[[provider_argocd]] <<provider_argocd,argocd>> |>= 5
363364
|[[provider_kubernetes]] <<provider_kubernetes,kubernetes>> |>= 2
364-
|[[provider_random]] <<provider_random,random>> |>= 3
365365
|[[provider_utils]] <<provider_utils,utils>> |>= 1
366366
|===
367367

locals.tf

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,24 +94,27 @@ locals {
9494

9595
alertmanager_template_files = length(local.alertmanager.slack_routes) > 0 ? {
9696
"slack.tmpl" = <<-EOT
97-
{{ define "slack.title" -}}
98-
[{{ .Status | toUpper }}
99-
{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{- end -}}
100-
] {{ .CommonLabels.alertname }}
101-
{{ end }}
102-
{{ define "slack.text" -}}
103-
{{ range .Alerts }}
104-
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
105-
{{- if .Annotations.description }}
106-
*Severity:* `{{ .Labels.severity }}`
107-
*Description:* {{ .Annotations.description }}
108-
{{- end }}
109-
*Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:>
110-
*Labels:*
111-
{{ range .Labels.SortedPairs }} - *{{ .Name }}:* `{{ .Value }}`
112-
{{ end }}
113-
{{ end }}
114-
{{ end }}
97+
{{ define "slack.title" -}}
98+
[{{ .Status | toUpper }}
99+
{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{- end -}}
100+
] {{ .CommonLabels.alertname }}
101+
{{ end }}
102+
{{ define "slack.text" -}}
103+
{{ range .Alerts }}
104+
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
105+
{{- if .Annotations.description }}
106+
*Severity:* `{{ .Labels.severity }}`
107+
*Description:* {{ .Annotations.description }}
108+
{{- end }}
109+
*Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:>
110+
*Labels:*
111+
{{ range .Labels.SortedPairs }} - *{{ .Name }}:* `{{ .Value }}`
112+
{{ end }}
113+
{{- if .Annotations.runbook_url }}
114+
*Runbook URL:* <{{ .Annotations.runbook_url }}|Click here>
115+
{{- end }}
116+
{{ end }}
117+
{{ end }}
115118
EOT
116119
} : {}
117120

0 commit comments

Comments
 (0)