optional object attribute

Marking an attribute of an object type with optional() so callers may leave it out, with an optional default value.

In more detail

It lets a module accept a rich settings object without forcing every caller to fill in every field. It has been available since Terraform 1.3.

Example

type = object({ name = string, size = optional(number, 2) })

Related terms

Taught in

References

Certification courses