4.4. Types, Expressions, and Functions
💡 First Principle: HCL is a small typed language — values have types, expressions transform them, and built-in functions do the heavy lifting — so "dynamic configuration" is just composing these three layers, never writing imperative loops.
Why care: The exam tests type constraints, the major expression forms (conditionals, for, splat, dynamic), and the fact that functions are built-in (you can't define your own general-purpose functions). These are also what make real modules flexible.
The mental model: Think spreadsheet formulas, not a programming language. You declare what a cell (value) should equal using functions and references; you don't write step-by-step procedures.
⚠️ Common Misconception: "I can write my own functions in Terraform." Core Terraform has no user-defined general functions — you use the built-in library (and, in newer versions, functions a provider contributes). Trying to define a custom function is not valid HCL.