From 00e503388eb3fec2d1504bb9f82bf2ee189073ff Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 18 Feb 2021 00:59:30 -0800 Subject: [PATCH] change template parsing error to include warning about file extensions (#10652) --- command/build.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/command/build.go b/command/build.go index 52982404c..31297eb2e 100644 --- a/command/build.go +++ b/command/build.go @@ -126,7 +126,11 @@ func (m *Meta) GetConfigFromJSON(cla *MetaArgs) (packer.Handler, int) { } if err != nil { - m.Ui.Error(fmt.Sprintf("Failed to parse template: %s", err)) + m.Ui.Error(fmt.Sprintf("Failed to parse file as legacy JSON template: "+ + "if you are using an HCL template, check your file extensions; they "+ + "should be either *.pkr.hcl or *.pkr.json; see the docs for more "+ + "details: https://www.packer.io/docs/templates/hcl_templates. \n"+ + "Original error: %s", err)) return nil, 1 }