You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @yermulnik, thanks for filing this! I've raised zclconf/go-cty#200 with the upstream function library to resolve this.
I'll note here the difference between a tuple and a list. A tuple is of concrete known length, and so the maintainer of the upstream library may not want to add support for unknown indices when referencing a tuple. I do also note the CHANGELOG for the library (and for Terraform) just said the element function supports negative indices and didn't clarify the difference between a tuple and a list.
While we wait for a response there, you can force the input into a list using the tolist(...) function, so element(tolist([0, 1, 2]), -1) does work as expected.
Terraform Version
Terraform Configuration Files
Debug Output
Expected Behavior
As of TF 1.10.0 release notes and #35501 I'd expect
element()
function to accept negative indices and not fail.Actual Behavior
Steps to Reproduce
echo 'element([1,2,3], -1)' | terraform console
Additional Context
No response
References
Generative AI / LLM assisted development?
No response
The text was updated successfully, but these errors were encountered: