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

Question 650

During an infrastructure audit, the team must accomplish all of these distinct aims: (1) enumerate the tracked resource addresses in the selected state; (2) download a copy of the current backend state for protected inspection. Select exactly the two relevant mechanisms. Choose TWO.

  1. Use terraform state list to inspect bindings
  2. Use a removed block with destroy = false
  3. Compare stored state with a freshly evaluated plan
  4. Use terraform state pull for an administrative snapshot
  5. Treat a deleted remote object as drift

Explanation

Correct Answers

A:

The command reports addresses, not a complete catalog of provider-side objects; unmanaged objects will not appear; this behavior should be assessed against the concrete need to enumerate the tracked resource addresses in the selected state and download a copy of the current backend state for protected inspection. This matches the distinct objective to enumerate the tracked resource addresses in the selected state; the remaining chosen features address download a copy of the current backend state for protected inspection.

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 enumerate the tracked resource addresses in the selected state and download a copy of the current backend state for protected inspection. This matches the distinct objective to download a copy of the current backend state for protected inspection; the remaining chosen features address enumerate the tracked resource addresses in the selected state.

Incorrect Answers

B:

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 enumerate the tracked resource addresses in the selected state and download a copy of the current backend state for protected inspection. Its main application is to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched; the checklist instead asks for enumerate the tracked resource addresses in the selected state; and download a copy of the current backend state for protected inspection. None of those distinct criteria specifically calls for this alternative.

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 enumerate the tracked resource addresses in the selected state and download a copy of the current backend state for protected inspection. Its main application is to identify whether old recorded values still reflect remote reality after out-of-band changes; the checklist instead asks for enumerate the tracked resource addresses in the selected state; and download a copy of the current backend state for protected inspection. None of those distinct criteria specifically calls for this alternative.

E:

If a tracked object no longer exists but configuration still declares it, a normal plan may propose recreating it; state alone cannot revive the original object; this behavior should be assessed against the concrete need to enumerate the tracked resource addresses in the selected state and download a copy of the current backend state for protected inspection. Its main application is to understand why Terraform may propose creation again; the checklist instead asks for enumerate the tracked resource addresses in the selected state; and download a copy of the current backend state for protected inspection. None of those distinct criteria specifically calls for this alternative.

Question 651

During a module implementation, one task is to understand a local backup snapshot that may contain sensitive information, while another is to share one authoritative object mapping across team members. Select the matching pair of techniques.

  1. Recognize terraform.tfstate.backup + Reinitialize after changing backend configuration
  2. Understand a local backend's locking mechanism + Use a remote backend for collaborative state
  3. Change local state file paths via backend configuration + Use CLI workspaces for separate local state snapshots
  4. Recognize terraform.tfstate.backup + Use a remote backend for collaborative state

Explanation

Correct Answer

D:

For the first criterion, 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 understand a local backup snapshot that may contain sensitive information and share one authoritative object mapping across team members; this directly addresses the need to understand a local backup snapshot that may contain sensitive information. For the separate second criterion, remote state centralizes updates and often supports distributed locking; this reduces the risk of divergent local state files; this behavior should be assessed against the concrete need to understand a local backup snapshot that may contain sensitive information and share one authoritative object mapping across team members; this fulfills the need to share one authoritative object mapping across team members. Together they cover the independent tasks of understand a local backup snapshot that may contain sensitive information and share one authoritative object mapping across team members without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure meets the requirement to understand a local backup snapshot that may contain sensitive information, but its partner serves a different role: 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 understand a local backup snapshot that may contain sensitive information and share one authoritative object mapping across team members. That second component is designed to make Terraform adopt the new local or remote state location, so the still-missing criterion is to share one authoritative object mapping across team members, while the first criterion remains understand a local backup snapshot that may contain sensitive information.

B:

The second measure does meet the share one authoritative object mapping across team members requirement, but the first is designed for another concern: 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 understand a local backup snapshot that may contain sensitive information and share one authoritative object mapping across team members. That first component is designed to recognize that local state can be locked to avoid concurrent local access, which does not accomplish the requested task to understand a local backup snapshot that may contain sensitive information, even though the other measure satisfies share one authoritative object mapping across team members.

C:

The first measure is intended to control storage without editing internal state JSON manually: 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 understand a local backup snapshot that may contain sensitive information and share one authoritative object mapping across team members. The second measure is intended to isolate environments while sharing the same root configuration: 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 understand a local backup snapshot that may contain sensitive information and share one authoritative object mapping across team members. Neither is the directly designated method for the separate goals of understand a local backup snapshot that may contain sensitive information and share one authoritative object mapping across team members in this review.

Question 652

A Terraform review separates 3 requirements: (1) avoid accidental interference with someone else's active run; (2) prevent simultaneous runs from overwriting shared state; (3) keep concurrency protection during normal writes. Identify the three features that each directly handle one of those requirements. Choose THREE.

  1. Keep lock tokens or IDs private to administrators
  2. Use -lock-timeout=5m where supported
  3. Use a backend with state locking
  4. Avoid -lock=false for shared production state
  5. Use separate states to reduce unrelated lock contention
  6. Use terraform force-unlock LOCK_ID only after verification

Explanation

Correct Answers

A:

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 and prevent simultaneous runs from overwriting shared state and keep concurrency protection during normal writes. This matches the distinct objective to avoid accidental interference with someone else's active run; the remaining chosen features address prevent simultaneous runs from overwriting shared state and keep concurrency protection during normal writes.

C:

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 accidental interference with someone else's active run and prevent simultaneous runs from overwriting shared state and keep concurrency protection during normal writes. This matches the distinct objective to prevent simultaneous runs from overwriting shared state; the remaining chosen features address avoid accidental interference with someone else's active run and keep concurrency protection during normal writes.

D:

Disabling locking increases risk of simultaneous updates and state corruption; it is not a substitute for resolving a stale lock; this behavior should be assessed against the concrete need to avoid accidental interference with someone else's active run and prevent simultaneous runs from overwriting shared state and keep concurrency protection during normal writes. This matches the distinct objective to keep concurrency protection during normal writes; the remaining chosen features address avoid accidental interference with someone else's active run and prevent simultaneous runs from overwriting shared state.

Incorrect Answers

B:

The timeout specifies how long to wait for lock availability before failing; it does not forcibly terminate another process; this behavior should be assessed against the concrete need to avoid accidental interference with someone else's active run and prevent simultaneous runs from overwriting shared state and keep concurrency protection during normal writes. Its main application is to let a Terraform operation retry acquiring a busy state lock; the checklist instead asks for avoid accidental interference with someone else's active run; and prevent simultaneous runs from overwriting shared state; and keep concurrency protection during normal writes. None of those distinct criteria specifically calls for this alternative.

E:

Different state keys or workspaces allow separate lock scopes; splitting state also introduces explicit cross-state integration responsibilities; this behavior should be assessed against the concrete need to avoid accidental interference with someone else's active run and prevent simultaneous runs from overwriting shared state and keep concurrency protection during normal writes. Its main application is to isolate independently managed infrastructure components; the checklist instead asks for avoid accidental interference with someone else's active run; and prevent simultaneous runs from overwriting shared state; and keep concurrency protection during normal writes. None of those distinct criteria specifically calls for this alternative.

F:

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 and prevent simultaneous runs from overwriting shared state and keep concurrency protection during normal writes. Its main application is to clear a stale lock when the original owner is definitely inactive; the checklist instead asks for avoid accidental interference with someone else's active run; and prevent simultaneous runs from overwriting shared state; and keep concurrency protection during normal writes. None of those distinct criteria specifically calls for this alternative.

Question 653

In a planned migration, the requested result is to avoid hardcoding secret authentication fields in HCL or init flags. What should the engineer select?

  1. Run terraform init after declaring a backend
  2. Understand terraform_remote_state reads root outputs
  3. Avoid committing .terraform/ backend metadata
  4. Use backend-specific environment variables for credentials

Explanation

Correct Answer

D:

Environment-based authentication can reduce disclosure in saved metadata and plans; backend permissions must still permit the required state operations; this behavior should be assessed against the concrete need to avoid hardcoding secret authentication fields in HCL or init flags. This directly supports the task to avoid hardcoding secret authentication fields in HCL or init flags during a deployment checklist.

Incorrect Answers

A:

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 hardcoding secret authentication fields in HCL or init flags. The stated requirement is to avoid hardcoding secret authentication fields in HCL or init flags, not to initialize the configured state location before normal operations; this alternative addresses a different control or phase.

B:

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 hardcoding secret authentication fields in HCL or init flags. That can be useful when the aim is to share selected information from another state rather than taking over its resources, but it does not directly deliver the requested ability to avoid hardcoding secret authentication fields in HCL or init flags.

C:

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 hardcoding secret authentication fields in HCL or init flags. The distinction matters here: using that mechanism to prevent local initialization secrets and settings from entering Git would still leave the objective to avoid hardcoding secret authentication fields in HCL or init flags unmet.

Question 654

A Terraform resource has been renamed or modified outside code. The team must both identify whether old recorded values still reflect remote reality after out-of-band changes and prevent inconsistent serials, lineages, attributes, and provider references. Which paired choice implements those distinct goals?

  1. Use terraform state rm to forget an object + Avoid editing raw state JSON
  2. Compare stored state with a freshly evaluated plan + Use terraform state pull for an administrative snapshot
  3. Use terraform apply -refresh-only when appropriate + Treat out-of-band tag updates as drift
  4. Compare stored state with a freshly evaluated plan + Avoid editing raw state JSON

Explanation

Correct Answer

D:

For the first criterion, 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 identify whether old recorded values still reflect remote reality after out-of-band changes and prevent inconsistent serials, lineages, attributes, and provider references; this directly addresses the need to identify whether old recorded values still reflect remote reality after out-of-band changes. For the separate second criterion, 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 identify whether old recorded values still reflect remote reality after out-of-band changes and prevent inconsistent serials, lineages, attributes, and provider references; this fulfills the need to prevent inconsistent serials, lineages, attributes, and provider references. Together they cover the independent tasks of identify whether old recorded values still reflect remote reality after out-of-band changes and prevent inconsistent serials, lineages, attributes, and provider references without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the prevent inconsistent serials, lineages, attributes, and provider references requirement, but the first is designed for another concern: 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 identify whether old recorded values still reflect remote reality after out-of-band changes and prevent inconsistent serials, lineages, attributes, and provider references. That first component is designed to stop managing a specific binding without deleting the infrastructure, which does not accomplish the requested task to identify whether old recorded values still reflect remote reality after out-of-band changes, even though the other measure satisfies prevent inconsistent serials, lineages, attributes, and provider references.

B:

The first measure meets the requirement to identify whether old recorded values still reflect remote reality after out-of-band changes, but its partner serves a different role: 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 identify whether old recorded values still reflect remote reality after out-of-band changes and prevent inconsistent serials, lineages, attributes, and provider references. That second component is designed to download a copy of the current backend state for protected inspection, so the still-missing criterion is to prevent inconsistent serials, lineages, attributes, and provider references, while the first criterion remains identify whether old recorded values still reflect remote reality after out-of-band changes.

C:

The first measure is intended to commit the newly observed remote attributes to state without altering cloud objects: 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 identify whether old recorded values still reflect remote reality after out-of-band changes and prevent inconsistent serials, lineages, attributes, and provider references. The second measure is intended to understand reconciliation when provider-observed values differ from HCL: 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 identify whether old recorded values still reflect remote reality after out-of-band changes and prevent inconsistent serials, lineages, attributes, and provider references. Neither is the directly designated method for the separate goals of identify whether old recorded values still reflect remote reality after out-of-band changes and prevent inconsistent serials, lineages, attributes, and provider references in this review.

Question 655

A reviewer has to approve a two-part design: choose a nondefault local state file location; additionally, understand a local backup snapshot that may contain sensitive information. Which option pairs the correct mechanisms?

  1. Set backend "local" { path = "..." } + Use the default local backend
  2. Set backend "local" { path = "..." } + Recognize terraform.tfstate.backup
  3. Avoid deleting state to repair an ordinary HCL error + Recognize terraform.tfstate.backup
  4. Use a remote backend for collaborative state + Keep local state out of Git

Explanation

Correct Answer

B:

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 understand a local backup snapshot that may contain sensitive information; this directly addresses the need to choose a nondefault local state file location. For the separate second criterion, 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 understand a local backup snapshot that may contain sensitive information; this fulfills the need to understand a local backup snapshot that may contain sensitive information. Together they cover the independent tasks of choose a nondefault local state file location and understand a local backup snapshot that may contain sensitive information without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure meets the requirement to choose a nondefault local state file location, but its partner serves a different role: 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 understand a local backup snapshot that may contain sensitive information. That second component is designed to store state in a local filesystem file without configuring a remote backend, so the still-missing criterion is to understand a local backup snapshot that may contain sensitive information, while the first criterion remains choose a nondefault local state file location.

C:

The second measure does meet the understand a local backup snapshot that may contain sensitive information requirement, but the first is designed for another concern: 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 choose a nondefault local state file location and understand a local backup snapshot that may contain sensitive information. That first component is designed to prevent Terraform from losing track of existing objects, which does not accomplish the requested task to choose a nondefault local state file location, even though the other measure satisfies understand a local backup snapshot that may contain sensitive information.

D:

The first measure is intended to share one authoritative object mapping across team members: Remote state centralizes updates and often supports distributed locking; this reduces the risk of divergent local state files; this behavior should be assessed against the concrete need to choose a nondefault local state file location and understand a local backup snapshot that may contain sensitive information. The second measure is intended to avoid exposing sensitive resource attributes in repository history: 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 understand a local backup snapshot that may contain sensitive information. Neither is the directly designated method for the separate goals of choose a nondefault local state file location and understand a local backup snapshot that may contain sensitive information in this review.

Question 656

In a planned migration, the requested result is to keep concurrency protection during normal writes. What should the engineer select?

  1. Avoid -lock=false for shared production state
  2. Keep lock tokens or IDs private to administrators
  3. Recognize lock acquisition occurs around state operations
  4. Distinguish backend locking support from remote storage

Explanation

Correct Answer

A:

Disabling locking increases risk of simultaneous updates and state corruption; it is not a substitute for resolving a stale lock; this behavior should be assessed against the concrete need to keep concurrency protection during normal writes. This directly supports the task to keep concurrency protection during normal writes during a deployment checklist.

Incorrect Answers

B:

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 keep concurrency protection during normal writes. It may support a related workflow, but the question specifically requires the mechanism for keep concurrency protection during normal writes rather than avoid accidental interference with someone else's active run.

C:

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 keep concurrency protection during normal writes. The stated requirement is to keep concurrency protection during normal writes, not to understand why a run can fail before any resource creation; this alternative addresses a different control or phase.

D:

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 keep concurrency protection during normal writes. That can be useful when the aim is to verify that the selected backend actually coordinates operations, but it does not directly deliver the requested ability to keep concurrency protection during normal writes.

Question 657

An engineer needs to retain recoverable previous snapshots for disaster response as part of a planned migration. Which option is the best fit?

  1. Use a backend with versioned object storage when possible
  2. Use terraform init -migrate-state for a backend switch
  3. Run terraform init after declaring a backend
  4. Enable state locking when supported

Explanation

Correct Answer

A:

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. This directly supports the task to retain recoverable previous snapshots for disaster response during a maintenance request.

Incorrect Answers

B:

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. The distinction matters here: using that mechanism to copy existing state to the new location during reinitialization would still leave the objective to retain recoverable previous snapshots for disaster response unmet.

C:

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 retain recoverable previous snapshots for disaster response. It may support a related workflow, but the question specifically requires the mechanism for retain recoverable previous snapshots for disaster response rather than initialize the configured state location before normal operations.

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. The stated requirement is to retain recoverable previous snapshots for disaster response, not to protect the authoritative snapshot from concurrent writers; this alternative addresses a different control or phase.

Question 658

An infrastructure team is choosing safe state-refactoring and drift actions. The requirement is to compare declared intent with refreshed remote resource attributes. Which Terraform mechanism directly meets this requirement?

  1. Treat out-of-band tag updates as drift
  2. Use a normal terraform plan to assess drift
  3. Use terraform state rm to forget an object
  4. Treat a deleted remote object as drift

Explanation

Correct Answer

B:

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 compare declared intent with refreshed remote resource attributes. This directly supports the task to compare declared intent with refreshed remote resource attributes during an automated release.

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 compare declared intent with refreshed remote resource attributes. The stated requirement is to compare declared intent with refreshed remote resource attributes, not to understand reconciliation when provider-observed values differ from HCL; this alternative addresses a different control or phase.

C:

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 compare declared intent with refreshed remote resource attributes. The distinction matters here: using that mechanism to stop managing a specific binding without deleting the infrastructure would still leave the objective to compare declared intent with refreshed remote resource attributes unmet.

D:

If a tracked object no longer exists but configuration still declares it, a normal plan may propose recreating it; state alone cannot revive the original object; this behavior should be assessed against the concrete need to compare declared intent with refreshed remote resource attributes. It may support a related workflow, but the question specifically requires the mechanism for compare declared intent with refreshed remote resource attributes rather than understand why Terraform may propose creation again.

Question 659

A Terraform rollout has separate acceptance criteria: isolate environments while sharing the same root configuration and make Terraform adopt the new local or remote state location. Which combined approach directly satisfies the two criteria?

  1. Use CLI workspaces for separate local state snapshots + Understand a local backend's locking mechanism
  2. Recognize terraform.tfstate.backup + Reinitialize after changing backend configuration
  3. Use the default local backend + Set backend "local" { path = "..." }
  4. Use CLI workspaces for separate local state snapshots + Reinitialize after changing backend configuration

Explanation

Correct Answer

D:

For the first criterion, 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 isolate environments while sharing the same root configuration and make Terraform adopt the new local or remote state location; this directly addresses the need to isolate environments while sharing the same root configuration. For the separate second criterion, 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 isolate environments while sharing the same root configuration and make Terraform adopt the new local or remote state location; this fulfills the need to make Terraform adopt the new local or remote state location. Together they cover the independent tasks of isolate environments while sharing the same root configuration and make Terraform adopt the new local or remote state location without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure meets the requirement to isolate environments while sharing the same root configuration, but its partner serves a different role: 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 isolate environments while sharing the same root configuration and make Terraform adopt the new local or remote state location. That second component is designed to recognize that local state can be locked to avoid concurrent local access, so the still-missing criterion is to make Terraform adopt the new local or remote state location, while the first criterion remains isolate environments while sharing the same root configuration.

B:

The second measure does meet the make Terraform adopt the new local or remote state location requirement, but the first is designed for another concern: 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 isolate environments while sharing the same root configuration and make Terraform adopt the new local or remote state location. That first component is designed to understand a local backup snapshot that may contain sensitive information, which does not accomplish the requested task to isolate environments while sharing the same root configuration, even though the other measure satisfies make Terraform adopt the new local or remote state location.

C:

The first 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 isolate environments while sharing the same root configuration and make Terraform adopt the new local or remote state location. The second measure is intended to choose a nondefault local state file location: 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 isolate environments while sharing the same root configuration and make Terraform adopt the new local or remote state location. Neither is the directly designated method for the separate goals of isolate environments while sharing the same root configuration and make Terraform adopt the new local or remote state location in this review.

Question 660

An engineer needs to let a Terraform operation retry acquiring a busy state lock as part of a planned migration. Which option is the best fit?

  1. Use -lock-timeout=5m where supported
  2. Use separate states to reduce unrelated lock contention
  3. Use terraform force-unlock LOCK_ID only after verification
  4. Serialize applies in CI for a shared workspace

Explanation

Correct Answer

A:

The timeout specifies how long to wait for lock availability before failing; it does not forcibly terminate another process; this behavior should be assessed against the concrete need to let a Terraform operation retry acquiring a busy state lock. This directly supports the task to let a Terraform operation retry acquiring a busy state lock during a maintenance request.

Incorrect Answers

B:

Different state keys or workspaces allow separate lock scopes; splitting state also introduces explicit cross-state integration responsibilities; this behavior should be assessed against the concrete need to let a Terraform operation retry acquiring a busy state lock. The stated requirement is to let a Terraform operation retry acquiring a busy state lock, not to isolate independently managed infrastructure components; this alternative addresses a different control or phase.

C:

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 let a Terraform operation retry acquiring a busy state lock. That can be useful when the aim is to clear a stale lock when the original owner is definitely inactive, but it does not directly deliver the requested ability to let a Terraform operation retry acquiring a busy state lock.

D:

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 let a Terraform operation retry acquiring a busy state lock. The distinction matters here: using that mechanism to avoid overlapping infrastructure modifications even when locks exist would still leave the objective to let a Terraform operation retry acquiring a busy state lock unmet.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests