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

Actual exam question from HashiCorp's Terraform Associate
Question #: 200
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 in HCL2?

  • A. servers - var.num_servers
  • B. servers - num_servers
  • C. servers - var(num_servers)
  • D. $(var.num_servers)
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
LeyLey
Highly Voted 1 year, 9 months ago
Answer is A but is should be servers = var.num_servers
upvoted 10 times
...
Nunyabiznes
Highly Voted 1 year, 7 months ago
Selected Answer: A
module "example" { source = "path/to/module" servers = var.num_servers }
upvoted 5 times
...
Basavaraju_V
Most Recent 1 year, 8 months ago
by commenting the resource block in configuration file will also destroy the resources
upvoted 1 times
...
princajen
1 year, 9 months ago
Selected Answer: A
The correct way to pass the value in the variable num_servers into a module with the input servers in HCL2 is as follows: module "example" { source = "./modules/example" servers = var.num_servers }
upvoted 2 times
...
Daro_
1 year, 10 months ago
Selected Answer: A
servers = var.num_servers
upvoted 3 times
...
Zeppoonstream
1 year, 10 months ago
Selected Answer: A
A. servers - var.num_servers In HCL2, the correct way to pass the value in the variable num_servers into a module with the input servers is by using the following syntax: servers = var.num_servers This tells Terraform to use the value of the variable num_servers as the value of the input servers in the module.
upvoted 1 times
...
InformationOverload
1 year, 10 months ago
Selected Answer: A
correct way to pass the value of the variable num_servers into a module with the input servers is to use the var syntax in the module block: module "module_example" { source = "path/to/module" servers = var.num_servers }
upvoted 2 times
...
resnef
1 year, 10 months ago
going with A : servers = var.num_servers
upvoted 1 times
...
gekkehenk
1 year, 10 months ago
Selected Answer: A
Variables are always referenced with a var. prefix.
upvoted 1 times
...
Edileimig
1 year, 10 months ago
should be A ?
upvoted 1 times
...
nakikoo
1 year, 10 months ago
not sure if A or B, hope someone may clarify this
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 ...