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

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

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

  • A. servers = num_servers
  • B. servers = variable.num_servers
  • C. servers = var(num_servers)
  • D. servers = var.num_servers
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
tipzzz
Highly Voted 2 years, 7 months ago
D for sure
upvoted 22 times
...
vitasac
Highly Voted 2 years, 6 months ago
Selected Answer: D
Yes I'm agree D
upvoted 10 times
...
kanikachander
Most Recent 3 months, 3 weeks ago
Selected Answer: D
D for sure
upvoted 1 times
...
Cololand
6 months, 2 weeks ago
D - Who even marks the right answers at examtopics?
upvoted 2 times
...
enook
10 months, 3 weeks ago
Selected Answer: D
DDDDDDD
upvoted 1 times
...
ghostGuiggs
1 year ago
Selected Answer: D
D is the answer
upvoted 1 times
...
Kizerfor
1 year, 2 months ago
D for sure
upvoted 1 times
...
Bere
1 year, 3 months ago
Selected Answer: D
In Terraform, variables are referred to using the syntax var.<variable_name>. Here, var is a special namespace that contains all input variables. For example, if you have a variable named num_servers in your configuration and you want to pass it to a module, you would do it like this: variable "num_servers" { description = "The number of servers to create" default = 5 } module "server_module" { source = "app.terraform.io/example/server" version = "1.0.0" servers = var.num_servers } In the above example, the input variable num_servers is defined with a default value of 5. Then, the server_module is being called and the servers argument is being set to the value of var.num_servers, which is 5.
upvoted 9 times
...
Shane_C
1 year, 4 months ago
Selected Answer: D
D is correct
upvoted 1 times
...
Ni33
1 year, 6 months ago
Selected Answer: D
D is the one
upvoted 1 times
...
Bluemoon22
1 year, 7 months ago
D, servers = var.num_servers
upvoted 2 times
...
Power123
1 year, 7 months ago
Ans is D
upvoted 1 times
...
thor7
1 year, 7 months ago
Selected Answer: D
var.num_servers is correct and full answer
upvoted 2 times
...
Power123
1 year, 7 months ago
D is the ans
upvoted 1 times
...
kartikjena31
1 year, 10 months ago
I also go with D
upvoted 2 times
...
lalgebala
2 years ago
D for Sure
upvoted 1 times
...
RVivek
2 years, 2 months ago
Selected Answer: D
D to pass a value to a module the syntax is <child module variable name > = <value> Here child module variable name is servers to reference the value of a variable in main/root module var. <name_of _the varibale>
upvoted 3 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 ...