Error AtlasError Documentation and Resolution

Terraform one function received too many elements

Error: Invalid function argument

Terraform could not use one because the collection contains more than one element, while one only accepts zero-or-one collections.

Invalid function argumentconfiguration
Error: Invalid function argument
  • The list, set, or tuple passed to one contains multiple elements.
  • The configuration assumes a collection is optional-singleton, but runtime data returns more values.
  • A count or for_each expression produces more results than the downstream expression expects.
  1. Check why the collection contains multiple elements and whether that is expected.
  2. Use a different expression pattern if the collection can legitimately contain more than one value.
  3. Constrain the upstream logic so one only receives zero-or-one collections.
one function
Terraform Invalid function argument with one: causes and fixes | Error Atlas