Courseiva
Deployment →easyMultiple Choice

CV0-004 Deployment Practice Question

A cloud engineer is writing a Terraform configuration to deploy an AWS EC2 instance. Which file extension is typically used for Terraform configuration files written in HCL?

⚠ Common exam trap

CV0-004 often tests the distinction between .tf and .hcl; candidates may think .hcl is the Terraform extension, but Terraform uses .tf for HCL configurations.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

.tf

Terraform configuration files written in HCL (HashiCorp Configuration Language) typically use the .tf file extension. This is the standard convention for Terraform modules and configurations, and Terraform automatically loads files with this extension. Other extensions like .tf.json are used for JSON-based configurations, but .tf is the primary one for HCL.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    .yaml

    Why it's wrong here

    Terraform has no YAML configuration parser at all, so a .yaml file would be ignored entirely and no EC2 instance planned. It tempts because YAML is common for cloud tooling such as Ansible and Kubernetes manifests, but Terraform's native HCL syntax requires .tf files.

  • ✓

    .tf

    Why this is correct

    HCL configuration files that Terraform loads from a working directory use the .tf extension, holding resource, variable and provider blocks. Terraform also reads .tf.json for JSON syntax and .tfvars for variable values, but .tf is the standard for HCL-authored configuration, satisfying the scenario's requirement.

  • ✗

    .json

    Why it's wrong here

    Terraform reads .json files only as an alternative JSON syntax, not HCL, so the EC2 configuration would need JSON object notation rather than HCL blocks. It tempts because Terraform does parse .tf.json, but that format exists for machine-generated configs, not hand-written HCL.

  • ✗

    .hcl

    Why it's wrong here

    Terraform does not recognise .hcl as a loadable configuration extension; only .tf and .tf.json are parsed, so the file would be skipped. It tempts because HCL is the language name, yet Terraform's convention reserves .tf for configuration and .hcl for other HCL-based tools.

About these practice questions

This CV0-004 question is part of Courseiva's 834-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CompTIA exam blueprint

This CV0-004 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CV0-004 exam.