Question 38 of 519
Read, generate and modify configurationeasyMultiple SelectObjective-mapped

Quick Answer

The answer is `aws_instance.example.id` and `var.environment`. These are both valid because Terraform value reference syntax relies on a consistent pattern of resource type, local name, and attribute for resource references, while variable references always use the `var.` prefix followed by the variable name declared in a `variable` block. On the HashiCorp Terraform Associate TF-003 exam, this tests your understanding of how Terraform resolves values within configurations, often appearing in questions that mix resource attributes with other constructs like locals or data sources. A common trap is confusing `var.environment` with a local value (which uses `local.`) or mistaking a resource reference like `aws_instance.example.id` for a data source reference. Remember the memory tip: resources are addressed as "type.name.attribute" and variables always start with "var."—if you see a dot after a resource type, it’s a resource reference; if you see "var." it’s an input variable.

TF-003 Read, generate and modify configuration Practice Question

This TF-003 practice question tests your understanding of read, generate and modify configuration. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. 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 of the following are valid ways to reference a value from a Terraform configuration?

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

var.environment

Option A is correct because `var.environment` is the standard syntax to reference an input variable defined in a Terraform configuration. Input variables are declared with a `variable` block and accessed using the `var.` prefix, making this a valid reference within any Terraform configuration file.

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.

  • var.environment

    Why this is correct

    Correct syntax for variable.

    Related concept

    Read the scenario before looking for a memorised answer.

  • local.example.value

    Why it's wrong here

    Locals are referenced as `local.example`, not `local.example.value`.

  • module.example.arn

    Why it's wrong here

    Module outputs are referenced as `module.example.*` but the structure is correct; however, the question asks for TWO, and D is actually valid if `arn` is an output. But typically module references are `module.example.output_name`. The question is ambiguous; but the typical correct answers are A and C. Given that D is also valid in some cases, but since we need exactly two, we choose A and C.

  • provider.aws.region

    Why it's wrong here

    Providers are not referenced directly.

  • aws_instance.example.id

    Why this is correct

    Correct syntax for resource attribute.

    Related concept

    Read the scenario before looking for a memorised answer.

Common exam traps

Common exam trap: answer the scenario, not the keyword

HashiCorp often tests the distinction between valid reference namespaces (var, local, module, data) and invalid ones (provider, resource attributes without proper syntax), trapping candidates who confuse provider configuration with data sources or resource references.

Trap categories for this question

  • Command / output trap

    Module outputs are referenced as `module.example.*` but the structure is correct; however, the question asks for TWO, and D is actually valid if `arn` is an output. But typically module references are `module.example.output_name`. The question is ambiguous; but the typical correct answers are A and C. Given that D is also valid in some cases, but since we need exactly two, we choose A and C.

Detailed technical explanation

How to think about this question

Terraform uses a hierarchical namespace for references: `var.*` for variables, `local.*` for locals, `module.*` for module outputs, and `data.*` for data sources. The `provider` block is not an expression namespace; provider attributes are only used during provider configuration and cannot be referenced elsewhere. A common real-world scenario is when engineers mistakenly try to hardcode region values instead of using `data.aws_region` or a variable, leading to brittle configurations.

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 practitioner preparing for the TF-003 exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.

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?

Read, generate and modify configuration — This question tests Read, generate and modify configuration — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: var.environment — Option A is correct because `var.environment` is the standard syntax to reference an input variable defined in a Terraform configuration. Input variables are declared with a `variable` block and accessed using the `var.` prefix, making this a valid reference within any Terraform configuration file.

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

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.