Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 204


You want to tag multiple resources with a string that is a combination of a generated random_id and a variable.

How should you use the same value in all these resources without repeating the random_id and variable in each resource?

Show Answer
Correct Answer: A

To tag multiple resources with a string that combines a generated random_id and a variable without repeating the expression in each resource, you should use local values. Local values allow you to assign a name to an expression and reuse that name within the module, thereby ensuring consistency and reducing repetition.

Discussion

4 comments
Sign in to comment
ArizonaClassicsOption: A
Jan 13, 2023

A is correct: Local values: A local value assigns a name to an expression, so you can use the name multiple times within a module instead of repeating the expression. https://developer.hashicorp.com/terraform/language/values/locals

campsOption: A
Mar 31, 2023

A. Local values

lezginoOption: A
Feb 5, 2023

A is correct

Darshan07Option: A
Feb 28, 2024

A is the correct option