-
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 crash - reporting as instructed by the crash #5338
Comments
Relevant log section:
|
the crash was triggered by some invalid syntax, but it was a crash! |
I experienced a similar crash when I inadvertently assigned a number to the self parameter in the aws_security_group resource:
|
Does anyone have a config that can reproduce this? I have a hunch this is fixed on master since I can't repro it but w/o a known case where it was failing before I can't be 100% sure. |
@mitchellh Hi. I just tried with |
@mitchellh, @jen20 - looks to me like the the problem is Terraform doesn't attempt to interpolate bool attribute values. This is demonstrated by the following config: variable "bool_lookup" {
type = "map"
default = {
"0" = false
"1" = true
}
}
data "template_cloudinit_config" "config" {
count = 2
// the following will crash terraform
base64_encode = "${ lookup(var.bool_lookup, count.index, true) }"
part {
content_type = "text/x-shellscript"
content = "ffbaz"
}
} Also, in the original reported problem, the variable reference was missing |
I take it back.... the above config works with the following change: # BEFORE
base64_encode = "${ lookup(var.bool_lookup, count.index, true) }"
# AFTER
base64_encode = "${ lookup(var.bool_lookup, count.index, "true") }" |
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.
The referenced PR contains a fix for this issue, experienced by @sl1pm4t. This is actually part of a larger bug (that includes necessary BC breaking changes) that we'll be releasing fixes to as part of Terraform 0.8.0, as noted in the PR itself. |
Fixes hashicorp#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'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. |
The console output seems to indicate that it crashed on a syntax error while parsing "${var.apply_immediately}"
Attached is the console output and the crash log
crash.log.txt
console.txt
The text was updated successfully, but these errors were encountered: