Commit Graph

4 Commits

Author SHA1 Message Date
Paul Hinze
2fb7c957a4
Remove BC escaped double quote behavior
When we switched to the current edition of the HCL parser, we
inadvertently broke some undocumented behavior where users could
successfully used escaped double quotes in a nested interpolation like
this:

    foo = "${somefunc(\"somearg\")}"

The proper syntax here is:

    foo = "${somefunc("somearg")}"

Because once you are inside the interpolation braces, the "quoting
context" is different.

At the time, while we didn't like the fact that the non-standard syntax
was in the wild, we didn't want to break BC, so we treated it as a bug
and fixed it in #62.

Now that we are at the moment of a major Terraform release, we can yank
the BC compatible behavior, which fixes a currently broken use case -
there is no way to express strings with double quotes in them from
inside interpolation braces.

    foo = "${somefunc("\"inquotes\"")}"

After merge and a dep upgrade, this will take care of
https://github.com/hashicorp/terraform/issues/5550
2016-06-16 12:43:37 -05:00
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
Mitchell Hashimoto
88ef419bd9 Properly decode \\n 2014-11-12 21:12:45 -08:00
Mitchell Hashimoto
764b0ad3c0 Allow escaping quotes in HCL string [GH-14] 2014-10-10 16:07:25 -07:00