StudyToCert

All certifications / Terraform Associate / Lessons

HashiCorp Certified: Terraform Associate Terraform Associate (004) · Domain 4: Terraform configuration

Expressions: conditionals, `for` expressions, splat `[*]`, string templates, `dynamic` blocks

▶ Watch the overview video

Last reviewed September 25, 2026 · Leer en español

Expressions compute values in Terraform. Beyond literals and references, a handful of expression forms let you make decisions, transform collections and generate repeated blocks without writing a general-purpose program. A conditional expression uses the form condition ? true_value : false_value. For example, instance_type = var.environment == "prod" ? "m5.large" : "t3.micro". Both results should be of the same type, or convertible to one, because Terraform must know the result type. A common idiom is count = var.create_bucket ? 1 : 0 to make a resource optional.

Free account

Keep reading for free

Create a free StudyToCert account to read the rest of this lesson: 7 more sections, 5 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.

Sign up free Log in

Study Terraform Associate for free
A week-by-week plan with every lesson, quizzes, checkpoint tests, a practice exam and hands-on labs.
Open the Terraform Associate study plan