Courseiva
Deployment →easyMultiple Choice

CV0-004 Deployment Practice Question

A cloud engineer is writing Terraform code to provision AWS resources. They need to define the cloud provider and authentication details. Which block should they use in their HCL configuration?

⚠ Common exam trap

The trap is conflating the block that defines infrastructure (resource) with the block that defines how Terraform authenticates and connects (provider); candidates who focus on 'provisioning AWS resources' may wrongly select the resource block.

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

✓

provider block

In HashiCorp Configuration Language (HCL), the provider block declares which cloud provider Terraform should use (e.g., aws, azure, google) and supplies the configuration needed to authenticate and target the correct region or account. For AWS, this includes region, access keys, or references to credential profiles/roles. Without a provider block, Terraform cannot know which API to call or how to authenticate.

Answer analysis

Option-by-option breakdown

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

  • ✗

    resource block

    Why it's wrong here

    A resource block declares a managed infrastructure object such as an EC2 instance; it cannot specify the provider plugin or its authentication details. The provider block handles that. Resource blocks are correct for defining the actual AWS components to create.

  • ✓

    provider block

    Why this is correct

    The provider block declares the cloud platform, such as AWS, and supplies authentication details like access keys or region, so Terraform knows which API to call and how to authenticate. Resource blocks then reference that configured provider when provisioning.

  • ✗

    variable block

    Why it's wrong here

    A variable block declares input parameters that feed values into the configuration; it does not configure the AWS provider or its authentication. A provider block does that. Variables are correct when parameterising reusable configurations so values differ per environment.

  • ✗

    module block

    Why it's wrong here

    A module block instantiates a reusable child module from a source path; it cannot declare the AWS provider or its authentication credentials. The required provider block performs that. Modules are the right choice for packaging and reusing groups of resources across configurations.

About these practice questions

One of 834 original CV0-004 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.