From dbd93115cd7b35f4132b6de2d0f066f6fdd91ff1 Mon Sep 17 00:00:00 2001 From: wata_mac Date: Sun, 10 Jan 2021 01:35:00 +0900 Subject: [PATCH] tflint: Add workaround for parsing heredoc expressions --- tflint/client/decode.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tflint/client/decode.go b/tflint/client/decode.go index 34064be..5e15342 100644 --- a/tflint/client/decode.go +++ b/tflint/client/decode.go @@ -64,6 +64,9 @@ func decodeBlock(block *Block) (*hcl.Block, hcl.Diagnostics) { func parseExpression(src []byte, filename string, start hcl.Pos) (hcl.Expression, hcl.Diagnostics) { if strings.HasSuffix(filename, ".tf") { + // HACK: Always add a newline to avoid heredoc parse errors. + // @see https://github.com/hashicorp/hcl/issues/441 + src = []byte(string(src) + "\n") return hclsyntax.ParseExpression(src, filename, start) }