TA-002-P · Question #316
Which of the following is an invalid variable name?
The correct answer is A. count. count is a reserved keyword in Terraform and cannot be used as a variable name.
Question
Which of the following is an invalid variable name?
Options
- Acount
- Bweb
- Cvar1
- Dinstance_name
How the community answered
(36 responses)- A92% (33)
- C3% (1)
- D6% (2)
Why each option
`count` is a reserved keyword in Terraform and cannot be used as a variable name.
Terraform has reserved keywords that cannot be used as variable names to avoid conflicts with built-in language features. `count` is a meta-argument used within resource blocks to create multiple instances of a resource, making it an invalid choice for a custom variable name.
`web` is a valid and commonly used identifier for a variable.
`var1` is a valid identifier following typical naming conventions for variables.
`instance_name` is a valid and descriptive identifier for a variable.
Concept tested: Terraform reserved keywords
Source: https://developer.hashicorp.com/terraform/language/meta-arguments/count
Topics
Community Discussion
No community discussion yet for this question.