Courseiva
Read, generate and modify configurationhardMultiple ChoiceObjective-mapped

TF-004 Read, generate and modify configuration Practice Question

Exhibit

Refer to the exhibit.
```
$ terraform plan
...
  # aws_instance.example will be updated in-place
  ~ resource "aws_instance" "example" {
        id         = "i-0abcd1234"
      ~ instance_type = "t2.micro" -> "t2.small"
        tags       = {
            "Name" = "example"
        }
    }
```

Given the following Terraform configuration:

resource "aws_instance" "example" { ami = "ami-0c55b159cbfafe1f0" instance_type = "t2.micro"

}

If you change the instance_type to "t2.small" and run terraform apply, what will happen?

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 instance will be modified in-place, potentially causing a reboot.

Modifying an instance's type is an in-place update in Terraform (shown as a tilde ~ in the plan). This update typically requires a stop and start of the instance, which causes a reboot but not a full destroy and recreate. Option A is incorrect because the question does not indicate any missing variables; the configuration is assumed to be valid. Option B is incorrect because a destroy and recreate would be shown as a -/+ in the plan, whereas an instance type change is an in-place update. Option D is incorrect because changing the instance type usually requires a reboot, causing downtime, so there is no 'no downtime' guarantee.

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 plan will fail due to missing variables.

    Why it's wrong here

    Terraform's plan command evaluates the configuration against the current state, resolving all variables through their defined values, defaults, or environment variables. If all necessary variables are provided or have defaults, the plan will successfully generate a set of proposed changes without failing due to missing inputs. The successful generation of a plan indicates that all required variable values were available, making this option incorrect.

  • The instance will be destroyed and recreated.

    Why it's wrong here

    A destroy and recreate operation, symbolized by `-/+` in a Terraform plan, occurs when an attribute change necessitates the complete replacement of a resource because the cloud provider does not support in-place modification for that specific attribute. In this scenario, the plan output would explicitly show the resource being destroyed and then created anew. However, the plan indicates an in-place update (`~`), signifying that the existing instance will be modified directly rather than replaced.

  • The instance will be modified in-place, potentially causing a reboot.

    Why this is correct

    The tilde symbol (`~`) in a Terraform plan output explicitly indicates that an existing resource attribute will be modified in-place without destroying and recreating the entire resource. When changing an AWS EC2 `instance_type`, the underlying cloud provider typically performs a stop and start operation on the instance to apply the new configuration. This stop/start cycle inherently causes a temporary interruption in service, which often manifests as a system reboot from the operating system's perspective.

  • The instance type will be changed without downtime.

    Why it's wrong here

    Changing an AWS EC2 instance type is not a seamless operation that occurs without any service interruption. The underlying AWS platform requires the instance to be stopped and then restarted to apply the new hardware configuration, which inevitably leads to a period of downtime. This stop/start process causes the operating system to reboot, making the instance temporarily unavailable until it fully comes back online.

About these practice questions

Courseiva writes every TF-004 question from scratch — 428 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.