TA-002-P · Question #185
TA-002-P Question #185: Real Exam Question with Answer & Explanation
The correct answer is D: 4. {"question_number": 3, "question": "What is the value assigned to itemNum given multiple sources of variable assignment?", "correct_answer": "D", "explanation": "Terraform evaluates variable values in a strict precedence order, from lowest to highest: (1) default value in the var
Question
You have a Terraform configuration file where a variable itemNum is defined as follows: variable "itemNum" { default = 3} You also have a defined the following environment variables in your shell: TF_itemNum =6, TF_VAR_itemNum =9. You also have a terraform.tfvars file with the following contents itemNum = 7 When you run the following apply command, what is the value assigned to the itemNum variable? terraform apply -var itemNum =4
Options
- A10
- B6
- C1
- D4
- E3
Explanation
{"question_number": 3, "question": "What is the value assigned to itemNum given multiple sources of variable assignment?", "correct_answer": "D", "explanation": "Terraform evaluates variable values in a strict precedence order, from lowest to highest: (1) default value in the variable block (3), (2) TF_VAR_* environment variables (TF_VAR_itemNum=9), (3) terraform.tfvars / *.auto.tfvars files (7), (4) -var or -var-file flags on the command line (4). The -var flag has the highest precedence and always wins. Note that TF_itemNum is NOT a valid Terraform environment variable - only variables prefixed with TF_VAR_ are recognized. Because the command includes -var itemNum=4, the final value is 4.", "generated_by": "claude-sonnet", "llm_judge_score": 4}
Topics
Community Discussion
No community discussion yet for this question.