You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
heredocs_to_strings=True emits a multi-line quoted string, which is not valid HCL #337
The option converts a heredoc into a quoted string, but writes the heredoc's source -- markers and all -- inside the quotes, across as many physical lines
as the original occupied. A quoted template cannot span lines, so the result is
not readable by Terraform, and reading it back with this library gives the
marker text rather than the value.
OpenTofu rejects that with "Invalid multi-line string / Quoted strings may not
be split over multiple lines", although the input file evaluates to "hello\n".
Reading it back here yields '<<EOT\nhello\nEOT', so the option produces
neither a valid file nor the right value.
The field is DeserializerOptions.heredocs_to_strings
(hcl2/deserializer.py:73 at v8.1.3), read at :171 and :176, and it is
exposed on the shipped jsontohcl2 console script as --heredocs-to-strings
(cli/json_to_hcl.py:176, confirmed in jsontohcl2 --help).
Suggested shape of the fix
Convert the heredoc's value and escape it for a quoted string -- hello\n
becomes "hello\n" with the newline written as an escape -- rather than
quoting the source text.
This issue, and the investigation behind it, were produced by an AI assistant (Claude) working on behalf of the author. Please review with that provenance in mind.
Activity