Terraform Type Constraints (Collection & Structural)

Type Constraints - Terraform Variables

  • Type constraints control the type of variable values

  • Primitive (Single type value)

    • number, string, bool

  • Complex (Multiple types in a single variable)

    • list, tuple, map, object

Complex types - Collections

  • Collection types allow multiple values of one primitive types to be grouped together.

  • Constructors of these Collections include:

    • list(type)

    • map(type)

    • set(type)

Complex types - Structural

  • Structural types allow multiple values of different primitive types to be grouped together

  • Constructors of these Collections include:

    • object(type)

    • tuple(type)

    • set(type)

Dynamic types - The "any" constraint

  • Any is a placeholder for primitive type yet to be decided

  • Actual type will be determined at runtime

Last updated