hcl/test-fixtures/escape.hcl
Paul Hinze 8e05f061d6
strconv: Fix escaped backslashes \\ in braces ${}
Fixes https://github.com/hashicorp/terraform/issues/6359 and several
related issues by unescaping a double backslash within braces to a
single backslash.

This bumps into the bit of HIL that still hangs out in HCL - for values
that aren't interpolated, like Terraform's variable defaults - users
were unable to get a backslash to show up within `${}`.

That's because `${}` is handled specially to allow for, e.g., double
quotes inside of braces.

Here, we add `\\` as a special cased escape (along with `\"`) so users
can get backslashes in these scenarios by doubling them up.
2016-06-06 19:05:05 -05:00

7 lines
136 B
HCL

foo = "bar\"baz\\n"
bar = "new\nline"
qux = "back\\slash"
qax = "slash\\:colon"
nested = "${HH\\:mm\\:ss}"
nestedquotes = "${\"okay\"}"