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 (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
LeyLey
Highly Voted 7 months, 2 weeks ago
Answer is A but is should be servers = var.num_servers
upvoted 11 times
...
Nunyabiznes
Highly Voted 5 months, 1 week ago
Selected Answer: A
module "example" { source = "path/to/module" servers = var.num_servers }
upvoted 5 times
...
Basavaraju_V
Most Recent 6 months ago
by commenting the resource block in configuration file will also destroy the resources
upvoted 1 times
...
princajen
7 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_
7 months, 2 weeks ago
Selected Answer: A
servers = var.num_servers
upvoted 3 times
...
Zeppoonstream
7 months, 3 weeks 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
8 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
8 months ago
going with A : servers = var.num_servers
upvoted 1 times
...
gekkehenk
8 months ago
Selected Answer: A
Variables are always referenced with a var. prefix.
upvoted 1 times
...
Edileimig
8 months ago
should be A ?
upvoted 1 times
...
nakikoo
8 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago