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

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

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: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Burakko
Highly Voted 1 year, 6 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 25 times
Burakko
1 year, 6 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 13 times
...
...
kiran15789
Highly Voted 10 months, 2 weeks 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 7 times
Tyler2023
4 months, 3 weeks 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
4 months, 3 weeks ago
Answer is A
upvoted 1 times
...
...
...
Demonik
Most Recent 4 months ago
Selected Answer: A
A for me
upvoted 3 times
...
Stargazer11
4 months, 3 weeks 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
9 months, 2 weeks ago
Selected Answer: A
The answer is A. You CAN always REFER. You don't have to, but you can.
upvoted 4 times
...
Ni33
10 months, 3 weeks ago
Selected Answer: B
B is the correct answer
upvoted 1 times
...
raf314
11 months, 1 week 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 5 times
...
BennaniHaythem
11 months, 2 weeks 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 2 times
...
sylvergorilla
11 months, 2 weeks 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
11 months, 3 weeks ago
True we can refer parent module
upvoted 1 times
...
camps
12 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 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 ago
Selected Answer: A
refer to* key word i guess
upvoted 1 times
...
rotimislaw
1 year, 1 month ago
Selected Answer: A
Seems A to me
upvoted 1 times
...
agmesas
1 year, 1 month 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, 2 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, 2 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 ...