Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Terraform Associate All Questions

View all questions & answers for the Terraform Associate exam

Exam Terraform Associate topic 1 question 112 discussion

Actual exam question from HashiCorp's Terraform Associate
Question #: 112
Topic #: 1
[All Terraform Associate Questions]

A module can always refer to all variables declared in its parent module.

  • A. True
  • B. False
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Burakko
Highly Voted 2 years, 2 months ago
Selected Answer: B
Modules do not inherit variables from the parent module. All modules are self-contained units. So you have to explicitly define variables in the child module, and then explicit set these variables in the parent module, when you instantiate the child module.
upvoted 26 times
Burakko
2 years, 2 months ago
However you can refer them from the parent module, I guess it is A. The question is asking for referring not inheriting.
upvoted 14 times
...
...
kiran15789
Highly Voted 1 year, 6 months ago
Selected Answer: B
A module in Terraform can only access variables that are explicitly passed as input variables or declared as outputs by the parent module. It cannot access variables declared within the parent module unless they are passed to the module as input variables. This is known as the "principle of least privilege," which means that modules should only have access to the information and resources that they need to perform their tasks, and no more. So, to refer to a variable from a parent module, you must either pass it as an input variable to the child module or declare it as an output variable in the parent module and then reference it in the child module using the module.<name>.<output> syntax.
upvoted 8 times
Tyler2023
1 year ago
The question is asking if we can always refer to all variables declared which is true, It is not asking if it is automatically or manually
upvoted 1 times
Tyler2023
1 year ago
Answer is A
upvoted 1 times
...
...
...
Demonik
Most Recent 12 months ago
Selected Answer: A
A for me
upvoted 3 times
...
Stargazer11
1 year ago
Answer: B A child module can refer to variables declared in its parent module, but it does so in a controlled and explicit manner. By default, child modules do not have automatic access to all variables in the parent module. To reference a variable from the parent module in a child module, you should declare an input variable with the same name in the child module and then explicitly pass the value from the parent module.
upvoted 2 times
...
milan92stankovic
1 year, 5 months ago
Selected Answer: A
The answer is A. You CAN always REFER. You don't have to, but you can.
upvoted 5 times
...
Ni33
1 year, 6 months ago
Selected Answer: B
B is the correct answer
upvoted 1 times
...
raf314
1 year, 7 months ago
Selected Answer: B
The question is whether a (child) module can always refer to ALL variables in the parent module. The answer is NO. The child module can "see" and refer to the variables defined in its own (child module's) definition. The child module has no visibility of the variables defined in the parent module. Thus it cannot refer to them. Answer is False (B)
upvoted 7 times
...
BennaniHaythem
1 year, 7 months ago
A module can refer to variables in its parent module only if those variables are explicitly passed to it as input variables. If a variable is not passed to a child module, then that child module cannot refer to it. So the correct answer is B - False.
upvoted 3 times
...
sylvergorilla
1 year, 7 months ago
Selected Answer: B
No, a module cannot always refer to all variables declared in its parent module. Only variables declared as public in the parent module can be referred to by a module.
upvoted 1 times
...
Sathisgm
1 year, 7 months ago
True we can refer parent module
upvoted 1 times
...
camps
1 year, 7 months ago
Selected Answer: B
False. A module can refer to variables in its parent module only if they are explicitly passed to it using variable definitions or module blocks in the calling module.
upvoted 2 times
...
Nunyabiznes
1 year, 8 months ago
Selected Answer: B
B. False A module can only refer to variables that are explicitly passed to it as inputs, either through variable declarations or module calls. It cannot automatically refer to all variables declared in its parent module, as it may not need or have access to all of them. If a variable is not passed to a module as an input, the module will not be able to use it directly.
upvoted 1 times
...
phidelics
1 year, 8 months ago
Selected Answer: A
refer to* key word i guess
upvoted 1 times
...
rotimislaw
1 year, 9 months ago
Selected Answer: A
Seems A to me
upvoted 1 times
...
agmesas
1 year, 9 months ago
Selected Answer: B
B you must declare the variable in the child module if you can use it. Also, the parent module must call the child module using inputs. First, the parent module declares variables, second, the child module declares its inputs, then, the parent module call to the child module using inputs that were declared in the variables.tf of the child module.
upvoted 3 times
...
Zeppoonstream
1 year, 10 months ago
A. True. A module in Terraform can always refer to all variables declared in its parent module, as long as the parent module is called before the child module in the configuration file.
upvoted 1 times
...
ssanjayt
1 year, 10 months ago
Selected Answer: A
A is correct !A module can always refer to all variables declared in its parent module
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...