Pull Request | v2.1.0...v3.0.0
⚠️ Breaking Changes
#154 #155 #156 Default templates and some templates are changed
tfcmt provides useful templates but they weren't used in the default templates.
From v3, default templates are improved using them.
Futhermore, useful templates are added.
Default templates and existing templates are changed, so this includes breaking changes.
How to migrate
Please check the change and update tfcmt configuration if needed.
What are changed?
- default plan template
- default apply template
- default apply parse error template
- templates
- deletion_warning
- plan_title
- apply_title
default plan template
- Add warning
- Replace
CombinedOutput
tochanged_result
change_outside_terraform
AS IS
{{template "plan_title" .}}
{{if .Link}}[CI link]({{.Link}}){{end}}
{{if .HasDestroy}}{{template "deletion_warning" .}}{{end}}
{{template "result" .}}
{{template "updated_resources" .}}
<details><summary>Details (Click me)</summary>
{{wrapCode .CombinedOutput}}
</details>
{{if .ErrorMessages}}
## :warning: Errors
{{range .ErrorMessages}}
* {{. -}}
{{- end}}{{end}}
TO BE
{{template "plan_title" .}}
{{if .Link}}[CI link]({{.Link}}){{end}}
{{template "deletion_warning" .}}
{{template "result" .}}
{{template "updated_resources" .}}
{{template "changed_result" .}}
{{template "change_outside_terraform" .}}
{{template "warning" .}}
{{template "error_messages" .}}
default apply template
The template guide_apply_failure
are inserted.
By default this is empty.
You can insert the guide for apply failure to the template when terraform apply
fails.
{{template "apply_title" .}}
{{if .Link}}[CI link]({{.Link}}){{end}}
{{if ne .ExitCode 0}}{{template "guide_apply_failure" .}}{{end}}
{{template "result" .}}
<details><summary>Details (Click me)</summary>
{{wrapCode .CombinedOutput}}
</details>
{{template "error_messages" .}}
default apply parse error template
The template guide_apply_parse_error
are inserted.
By default this is empty.
You can insert the guide when it fails to parse the result of terraform apply
.
plan_title
AS IS
## {{if eq .ExitCode 1}}:x: {{end}}Plan Result{{if .Vars.target}} ({{.Vars.target}}){{end}}
TO BE
## {{if eq .ExitCode 1}}:x: Plan Failed{{else}}Plan Result{{end}}{{if .Vars.target}} ({{.Vars.target}}){{end}}
apply_title
AS IS
## :{{if eq .ExitCode 0}}white_check_mark{{else}}x{{end}}: Apply Result{{if .Vars.target}} ({{.Vars.target}}){{end}}
TO BE
## {{if eq .ExitCode 0}}:white_check_mark: Apply Succeeded{{else}}:x: Apply Failed{{end}}{{if .Vars.target}} ({{.Vars.target}}){{end}}
New templates
- warning
- error_messages
- change_outside_terraform
- guide_apply_failure
- guide_apply_parse_error
warning
{{if .Warning}}
## :warning: Warnings :warning:
{{wrapCode .Warning}}
{{end}}
error_messages
{{if .ErrorMessages}}
## :warning: Errors
{{range .ErrorMessages}}
* {{. -}}
{{- end}}{{end}}
change_outside_terraform
{{if .ChangeOutsideTerraform}}
<details><summary>:information_source: Objects have changed outside of Terraform</summary>
_This feature was introduced from [Terraform v0.15.4](https://github.com/hashicorp/terraform/releases/tag/v0.15.4)._
{{wrapCode .ChangeOutsideTerraform}}
</details>
{{end}}
guide_apply_failure
By default this is empty.
You can insert the guide for apply failure to the template when terraform apply
fails.
e.g.
templates:
guide_apply_failure: |
@{{.Vars.author}} Please check the error.
$ tfcmt apply -var "author:octocat" -- terraform apply -auto-approve
guide_apply_parse_error
By default this is empty.
You can insert the guide when it fails to parse the result of terraform apply
.