"tfcmt failed" error="html/template:default:12:11: no such template \"error_message\" #1492
-
tfcmt version$ tfcmt -v
v4.14.0 Environment
OverviewI set up the configuration referring to the example, but it resulted in an error. https://suzuki-shunsuke.github.io/tfcmt/config#example-configuration How to reproduce
terraform:
templates:
changed_result: |
{{if .ChangedResult}}
<details><summary>Change Result (Click me)</summary>
{{wrapCode .ChangedResult}}
</details>
{{end}}
change_outside_terraform: |
{{if .ChangeOutsideTerraform}}
<details><summary>:warning: Note: Objects have changed outside of Terraform</summary>
{{wrapCode .ChangeOutsideTerraform}}
</details>
{{end}}
warning: |
{{if .Warning}}
## :warning: Warnings :warning:
{{wrapCode .Warning}}
{{end}}
error_message: |
{{if .ErrorMessages}}
## :warning: Errors
{{range .ErrorMessages}}
* {{. -}}
{{- end}}{{end}}
plan:
template: |
aiueo
{{template "plan_title" .}}
{{if .Link}}[CI link]({{.Link}}){{end}}
{{template "result" .}}
{{template "updated_resources" .}}
{{template "changed_result" .}}
{{template "change_outside_terraform" .}}
{{template "warning" .}}
{{template "error_message" .}}
when_destroy:
template: |
abcde
{{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_message" .}}
when_no_changes:
disable_label: true
Debug output$ Expected behaviourno error Actual behaviourNote: You didn't use the -out option to save this plan, so Terraform can't Important FactoidsNo response NoteNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Thank you for your report!
tfcmt.yaml terraform:
templates:
error_message: |
{{if .ErrorMessages}}
## :warning: Errors
{{range .ErrorMessages}}
* {{. -}}
{{- end}}{{end}}
plan:
template: |
{{template "error_message" .}} main.tf resource "null_resource" "foo" {} terraform init $ tfcmt plan -- terraform plan
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# null_resource.foo will be created
+ resource "null_resource" "foo" {
+ id = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────────────
Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.
ERRO[0001] tfcmt failed error="html/template:default:1:11: no such template \"error_message\""
templates:
error_message: |
{{if .ErrorMessages}}
## :warning: Errors
{{range .ErrorMessages}}
* {{. -}}
{{- end}}{{end}}
terraform:
plan:
template: |
{{template "error_message" .}} |
Beta Was this translation helpful? Give feedback.
-
This was my misunderstanding. |
Beta Was this translation helpful? Give feedback.
-
Thank you so much. Including templates: in my Terraform configuration was my mistake. |
Beta Was this translation helpful? Give feedback.
Thank you for your report!
tfcmt.yaml
main.tf