Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 200


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?

Show Answer
Correct Answer: A

The correct way to pass the value in the variable num_servers into a module with the input servers in HCL2 is by using the syntax servers = var.num_servers. This states that the input parameter servers in the module block should be assigned the value of the variable num_servers.

Discussion

11 comments
Sign in to comment
LeyLey
Jul 31, 2024

Answer is A but is should be servers = var.num_servers

NunyabiznesOption: A
Oct 3, 2024

module "example" { source = "path/to/module" servers = var.num_servers }

Daro_Option: A
Jul 27, 2024

servers = var.num_servers

nakikoo
Jul 13, 2024

not sure if A or B, hope someone may clarify this

InformationOverloadOption: A
Jul 16, 2024

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 }

princajenOption: A
Aug 16, 2024

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 }

Edileimig
Jul 14, 2024

should be A ?

gekkehenkOption: A
Jul 14, 2024

Variables are always referenced with a var. prefix.

resnef
Jul 14, 2024

going with A : servers = var.num_servers

ZeppoonstreamOption: A
Jul 20, 2024

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.

Basavaraju_V
Sep 9, 2024

by commenting the resource block in configuration file will also destroy the resources