HashiCorp Terraform Associate (HashiCorp Certified: Terraform Associate) Practice Test 62

Question 610

In a planned migration, the requested result is to download a copy of the current backend state for protected inspection. What should the engineer select?

  1. Use a moved block for an address rename
  2. Use terraform state pull for an administrative snapshot
  3. Treat out-of-band tag updates as drift
  4. Use terraform state mv for imperative state relocation
  5. Use a removed block with destroy = false

Explanation

Correct Answer

B:

Pull emits the full state, potentially including secrets; it should not be treated as a public debugging log; this behavior should be assessed against the concrete need to download a copy of the current backend state for protected inspection. This directly supports the task to download a copy of the current backend state for protected inspection during a deployment checklist.

Incorrect Answers

A:

The from/to mapping teaches Terraform how to refactor tracked addresses before planning; it prevents an unnecessary destroy/create caused solely by a configuration rename; this behavior should be assessed against the concrete need to download a copy of the current backend state for protected inspection. The stated requirement is to download a copy of the current backend state for protected inspection, not to rename a Terraform resource address while preserving ongoing management of the same remote object; this alternative addresses a different control or phase.

C:

Terraform may plan to restore declared tags unless lifecycle rules deliberately ignore certain changes; the external edit does not automatically rewrite HCL; this behavior should be assessed against the concrete need to download a copy of the current backend state for protected inspection. The distinction matters here: using that mechanism to understand reconciliation when provider-observed values differ from HCL would still leave the objective to download a copy of the current backend state for protected inspection unmet.

D:

State move adjusts tracked bindings and writes a backup; it does not call a provider to physically move the cloud object; this behavior should be assessed against the concrete need to download a copy of the current backend state for protected inspection. It may support a related workflow, but the question specifically requires the mechanism for download a copy of the current backend state for protected inspection rather than change which Terraform address owns an existing object.

E:

The removed block records the intentional withdrawal of management without instructing the provider to delete the remote object; it is not a mere address rename like a moved block; this behavior should be assessed against the concrete need to download a copy of the current backend state for protected inspection. The stated requirement is to download a copy of the current backend state for protected inspection, not to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched; this alternative addresses a different control or phase.

Question 611

A developer is using local Terraform state on a workstation. A reviewer must determine how to separate infrastructure state from local backend configuration metadata. Which action is the appropriate choice?

  1. Distinguish terraform.tfstate from .terraform/terraform.tfstate
  2. Avoid deleting state to repair an ordinary HCL error
  3. Change local state file paths via backend configuration
  4. Use the default local backend

Explanation

Correct Answer

A:

The top-level file may contain actual local state; the file under .terraform/ holds initialization/backend information and may include credential-related settings; this behavior should be assessed against the concrete need to separate infrastructure state from local backend configuration metadata. This directly supports the task to separate infrastructure state from local backend configuration metadata during a cross-team handoff.

Incorrect Answers

B:

Removing state does not delete remote objects, but it removes their managed mappings; a later plan may attempt duplicate creation rather than fixing source syntax; this behavior should be assessed against the concrete need to separate infrastructure state from local backend configuration metadata. That can be useful when the aim is to prevent Terraform from losing track of existing objects, but it does not directly deliver the requested ability to separate infrastructure state from local backend configuration metadata.

C:

A backend path setting governs where the state is written; manual alteration of state bindings can cause damaging reconciliation errors; this behavior should be assessed against the concrete need to separate infrastructure state from local backend configuration metadata. The distinction matters here: using that mechanism to control storage without editing internal state JSON manually would still leave the objective to separate infrastructure state from local backend configuration metadata unmet.

D:

By default Terraform writes state in the working directory, typically terraform.tfstate; local storage does not supply shared team coordination; this behavior should be assessed against the concrete need to separate infrastructure state from local backend configuration metadata. It may support a related workflow, but the question specifically requires the mechanism for separate infrastructure state from local backend configuration metadata rather than store state in a local filesystem file without configuring a remote backend.

Question 612

The immediate Terraform task is to avoid accidental interference with someone else's active run. Which method handles that task most directly?

  1. Understand a crash can leave a stale lock
  2. Wait for a held lock to be released
  3. Keep lock tokens or IDs private to administrators
  4. Use terraform force-unlock LOCK_ID only after verification

Explanation

Correct Answer

C:

An unlock command can affect shared state coordination; its use should be audited and restricted to trusted operators; this behavior should be assessed against the concrete need to avoid accidental interference with someone else's active run. This directly supports the task to avoid accidental interference with someone else's active run during a platform review.

Incorrect Answers

A:

Abnormal termination may prevent normal unlock; verify process inactivity and current state integrity before administrative cleanup; this behavior should be assessed against the concrete need to avoid accidental interference with someone else's active run. It may support a related workflow, but the question specifically requires the mechanism for avoid accidental interference with someone else's active run rather than distinguish genuine active operations from abandoned lock records.

B:

A lock usually means another process is modifying the same state; waiting is safer than forcing unlock while the first run is still active; this behavior should be assessed against the concrete need to avoid accidental interference with someone else's active run. The stated requirement is to avoid accidental interference with someone else's active run, not to avoid interrupting an active legitimate Terraform operation; this alternative addresses a different control or phase.

D:

Force-unlock bypasses normal safeguards and can permit conflicting state writes; the lock ID helps ensure the intended lock is targeted; this behavior should be assessed against the concrete need to avoid accidental interference with someone else's active run. The distinction matters here: using that mechanism to clear a stale lock when the original owner is definitely inactive would still leave the objective to avoid accidental interference with someone else's active run unmet.

Question 613

A Terraform rollout has separate acceptance criteria: avoid treating backend setup like an ordinary runtime variable evaluation and protect the authoritative snapshot from concurrent writers. Which combined approach directly satisfies the two criteria?

  1. Use backend migration instead of copying arbitrary JSON + Enable state locking when supported
  2. Run terraform init after declaring a backend + Enable state locking when supported
  3. Recognize backend blocks cannot use var.* expressions + Enable state locking when supported
  4. Recognize backend blocks cannot use var.* expressions + Use distinct state keys or workspaces for environments
  5. Understand terraform_remote_state reads root outputs + Avoid committing .terraform/ backend metadata

Explanation

Correct Answer

C:

For the first criterion, terraform initializes its backend before normal expression evaluation and variable processing; use supported partial configuration mechanisms instead; this behavior should be assessed against the concrete need to avoid treating backend setup like an ordinary runtime variable evaluation and protect the authoritative snapshot from concurrent writers; this directly addresses the need to avoid treating backend setup like an ordinary runtime variable evaluation. For the separate second criterion, storage alone does not coordinate multiple applies; the backend's documented locking behavior must be configured and understood; this behavior should be assessed against the concrete need to avoid treating backend setup like an ordinary runtime variable evaluation and protect the authoritative snapshot from concurrent writers; this fulfills the need to protect the authoritative snapshot from concurrent writers. Together they cover the independent tasks of avoid treating backend setup like an ordinary runtime variable evaluation and protect the authoritative snapshot from concurrent writers without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the protect the authoritative snapshot from concurrent writers requirement, but the first is designed for another concern: Terraform's migration workflow handles state snapshots and workspace considerations; manual files copied to the wrong state key can cause unexpected destructive plans; this behavior should be assessed against the concrete need to avoid treating backend setup like an ordinary runtime variable evaluation and protect the authoritative snapshot from concurrent writers. That first component is designed to preserve state metadata while switching storage, which does not accomplish the requested task to avoid treating backend setup like an ordinary runtime variable evaluation, even though the other measure satisfies protect the authoritative snapshot from concurrent writers.

B:

The second measure does meet the protect the authoritative snapshot from concurrent writers requirement, but the first is designed for another concern: Backend initialization validates configuration and can prompt to migrate existing state; declaring the block alone does not upload the prior snapshot; this behavior should be assessed against the concrete need to avoid treating backend setup like an ordinary runtime variable evaluation and protect the authoritative snapshot from concurrent writers. That first component is designed to initialize the configured state location before normal operations, which does not accomplish the requested task to avoid treating backend setup like an ordinary runtime variable evaluation, even though the other measure satisfies protect the authoritative snapshot from concurrent writers.

D:

The first measure meets the requirement to avoid treating backend setup like an ordinary runtime variable evaluation, but its partner serves a different role: Isolation prevents two environments from sharing addresses and IDs in one state; the storage service can still be shared if access boundaries are enforced; this behavior should be assessed against the concrete need to avoid treating backend setup like an ordinary runtime variable evaluation and protect the authoritative snapshot from concurrent writers. That second component is designed to separate staging and production resource bindings, so the still-missing criterion is to protect the authoritative snapshot from concurrent writers, while the first criterion remains avoid treating backend setup like an ordinary runtime variable evaluation.

E:

The first measure is intended to share selected information from another state rather than taking over its resources: The built-in data source consumes outputs from a different state; it does not give Terraform lifecycle ownership of the remote objects stored there; this behavior should be assessed against the concrete need to avoid treating backend setup like an ordinary runtime variable evaluation and protect the authoritative snapshot from concurrent writers. The second measure is intended to prevent local initialization secrets and settings from entering Git: Terraform records initialized backend configuration in its generated data directory; this is separate from the tracked HCL declarations; this behavior should be assessed against the concrete need to avoid treating backend setup like an ordinary runtime variable evaluation and protect the authoritative snapshot from concurrent writers. Neither is the directly designated method for the separate goals of avoid treating backend setup like an ordinary runtime variable evaluation and protect the authoritative snapshot from concurrent writers in this review.

Question 614

An engineer needs to commit the newly observed remote attributes to state without altering cloud objects as part of a planned migration. Which option is the best fit?

  1. Treat out-of-band tag updates as drift
  2. Avoid editing raw state JSON
  3. Use a normal terraform plan to assess drift
  4. Use an import block to adopt a preexisting object
  5. Use terraform apply -refresh-only when appropriate

Explanation

Correct Answer

E:

The mode reconciles state to remote reality; it differs from an ordinary apply that might revert unauthorized changes; this behavior should be assessed against the concrete need to commit the newly observed remote attributes to state without altering cloud objects. This directly supports the task to commit the newly observed remote attributes to state without altering cloud objects during a maintenance request.

Incorrect Answers

A:

Terraform may plan to restore declared tags unless lifecycle rules deliberately ignore certain changes; the external edit does not automatically rewrite HCL; this behavior should be assessed against the concrete need to commit the newly observed remote attributes to state without altering cloud objects. That can be useful when the aim is to understand reconciliation when provider-observed values differ from HCL, but it does not directly deliver the requested ability to commit the newly observed remote attributes to state without altering cloud objects.

B:

Supported state commands and declarative refactoring blocks are safer; incorrect manual edits can make future plans target the wrong objects; this behavior should be assessed against the concrete need to commit the newly observed remote attributes to state without altering cloud objects. The distinction matters here: using that mechanism to prevent inconsistent serials, lineages, attributes, and provider references would still leave the objective to commit the newly observed remote attributes to state without altering cloud objects unmet.

C:

Planning typically refreshes tracked resource values and proposes actions to converge with configuration; it does not automatically accept external modifications as desired; this behavior should be assessed against the concrete need to commit the newly observed remote attributes to state without altering cloud objects. It may support a related workflow, but the question specifically requires the mechanism for commit the newly observed remote attributes to state without altering cloud objects rather than compare declared intent with refreshed remote resource attributes.

D:

Import maps a remote ID to resource configuration; it does not automatically create the imported infrastructure from scratch; this behavior should be assessed against the concrete need to commit the newly observed remote attributes to state without altering cloud objects. The stated requirement is to commit the newly observed remote attributes to state without altering cloud objects, not to add an unmanaged object into the current state under a declared address; this alternative addresses a different control or phase.

Question 615

A reviewer has to approve a two-part design: choose a nondefault local state file location; additionally, recognize that local state can be locked to avoid concurrent local access. Which option pairs the correct mechanisms?

  1. Reinitialize after changing backend configuration + Understand a local backend's locking mechanism
  2. Set backend "local" { path = "..." } + Keep local state out of Git
  3. Set backend "local" { path = "..." } + Understand a local backend's locking mechanism
  4. Recognize terraform.tfstate.backup + Use the default local backend

Explanation

Correct Answer

C:

For the first criterion, the local backend supports configuring where state data is stored; this changes file location, not provider credentials or resource addresses; this behavior should be assessed against the concrete need to choose a nondefault local state file location and recognize that local state can be locked to avoid concurrent local access; this directly addresses the need to choose a nondefault local state file location. For the separate second criterion, the local backend uses local filesystem locking where supported; it does not coordinate developers operating separate copies on different machines; this behavior should be assessed against the concrete need to choose a nondefault local state file location and recognize that local state can be locked to avoid concurrent local access; this fulfills the need to recognize that local state can be locked to avoid concurrent local access. Together they cover the independent tasks of choose a nondefault local state file location and recognize that local state can be locked to avoid concurrent local access without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the recognize that local state can be locked to avoid concurrent local access requirement, but the first is designed for another concern: Backend setting changes require init to recognize and potentially migrate state; a subsequent plan alone cannot safely change backend storage; this behavior should be assessed against the concrete need to choose a nondefault local state file location and recognize that local state can be locked to avoid concurrent local access. That first component is designed to make Terraform adopt the new local or remote state location, which does not accomplish the requested task to choose a nondefault local state file location, even though the other measure satisfies recognize that local state can be locked to avoid concurrent local access.

B:

The first measure meets the requirement to choose a nondefault local state file location, but its partner serves a different role: State can contain secrets even if outputs are redacted; a version-control checkout is not a secure state database or concurrency mechanism; this behavior should be assessed against the concrete need to choose a nondefault local state file location and recognize that local state can be locked to avoid concurrent local access. That second component is designed to avoid exposing sensitive resource attributes in repository history, so the still-missing criterion is to recognize that local state can be locked to avoid concurrent local access, while the first criterion remains choose a nondefault local state file location.

D:

The first measure is intended to understand a local backup snapshot that may contain sensitive information: Terraform can write a previous state snapshot as a backup during updates; this file is not a replacement for deliberate disaster recovery planning; this behavior should be assessed against the concrete need to choose a nondefault local state file location and recognize that local state can be locked to avoid concurrent local access. The second measure is intended to store state in a local filesystem file without configuring a remote backend: By default Terraform writes state in the working directory, typically terraform.tfstate; local storage does not supply shared team coordination; this behavior should be assessed against the concrete need to choose a nondefault local state file location and recognize that local state can be locked to avoid concurrent local access. Neither is the directly designated method for the separate goals of choose a nondefault local state file location and recognize that local state can be locked to avoid concurrent local access in this review.

Question 616

In a planned migration, the requested result is to verify that the selected backend actually coordinates operations. What should the engineer select?

  1. Use terraform force-unlock LOCK_ID only after verification
  2. Distinguish backend locking support from remote storage
  3. Recognize lock ownership metadata
  4. Recognize lock acquisition occurs around state operations

Explanation

Correct Answer

B:

A remote backend may store state but have different locking capabilities; sharing storage is not proof that concurrent writers are safe; this behavior should be assessed against the concrete need to verify that the selected backend actually coordinates operations. This directly supports the task to verify that the selected backend actually coordinates operations during a deployment checklist.

Incorrect Answers

A:

Force-unlock bypasses normal safeguards and can permit conflicting state writes; the lock ID helps ensure the intended lock is targeted; this behavior should be assessed against the concrete need to verify that the selected backend actually coordinates operations. The stated requirement is to verify that the selected backend actually coordinates operations, not to clear a stale lock when the original owner is definitely inactive; this alternative addresses a different control or phase.

C:

Lock reports can include identifying information about the holder and operation; investigate the legitimate owner before overriding anything; this behavior should be assessed against the concrete need to verify that the selected backend actually coordinates operations. The distinction matters here: using that mechanism to diagnose whether another run or process holds a state lock would still leave the objective to verify that the selected backend actually coordinates operations unmet.

D:

Terraform may need to lock state for a safe plan or apply; a lock error is not itself an API authentication or HCL syntax error; this behavior should be assessed against the concrete need to verify that the selected backend actually coordinates operations. It may support a related workflow, but the question specifically requires the mechanism for verify that the selected backend actually coordinates operations rather than understand why a run can fail before any resource creation.

Question 617

During a planned migration, the team must accomplish all of these distinct aims: (1) retain recoverable previous snapshots for disaster response; (2) secure a centrally stored record of infrastructure attributes; (3) separate staging and production resource bindings. Select exactly the three relevant mechanisms. Choose THREE.

  1. Recognize backend blocks cannot use var.* expressions
  2. Protect remote state with encryption and restricted IAM
  3. Use a backend with versioned object storage when possible
  4. Enable state locking when supported
  5. Use terraform init -migrate-state for a backend switch
  6. Use distinct state keys or workspaces for environments

Explanation

Correct Answers

B:

Remote state can include secrets, IDs, and metadata; confidentiality and access authorization are required even when console outputs are marked sensitive; this behavior should be assessed against the concrete need to retain recoverable previous snapshots for disaster response and secure a centrally stored record of infrastructure attributes and separate staging and production resource bindings. This matches the distinct objective to secure a centrally stored record of infrastructure attributes; the remaining chosen features address retain recoverable previous snapshots for disaster response and separate staging and production resource bindings.

C:

Storage-side version history can assist state recovery after mistakes; it does not automatically repair corrupt resource bindings or provider permissions; this behavior should be assessed against the concrete need to retain recoverable previous snapshots for disaster response and secure a centrally stored record of infrastructure attributes and separate staging and production resource bindings. This matches the distinct objective to retain recoverable previous snapshots for disaster response; the remaining chosen features address secure a centrally stored record of infrastructure attributes and separate staging and production resource bindings.

F:

Isolation prevents two environments from sharing addresses and IDs in one state; the storage service can still be shared if access boundaries are enforced; this behavior should be assessed against the concrete need to retain recoverable previous snapshots for disaster response and secure a centrally stored record of infrastructure attributes and separate staging and production resource bindings. This matches the distinct objective to separate staging and production resource bindings; the remaining chosen features address retain recoverable previous snapshots for disaster response and secure a centrally stored record of infrastructure attributes.

Incorrect Answers

A:

Terraform initializes its backend before normal expression evaluation and variable processing; use supported partial configuration mechanisms instead; this behavior should be assessed against the concrete need to retain recoverable previous snapshots for disaster response and secure a centrally stored record of infrastructure attributes and separate staging and production resource bindings. Its main application is to avoid treating backend setup like an ordinary runtime variable evaluation; the checklist instead asks for retain recoverable previous snapshots for disaster response; and secure a centrally stored record of infrastructure attributes; and separate staging and production resource bindings. None of those distinct criteria specifically calls for this alternative.

D:

Storage alone does not coordinate multiple applies; the backend's documented locking behavior must be configured and understood; this behavior should be assessed against the concrete need to retain recoverable previous snapshots for disaster response and secure a centrally stored record of infrastructure attributes and separate staging and production resource bindings. Its main application is to protect the authoritative snapshot from concurrent writers; the checklist instead asks for retain recoverable previous snapshots for disaster response; and secure a centrally stored record of infrastructure attributes; and separate staging and production resource bindings. None of those distinct criteria specifically calls for this alternative.

E:

Migration helps preserve object bindings when changing backends; backup and verify the source state first because the operation affects management continuity; this behavior should be assessed against the concrete need to retain recoverable previous snapshots for disaster response and secure a centrally stored record of infrastructure attributes and separate staging and production resource bindings. Its main application is to copy existing state to the new location during reinitialization; the checklist instead asks for retain recoverable previous snapshots for disaster response; and secure a centrally stored record of infrastructure attributes; and separate staging and production resource bindings. None of those distinct criteria specifically calls for this alternative.

Question 618

A Terraform resource has been renamed or modified outside code. The requirement is to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched. Which Terraform mechanism directly meets this requirement?

  1. Use a removed block with destroy = false
  2. Treat out-of-band tag updates as drift
  3. Compare stored state with a freshly evaluated plan
  4. Use terraform state pull for an administrative snapshot
  5. Use terraform state rm to forget an object

Explanation

Correct Answer

A:

The removed block records the intentional withdrawal of management without instructing the provider to delete the remote object; it is not a mere address rename like a moved block; this behavior should be assessed against the concrete need to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched. This directly supports the task to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched during an automated release.

Incorrect Answers

B:

Terraform may plan to restore declared tags unless lifecycle rules deliberately ignore certain changes; the external edit does not automatically rewrite HCL; this behavior should be assessed against the concrete need to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched. It may support a related workflow, but the question specifically requires the mechanism for document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched rather than understand reconciliation when provider-observed values differ from HCL.

C:

State holds a previous observation rather than live inventory; a new normal plan asks the provider for current properties and can expose drift that a static state inspection alone would miss; this behavior should be assessed against the concrete need to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched. The stated requirement is to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched, not to identify whether old recorded values still reflect remote reality after out-of-band changes; this alternative addresses a different control or phase.

D:

Pull emits the full state, potentially including secrets; it should not be treated as a public debugging log; this behavior should be assessed against the concrete need to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched. That can be useful when the aim is to download a copy of the current backend state for protected inspection, but it does not directly deliver the requested ability to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched.

E:

The command removes an address from state; the remote object remains, but a still-present resource block may plan a new object later; this behavior should be assessed against the concrete need to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched. The distinction matters here: using that mechanism to stop managing a specific binding without deleting the infrastructure would still leave the objective to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched unmet.

Question 619

In a planned migration, the requested result is to recognize that local state can be locked to avoid concurrent local access. What should the engineer select?

  1. Understand a local backend's locking mechanism
  2. Use CLI workspaces for separate local state snapshots
  3. Distinguish terraform.tfstate from .terraform/terraform.tfstate
  4. Avoid deleting state to repair an ordinary HCL error

Explanation

Correct Answer

A:

The local backend uses local filesystem locking where supported; it does not coordinate developers operating separate copies on different machines; this behavior should be assessed against the concrete need to recognize that local state can be locked to avoid concurrent local access. This directly supports the task to recognize that local state can be locked to avoid concurrent local access during a deployment checklist.

Incorrect Answers

B:

Terraform CLI workspaces select different state instances; local nondefault workspaces use workspace-specific file locations; they do not establish HCP workspace permissions; this behavior should be assessed against the concrete need to recognize that local state can be locked to avoid concurrent local access. It may support a related workflow, but the question specifically requires the mechanism for recognize that local state can be locked to avoid concurrent local access rather than isolate environments while sharing the same root configuration.

C:

The top-level file may contain actual local state; the file under .terraform/ holds initialization/backend information and may include credential-related settings; this behavior should be assessed against the concrete need to recognize that local state can be locked to avoid concurrent local access. The stated requirement is to recognize that local state can be locked to avoid concurrent local access, not to separate infrastructure state from local backend configuration metadata; this alternative addresses a different control or phase.

D:

Removing state does not delete remote objects, but it removes their managed mappings; a later plan may attempt duplicate creation rather than fixing source syntax; this behavior should be assessed against the concrete need to recognize that local state can be locked to avoid concurrent local access. That can be useful when the aim is to prevent Terraform from losing track of existing objects, but it does not directly deliver the requested ability to recognize that local state can be locked to avoid concurrent local access.

Question 620

Two automation workers can run Terraform concurrently. The team must both avoid interrupting an active legitimate Terraform operation and clear a stale lock when the original owner is definitely inactive. Which paired choice implements those distinct goals?

  1. Recognize lock ownership metadata + Use a backend with state locking
  2. Wait for a held lock to be released + Use terraform force-unlock LOCK_ID only after verification
  3. Wait for a held lock to be released + Serialize applies in CI for a shared workspace
  4. Recognize lock acquisition occurs around state operations + Use terraform force-unlock LOCK_ID only after verification

Explanation

Correct Answer

B:

For the first criterion, a lock usually means another process is modifying the same state; waiting is safer than forcing unlock while the first run is still active; this behavior should be assessed against the concrete need to avoid interrupting an active legitimate Terraform operation and clear a stale lock when the original owner is definitely inactive; this directly addresses the need to avoid interrupting an active legitimate Terraform operation. For the separate second criterion, force-unlock bypasses normal safeguards and can permit conflicting state writes; the lock ID helps ensure the intended lock is targeted; this behavior should be assessed against the concrete need to avoid interrupting an active legitimate Terraform operation and clear a stale lock when the original owner is definitely inactive; this fulfills the need to clear a stale lock when the original owner is definitely inactive. Together they cover the independent tasks of avoid interrupting an active legitimate Terraform operation and clear a stale lock when the original owner is definitely inactive without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure is intended to diagnose whether another run or process holds a state lock: Lock reports can include identifying information about the holder and operation; investigate the legitimate owner before overriding anything; this behavior should be assessed against the concrete need to avoid interrupting an active legitimate Terraform operation and clear a stale lock when the original owner is definitely inactive. The second measure is intended to prevent simultaneous runs from overwriting shared state: Backends that support locking serialize state-changing operations; this guards consistency but does not replace change approval; this behavior should be assessed against the concrete need to avoid interrupting an active legitimate Terraform operation and clear a stale lock when the original owner is definitely inactive. Neither is the directly designated method for the separate goals of avoid interrupting an active legitimate Terraform operation and clear a stale lock when the original owner is definitely inactive in this review.

C:

The first measure meets the requirement to avoid interrupting an active legitimate Terraform operation, but its partner serves a different role: Pipeline serialization reduces contention and conflicting approval assumptions; backend locking is an additional integrity layer rather than a full deployment scheduler; this behavior should be assessed against the concrete need to avoid interrupting an active legitimate Terraform operation and clear a stale lock when the original owner is definitely inactive. That second component is designed to avoid overlapping infrastructure modifications even when locks exist, so the still-missing criterion is to clear a stale lock when the original owner is definitely inactive, while the first criterion remains avoid interrupting an active legitimate Terraform operation.

D:

The second measure does meet the clear a stale lock when the original owner is definitely inactive requirement, but the first is designed for another concern: Terraform may need to lock state for a safe plan or apply; a lock error is not itself an API authentication or HCL syntax error; this behavior should be assessed against the concrete need to avoid interrupting an active legitimate Terraform operation and clear a stale lock when the original owner is definitely inactive. That first component is designed to understand why a run can fail before any resource creation, which does not accomplish the requested task to avoid interrupting an active legitimate Terraform operation, even though the other measure satisfies clear a stale lock when the original owner is definitely inactive.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests