Merge pull request #31149 from hashicorp/docs-for-each-list-toset

fix(docs): change set to list when recommending using toset()
This commit is contained in:
Laura Pacilio 2022-10-25 11:04:19 -04:00 committed by GitHub
commit c3c6f8327f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,11 +133,11 @@ can't refer to any resource attributes that aren't known until after a
configuration is applied (such as a unique ID generated by the remote API when
an object is created).
The `for_each` value must be a map or set with one element per desired
resource instance. When providing a set, you must use an expression that
explicitly returns a set value, like the [`toset`](/language/functions/toset)
function; to prevent unwanted surprises during conversion, the `for_each`
argument does not implicitly convert lists or tuples to sets.
The `for_each` value must be a map or set with one element per desired resource
instance. To use a sequence as the `for_each` value, you must use an expression
that explicitly returns a set value, like the [toset](/language/functions/toset)
function. To prevent unwanted surprises during conversion, the `for_each` argument
does not implicitly convert lists or tuples to sets.
If you need to declare resource instances based on a nested
data structure or combinations of elements from multiple data structures you
can use Terraform expressions and functions to derive a suitable value.