-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Conditional expression evaluates unreachable substitution #17960
Comments
Hi @wschult23, Thanks for filing the issue. This is correct that conditional statements don't short-circuit. |
We're leaving the earlier issue #15605 open to track this feature. |
Hi James,
is there a workaround? I want to access data within a „data“ resource only if the resource itself exists.
Best regards,
Wolfgang.
… Am 27.04.2018 um 20:59 schrieb James Bardin ***@***.***>:
Hi @wschult23 <https://github.com/wschult23>,
Thanks for filing the issue. This is correct that conditional statements don't short-circuit.
We are working on including this in a suite of changes to the configuration language that will come in a future release.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#17960 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AFMdbYchpRdm3sm4KrjiU4x7e6ymQQ5oks5ts2qZgaJpZM4Tq2nu>.
|
Hi @wschult23, There's no workaround if the resource does not exist in the configuration at all (I'm actually not sure yet if that will work in the next version, but it's not something that should be counted on). If the resource doesn't exist because the count is 0, you can reference it as an empty list using the |
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.11.5
I have a conditional data resource and I want to obtain a value from this resource. If the ressource doesn't exist, I want to set the value to an empty string.
Expected Behavior
Due to the fact that the expression evaluates to true, I would expect, that the second term
would not be evaluated and the value of locals.name is "".
Actual Behavior
Terraform produces a error message, that it can't find the ressource after applying the plan:
Steps to Reproduce
terraform apply
The text was updated successfully, but these errors were encountered: