Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve default destroy warning template #49

Merged
merged 1 commit into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion terraform/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ const (

// DefaultDestroyWarningTemplate is a default template for terraform plan
DefaultDestroyWarningTemplate = `
## :warning: Plan Result{{if .Vars.target}} ({{.Vars.target}}){{end}}: Resource Deletion will happen :warning:
## Plan Result{{if .Vars.target}} ({{.Vars.target}}){{end}}

[CI link]({{ .Link }})

### :warning: Resource Deletion will happen :warning:

This plan contains resource delete operation. Please check the plan result very carefully!

{{if .Result}}
Expand Down
20 changes: 15 additions & 5 deletions terraform/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,12 @@ func TestDestroyWarningTemplateExecute(t *testing.T) {
template: DefaultDestroyWarningTemplate,
value: CommonTemplate{},
resp: `
## :warning: Plan Result: Resource Deletion will happen :warning:
## Plan Result

[CI link]()

### :warning: Resource Deletion will happen :warning:

This plan contains resource delete operation. Please check the plan result very carefully!


Expand All @@ -218,10 +220,12 @@ This plan contains resource delete operation. Please check the plan result very
Result: `This is a "result".`,
},
resp: `
## :warning: Plan Result: Resource Deletion will happen :warning:
## Plan Result

[CI link]()

### :warning: Resource Deletion will happen :warning:

This plan contains resource delete operation. Please check the plan result very carefully!


Expand All @@ -246,10 +250,12 @@ This plan contains resource delete operation. Please check the plan result very
UseRawOutput: true,
},
resp: `
## :warning: Plan Result: Resource Deletion will happen :warning:
## Plan Result

[CI link]()

### :warning: Resource Deletion will happen :warning:

This plan contains resource delete operation. Please check the plan result very carefully!


Expand All @@ -273,10 +279,12 @@ This plan contains resource delete operation. Please check the plan result very
Result: "",
},
resp: `
## :warning: Plan Result: Resource Deletion will happen :warning:
## Plan Result

[CI link]()

### :warning: Resource Deletion will happen :warning:

This plan contains resource delete operation. Please check the plan result very carefully!


Expand All @@ -297,10 +305,12 @@ This plan contains resource delete operation. Please check the plan result very
Result: "",
},
resp: `
## :warning: Plan Result: Resource Deletion will happen :warning:
## Plan Result

[CI link]()

### :warning: Resource Deletion will happen :warning:

This plan contains resource delete operation. Please check the plan result very carefully!


Expand Down