HashiCorp Certified: Terraform Associate — Question 101

Which of the following is the correct way to pass the value in the variable num_servers into a module with the input servers in HCL2?

Answer options

Correct answer: A

Explanation

The correct answer is A because it correctly references the variable using the var prefix, which is required in HCL2 syntax. Option B is incorrect as it does not use the var prefix. Option C is also wrong because it uses parentheses incorrectly, and option D, while it looks like a variable reference, is not the correct syntax for HCL2.