Study HashiCorp Terraform 004 Expressions: key concepts, common traps, and exam decision cues.
Terraform supports dynamic configuration, but it still stays declarative. The exam expects you to understand that expressions and functions help shape values and repeated patterns without turning Terraform into imperative scripting.
| Tool | Main purpose |
|---|---|
| expression | compute or transform values inside configuration |
| built-in function | manipulate strings, numbers, collections, or other values |
| dynamic configuration pattern | make configuration flexible or repeatable while keeping intent clear |
| Trap | Better rule |
|---|---|
| treating expressions like shell logic | expressions shape values inside Terraform’s model, not procedural flow |
| overcomplicating config with unnecessary dynamic patterns | dynamic should improve clarity, not hide intent |
| assuming functions change Terraform’s core workflow | functions shape values; the plan/apply model stays the same |
Expressions and functions exist to keep Terraform declarative while still allowing flexible value construction. If you are transforming values, think expression or function. If you are repeating nested configuration based on inputs, think dynamic configuration or collection-driven blocks. The weak answer usually assumes Terraform has become an imperative scripting language just because the config is more flexible.