Question 453 of 519
Understand IaC conceptsmediumMultiple ChoiceObjective-mapped

Quick Answer

The answer is that the aws_instance.db resource in state but missing from config will be destroyed. This is correct because Terraform operates on a desired-state reconciliation model: it compares the current configuration against the state file, and any resource present in state but absent from the configuration is treated as a deletion candidate. The terraform plan output explicitly marks aws_instance.db for destruction, confirming that Terraform will remove it to align real-world infrastructure with the declared config. On the HashiCorp Terraform Associate TF-003 exam, this concept tests your understanding of state drift and how Terraform handles resources that are no longer defined in code—a common trap is assuming Terraform ignores orphaned state entries. Remember the memory tip: "State without config? Terraform sends it to the grave." This behavior is fundamental to Terraform's idempotent infrastructure management, where the config is the single source of truth.

TF-003 Understand IaC concepts Practice Question

This TF-003 practice question tests your understanding of understand iac concepts. 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.

Exhibit

# terraform plan output
Terraform will perform the following actions:

  # aws_instance.web will be created
  + resource "aws_instance" "web" {
      + ami           = "ami-0c55b159cbfafe1f0"
      + instance_type = "t2.micro"
      + tags          = {
          + "Name" = "WebServer"
        }
    }

  # aws_instance.db will be destroyed
  - resource "aws_instance" "db" {
      - ami           = "ami-0c55b159cbfafe1f0" -> null
      - instance_type = "t2.micro" -> null
    }
Plan: 1 to add, 0 to change, 1 to destroy.

Based on the exhibit, what can be inferred about the Terraform state and configuration?

Question 1mediummultiple choice
Full question →

Exhibit

# terraform plan output
Terraform will perform the following actions:

  # aws_instance.web will be created
  + resource "aws_instance" "web" {
      + ami           = "ami-0c55b159cbfafe1f0"
      + instance_type = "t2.micro"
      + tags          = {
          + "Name" = "WebServer"
        }
    }

  # aws_instance.db will be destroyed
  - resource "aws_instance" "db" {
      - ami           = "ami-0c55b159cbfafe1f0" -> null
      - instance_type = "t2.micro" -> null
    }
Plan: 1 to add, 0 to change, 1 to destroy.

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

The aws_instance.db resource is in state but not in configuration, so it will be destroyed.

The `terraform plan` output shows that `aws_instance.db` exists in the state file but is absent from the current configuration. Terraform interprets this as a resource that should be removed to align the real-world infrastructure with the configuration, so it will be destroyed. This is a core behavior of Terraform's desired-state management: any resource in state but not in configuration is marked for deletion.

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 aws_instance.db resource is in state but not in configuration, so it will be destroyed.

    Why this is correct

    Terraform plans to destroy resources that are in state but removed from configuration.

    Related concept

    Read the scenario before looking for a memorised answer.

  • The configuration for aws_instance.db has been added back to the .tf files.

    Why it's wrong here

    If added back, the destroy would not occur; instead it would be created or updated.

  • The aws_instance.db resource was manually deleted from the AWS console.

    Why it's wrong here

    Manual deletion would cause a state drift, not a planned destroy.

  • The aws_instance.web resource is being imported into Terraform management.

    Why it's wrong here

    The plan shows creation, not import.

Common exam traps

Common exam trap: answer the scenario, not the keyword

HashiCorp often tests the distinction between resources missing from configuration (destroy) versus resources missing from the real world (re-create), and the trap here is confusing manual deletion with configuration removal.

Trap categories for this question

  • Command / output trap

    The plan shows creation, not import.

Detailed technical explanation

How to think about this question

Terraform maintains a state file that maps configuration resources to real-world objects. During a plan, Terraform performs a three-way diff: configuration vs. state vs. real infrastructure. If a resource exists in state but not in configuration, Terraform assumes the user intentionally removed it from code and schedules a destroy. This is distinct from a resource deleted outside Terraform, which would trigger a re-create (unless `prevent_destroy` is set). Understanding this lifecycle is critical for managing drift and refactoring infrastructure.

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?

Understand IaC concepts — This question tests Understand IaC concepts — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: The aws_instance.db resource is in state but not in configuration, so it will be destroyed. — The `terraform plan` output shows that `aws_instance.db` exists in the state file but is absent from the current configuration. Terraform interprets this as a resource that should be removed to align the real-world infrastructure with the configuration, so it will be destroyed. This is a core behavior of Terraform's desired-state management: any resource in state but not in configuration is marked for deletion.

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. Refer to the exhibit. After applying this configuration, a team member manually changes the instance type to 't2.small' via the AWS console. The next `terraform plan` shows a change to revert to 't2.micro'. What does this demonstrate?

hard
  • A.Terraform's drift detection only
  • B.Immutable infrastructure pattern
  • C.Terraform's desired state reconciliation
  • D.A misconfiguration in the Terraform code

Why C: Terraform has detected configuration drift (the manual change) and plans to reconcile back to the desired state defined in configuration (C). A is incorrect because immutable infrastructure would replace the instance entirely. B is partially true but the key point is reconciliation, not just detection. D is false.

Variation 2. A team uses Terraform to manage AWS resources. After a manual change to an S3 bucket policy through the AWS console, Terraform's next plan shows that it will revert the policy to the configuration. This is an example of which concept?

medium
  • A.Configuration drift and correction
  • B.Immutable infrastructure
  • C.Resource tagging
  • D.Imperative provisioning

Why A: Configuration drift and correction (B) - the manual change caused drift, and Terraform plans to correct it. Immutable infrastructure (A) would involve replacing the resource, not modifying it. Imperative provisioning (C) is not relevant. Resource tagging (D) is unrelated.

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.