Courseiva
Implement and maintain statemediumMultiple ChoiceObjective-mapped

TF-004 Implement and maintain state Practice Question

A team uses an S3 backend with DynamoDB locking. They accidentally delete the DynamoDB table used for state locking. What is the immediate consequence?

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

Terraform commands that require state locking will fail with a locking error.

When the DynamoDB table is deleted, Terraform cannot acquire or release locks, so any command needing locking (apply, plan, destroy) will fail. Option A is correct. Option B is incorrect because Terraform will not proceed without lock; it returns an error. Options C and D are not automatic behaviors.

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 commands that require state locking will fail with a locking error.

    Why this is correct

    When the configured DynamoDB table for state locking is unavailable or missing, Terraform cannot acquire the necessary lock before executing state-modifying commands like `terraform apply` or `terraform plan`. This immediately results in a locking error, preventing any operation that could potentially corrupt the remote state file. Terraform prioritizes state integrity by failing explicitly rather than proceeding unsafely.

  • State operations will continue without locking, risking corruption.

    Why it's wrong here

    Terraform is designed with strong consistency guarantees for its state file, especially in remote backends. It will not bypass the configured state locking mechanism, even if the locking resource (DynamoDB) is unavailable. Instead, Terraform will halt execution and report an error, explicitly preventing operations that could lead to concurrent modifications and subsequent state corruption.

  • Terraform will automatically create a new DynamoDB table.

    Why it's wrong here

    Terraform's backend configuration specifies existing infrastructure components, such as an S3 bucket for state and a DynamoDB table for locking. Terraform itself does not possess the capability or logic to automatically provision or create these external resources. Users are responsible for ensuring that all required backend infrastructure, including the DynamoDB table, is pre-existing and correctly configured before Terraform can utilize it.

  • The state file will be migrated to local storage.

    Why it's wrong here

    Terraform backends are explicitly configured, and a failure or unavailability of a remote backend does not trigger an automatic fallback or migration to local storage. If the remote S3 backend or its associated DynamoDB locking mechanism becomes inaccessible, Terraform will simply fail to perform state operations. Manual intervention is required to either restore the remote backend or explicitly reconfigure Terraform to use a different backend, including a local one.

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 428-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.