HashiCorp Certified: Terraform Associate — Question 233

Your root module contains a variable named num.servers. Which is the correct way to pass its value to a child module with an input named servers?

Answer options

Correct answer: D

Explanation

The correct option is D because it correctly references the variable using the var keyword and replaces the dot notation with an underscore, matching the input name in the child module. Options A and C are incorrect as they either use the wrong syntax or do not properly format the variable. Option B is incorrect because it does not use the var keyword, which is necessary for passing variables to child modules.