AWS provider Dynamic HCL Configuration Practice Question
You are attempting to use a conditional expression to set a variable, but the types returned by the true and false results differ. What happens?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
A type mismatch error is returned
Terraform requires that both branches of a conditional expression return the same type, otherwise it will throw a type mismatch error during the planning phase.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The result is coerced to a string
Why it's wrong here
There is no automatic coercion to string.
- ✓
A type mismatch error is returned
Why this is correct
Terraform demands that both expressions return the same type.
- ✗
It defaults to the true result type
Why it's wrong here
Terraform does not assume the true branch type is the target.
- ✗
Terraform automatically casts to the most flexible type
Why it's wrong here
Terraform is strictly typed regarding conditional branches and requires explicit conversion.
About these practice questions
One of 193 original AWS provider practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed August 2026 · checked against the official HashiCorp exam blueprint
This AWS provider practice question is part of Courseiva's free HashiCorp certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AWS provider exam.