-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Labels
available-in-prereleasefixed in the latest pre-release version. Install with: pip install python-hcl2 --pre --upgradefixed in the latest pre-release version. Install with: pip install python-hcl2 --pre --upgradebugSomething isn't workingSomething isn't working
Description
Describe the bug
https://developer.hashicorp.com/terraform/language/expressions/strings#escape-sequences-1 says
Backslash sequences are not interpreted as escapes in a heredoc string expression. Instead, the backslash character is interpreted literally.
However, python-hcl2 appears to process backslash sequences in heredocs as if they were in a literal string.
Software:
- OS: Mac OS Tahoe 26.3 (25D125)
- Python version: Python 3.13.7
- python-hcl2 version:
main(currently a8e5ac0)
Snippet of HCL2 code causing the unexpected behaviour:
block "example" {
value = <<-EOT
value with "quoted" word and \"escaped\" quote
and literal \n newline on line two
EOT
}Expected behavior
{
"block": [
{
"example": {
"value": "value with \"quoted\" word and \\\"escaped\\\" quote\nand literal \\n newline on line two"
}
}
]
}Actual behavior
{
"block": [
{
"example": {
"value": "value with \"quoted\" word and \"escaped\" quote\nand literal \n newline on line two"
}
}
]
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
available-in-prereleasefixed in the latest pre-release version. Install with: pip install python-hcl2 --pre --upgradefixed in the latest pre-release version. Install with: pip install python-hcl2 --pre --upgradebugSomething isn't workingSomething isn't working