Courseiva
Use the core Terraform workflowhardMultiple ChoiceObjective-mapped

TF-004 Use the core Terraform workflow Practice Question

Exhibit

Refer to the exhibit.

```
$ terraform init
Initializing the backend...

Successfully configured the backend "local"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...
- Using previously-installed hashicorp/random v3.5.1

Terraform has been successfully initialized!

$ terraform plan

No changes. Your infrastructure matches the configuration.

$ terraform apply -auto-approve

No changes. Your infrastructure matches the configuration.
```

Refer to the exhibit. A developer runs the commands shown. The Terraform configuration defines a `random_pet` resource. The developer expects the plan to show a new resource to be created, but it says "No changes." What is the most likely reason?

⚠ Common exam trap

Many candidates assume `random_pet` generates a new value on every plan, but Terraform treats it as a managed resource that only changes when the configuration or state is altered.

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 random_pet resource was already created in a previous apply and is still in the state

The `random_pet` resource was already created and recorded in the Terraform state file during a previous `terraform apply`. When the developer runs `terraform plan` again without any changes to the configuration, Terraform compares the current state to the configuration and finds no differences, resulting in 'No changes.' The resource already exists in the state, so no new resource is planned.

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 random_pet resource was already created in a previous apply and is still in the state

    Why this is correct

    The `terraform apply` command reporting "No changes. Your infrastructure matches the configuration." indicates that all resources defined in the Terraform configuration files are already present in the Terraform state file, and their current attributes align perfectly with the desired state. This means the `random_pet` resource was successfully created during a previous `terraform apply` operation and its existence and configuration are accurately tracked within the state, requiring no further action.

  • The `-auto-approve` flag prevents showing changes in the plan

    Why it's wrong here

    The `-auto-approve` flag, when used with `terraform apply`, serves only to bypass the interactive confirmation prompt that typically asks the user to type "yes" before applying changes. It does not, however, suppress or prevent the display of the detailed execution plan output. The plan, which outlines all proposed infrastructure modifications, is still shown in the console, providing transparency even in automated environments.

  • The `random_pet` resource is not supported by the Terraform version

    Why it's wrong here

    If the `random_pet` resource were genuinely unsupported by the installed Terraform version or its associated provider, the `terraform init` command would likely fail to download the necessary provider plugin, or `terraform plan` would immediately terminate with an error indicating an unknown resource type or an invalid provider configuration. The successful execution of `terraform apply` to the point of reporting "no changes" confirms that the resource type is recognized and valid within the current environment.

  • The backend is local, so changes are not persisted across runs

    Why it's wrong here

    The local backend, which is Terraform's default state storage mechanism, explicitly persists the `terraform.tfstate` file within the working directory where Terraform commands are executed. This state file is crucial for tracking all managed infrastructure resources and their attributes across multiple runs. Therefore, any changes applied or resources created are indeed persisted in this state file, allowing Terraform to maintain a consistent understanding of the infrastructure over time.

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.