Courseiva
Understand IaC conceptsmediumMultiple SelectObjective-mapped

TF-004 Understand IaC concepts Practice Question

Which three practices help maintain consistency and reduce configuration drift in IaC? (Choose three.)

⚠ Common exam trap

A common trap in Terraform exams is assuming that manual changes or concurrent applies are acceptable shortcuts. The exam emphasizes that any deviation from the IaC pipeline—even minor fixes—introduces drift and undermines reproducibility.

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

Storing state files remotely and locking them

Storing state files remotely (e.g., in an S3 bucket with DynamoDB locking) prevents concurrent modifications and ensures that the state file reflects the true infrastructure state. This practice eliminates the risk of conflicting changes and configuration drift caused by local or stale state files.

Answer analysis

Option-by-option breakdown

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

  • Storing state files remotely and locking them

    Why this is correct

    Storing Terraform state files remotely, typically in a backend like S3, Azure Blob Storage, or HashiCorp Consul, centralizes the authoritative record of managed infrastructure. This remote storage, combined with state locking mechanisms provided by the backend, prevents multiple users or automated processes from concurrently modifying the state file. This ensures that only one operation can write to the state at a time, preventing race conditions, state corruption, and configuration drift caused by uncoordinated changes.

  • Implementing CI/CD pipelines with automated testing

    Why this is correct

    Integrating Terraform into CI/CD pipelines ensures that infrastructure changes are systematically reviewed, validated, and applied through a consistent, repeatable process. Automated testing within these pipelines, including `terraform validate`, `terraform plan` checks, and potentially integration tests, catches errors early and verifies that proposed changes align with desired configurations. This automation minimizes human error, enforces best practices, and guarantees that infrastructure deployments are consistent across environments.

  • Regularly running terraform plan and apply

    Why this is correct

    Regularly executing `terraform plan` allows teams to preview proposed infrastructure changes and identify any drift between the actual infrastructure and the desired state defined in configuration files. Following up with `terraform apply` then reconciles these differences, ensuring that the infrastructure consistently matches the declared configuration. This proactive approach helps detect and correct unauthorized or manual changes, thereby maintaining consistency and preventing significant divergence over time.

  • Using manual changes to fix minor issues

    Why it's wrong here

    Directly making manual changes to infrastructure resources outside of Terraform, even for seemingly minor issues, immediately introduces configuration drift. These changes are not reflected in the Terraform state file or configuration, leading to discrepancies between the desired state and the actual infrastructure. Subsequent `terraform apply` operations might then attempt to revert these manual fixes or fail due to unexpected resource states, undermining consistency and making infrastructure management unpredictable.

  • Allowing multiple team members to run apply simultaneously

    Why it's wrong here

    Permitting multiple team members to execute `terraform apply` commands concurrently without proper state locking mechanisms creates a high risk of state file corruption and conflicting infrastructure changes. Without a lock, simultaneous operations could attempt to write to the same state file, leading to an inconsistent or corrupted record of the infrastructure. This can result in resources being incorrectly provisioned, modified, or destroyed, severely compromising consistency and operational stability.

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.