diff --git a/terraform/template.go b/terraform/template.go
index 0126acb..408888d 100644
--- a/terraform/template.go
+++ b/terraform/template.go
@@ -41,9 +41,15 @@ const (
{{ .Message }}
-{{ .Result }}
+{{if .Result}}
+
{{ .Result }}
+
+{{end}}
+
+Details (Click me)
-{{ .Body }}
+{{ .Body }}
+
`
// DefaultPlanTemplate is a default template for terraform plan
@@ -242,8 +248,8 @@ func (t *FmtTemplate) Execute() (string, error) {
data := map[string]interface{}{
"Title": t.Title,
"Message": t.Message,
- "Result": "",
- "Body": t.Result,
+ "Result": t.Result,
+ "Body": t.Body,
"Link": t.Link,
}
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 {