Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 63


A Terraform local value can reference other Terraform local values.

Show Answer
Correct Answer: A

A Terraform local value can reference other Terraform local values. This feature allows values within the configuration to be transformed or combined, reducing redundancy and simplifying the code. For example, one local value can be used to define another local value, which helps in managing and organizing the configuration more effectively.

Discussion

8 comments
Sign in to comment
Eltooth
Dec 28, 2022

Answer is correct : True "The expressions in local values are not limited to literal constants; they can also reference other values in the module in order to transform or combine them, including variables, resource attributes, or other local values:" https://www.terraform.io/language/values/locals#declaring-a-local-value

ilmi70
Aug 21, 2024

locals { common_tags = { Owner = "team-name" Service = "customer-service" } extra_tags = merge(local.common_tags, { Environment = "production" }) }

Molly1994
Dec 5, 2024

A locals { # Ids for multiple sets of EC2 instances, merged together instance_ids = concat(aws_instance.blue.*.id, aws_instance.green.*.id) } locals { # Common tags to be assigned to all resources common_tags = { Service = local.service_name Owner = local.owner } }

eduvar4Option: A
Mar 27, 2023

https://developer.hashicorp.com/terraform/language/values/locals#declaring-a-local-value

AbuuOption: A
Aug 5, 2023

True; Terraform local values can reference other Terraform local values. This is useful for sharing common values between resources, such as defining a common name or set of tags. When referencing other local values, Terraform will automatically look for the referenced value and substitute it in the configuration. This helps avoid repetition and makes Terraform configurations easier to maintain.

campsOption: A
Sep 30, 2023

A. True. A Terraform local value can reference other Terraform local values. Local values in Terraform are used to create intermediate values that can be used to simplify complex expressions or avoid duplicating values in the code. They can reference other resources and values within the Terraform configuration.

RagqueOption: A
Feb 21, 2024

A is the correct answer

debabrata6983Option: A
Feb 26, 2024

The right answer is A as local value can also reference other terraform local value(s)