TF-004 Understand Terraform's purpose Practice Question
Exhibit
Terraform will perform the following actions:
# aws_instance.example will be updated in-place
~ resource "aws_instance" "example" {
ami = "ami-0c55b159cbfafe1f0"
~ instance_type = "t2.micro" -> "t2.small"
tags = {}
}Refer to the exhibit. A developer runs terraform plan and sees the above output. What will happen when terraform apply is executed?
⚠ Common exam trap
Candidates often misinterpret the tilde (~) symbol in Terraform plan output as indicating a destroy-and-recreate action, but it actually signifies an in-place update. This question tests the ability to distinguish between in-place changes and resource replacement.
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 existing EC2 instance's instance_type is changed to t2.small in-place.
Terraform's plan output shows an in-place update (indicated by the tilde `~` symbol) for the `instance_type` attribute of the existing EC2 instance. When `terraform apply` is executed, Terraform will modify the instance's type to `t2.small` without destroying and recreating the resource, as the change is supported by the AWS provider for EC2 instances.
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 existing EC2 instance is replaced due to a change in instance_type.
Why it's wrong here
This statement is incorrect because a change to the `instance_type` attribute for an AWS EC2 instance resource typically results in an in-place update, not a replacement. Terraform's AWS provider is designed to modify this specific attribute without destroying and recreating the instance. A replacement operation would be explicitly indicated by a `(-+)` or `(+/-)` prefix in the `terraform plan` output, clearly showing destruction followed by creation, which is not present here.
- ✗
A new EC2 instance is created with instance_type t2.small, and the old one is destroyed.
Why it's wrong here
This option is incorrect because the `terraform plan` output for an in-place update is denoted by a tilde (`~`) prefix, not a `(-+)` or `(+/-)` which signifies replacement (destroy then create). If a new instance were to be created and the old one destroyed, the plan would explicitly show a `destroy` action for the old resource and a `create` action for the new one, often with a "forces new resource" annotation. The absence of these explicit actions confirms it's not a replacement.
- ✓
The existing EC2 instance's instance_type is changed to t2.small in-place.
Why this is correct
This statement is correct. The tilde (`~`) prefix in a `terraform plan` output explicitly indicates that an existing resource will be updated in-place, meaning its attributes will be modified without destroying and recreating the resource itself. For an AWS EC2 instance, changing the `instance_type` from its current value to `t2.small` is a supported in-place modification by the AWS provider, which will apply the change to the running instance.
- ✗
No changes will be made because the plan shows an update.
Why it's wrong here
This statement is incorrect. A `terraform plan` command is specifically designed to show *proposed* changes that Terraform will make to infrastructure to match the desired state defined in configuration. An "update" action, clearly indicated by the `~` symbol, signifies a modification that *will* be applied when `terraform apply` is executed. Therefore, running `terraform apply` after this plan would indeed execute the planned change, modifying the EC2 instance's `instance_type`.
Go deeper
Related to this question
About these practice questions
One of 428 original TF-004 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This TF-004 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-004 exam.