Which language does Terraform use for its configuration files?

  1. Python
  2. HCL (HashiCorp Configuration Language) ✓
  3. YAML
  4. JSON

Correct answer: HCL (HashiCorp Configuration Language)

Option B is correct because Terraform configuration files are written in HCL, HashiCorp Configuration Language, a purpose-built declarative language designed for human readability and machine parsing, used for all .tf files. Option A is incorrect because Python is a general-purpose programming language and is not the native configuration language for Terraform, though it can be used with the CDK for Terraform. Option C is incorrect because YAML is not the primary language for Terraform configurations; while some Terraform-adjacent tools use YAML, HCL is the standard for .tf files. Option D is incorrect because JSON is supported by Terraform as an alternative syntax for .tf.json files but is not the primary or recommended configuration language; HCL is the default.

Topic: · terraform, hcl, infrastructure as code, configuration language

Practice HashiCorp Terraform Associate (003) Questions Free