nerdexam
HashiCorpHashiCorp

TA-002-P · Question #89

TA-002-P Question #89: Real Exam Question with Answer & Explanation

The correct answer is B: name. Terraform reserves certain identifiers like 'count', 'source', and 'version' for special use; only 'name' is a valid user-defined variable name.

Understand Terraform basics

Question

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

Options

  • Acount
  • Bname
  • Csource
  • Dversion

Explanation

Terraform reserves certain identifiers like 'count', 'source', and 'version' for special use; only 'name' is a valid user-defined variable name.

Common mistakes.

  • A. 'count' is a reserved meta-argument used to create multiple resource instances and cannot be used as a user-defined variable name.
  • C. 'source' is a reserved argument in module blocks that specifies the module's source location and is not allowed as a variable name.
  • D. 'version' is a reserved argument in module and provider blocks for version constraints and cannot be used as a variable name.

Concept tested. Terraform reserved variable name restrictions

Reference. https://developer.hashicorp.com/terraform/language/values/variables#declaring-an-input-variable

Topics

#Terraform variables#Naming conventions#Reserved keywords

Community Discussion

No community discussion yet for this question.

Full TA-002-P PracticeBrowse All TA-002-P Questions