Question 184 of 519
Interact with Terraform moduleseasyMultiple SelectObjective-mapped

Quick Answer

The correct answer is that `source = "hashicorp/consul/aws"` and `version = "~> 0.1"` are the two valid ways to specify a Terraform module source from a registry and apply a version constraint. The source syntax must follow the strict three-part format of `namespace/name/provider`, where `hashicorp/consul/aws` correctly points to the public Terraform Registry, and the `~>` operator defines a pessimistic version constraint that allows only patch-level updates within the specified minor version. On the HashiCorp Terraform Associate TF-003 exam, this question tests your understanding of module sourcing fundamentals and version constraint syntax, often appearing as a multiple-select trap where candidates confuse Git URLs or local paths with registry references. A common mistake is forgetting that the registry source requires exactly three segments separated by slashes, or misapplying version constraints like `>= 1.0` when the `~>` operator is the standard for compatible updates. Remember the memory tip: “Three slashes for the registry, tilde-greater for safety.”

TF-003 Interact with Terraform modules Practice Question

This TF-003 practice question tests your understanding of interact with terraform modules. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

Which TWO options are valid ways to reference a Terraform module from a registry?

Question 1easymulti select
Full question →

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"

Option A is correct because the Terraform registry module source syntax requires the format `namespace/name/provider`, and `hashicorp/consul/aws` follows this exactly. This tells Terraform to fetch the module from the public registry, using the `hashicorp` namespace, the `consul` module name, and the `aws` provider. The `version` constraint in option C is also valid, as it pins the module to a compatible version range using the `~>` operator, which is a standard Terraform version constraint syntax.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

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/aws"

    Why this is correct

    Correct; omitting the version defaults to the latest.

    Related concept

    Read the scenario before looking for a memorised answer.

  • source = "consul/aws"

    Why it's wrong here

    Registry modules require the full three-part address including namespace.

  • source = "hashicorp/consul/aws" version = "~> 0.1"

    Why this is correct

    Correct; specifying a version constraint is valid for registry modules.

    Related concept

    Read the scenario before looking for a memorised answer.

  • from = "hashicorp/consul/aws"

    Why it's wrong here

    The argument is 'source' not 'from'.

  • source = "hashicorp/consul/aws?ref=v1.0.0"

    Why it's wrong here

    The 'ref' parameter is used for Git sources, not registry modules.

Common exam traps

Common exam trap: answer the scenario, not the keyword

HashiCorp often tests the distinction between registry module syntax and Git-based module references, so the trap here is that candidates mistakenly apply Git-style `?ref=` syntax to registry modules, not realizing that registry modules require the `version` argument instead.

Detailed technical explanation

How to think about this question

Under the hood, Terraform resolves registry module sources by querying the Terraform Registry API at `https://registry.terraform.io/v1/modules/namespace/name/provider/versions`. The `version` constraint is evaluated against the list of available versions, and the `~>` operator (pessimistic constraint) allows only patch-level updates within a minor version (e.g., `~> 0.1` allows `0.1.x` but not `0.2.0`). A real-world scenario is when a team wants to ensure consistent module versions across environments; using `version = "~> 1.2.0"` prevents unexpected breaking changes from minor version bumps.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related TF-003 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free TF-003 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this TF-003 question test?

Interact with Terraform modules — This question tests Interact with Terraform modules — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: source = "hashicorp/consul/aws" — Option A is correct because the Terraform registry module source syntax requires the format `namespace/name/provider`, and `hashicorp/consul/aws` follows this exactly. This tells Terraform to fetch the module from the public registry, using the `hashicorp` namespace, the `consul` module name, and the `aws` provider. The `version` constraint in option C is also valid, as it pins the module to a compatible version range using the `~>` operator, which is a standard Terraform version constraint syntax.

What should I do if I get this TF-003 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

2 more ways this is tested on TF-003

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A team is using a module from the public Terraform Registry. They want to ensure that the module is pinned to a specific version to avoid unexpected changes. Which approach should they use?

easy
  • A.Use 'required_providers' block in the root module to lock the module version.
  • B.Add a 'version' argument inside the module block.
  • C.Set 'version' in the module's source attribute, e.g., source = "terraform-aws-modules/vpc/aws" with version = "3.2.0".
  • D.Store the module locally in a vendor directory and reference it by path.

Why C: Option C is correct because the Terraform Registry module syntax requires the version constraint to be specified as a separate argument within the module block, not embedded in the source string. Pinning to a specific version (e.g., "3.2.0") ensures that only that exact module version is used, preventing unexpected changes from upstream updates. This is the standard approach for versioning public registry modules in Terraform.

Variation 2. A team is using a module from the Terraform Registry. They want to ensure that changes to the module's source version are tested in a non-production environment before being applied to production. Which approach best supports this workflow?

medium
  • A.Fork the module repository and manage the module internally as a private module.
  • B.Pin the module to an exact version (e.g., version = "1.2.3") and update it manually after testing in isolation.
  • C.Configure the module source to reference the latest commit from the default branch of the repository.
  • D.Use a version constraint like ~> 1.0 in the module configuration and test the module in a non-production workspace before promoting to production.

Why D: Option D is correct because using a version constraint like `~> 1.0` allows Terraform to automatically select the latest compatible patch version within the specified minor version range. This enables safe, incremental updates that can be tested in a non-production workspace first, and then promoted to production by simply applying the same configuration. The constraint ensures that breaking changes (major version bumps) are not automatically pulled in, giving the team control over when to adopt them.

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This TF-003 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-003 exam.