-
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
only evaluate the part of a ternary statement that is used #11574
Comments
I have this problem as well... We use
Error:
|
Obligatory me too post... We began using this for an AMI auto-select feature in
Results in:
It's a bit of a showstopper for us. |
@dayglojesus in your case I think you are seeing #14399 rather than this issue. That was just a straight regression in the latest release, and a fix is ready for the next release. |
@apparentlymart ah, good to know. thanks! |
I'm running into a similar issue. My code looks like:
I get the following error:
Should I be doing it differently, or should we work on this issue? EDIT: I found a related issue/workaround here: #2831 (comment) |
Just hit this too... massively annoying. (0.9.10 and 0.10.3). Modified from the original code but it demonstrates the point:
gives
|
Just tested in
i get this error:
|
Same problem here with index out of range ... had to switch back to element() |
Hi @dansteen, and everyone else here! Sorry about this limitation and thanks for reporting it. This is the same issue being discussed in #11566. As mentioned there, a new version of the interpolation evaluator is coming which fixes this and many other limitations. Since we already have that issue open I'm going to close this one just to consolidate the discussion over there. That issue also contains some example workarounds for certain situations, which may be useful in the short term. |
As workaround I use method
|
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.8.5
Affected Resource(s)
not a specific reasource, but rather the way ternary operations are processed
Terraform Configuration Files
Expected Behavior
I would expect it not to attempt to evaluate
${aws_sns_topic.api.arn}
in a case wherevar.env != var.sns_env
. That way, if that resource is not created things will still work.Actual Behavior
Instead it attempts to evaluate both parts of the ternary results, and I get the following error in a case where
var.env != var.sns_env
:* consul_keys.api_sns: resource count can't reference resource variable: aws_sns_topic.api.arn
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
Thanks!
The text was updated successfully, but these errors were encountered: