Error AtlasError Documentation and Resolution

Terraform each object does not contain the referenced attribute

Error: Invalid "each" attribute

Terraform could not evaluate the each object because the expression referenced an attribute that does not exist for the current for_each context.

Invalid "each" attributeconfiguration
Error: Invalid "each" attribute
  • The configuration references an unsupported each attribute such as each.id.
  • The for_each value shape changed, but the resource body still assumes a different structure.
  • The expression expects an object while the current iteration value is a primitive or map entry.
  1. Use each.key or each.value as appropriate for the current for_each collection.
  2. Inspect the type and shape of the for_each data before referencing nested values.
  3. Refactor the local or map used by for_each if you need richer iteration values.
Troubleshoot Terraform
Terraform Invalid each attribute: causes and fixes | Error Atlas