Courseiva

TF-004 Interact with Terraform modules Practice Question

Which TWO of the following are valid ways to reference a module from the Terraform Registry?

⚠ Common exam trap

The Terraform certification often tests the distinction between the two-part provider namespace and the three-part module namespace, causing candidates to mistakenly select a two-part source like 'hashicorp/consul' as a valid module reference.

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

✓

source = "hashicorp/consul/aws"

The Terraform Registry uses a three-part namespace format: `<namespace>/<type>/<provider>`, where `hashicorp/consul/aws` specifies the `consul` module from the `hashicorp` namespace for the `aws` provider. This format is the standard way to reference a module hosted in the public Terraform Registry, and Terraform automatically resolves it to the registry's HTTPS URL.

Answer analysis

Option-by-option breakdown

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

  • ✗

    source = "hashicorp/consul"

    Why it's wrong here

    This is missing the provider component (e.g., /aws, /azurerm).

  • ✗

    source = "github.com/hashicorp/terraform-aws-consul"

    Why it's wrong here

    This is a Git source, not a registry module reference.

  • ✓

    source = "hashicorp/consul/aws"

    Why this is correct

    This is a valid registry module reference with namespace, module, and provider.

  • ✓

    source = "terraform-aws-modules/vpc/aws"

    Why this is correct

    This is a valid registry module reference from the terraform-aws-modules namespace.

  • ✗

    source = "./modules/consul"

    Why it's wrong here

    This is a local path source, not a registry module.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

About these practice questions

One of 434 original TF-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 by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This TF-004 practice question is part of Courseiva's free HashiCorp 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 TF-004 exam.