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
"is empty tuple" error #22480
Comments
Hi @designermonkey, This expression is failing static validation because it's referring to an element of a list that isn't there. The static validation happens before The good news is that there is a straightforward way around this: use value = local.services[count.index].public_address Since this doesn't refer to zero specifically, it can now pass even if there isn't a zeroth element in the list or tuple. Terraform's validator understands that As well as avoiding the need for any indexing at all ( Terraform is working as designed here -- this is static validation for correctness of expressions regardless of the current |
Thanks for the feedback. Of course it will always only be |
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
Expected Behavior
I expect that having an empty array in a local defined in a
.tf.json
file is treated as a list.Actual Behavior
Apparently my list is a tuple. The resource is defined similar to:
With that being said, I also don't understand why it is even processing that to an error when the count is clearly
0
as defined above :/Steps to Reproduce
Use the following
.tf.json
definition:Additional Context
I can't provide more details as to what is being run where as we have very tight contracts here.
The text was updated successfully, but these errors were encountered: