0.8.8
in main.tf
module "test" {
source = "module1/"
}
module "test2" {
source = "module2/"
input_var = "${module.test.my_output}"
}
in module1/test.tf
data "template_file" "tpl" {
template = "whatever"
vars = {
}
}
output "my_output" {
value = "${data.template_file.tpl.vars.doesntexist}"
}
in module2/test.tf
variable "input_var" { }
data "template_file" "tpl2" {
template = "$${OtherVariable}"
vars = {
OtherVariable = "test"
Variable = "${var.input_var}"
}
}
Referencing the nonexistent variable in the output variable should have failed with an error.
Apply fails with: * data.template_file.tpl2: failed to render : 1:3: unknown variable accessed: OtherVariable
Note that it's failing on the "wrong" variable, which caused some head-scratching.
terraform getterraform applyRelated to #12403. Once outputs can produce errors, this may take care of itself.
Bump, silent failures like this lead to really bad problems down the pipeline.
EDIT, the related tickets have been closed, so maybe this is also resolved?
EDIT: #12403 was a dupe of #9080.
Thanks @ketzacoatl, this also should have been closed.
The next release will have even more type information, and can present an error even earlier.
You would see something along the lines of:
Error: Missing map element
on module1/main.tf line 9, in output "my_output":
9: value = data.template_file.tpl.vars.doesntexist
|----------------
| data.template_file.tpl.vars is map of string with 0 elements
This map does not have an element with the key "doesntexist".
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.
Most helpful comment
Thanks @ketzacoatl, this also should have been closed.
The next release will have even more type information, and can present an error even earlier.
You would see something along the lines of: