What file extension do Terraform configuration files use?
- .json
- .hcl
- .tf ✓
- .yaml
Correct answer: .tf
Option C is correct because Terraform uses the .tf file extension for its native HashiCorp Configuration Language (HCL) files, which define infrastructure resources, providers, variables, and outputs in a human-readable declarative syntax. Option A is incorrect because while Terraform does support JSON-formatted configuration with a .tf.json extension, plain .json is not the standard or default extension for Terraform configurations. Option B is incorrect because .hcl is the generic file extension for the HashiCorp Configuration Language itself, but Terraform specifically requires the .tf extension to recognize and load configuration files. Option D is incorrect because .yaml is associated with tools like Ansible, Kubernetes manifests, and GitHub Actions workflows, not Terraform configuration files.
Topic: · terraform, hcl, infrastructure as code, configuration files