Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 249


You are creating a reusable Terraform configuration and want to include a billing_dept tag so your Finance team can track team-specific spending on resources. Which of the following billing_dept variable declarations will allow you to do this?

Show Answer
Correct Answer: C

To include a billing_dept tag for tracking team-specific spending on resources in Terraform, you can make the variable optional by providing a default value. Setting the default value to an empty string, as shown in option C, achieves this. This way, if no value is provided, the variable will default to an empty string, enabling the Finance team to optionally track spending without errors. Other options listed either contain invalid properties or syntax, making them unsuitable for this purpose.

Discussion

7 comments
Sign in to comment
sdm13168Option: C
May 15, 2023

tested, got error for A. But C verifed

Oleg_golOption: B
May 6, 2023

variable "billing_dept "{ type = optional(string) }

szyd3rca
May 13, 2023

│ Error: Invalid type specification │ │ on main.tf line 15, in variable "billing_dept": │ 15: type = optional(string) │ │ Keyword "optional" is valid only as a modifier for object type attributes.

Ni33Option: C
May 10, 2023

C is the correct option. All the arguments of variables are optional. A - optional is not a valid argument. B- optional(string) is not a valid argument value. D - default is not a valid argument value.

Ni33Option: C
May 12, 2023

C is the correct answer. Tested and verified.

JhaggarOption: B
May 14, 2023

type = optional(string)

halfwayOption: C
May 25, 2023

It is C, optional, any data type is acceptable.

SimplonOption: C
Oct 13, 2023

Tested. All other answers returned an error.javascript:void(0)

Simplon
Oct 13, 2023

*Tested. All other answers returned an error. (the javascript:void(0) is a typing mistake on my part).