Courseiva

TF-004 Use the core Terraform workflow Practice Question

Which THREE are valid methods to manage Terraform state files? (Choose three.)

⚠ Common exam trap

HashiCorp often tests the distinction between state management methods (storage backends) and state manipulation commands (like push, mv, rm), causing candidates to confuse operational commands with valid storage approaches.

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

✓

Local state file

Option B (Local state file) is correct because Terraform's default behavior stores state in a local file named terraform.tfstate in the working directory, which is a fully valid way to manage state for solo or simple workflows. Option C (Terraform Cloud state storage) is correct because Terraform Cloud (and Terraform Enterprise) provides a managed remote backend that stores state, supports locking, versioning, and team collaboration, making it a legitimate state management method. Option E (Remote backends such as S3, AzureRM, GCS) is correct because configuring a backend block (e.g., backend "s3", "azurerm", or "gcs") stores the state file remotely and enables locking and shared access, which is the recommended approach for teams. Options A (terraform state push) and D (terraform state mv) are not state management methods but rather state manipulation subcommands: terraform state push manually uploads a local state to a remote backend, and terraform state mv moves resources within state, so neither constitutes a method of storing or managing the state file itself.

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 state push

    Why it's wrong here

    The `terraform state push` command is an operational utility used to manually upload a local state file to a configured remote backend. It is not a method for *managing* where the state file is stored or how it's accessed by Terraform itself. Instead, it's a specific action performed *on* an existing state management configuration, typically for recovery or explicit synchronization, assuming a backend is already in place.

  • ✓

    Local state file

    Why this is correct

    Storing the state file locally involves Terraform writing the `terraform.tfstate` file directly into the root directory of the configuration. This method is the default behavior when no remote backend is explicitly configured, making it suitable for individual development or small, isolated projects. However, it lacks collaboration features like state locking and can lead to state drift or conflicts in team environments.

  • ✓

    Terraform Cloud state storage

    Why this is correct

    Terraform Cloud offers a fully managed, secure, and highly available remote backend for Terraform state files. It automatically handles state locking, versioning, and access control, significantly simplifying collaboration for teams and ensuring state consistency. This service integrates seamlessly with Terraform Cloud's run environment, providing a robust and centralized solution for state management.

  • ✗

    terraform state mv

    Why it's wrong here

    The `terraform state mv` command is used to move or rename resources *within* the Terraform state file, or to move resources between different state files. It is an administrative command for refactoring infrastructure managed by Terraform, not a method for defining how or where the state file itself is stored or managed by Terraform's backend configuration. It operates on the contents of the state, not its storage mechanism.

  • ✓

    Remote backends (e.g., S3, AzureRM, GCS)

    Why this is correct

    Remote backends provide a robust solution for storing Terraform state files in a shared, persistent, and often highly available location, such as Amazon S3, Azure Blob Storage, or Google Cloud Storage. These backends facilitate team collaboration by centralizing state, enabling state locking to prevent concurrent modifications, and often supporting state versioning for recovery. They are configured within the `backend` block of the Terraform configuration, offering a scalable and secure approach to state management.

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

This TF-004 question is part of Courseiva's 434-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.