This website requires JavaScript.
Explore
Help
Sign In
go
/
hcl
Watch
2
Star
0
Fork
0
You've already forked hcl
Code
Issues
Pull Requests
Releases
Wiki
Activity
5eb0f21a30
hcl
/
test-fixtures
/
multiline_indented.hcl
5 lines
47 B
HCL
Raw
Normal View
History
Unescape
Escape
Add support for indented HEREDOC terminators This PR adds support for the style of HEREDOC often used in Ruby which allows the terminating marker to be indented if the HEREDOC is started with the sequence "<<-" rather than the usual "<<". This allows users to express documents with more natural indentation: resource "template_file" "test" { template = <<-HEREDOC First Line Second Line HEREDOC } Note that this does not attempt to add any semantics around removing hanging indent from the actual text of the document, so extra indentation would still be present. We could make use of the canonical style for HCL herre to remove the hanging indent in the style of Ruby which would probably be more predictable for users.
2016-02-22 05:07:29 +00:00
foo
=
<
<
-
EOF
bar
baz
Remove hanging indent on HEREDOCs with <<- prefix This commit adds support for removing a hanging indent from HEREDOC token contents if the marker is prefixed with <<-. For example, given the HCL definition: my_long_var_name = <<-EOF { "key": "value" } EOF The value of the HEREDOC will be: { "key": "value" } This is useful for use cases where indentation or leading whitespace is important. The rule applied is that the prefix on the terminating marker will be removed from each each line in the HEREDOC, providing all the lines have that prefix (i.e. every line is at least as indented as the terminating marker, and using the same mechanism of tabs vs spaces).
2016-02-27 20:10:56 +00:00
EOF
Reference in New Issue
Copy Permalink