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 91 discussion

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

Module variable assignments are inherited from the parent module and do not need to be explicitly set.

  • 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
stalk98
Highly Voted 2 years, 5 months ago
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 20 times
...
Bere
Most Recent 1 year, 1 month ago
Selected Answer: B
Module variable assignments must be explicitly set by the parent module when it instantiates the child module. Variable Declaration in Child Module (modules/vm/main.tf): variable "instance_type" { type = string default = "t2.micro" # This is an optional default value. } resource "aws_instance" "example" { instance_type = var.instance_type ami = "ami-abc123" subnet_id = "subnet-1234abcd" } Variable Assignment in Parent Module (main.tf): module "vm" { source = "./modules/vm" instance_type = "t3.micro" # Assigning a value to the variable. } In this example, instance_type is declared as a variable in the child module and is assigned a value by the parent module when it instantiates the vm module. The value "t3.micro" assigned by the parent module will override the default value "t2.micro" declared in the child module.
upvoted 4 times
...
modarov
1 year, 3 months ago
The answer is False. Module variable assignments are not inherited from the parent module and do need to be explicitly set.
upvoted 2 times
...
cracit
1 year, 5 months ago
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 2 times
...
DineshSG
1 year, 6 months ago
I think we are confused between variable assignment and variable declaration. Variable need to be declared in child module but not necessarily be assigned. We can pass values from parent module
upvoted 3 times
...
Ni33
1 year, 6 months ago
Selected Answer: A
I think A is the correct answer. Variable value assignments can be passed from root module variables to child module.
upvoted 2 times
...
Eltooth
2 years, 4 months ago
Selected Answer: B
B is correct answer : false.
upvoted 4 times
...
amrith501
2 years, 5 months ago
Selected Answer: B
Modules do not inherit variables from the 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 ...