-
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
template_file resource failed to render with unknown variable accessed #10148
Comments
@apparentlymart, you've chimed in on most of the threads surrounding this issue. Does a temporary workaround exist? |
I'm unable to reproduce this locally, but I have it feeling it may have to do with those modules, or it may already be fixed. @jcderose can you try with 0.7.11 with the |
That didn't resolve the issue. Here's my debug output, if it helps: https://gist.github.com/jcderose/d352206735196050fdd16cc852e24dfb To clarify our use case: the app1 module is always called/run, but the app2 module may or may not be called, depending on the environment. So in cases where the app2 module is not called (and thus, the Also to clarify, this code worked before I added the |
Two interesting notes: First, I tried replacing the Second, I re-ordered the variables in the
And now the error message complains about the
|
In troubleshooting this issue, I noticed the docs for the I've tried refactoring the |
Okay, I resolved my issue: the output variable In my app2 module, I changed the output variable from:
to:
This creates my intended effect of assigning an empty string to the output variable
This compares the sometimes-empty string of module.app1.db_fqdn against the non-empty string of module.app0.db_fqdn and assigns whichever first value is non-empty. |
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. |
Terraform Version
0.7.9
Affected Resource(s)
Terraform Configuration Files
template_file
resource declaration:template_file
file (/path/foo/environment.json
):Debug Output
https://gist.github.com/jcderose/ded36006a6368346b32ad9ea77926b74
Panic Output
n/a
Expected Behavior
The template file should be populated with the interpolated values.
Actual Behavior
I get the now-infamous error message:
Steps to Reproduce
terraform apply
(terraform plan
doesn't catch the error)Important Factoids
I know this may be fixed with the upcoming 0.8 release (given the PR references I found below), but the linked issues and use cases don't quite seem to match my own.
And if nothing else, I'd love a temporary workaround.
References
The text was updated successfully, but these errors were encountered: