Domain 4 of 8 · Chapter 4 of 8

Complex types

Unlock the complete study guide + 1,500 practice questions across 25 full exams.

Bundled into the existing HashiCorp Certified: Terraform Associate premium course — no separate purchase.

14-day money-back guarantee — no questions asked.

Included in this chapter:

  • The two families of complex type
  • Collection types: list, set, and map
  • Structural types: object and tuple
  • Accessing elements
  • Exam-pattern recognition

The five complex types at a glance

Propertylistsetmapobjecttuple
Familycollectioncollectioncollectionstructuralstructural
Element typesuniformuniformuniformper attributeper position
Orderingorderedunorderedstring-keyednamed attributesordered
Duplicatesallowedremovedkeys uniquen/aallowed
Element accessindex [0]not indexablekey ["k"].attr or ["attr"]index [0]

Decision tree

One shared element type?Look up by string key?Members have names?mapkeyed by stringOrder or duplicates matter?listordered, dupes allowedsetunique, unorderedobjectnamed attrs, optional()tupleexact element countYes: collectionNo: structuralYesNoYesNoYesNo

Cheat sheet

  • Collection type distinctions
  • List to set conversion
  • Object vs tuple
  • Optional object attributes
  • Indexing maps vs lists
  • Automatic primitive conversion

Unlock with Premium — includes all practice exams and the complete study guide.

References

  1. Terraform Language: Type Constraints
  2. Terraform Language: Types and Values
  3. Terraform Language: References to Values
  4. Terraform Language: Arithmetic and Logical Operators