Dump invalid HCL if we hit it

This commit is contained in:
Justin Santa Barbara 2017-09-16 18:48:08 -04:00
parent 0224883aba
commit fa1be5371c
1 changed files with 4 additions and 0 deletions

View File

@ -121,6 +121,10 @@ func hclPrint(node ast.Node) ([]byte, error) {
// Apply Terraform style (alignment etc.)
formatted, err := hcl_printer.Format([]byte(s))
if err != nil {
glog.Errorf("Invalid HCL follows:")
for i, line := range strings.Split(s, "\n") {
glog.Errorf("%d\t%s", (i + 1), line)
}
return nil, fmt.Errorf("error formatting HCL: %v", err)
}