-
Notifications
You must be signed in to change notification settings - Fork 368
Extending Terraform - state representation of TypeSet #1495
Comments
Hey @dak1n1 👋 Broadly speaking, set types in Terraform after Terraform CLI 0.12 are non-indexable by design. It is invalid to attempt to index into a set and Terraform CLI will throw a configuration error. For practitioners, the choice of how to handle a set typed attribute will be configuration and goal specific. For example, using I think the best way to describe this from the provider acceptance testing side is that the Terraform CLI 0.12 shims in the Terraform Plugin SDK no longer know how to handle the TypeSet hash (the integer after It would certainly be good to mention the |
Reference: #1495 Call out most common `TestCheckFunc` and add `TypeSet` functions. Also call out list/set/map element count syntax.
Reference: #1495 Call out most common `TestCheckFunc` and add `TypeSet` functions. Also call out list/set/map element count syntax.
Submitted #1796 to revamp that section a bit. |
I was looking for some documentation to help guide a user through accessing elements of a TypeSet resource attribute, and I found this page that shows the Terraform SDK v1 representation of TypeSet. It will probably need to be updated with the new SDK v2 representation of TypeSet.
This is the page: https://www.terraform.io/docs/extend/schemas/schema-types.html#typeset
The code block shows the index value calculated from a hash:
With Terraform SDK v2, it now can be accessed like a list instead:
But there might be a better way to represent it, using the TypeSet helper. It would probably be helpful to show users:
The text was updated successfully, but these errors were encountered: