Practice Exams:

HashiCorp Terraform Associate 004 Dumps

EXAM: HashiCorp Certified: Terraform Associate (004)
Verified By Experts
Premium Bundle
$40.00
$59.97 $99.97

Terraform Associate 004 Premium Bundle


  • Premium File 167 Questions & Answers
  • Training Course 118 Lectures
  • Study Guide 285 Pages

HashiCorp Terraform Associate 004 Practice Test 56

Question 550

A municipal service performs emergency infrastructure repairs while a scheduled release also attempts to apply changes to the same workspace. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock. Verify: Launch two harmless test operations against a locking-capable backend and verify the second cannot modify state until the first releases its lock.
  2. Implement: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. Verify: Launch two harmless test operations against a locking-capable backend and verify the second cannot modify state until the first releases its lock.
  3. Implement: Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock. Verify: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.
  4. Implement: Provide backend authentication using supported environment or workload identity and inject backend settings safely rather than embedding long-lived access tokens in HCL. Verify: Run a clean test initialization with a scoped CI identity and verify that source and saved artifacts contain no plaintext backend password.

Answer & Explanations

Correct answer: A

A.

The question is set in this situation: A municipal service performs emergency infrastructure repairs while a scheduled release also attempts to apply changes to the same workspace. Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock. Confirm it through this test: Launch two harmless test operations against a locking-capable backend and verify the second cannot modify state until the first releases its lock. Locking protects the critical section for reading and writing a shared state snapshot; concurrent plan-and-apply processes can otherwise race.

B.

The question is set in this situation: A municipal service performs emergency infrastructure repairs while a scheduled release also attempts to apply changes to the same workspace. The test would be relevant: Launch two harmless test operations against a locking-capable backend and verify the second cannot modify state until the first releases its lock. But the offered implementation—Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.—addresses “Use force-unlock only after verifying a stale lock”. The action needed here is: Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock.

C.

The question is set in this situation: A municipal service performs emergency infrastructure repairs while a scheduled release also attempts to apply changes to the same workspace. The action is applicable: Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock. But its proposed test—Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.—addresses “Use force-unlock only after verifying a stale lock”. This requirement is confirmed instead by: Launch two harmless test operations against a locking-capable backend and verify the second cannot modify state until the first releases its lock.

D.

This action/test pair addresses “Keep backend configuration credentials outside source control”. Provide backend authentication using supported environment or workload identity and inject backend settings safely rather than embedding long-lived access tokens in HCL. Run a clean test initialization with a scoped CI identity and verify that source and saved artifacts contain no plaintext backend password. The case instead calls for: Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock.

Question 551

A fintech team's crashed CI agent left a stale lock, and on-call staff must determine whether the original job is truly stopped. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Use the local backend only for isolated or small controlled contexts and secure the terraform.tfstate file from loss, accidental commits and parallel writers.
  2. Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.
  3. Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock.
  4. Protect the working directory's local state with appropriate encrypted backups and avoid manual file edits while preparing a move to an approved shared backend.

Answer & Explanations

Correct answer: B

A.

Use the local backend only for isolated or small controlled contexts and secure the terraform.tfstate file from loss, accidental commits and parallel writers. This addresses “Recognize the limits of the local Terraform state backend”, where the governing principle is: A local backend writes state on the machine running Terraform, so other workers may not share the same view or state lock across machines. The stated case instead calls for: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

B.

Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts. Verify the result with this test: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.

C.

Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock. This addresses “Respect state locking when multiple operators share a backend”, where the governing principle is: Locking protects the critical section for reading and writing a shared state snapshot; concurrent plan-and-apply processes can otherwise race. The stated case instead calls for: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

D.

Protect the working directory's local state with appropriate encrypted backups and avoid manual file edits while preparing a move to an approved shared backend. This addresses “Do not assume local backend state is automatically backed up”, where the governing principle is: The local backend does not inherently provide centralized recovery, cross-host synchronization or immutable history; a damaged state file can lose resource identity bindings. The stated case instead calls for: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

Question 552

A fintech team's crashed CI agent left a stale lock, and on-call staff must determine whether the original job is truly stopped. The infrastructure engineer proposes this change: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. Which mechanism explains why it works?

  1. Locking protects the critical section for reading and writing a shared state snapshot; concurrent plan-and-apply processes can otherwise race.
  2. The local backend does not inherently provide centralized recovery, cross-host synchronization or immutable history; a damaged state file can lose resource identity bindings.
  3. Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts.
  4. A local backend writes state on the machine running Terraform, so other workers may not share the same view or state lock across machines.

Answer & Explanations

Correct answer: C

A.

Locking protects the critical section for reading and writing a shared state snapshot; concurrent plan-and-apply processes can otherwise race. That explains “Respect state locking when multiple operators share a backend”, not the mechanism behind the described change. The relevant principle is: Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts.

B.

The local backend does not inherently provide centralized recovery, cross-host synchronization or immutable history; a damaged state file can lose resource identity bindings. That explains “Do not assume local backend state is automatically backed up”, not the mechanism behind the described change. The relevant principle is: Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts.

C.

Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts. The corresponding implementation is: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

D.

A local backend writes state on the machine running Terraform, so other workers may not share the same view or state lock across machines. That explains “Recognize the limits of the local Terraform state backend”, not the mechanism behind the described change. The relevant principle is: Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts.

Question 553

A fintech team's crashed CI agent left a stale lock, and on-call staff must determine whether the original job is truly stopped. After implementing this change—Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.—which test most directly validates its intended outcome?

  1. Launch two harmless test operations against a locking-capable backend and verify the second cannot modify state until the first releases its lock.
  2. Create a controlled state backup before an isolated lab change and demonstrate restoring it to recover the original resource addresses.
  3. Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.
  4. Apply a disposable resource, locate its local state and compare a second isolated checkout to show why it lacks a shared authoritative state snapshot.

Answer & Explanations

Correct answer: C

A.

Launch two harmless test operations against a locking-capable backend and verify the second cannot modify state until the first releases its lock. That would help test “Respect state locking when multiple operators share a backend”, not the outcome required in this scenario. The relevant acceptance check is: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.

B.

Create a controlled state backup before an isolated lab change and demonstrate restoring it to recover the original resource addresses. That would help test “Do not assume local backend state is automatically backed up”, not the outcome required in this scenario. The relevant acceptance check is: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.

C.

Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation. This check is decisive because force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts.

D.

Apply a disposable resource, locate its local state and compare a second isolated checkout to show why it lacks a shared authoritative state snapshot. That would help test “Recognize the limits of the local Terraform state backend”, not the outcome required in this scenario. The relevant acceptance check is: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.

Question 554

A fintech team's crashed CI agent left a stale lock, and on-call staff must determine whether the original job is truly stopped. Which proposed shortcut most directly risks overlapping operations and potential state corruption after premature unlock and should therefore be rejected?

  1. Delete a locally stored state file after an apply because the configuration source code alone can reconstruct every remote object ID.
  2. Force-unlock a backend whenever planning is slow without checking whether a live CI job currently owns the lock.
  3. Disable locking for a busy shared state so both pipelines can apply competing changes at the same time.
  4. Have three engineers keep independent terraform.tfstate files for one production environment and assume all changes will reconcile safely.

Answer & Explanations

Correct answer: B

A.

Delete a locally stored state file after an apply because the configuration source code alone can reconstruct every remote object ID. That shortcut risks orphaned infrastructure or costly duplicate resources after losing state identities. Here the specific shortcut is: Force-unlock a backend whenever planning is slow without checking whether a live CI job currently owns the lock.

B.

Force-unlock a backend whenever planning is slow without checking whether a live CI job currently owns the lock. The foreseeable failure is overlapping operations and potential state corruption after premature unlock. The safer response is: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

C.

Disable locking for a busy shared state so both pipelines can apply competing changes at the same time. That shortcut risks corrupted state or infrastructure conflicts from concurrent writes. Here the specific shortcut is: Force-unlock a backend whenever planning is slow without checking whether a live CI job currently owns the lock.

D.

Have three engineers keep independent terraform.tfstate files for one production environment and assume all changes will reconcile safely. That shortcut risks competing resource ownership and state divergence among collaborators. Here the specific shortcut is: Force-unlock a backend whenever planning is slow without checking whether a live CI job currently owns the lock.

Question 555

A fintech team's crashed CI agent left a stale lock, and on-call staff must determine whether the original job is truly stopped. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. Verify: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.
  2. Implement: Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock. Verify: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.
  3. Implement: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. Verify: Launch two harmless test operations against a locking-capable backend and verify the second cannot modify state until the first releases its lock.
  4. Implement: Protect the working directory's local state with appropriate encrypted backups and avoid manual file edits while preparing a move to an approved shared backend. Verify: Create a controlled state backup before an isolated lab change and demonstrate restoring it to recover the original resource addresses.

Answer & Explanations

Correct answer: A

A.

Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. Confirm it through this test: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation. Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts.

B.

The test would be relevant: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation. But the offered implementation—Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock.—addresses “Respect state locking when multiple operators share a backend”. The action needed here is: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

C.

The action is applicable: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. But its proposed test—Launch two harmless test operations against a locking-capable backend and verify the second cannot modify state until the first releases its lock.—addresses “Respect state locking when multiple operators share a backend”. This requirement is confirmed instead by: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.

D.

This action/test pair addresses “Do not assume local backend state is automatically backed up”. Protect the working directory's local state with appropriate encrypted backups and avoid manual file edits while preparing a move to an approved shared backend. Create a controlled state backup before an isolated lab change and demonstrate restoring it to recover the original resource addresses. The case instead calls for: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

Question 556

A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock.
  2. Use the local backend only for isolated or small controlled contexts and secure the terraform.tfstate file from loss, accidental commits and parallel writers.
  3. Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.
  4. Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

Answer & Explanations

Correct answer: D

A.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock. This addresses “Respect state locking when multiple operators share a backend”, where the governing principle is: Locking protects the critical section for reading and writing a shared state snapshot; concurrent plan-and-apply processes can otherwise race. The stated case instead calls for: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

B.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Use the local backend only for isolated or small controlled contexts and secure the terraform.tfstate file from loss, accidental commits and parallel writers. This addresses “Recognize the limits of the local Terraform state backend”, where the governing principle is: A local backend writes state on the machine running Terraform, so other workers may not share the same view or state lock across machines. The stated case instead calls for: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

C.

Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. This addresses “Use refresh-only plans to reconcile observed drift into state deliberately”, where the governing principle is: Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs. The stated case instead calls for: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

D.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts. Verify the result with this test: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.

Question 557

A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. The infrastructure engineer proposes this change: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. Which mechanism explains why it works?

  1. Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts.
  2. A local backend writes state on the machine running Terraform, so other workers may not share the same view or state lock across machines.
  3. Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs.
  4. Locking protects the critical section for reading and writing a shared state snapshot; concurrent plan-and-apply processes can otherwise race.

Answer & Explanations

Correct answer: A

A.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts. The corresponding implementation is: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

B.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. A local backend writes state on the machine running Terraform, so other workers may not share the same view or state lock across machines. That explains “Recognize the limits of the local Terraform state backend”, not the mechanism behind the described change. The relevant principle is: Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts.

C.

Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs. That explains “Use refresh-only plans to reconcile observed drift into state deliberately”, not the mechanism behind the described change. The relevant principle is: Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts.

D.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Locking protects the critical section for reading and writing a shared state snapshot; concurrent plan-and-apply processes can otherwise race. That explains “Respect state locking when multiple operators share a backend”, not the mechanism behind the described change. The relevant principle is: Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts.

Question 558

A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. After implementing this change—Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.—which test most directly validates its intended outcome?

  1. Apply a disposable resource, locate its local state and compare a second isolated checkout to show why it lacks a shared authoritative state snapshot.
  2. Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.
  3. Launch two harmless test operations against a locking-capable backend and verify the second cannot modify state until the first releases its lock.
  4. Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.

Answer & Explanations

Correct answer: B

A.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Apply a disposable resource, locate its local state and compare a second isolated checkout to show why it lacks a shared authoritative state snapshot. That would help test “Recognize the limits of the local Terraform state backend”, not the outcome required in this scenario. The relevant acceptance check is: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.

B.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation. This check is decisive because force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts.

C.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Launch two harmless test operations against a locking-capable backend and verify the second cannot modify state until the first releases its lock. That would help test “Respect state locking when multiple operators share a backend”, not the outcome required in this scenario. The relevant acceptance check is: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.

D.

Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either. That would help test “Use refresh-only plans to reconcile observed drift into state deliberately”, not the outcome required in this scenario. The relevant acceptance check is: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.

Question 559

A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Which proposed shortcut most directly risks overlapping operations and potential state corruption after premature unlock and should therefore be rejected?

  1. Disable locking for a busy shared state so both pipelines can apply competing changes at the same time.
  2. Assume terraform apply -refresh-only will forcibly restore every cloud resource to its old configured values after an external manual edit.
  3. Force-unlock a backend whenever planning is slow without checking whether a live CI job currently owns the lock.
  4. Have three engineers keep independent terraform.tfstate files for one production environment and assume all changes will reconcile safely.

Answer & Explanations

Correct answer: C

A.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Disable locking for a busy shared state so both pipelines can apply competing changes at the same time. That shortcut risks corrupted state or infrastructure conflicts from concurrent writes. Here the specific shortcut is: Force-unlock a backend whenever planning is slow without checking whether a live CI job currently owns the lock.

B.

Assume terraform apply -refresh-only will forcibly restore every cloud resource to its old configured values after an external manual edit. That shortcut risks unrepaired infrastructure drift because state refresh was confused with configuration enforcement. Here the specific shortcut is: Force-unlock a backend whenever planning is slow without checking whether a live CI job currently owns the lock.

C.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Force-unlock a backend whenever planning is slow without checking whether a live CI job currently owns the lock. The foreseeable failure is overlapping operations and potential state corruption after premature unlock. The safer response is: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

D.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Have three engineers keep independent terraform.tfstate files for one production environment and assume all changes will reconcile safely. That shortcut risks competing resource ownership and state divergence among collaborators. Here the specific shortcut is: Force-unlock a backend whenever planning is slow without checking whether a live CI job currently owns the lock.

Question 560

A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. Verify: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.
  2. Implement: Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock. Verify: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.
  3. Implement: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. Verify: Launch two harmless test operations against a locking-capable backend and verify the second cannot modify state until the first releases its lock.
  4. Implement: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. Verify: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.

Answer & Explanations

Correct answer: D

A.

This action/test pair addresses “Use refresh-only plans to reconcile observed drift into state deliberately”. Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either. The case instead calls for: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

B.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. The test would be relevant: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation. But the offered implementation—Configure a remote backend with supported state locking and avoid applying while another run holds the relevant workspace lock.—addresses “Respect state locking when multiple operators share a backend”. The action needed here is: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.

C.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. The action is applicable: Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. But its proposed test—Launch two harmless test operations against a locking-capable backend and verify the second cannot modify state until the first releases its lock.—addresses “Respect state locking when multiple operators share a backend”. This requirement is confirmed instead by: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.

D.

The question is set in this situation: A university platform team sees a lock error during lab hours and must not disrupt another student's active Terraform apply. Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. Confirm it through this test: Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation. Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts.

HashiCorp Certified: Terraform Associate (004) (Terraform Associate 004) Practice Tests