-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace function cannot do double backslashes #8709
Comments
Shows that had backslash handling been more correct, it would not have been an issue. Also, removing the period as in the following example is actually apparently a syntax error, which makes me believe that backslash handling is rather broken:
|
I'll look into this, feels like an HCL bug. Thanks for the easy repros. I haven't tried them yet but they're comprehensive here and give me faith. |
This is fixed and explained here: hashicorp/hcl#150 Unfortunately this has a chance to break working TF configs so we're going to have to hold this until TF 0.8. :( I'm adding it to that milestone so we know. I'm also going to hijack the top of your issue to make a note to my future self. |
We got the fix in, will be part of 0.8 beta 1 this week. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I need to use the
replace
function to replace dots in a domain name with two backslashes. Sounds simple, right? Well, it is not. Terraform's replace function does not work entirely as advertised. See the following example:I would expect to have the value of "buggy" be
needs\\.double\\.backslashes\\.com
, but it is not. It is in factneeds\.double\.backslashes\.com
.The entire output from the example above (save it to a file, run
terraform apply
on it) is:Please fix this. :)
(My particular use case is that I need to feed a string like this into a JSON file and then into a regex parser, so I need to escape the periods twice.)
This is using Terraform 0.7.3.
The text was updated successfully, but these errors were encountered: