-
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
terraform: disallow simple variables ("foo") #9698
Conversation
Fixes #5338 (and I'm sure many others) There is no use case for "simple" variables in Terraform at all so anytime one is found it should be an error. There is a _huge_ backwards incompatibility here that was not supposed to be by design but I'm sure a lot of people are relying on: in the `template_file` datasource, this bug allowed you to not escape your interpolations and have the work. For example: ``` data "template_file" "foo" { template = "${a}" vars { a = 12 } } ``` The above would work, but it shouldn't. The template should have to be `"$${a}"` (to escape the interpolation). Because of this BC, I recommend holding this until Terraform 0.8.0 and documenting it carefully. As part of this PR, I've added some special error message notes.
I've seen questions about this particular instance of the bug with This fix looks plausible, but agreed about the BC concerns given how many people reported phantom bugs in the data sources code due to using |
@apparentlymart Yeah this is going to be paired with: hashicorp/hcl#150 That makes the HCL/HIL interaction a lot more sense at the expense of BC |
Some more issue references, just to make sure there are link trails from these other issues to here:
|
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. |
Fixes #5338 (and I'm sure many others)
There is no use case for "simple" variables in Terraform at all so
anytime one is found it should be an error.
There is a huge backwards incompatibility here that was not supposed
to be by design but I'm sure a lot of people are relying on: in the
template_file
datasource, this bug allowed you to not escape yourinterpolations and have the work. For example:
The above would work, but it shouldn't. The template should have to be
"$${a}"
(to escape the interpolation).Because of this BC, I recommend holding this until Terraform 0.8.0 and
documenting it carefully. As part of this PR, I've added some special
error message notes.