Question 311 of 519
Read, generate and modify configurationmediumMultiple ChoiceObjective-mapped

Quick Answer

The answer is a new variable with a default value that forces recreation of the database was added to the root module, but the 'dev' workspace's tfvars file does not override it, so Terraform uses the default which differs from the current state. This occurs because Terraform variable precedence dictates that a default value in the variable block is the lowest priority, but if no workspace-specific override exists in the terraform.tfvars file, that default becomes the effective value. When that default differs from the value recorded in the state file—such as a database engine version or instance class—Terraform sees a configuration drift and plans a destroy-and-recreate. On the HashiCorp Terraform Associate TF-003 exam, this scenario tests your understanding of variable precedence order and the common pitfall of forgetting to update workspace-specific variable files after adding a new variable to the root module. The trap is that the state file still holds the old value, but the configuration now supplies a different default. Memory tip: "Default is last—if you don't override, the state will be overridden."

TF-003 Read, generate and modify configuration Practice Question

This TF-003 practice question tests your understanding of read, generate and modify configuration. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. 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.

You are managing a multi-environment Terraform configuration using separate workspaces for 'dev', 'staging', and 'prod'. Each workspace uses the same root module but different variable values stored in terraform.tfvars files per workspace. Your team reports that after a recent change to the root module, running `terraform plan` in the 'dev' workspace shows that it will destroy and recreate a critical RDS database instance, even though no changes were made to the database configuration. The state file for 'dev' is stored in a remote S3 backend with DynamoDB locking. You suspect the issue is related to how Terraform generates and reads configuration. What is the most likely cause?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "most likely"

    Why it matters: Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

Question 1mediummultiple choice
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

A new variable with a default value that forces recreation of the database was added to the root module, but the 'dev' workspace's tfvars file does not override it, so Terraform uses the default which differs from the current state.

Option B is correct because when a new variable with a default value is added to the root module, and the 'dev' workspace's terraform.tfvars does not override it, Terraform uses the default value. If that default differs from the value currently tracked in the state (e.g., a database engine version or instance class), Terraform interprets this as a configuration change and plans to destroy and recreate the resource to match the new default. This is a common pitfall when variables are introduced without updating all workspace-specific variable files.

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.

  • The S3 backend is misconfigured, causing the 'dev' workspace to use the 'prod' state file.

    Why it's wrong here

    Workspaces use separate state paths; misconfiguration would cause different symptoms.

  • A new variable with a default value that forces recreation of the database was added to the root module, but the 'dev' workspace's tfvars file does not override it, so Terraform uses the default which differs from the current state.

    Why this is correct

    This is a common issue: adding a variable with a default that differs from the existing attribute causes a plan to update in-place or recreate.

    Clue confirmation

    The clue word "most likely" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • The root module was changed to use a different Terraform provider version that is incompatible with the existing state.

    Why it's wrong here

    Provider version changes may cause issues, but typically not force recreation of a resource unless the provider schema changed.

  • The DynamoDB lock is not being released after previous operations, causing state corruption.

    Why it's wrong here

    State locking prevents corruption, not causes it.

Common exam traps

Common exam trap: answer the scenario, not the keyword

HashiCorp often tests the misconception that state corruption or backend misconfiguration is the root cause, when the real issue is Terraform's variable default behavior and its interaction with 'ForceNew' attributes in resource schemas.

Detailed technical explanation

How to think about this question

When Terraform plans, it compares the current state's attribute values against the configuration's desired values. If a variable is added with a default that changes a 'ForceNew' attribute (like engine_version or instance_class), Terraform marks the resource for recreation even if no explicit change was made to the database block. This behavior is governed by the resource's schema definition, where certain arguments have the 'ForceNew: true' flag, meaning any change triggers destroy and recreate. In real-world scenarios, this often happens when teams add a 'db_engine_version' variable with a default of '13.0' while the existing database was created with '12.0' from a previous implicit value.

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?

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: A new variable with a default value that forces recreation of the database was added to the root module, but the 'dev' workspace's tfvars file does not override it, so Terraform uses the default which differs from the current state. — Option B is correct because when a new variable with a default value is added to the root module, and the 'dev' workspace's terraform.tfvars does not override it, Terraform uses the default value. If that default differs from the value currently tracked in the state (e.g., a database engine version or instance class), Terraform interprets this as a configuration change and plans to destroy and recreate the resource to match the new default. This is a common pitfall when variables are introduced without updating all workspace-specific variable files.

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.

Are there clue words in this question I should notice?

Yes — watch for: "most likely". Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

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 configuration defines a variable `instance_type` with a default value `t2.micro`. After running `terraform apply`, the operator notices that the instances are being created with type `t2.small`. They check the configuration file and see the default is `t2.micro`. What is the most likely cause?

medium
  • A.The variable declaration was changed after apply.
  • B.The state file stores the variable value and overrides the default.
  • C.A `terraform.tfvars` file in the working directory sets the variable to `t2.small`.
  • D.The `instance_type` attribute was changed by a lifecycle rule.

Why C: Option A is correct because the default can be overridden by setting the variable in a `terraform.tfvars` file or via environment variable `TF_VAR_instance_type`. Option B is wrong because the default is read from the variable declaration. Option C is wrong because variable is set, not read from state. Option D is wrong because the instance type is a variable, not a resource attribute change.

Variation 2. A configuration uses variables defined in a 'variables.tf' file. The operator wants to override these variables for a specific run without modifying the file. Which method should they use?

easy
  • A.Edit the state file directly.
  • B.Set environment variables with the same name as the variables.
  • C.Create a 'terraform.tfvars' file.
  • D.Use the '-var' flag with 'terraform plan' or 'terraform apply'.

Why D: The `-var` flag on `terraform plan` or `terraform apply` allows operators to override variable values for a single run without modifying any files. This is the correct method because it provides a temporary override that does not persist across runs, unlike file-based or environment variable approaches.

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.