โ† Terraform Associate Exam Practice learning path
Terraform Associate Exam Practice ยท Module 4 of 10

Variables, outputs and expressions

Making configuration flexible.

๐Ÿ“– Key ideas

  1. Input variables (variable blocks) parameterise configs; set via defaults, tfvars files, -var flags or TF_VAR_ environment variables.
  2. Variable types: string, number, bool, list, map, set, object and tuple; validation blocks enforce rules.
  3. Outputs expose values after apply and pass data between modules.
  4. Mark sensitive values with sensitive = true to hide them in output.
  5. Expressions: interpolation, conditionals (condition ? a : b), for expressions, count and for_each.
๐Ÿ’ก Real-life example: Like a form template: the same form, filled with different names and dates each time.
Input variableParameter supplied to configuration
Output valueValue exposed after apply
tfvars fileFile assigning variable values
for_eachCreates instances from a map or set