TF-003 Understand Terraform basics Practice Question
This TF-003 practice question tests your understanding of understand terraform basics. 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
Refer to the exhibit.
```hcl
resource "aws_instance" "web" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t2.micro"
tags = {
Name = "WebServer"
}
}
resource "aws_eip" "ip" {
instance = aws_instance.web.id
}
```
Refer to the exhibit. A developer runs `terraform apply` and the operation succeeds. Later, they manually terminate the EC2 instance through the AWS console. What will happen when the developer runs `terraform apply` again?
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Terraform will recreate the EC2 instance and reassociate the Elastic IP
Option A is correct because Terraform maintains the Elastic IP (EIP) association in its state file. When the EC2 instance is manually terminated outside of Terraform, the state still records the EIP as associated with that instance ID. On the next `terraform apply`, Terraform detects that the instance is missing (drift) and plans to recreate it, then reassociates the EIP to the new instance as defined in the configuration, ensuring the public IP remains attached.
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.
✓
Terraform will recreate the EC2 instance and reassociate the Elastic IP
Why this is correct
Terraform will detect drift, recreate the instance, and update the EIP association.
Related concept
Read the scenario before looking for a memorised answer.
✗
The Elastic IP will be disassociated and the instance will be recreated
Why it's wrong here
The IP is still associated but the instance is missing; Terraform will first create the instance, then associate the IP.
✗
Terraform will only recreate the EC2 instance without reassociating the Elastic IP
Why it's wrong here
The EIP resource references the instance ID, so Terraform will reassociate it.
✗
The apply will fail because the Elastic IP is still attached to the terminated instance
Why it's wrong here
The Elastic IP becomes unattached when instance terminates; Terraform can handle it.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates assume Terraform will fail or skip the EIP reassociation because the instance is terminated, but Terraform's state-driven reconciliation ensures it recreates and reassociates all resources to match the configuration, regardless of manual changes.
Detailed technical explanation
How to think about this question
Under the hood, Terraform uses the state file to track resource IDs and attributes. When an EC2 instance is terminated outside Terraform, the state still contains the old instance ID and the EIP association. On `terraform apply`, Terraform performs a refresh (unless disabled) and detects the instance is missing, then plans to create a new instance and reassociate the EIP. This behavior relies on Terraform's ability to manage dependencies and update the state after successful apply. A real-world scenario is when an admin manually deletes a resource for troubleshooting; Terraform will restore it to the desired configuration, which can be both a safety net and a source of unintended recovery if not understood.
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.
Understand Terraform basics — This question tests Understand Terraform basics — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Terraform will recreate the EC2 instance and reassociate the Elastic IP — Option A is correct because Terraform maintains the Elastic IP (EIP) association in its state file. When the EC2 instance is manually terminated outside of Terraform, the state still records the EIP as associated with that instance ID. On the next `terraform apply`, Terraform detects that the instance is missing (drift) and plans to recreate it, then reassociates the EIP to the new instance as defined in the configuration, ensuring the public IP remains attached.
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 →
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.
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.
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.
Sign in to join the discussion.