Courseiva
Understand Terraform's purposeeasyMultiple ChoiceObjective-mapped

TF-004 Understand Terraform's purpose Practice Question

Exhibit

aws_instance.web
aws_security_group.sg

Refer to the exhibit. What does this output show?

⚠ Common exam trap

A common pitfall in Terraform exams is confusing resources defined in the configuration with resources actually managed in the state, leading candidates to select 'Resources in the configuration' (Option B) instead of 'Resources managed by Terraform'.

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

Resources managed by Terraform

The output shows a list of resources that Terraform is currently tracking in its state file. This indicates which resources are under Terraform's management, not just those defined in the configuration or those that are out of sync. Option D is correct because the `terraform state list` command (or similar output) displays all resources that Terraform is actively managing, regardless of their current state relative to the configuration.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Resources to be created

    Why it's wrong here

    The `terraform state list` command is designed to display resources already tracked within the Terraform state file, which represents the current reality of managed infrastructure. It does not execute a planning phase to compare the configuration with the desired state and identify new resources that are pending creation. Therefore, this output solely reflects existing, managed resources, not those slated for future provisioning.

  • Resources in the configuration

    Why it's wrong here

    The `terraform state list` command specifically enumerates resources that have been successfully provisioned and recorded in the Terraform state file. It does not provide a comprehensive inventory of all resource blocks defined within the `.tf` configuration files, as some resources might be newly added and not yet applied, or others might have been removed from the configuration but still persist in the state. Consequently, this output is a subset of the configuration, specifically what's currently managed.

  • Resources that are out of sync

    Why it's wrong here

    The `terraform state list` command merely provides a textual enumeration of resource addresses stored within the Terraform state file. It does not perform any comparison between the state file's contents and the actual infrastructure deployed in the cloud provider. Detecting resources that are 'out of sync' or have drifted from their desired configuration requires a `terraform plan` or `terraform refresh` operation, which actively queries the remote APIs to identify discrepancies.

  • Resources managed by Terraform

    Why this is correct

    The `terraform state list` command directly queries and displays the contents of the Terraform state file, which is the authoritative record of all infrastructure resources that Terraform is currently managing. This output precisely enumerates every resource instance that has been successfully provisioned, imported, and whose metadata is stored within the state, unequivocally confirming their status as being under Terraform's active management. It serves as a definitive inventory of the infrastructure Terraform controls.

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.