diff --git a/terraform/template.go b/terraform/template.go index 848e6dd..408888d 100644 --- a/terraform/template.go +++ b/terraform/template.go @@ -39,10 +39,17 @@ const ( DefaultFmtTemplate = ` {{ .Title }} +{{ .Message }} + +{{if .Result}} +
{{ .Result }}
+
+{{end}} +
Details (Click me)
{{ .Body }}
-
+ ` // DefaultPlanTemplate is a default template for terraform plan diff --git a/terraform/template_test.go b/terraform/template_test.go index c947061..8cccc6c 100644 --- a/terraform/template_test.go +++ b/terraform/template_test.go @@ -66,7 +66,6 @@ b `, }, - { template: "", value: CommonTemplate{ @@ -193,7 +192,10 @@ func TestFmtTemplateExecute(t *testing.T) { +
Details (Click me) +

+
`, }, { @@ -208,7 +210,10 @@ message +
Details (Click me) +

+
`, }, { @@ -225,11 +230,16 @@ a b +
c
+
+ -c +
Details (Click me) + +
d
+
`, }, - { template: "", value: CommonTemplate{ @@ -244,8 +254,14 @@ a b +
c
+
+ + +
Details (Click me) -c +
d
+
`, }, { @@ -262,8 +278,14 @@ a b +
This is a "result".
+
+ + +
Details (Click me) -This is a "result". +
d
+
`, }, { @@ -281,8 +303,14 @@ a b +
This is a "result".
+
+ -This is a "result". +
Details (Click me) + +
d
+
`, }, { @@ -290,10 +318,10 @@ This is a "result". value: CommonTemplate{ Title: "a", Message: "b", - Result: "should be used as body", - Body: "should be empty", + Result: "c", + Body: "d", }, - resp: `a-b--should be used as body`, + resp: `a-b-c-d`, }, } for _, testCase := range testCases {