Skip to content

Commit d3b1234

Browse files
committed
fix(grafana_terraform): fix subject section
1 parent 4b498c9 commit d3b1234

File tree

1 file changed

+12
-16
lines changed
  • app/template_generators/terraform/tfvars

1 file changed

+12
-16
lines changed

app/template_generators/terraform/tfvars/grafana.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def grafana_tfvars(input):
1616
{{ template "Alert Instance Template" . }}
1717
{{ end }}
1818
EOT
19-
}
19+
}
2020
2121
"""
2222

@@ -41,7 +41,8 @@ def grafana_tfvars(input):
4141
4242
"""
4343

44-
policies = """{matchers = [
44+
policies = """{
45+
matchers = [
4546
{ label = "mylabel", match = "=", value = "myvalue" },
4647
{ label = "alertname", match = "=", value = "CPU Usage" },
4748
{ label = "Name", match = "=~", value = "host.*|host-b.*" }
@@ -63,7 +64,13 @@ def grafana_tfvars(input):
6364
6465
"""
6566
subject = "{{ template \"default.title\" .}}"
66-
67+
message_template_content = """<<EOT
68+
{{ define "Alert Instance Template" }}
69+
Firing: {{ .Labels.alertname }}
70+
Silence: {{ .SilenceURL }}
71+
{{ end }}
72+
EOT
73+
"""
6774
if input.create_contact_point is None:
6875
tfvars_file = f'''
6976
# Grafana Connection Variables
@@ -90,13 +97,7 @@ def grafana_tfvars(input):
9097
# Grafana_Message_Template Variables
9198
create_message_template = {str(input.create_message_template).lower()}
9299
message_template_name = "Alert Instance Template"
93-
message_template_content = <<EOT
94-
{{ define "Alert Instance Template" }}
95-
Firing: {{ .Labels.alertname }}
96-
Silence: {{ .SilenceURL }}
97-
{{ end }}
98-
EOT
99-
100+
message_template_content = {message_template_content}
100101
101102
# Grafana_Mute_Timing Variables
102103
create_mute_timing = {str(input.create_mute_timing).lower()}
@@ -145,12 +146,7 @@ def grafana_tfvars(input):
145146
# Grafana_Message_Template Variables
146147
create_message_template = {str(input.create_message_template).lower()}
147148
message_template_name = "Alert Instance Template"
148-
message_template_content = <<EOT
149-
{{ define "Alert Instance Template" }}
150-
Firing: {{ .Labels.alertname }}
151-
Silence: {{ .SilenceURL }}
152-
{{ end }}
153-
EOT
149+
message_template_content = {message_template_content}
154150
155151
156152
# Grafana_Mute_Timing Variables

0 commit comments

Comments
 (0)