Which of the following is allowed as a Terraform variable name?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

Which of the following is allowed as a Terraform variable name?

Explanation:
In Terraform, a variable name must be a valid identifier and must not clash with built-in keywords or meta-arguments. The word count is a special meta-argument used to create multiple instances of a resource, which makes it inappropriate as a variable label. The words source and version are also tied to specific constructs (module sources and provider version constraints, respectively), so using them as a variable name would conflict with Terraform’s syntax. The name is a plain identifier with no special meaning in this context, so it’s allowed to be used as a variable name. A valid declaration would be variable "name" { type = string }.

In Terraform, a variable name must be a valid identifier and must not clash with built-in keywords or meta-arguments. The word count is a special meta-argument used to create multiple instances of a resource, which makes it inappropriate as a variable label. The words source and version are also tied to specific constructs (module sources and provider version constraints, respectively), so using them as a variable name would conflict with Terraform’s syntax. The name is a plain identifier with no special meaning in this context, so it’s allowed to be used as a variable name. A valid declaration would be variable "name" { type = string }.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy