There are several cases where it would be desirable to have a string format that makes it easier to create string literal without needing to escape special characters. In particular, regexes, and template strings passed to something else, where I have a lot of "${" that shouldn't be interpolated by hcl itself.
Heredoc strings avoid needing to escape backslashes, but require a newline at the end. Which can be problematic. And it doesn't help with avoiding template interpolation.
I propose adding some form of raw string literal syntax. This could be any of the following:
- surround the text with a matching amount of backtics for example
x = `single`
y = ``double``
Or maybe only use single backtics
- something like rusts raw strings:
##"number of #s must match"##
- a prefix like python raw strings:
r"raw". Although that is problematic if you need to use " in it
There are several cases where it would be desirable to have a string format that makes it easier to create string literal without needing to escape special characters. In particular, regexes, and template strings passed to something else, where I have a lot of "${" that shouldn't be interpolated by hcl itself.
Heredoc strings avoid needing to escape backslashes, but require a newline at the end. Which can be problematic. And it doesn't help with avoiding template interpolation.
I propose adding some form of raw string literal syntax. This could be any of the following:
##"number of #s must match"##r"raw". Although that is problematic if you need to use " in it