Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 31


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

Show Answer
Correct Answer: D

To pass the value from the variable num_servers into a module with the input servers, you should use the syntax var.num_servers. The var namespace is used to reference input variables in Terraform. Therefore, the correct way to reference the variable is servers = var.num_servers.

Discussion

17 comments
Sign in to comment
tipzzzOption: D
Apr 24, 2022

D for sure

vitasacOption: D
Apr 29, 2022

Yes I'm agree D

BereOption: D
Jul 29, 2023

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.

RVivekOption: D
Sep 22, 2022

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>

najslejdiOption: D
Aug 24, 2022

D correct

kartikjena31Option: D
Jan 17, 2023

I also go with D

thor7Option: D
Mar 29, 2023

var.num_servers is correct and full answer

Bluemoon22Option: D
Apr 24, 2023

D, servers = var.num_servers

lalgebalaOption: D
Nov 16, 2022

D for Sure

Power123Option: D
Mar 28, 2023

D is the ans

Power123Option: D
Mar 30, 2023

Ans is D

Ni33Option: D
May 8, 2023

D is the one

Shane_COption: D
Jul 4, 2023

D is correct

KizerforOption: D
Aug 26, 2023

D for sure

ghostGuiggsOption: D
Nov 2, 2023

D is the answer

enookOption: D
Jan 3, 2024

DDDDDDD

CololandOption: D
May 8, 2024

D - Who even marks the right answers at examtopics?