TA-002-P · Question #39
Which argument(s) is (are) required when declaring a Terraform variable?
The correct answer is B. default. No arguments are required in a Terraform variable declaration. A minimal valid variable block is simply 'variable "name" {}'. The 'type', 'default', and 'description' arguments are all optional. Omitting 'default' makes the variable mandatory at plan/apply time - Terraform will p
Question
Which argument(s) is (are) required when declaring a Terraform variable?
Options
- Atype
- Bdefault
- Cdescription
- DAll of the above
- ENone of the above
How the community answered
(34 responses)- A6% (2)
- B91% (31)
- D3% (1)
Explanation
No arguments are required in a Terraform variable declaration. A minimal valid variable block is simply 'variable "name" {}'. The 'type', 'default', and 'description' arguments are all optional. Omitting 'default' makes the variable mandatory at plan/apply time - Terraform will prompt for a value or error if none is supplied - but the declaration itself is still valid. The provided answer key lists B (default), which is incorrect. The correct answer is E (None of the above).
Topics
Community Discussion
No community discussion yet for this question.