From 714d594e552f52f539e0087921a02158473c8ba0 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 18 Aug 2026 11:15:21 -0700 Subject: [PATCH] fix: parse heredocs with an empty body (#309) `a = <[a-zA-Z][a-zA-Z0-9._-]+)\n(?:.|\n)*?\n\s*(?P=heredoc)\n/ -HEREDOC_TEMPLATE_TRIM : /<<-(?P[a-zA-Z][a-zA-Z0-9._-]+)\n(?:.|\n)*?\n\s*(?P=heredoc_trim)\n/ +HEREDOC_TEMPLATE : /<<(?P[a-zA-Z][a-zA-Z0-9._-]+)\n(?:(?:.|\n)*?\n)??\s*(?P=heredoc)\n/ +HEREDOC_TEMPLATE_TRIM : /<<-(?P[a-zA-Z][a-zA-Z0-9._-]+)\n(?:(?:.|\n)*?\n)??\s*(?P=heredoc_trim)\n/ // Ignore whitespace (but not newlines, as they're significant in HCL) %ignore /[ \t]+/ diff --git a/test/integration/specialized/heredocs.tf b/test/integration/specialized/heredocs.tf index 9fc16498..6a10897b 100644 --- a/test/integration/specialized/heredocs.tf +++ b/test/integration/specialized/heredocs.tf @@ -31,4 +31,16 @@ EOF json_content = <