zclconf / go-cty

A type system for dynamic values in Go applications
MIT License
338 stars 70 forks source link

Add a note for CanIterateElements about unknown and null #166

Open wata727 opened 11 months ago

wata727 commented 11 months ago

See also https://github.com/terraform-linters/tflint-ruleset-aws/pull/517#discussion_r1268169565 See also https://github.com/terraform-linters/tflint-ruleset-aws/issues/528#issuecomment-1667906280

The documentation for CanIterateElements says "return true if the receiver can support the ElementIterator method without panic", but it actually causes panic if unknown or null.

One way would be to fix the implementation to match the documentation, but that would probably be too much of an impact. This PR fixes the documentation to match the implementation and avoid making the same mistakes.