Exam Terraform Associate All QuestionsBrowse all questions from this exam
Question 17

If a module uses a local values, you can expose that value with a terraform output.

    Correct Answer: A

    In Terraform, output values serve the purpose of sharing data between modules and even between separate configurations. These outputs are similar to return values in programming and can be used to expose important information. Local values, while typically used internally within modules, can indeed be exposed through an output block, allowing other parts of the configuration to consume this information. Therefore, the statement is true.

Discussion
BereOption: A

Code example: variable "input" { description = "An input variable" default = "Hello" } locals { local_value = "${var.input}, World!" } output "greeting" { description = "A greeting message" value = local.local_value } Outputs: greeting = "Hello, World!"

SilentMilliOption: A

If a module uses local values, those values can be exposed using the "terraform output" directive. By using the terraform output directive, you can define an output for a module that provides information about the local values used within the module. This information can then be consumed by other parts of the Terraform configuration, allowing you to make use of the values that have been set within the module. To expose a local value, you would define an output block in the module, specifying the name and value of the output, and then reference the output in other parts of your Terraform configuration using the "terraform output" data source.

daawwOption: A

A is correct

HarshPatel198Option: A

Bere is right

JayanthOption: A

A. True

Busi57Option: A

Teams A

VSMuOption: A

Answer A. # Output the local variable as an output value output "instance_public_ip" { value = local.instance_public_ip }

SammySunnyOption: B

Why not B? The documentation says "A local value can only be accessed in expressions within the module where it was declared"

HMthyl

Confirmed using a project, A is true. That definition threw me too - but if you explicitly output the local value it can be accessed as expected

IK912Option: A

Answer Definitely A

karendavtyanOption: A

A. true

gargadityaOption: A

1. Output values make information about your infrastructure available on the command line, and can expose information for other Terraform configurations to use. Output values are similar to return values in programming languages. 2.Basic Syntax: https://drive.google.com/file/d/1td5DcyZ-7iHL3Xhpwep4deEEfKbC7DkT/view?usp=sharing 3.Using Output Values with Modules(logical concept described in diagram below): https://drive.google.com/file/d/1tbYWsCSev063ibz9Pv9poqViOY6fAAsG/view?usp=sharing Basically,the question is narrowed down to exposing locals from the root module(can be any resource attribute in general).

TanacetOption: A

It is A

ssanjaytOption: A

A is correct

jj22222Option: A

A is correct

hectordjOption: A

A is correct

poojithakadiyalaOption: A

A is correct