Closed nozaq closed 4 years ago
Thanks for finding and fixing this! I've merged your change into master, and tested upgrading terraform with this change, but it doesn't seem to fix the upstream issue as yet. That said, this issue can be closed, and thank you for moving us closer to the solution!
hclfmt failed to properly format indentation when a block contains two or more heredocs. related issue: https://github.com/hashicorp/terraform/issues/21434
Consider the following HCL code.
When pass that file to hclfmt, the output of
baz
block is not indented as expected.The expected output is:
It seems inHeredoc flag is not set to false even after processing
foo
block. This could be becauseformatIndent()
function expectsTokenOHeredoc
andTokenCHeredoc
appear in different lines, whilelinesForFormat
function put all tokens betweenTokenOHeredoc
andTokenCHeredoc
in the sameformatLine
instance.I'm new to this codebase, so the above analysis could be completely wrong though...