Question 358 of 519
Read, generate and modify configurationhardMultiple ChoiceObjective-mapped

Quick Answer

The answer is that the `depends_on` meta-argument is missing from the `aws_eip` resource. This is correct because Terraform builds a dependency graph from explicit references, and when an `aws_eip` uses an `instance` argument that points to `aws_instance.web`, but no direct attribute reference exists in the resource block, Terraform cannot infer the ordering. Without an explicit `depends_on`, Terraform may attempt to allocate the Elastic IP before the EC2 instance is fully created, causing a `depends_on error` where the instance ID is unavailable. On the HashiCorp Terraform Associate TF-003 exam, this scenario tests your understanding of implicit versus explicit dependencies—a common trap is assuming that simply referencing a resource’s name in a string argument creates a dependency; it does not. The exam often presents this error in a multi-resource configuration where one resource’s creation relies on another’s completion. Memory tip: if you see a “depends_on error” and the resource has no direct attribute reference (like `aws_instance.web.id`), think “explicit tie required”—Terraform needs a `depends_on` to force the order.

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.

Exhibit

Refer to the exhibit.

```hcl
resource "aws_instance" "web" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t2.micro"
}

resource "aws_eip" "ip" {
  instance = aws_instance.web.id
}

output "public_ip" {
  value = aws_eip.ip.public_ip
}
```

A user runs `terraform apply` and gets: Error: Invalid index on aws_eip.ip, in the 'instance' argument. The resource aws_instance.web has not been created yet.

What is the most likely cause of this error?

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 1hardmultiple choice
Full question →

Exhibit

Refer to the exhibit.

```hcl
resource "aws_instance" "web" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t2.micro"
}

resource "aws_eip" "ip" {
  instance = aws_instance.web.id
}

output "public_ip" {
  value = aws_eip.ip.public_ip
}
```

A user runs `terraform apply` and gets: Error: Invalid index on aws_eip.ip, in the 'instance' argument. The resource aws_instance.web has not been created yet.

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 `depends_on` meta-argument is missing from the aws_eip resource.

Option C is correct because the `aws_eip` resource depends on the `aws_instance.web` resource to ensure the instance is created before the Elastic IP is allocated. Without an explicit `depends_on` meta-argument, Terraform may attempt to create the EIP before the instance, causing an error if the instance ID is not yet available. The error message typically indicates that the `aws_eip` resource cannot resolve the `instance` argument because the instance resource has not been created yet.

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 `output` block is referencing a non-existent attribute.

    Why it's wrong here

    The output references a valid attribute.

  • The `aws_eip` resource must use `self.instance` instead of `aws_instance.web.id`.

    Why it's wrong here

    Resource references are correct syntactically.

  • The `depends_on` meta-argument is missing from the aws_eip resource.

    Why this is correct

    Implicit dependency should work, but the error suggests Terraform is not resolving the dependency correctly. Adding explicit depends_on resolves it.

    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 `aws_instance.web` resource has a syntax error in the ami attribute.

    Why it's wrong here

    The ami format is valid.

Common exam traps

Common exam trap: answer the scenario, not the keyword

HashiCorp often tests the misconception that `depends_on` is only needed when there is no implicit reference, but the trap here is that candidates may overlook that Terraform's automatic dependency detection can fail in certain edge cases, such as when the reference is inside a `count` or `for_each` expression, or when the resource is in a different module.

Trap categories for this question

  • Command / output trap

    The output references a valid attribute.

Detailed technical explanation

How to think about this question

Terraform's dependency graph is built automatically from resource references, but when a resource references another resource indirectly (e.g., via a variable or data source), the implicit dependency may not be detected. The `depends_on` meta-argument forces Terraform to create an explicit dependency, ensuring the target resource is fully created before the dependent resource. In this case, the `aws_eip` resource likely uses `instance = aws_instance.web.id`, which creates an implicit dependency, but if the error persists, it may be due to a race condition or a misconfigured provider that requires explicit ordering.

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: The `depends_on` meta-argument is missing from the aws_eip resource. — Option C is correct because the `aws_eip` resource depends on the `aws_instance.web` resource to ensure the instance is created before the Elastic IP is allocated. Without an explicit `depends_on` meta-argument, Terraform may attempt to create the EIP before the instance, causing an error if the instance ID is not yet available. The error message typically indicates that the `aws_eip` resource cannot resolve the `instance` argument because the instance resource has not been created yet.

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

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.