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
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.