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

Question 630

In an automated release, the requested result is to preview a state update that accepts the current remote attributes. What should the engineer select?

  1. Treat out-of-band tag updates as drift
  2. Avoid editing raw state JSON
  3. Use terraform state list to inspect bindings
  4. Use terraform plan -refresh-only

Explanation

Correct Answer

D:

Refresh-only does not plan corrective resource changes; applying that plan updates Terraform's state representation of the observed infrastructure; this behavior should be assessed against the concrete need to preview a state update that accepts the current remote attributes. This directly supports the task to preview a state update that accepts the current remote attributes during a module implementation.

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 preview a state update that accepts the current remote attributes. 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 preview a state update that accepts the current remote attributes.

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 preview a state update that accepts the current remote attributes. The distinction matters here: using that mechanism to prevent inconsistent serials, lineages, attributes, and provider references would still leave the objective to preview a state update that accepts the current remote attributes unmet.

C:

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 preview a state update that accepts the current remote attributes. It may support a related workflow, but the question specifically requires the mechanism for preview a state update that accepts the current remote attributes rather than enumerate the tracked resource addresses in the selected state.

Question 631

A Terraform review separates 3 requirements: (1) share one authoritative object mapping across team members; (2) understand a local backup snapshot that may contain sensitive information; (3) recognize that local state can be locked to avoid concurrent local access. Identify the three features that each directly handle one of those requirements. Choose THREE.

  1. Recognize terraform.tfstate.backup
  2. Understand a local backend's locking mechanism
  3. Use CLI workspaces for separate local state snapshots
  4. Distinguish terraform.tfstate from .terraform/terraform.tfstate
  5. Use a remote backend for collaborative state
  6. Keep local state out of Git

Explanation

Correct Answers

A:

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 share one authoritative object mapping across team members and understand a local backup snapshot that may contain sensitive information and recognize that local state can be locked to avoid concurrent local access. This matches the distinct objective to understand a local backup snapshot that may contain sensitive information; the remaining chosen features address share one authoritative object mapping across team members and recognize that local state can be locked to avoid concurrent local access.

B:

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 share one authoritative object mapping across team members and understand a local backup snapshot that may contain sensitive information and recognize that local state can be locked to avoid concurrent local access. This matches the distinct objective to recognize that local state can be locked to avoid concurrent local access; the remaining chosen features address share one authoritative object mapping across team members and understand a local backup snapshot that may contain sensitive information.

E:

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 share one authoritative object mapping across team members and understand a local backup snapshot that may contain sensitive information and recognize that local state can be locked to avoid concurrent local access. This matches the distinct objective to share one authoritative object mapping across team members; the remaining chosen features address understand a local backup snapshot that may contain sensitive information and recognize that local state can be locked to avoid concurrent local access.

Incorrect Answers

C:

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 share one authoritative object mapping across team members and understand a local backup snapshot that may contain sensitive information and recognize that local state can be locked to avoid concurrent local access. Its main application is to isolate environments while sharing the same root configuration; the checklist instead asks for share one authoritative object mapping across team members; and understand a local backup snapshot that may contain sensitive information; and recognize that local state can be locked to avoid concurrent local access. None of those distinct criteria specifically calls for this alternative.

D:

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 share one authoritative object mapping across team members and understand a local backup snapshot that may contain sensitive information and recognize that local state can be locked to avoid concurrent local access. Its main application is to separate infrastructure state from local backend configuration metadata; the checklist instead asks for share one authoritative object mapping across team members; and understand a local backup snapshot that may contain sensitive information; and recognize that local state can be locked to avoid concurrent local access. None of those distinct criteria specifically calls for this alternative.

F:

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 share one authoritative object mapping across team members and understand a local backup snapshot that may contain sensitive information and recognize that local state can be locked to avoid concurrent local access. Its main application is to avoid exposing sensitive resource attributes in repository history; the checklist instead asks for share one authoritative object mapping across team members; and understand a local backup snapshot that may contain sensitive information; and recognize that local state can be locked to avoid concurrent local access. None of those distinct criteria specifically calls for this alternative.

Question 632

The immediate Terraform task is to clear a stale lock when the original owner is definitely inactive. Which method handles that task most directly?

  1. Use terraform force-unlock LOCK_ID only after verification
  2. Serialize applies in CI for a shared workspace
  3. Keep lock tokens or IDs private to administrators
  4. Understand a crash can leave a stale lock

Explanation

Correct Answer

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 clear a stale lock when the original owner is definitely inactive. This directly supports the task to clear a stale lock when the original owner is definitely inactive during a configuration change.

Incorrect Answers

B:

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 clear a stale lock when the original owner is definitely inactive. That can be useful when the aim is to avoid overlapping infrastructure modifications even when locks exist, but it does not directly deliver the requested ability to clear a stale lock when the original owner is definitely inactive.

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 clear a stale lock when the original owner is definitely inactive. The distinction matters here: using that mechanism to avoid accidental interference with someone else's active run would still leave the objective to clear a stale lock when the original owner is definitely inactive unmet.

D:

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 clear a stale lock when the original owner is definitely inactive. It may support a related workflow, but the question specifically requires the mechanism for clear a stale lock when the original owner is definitely inactive rather than distinguish genuine active operations from abandoned lock records.

Question 633

A platform team is configuring remote state securely. The checklist contains independent tasks: (1) secure a centrally stored record of infrastructure attributes; (2) separate staging and production resource bindings. Which two options directly correspond to the respective tasks? Choose TWO.

  1. Use terraform init -migrate-state for a backend switch
  2. Use backend migration instead of copying arbitrary JSON
  3. Use distinct state keys or workspaces for environments
  4. Protect remote state with encryption and restricted IAM
  5. Enable state locking when supported
  6. Run terraform init after declaring a backend

Explanation

Correct Answers

C:

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 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 secure a centrally stored record of infrastructure attributes.

D:

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 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 separate staging and production resource bindings.

Incorrect Answers

A:

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

B:

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 secure a centrally stored record of infrastructure attributes and separate staging and production resource bindings. Its main application is to preserve state metadata while switching storage; the checklist instead asks for 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:

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

F:

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 secure a centrally stored record of infrastructure attributes and separate staging and production resource bindings. Its main application is to initialize the configured state location before normal operations; the checklist instead asks for 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 634

An infrastructure team is choosing safe state-refactoring and drift actions. The team must both document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched and enumerate the tracked resource addresses in the selected state. Which paired choice implements those distinct goals?

  1. Use a removed block with destroy = false + Use a normal terraform plan to assess drift
  2. Use terraform state pull for an administrative snapshot + Use terraform state list to inspect bindings
  3. Use a removed block with destroy = false + Use terraform state list to inspect bindings
  4. Use terraform state mv for imperative state relocation + Treat out-of-band tag updates as drift

Explanation

Correct Answer

C:

For the first criterion, 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 and enumerate the tracked resource addresses in the selected state; this directly addresses the need to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched. For the separate second criterion, 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 document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched and enumerate the tracked resource addresses in the selected state; this fulfills the need to enumerate the tracked resource addresses in the selected state. Together they cover the independent tasks of document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched and enumerate the tracked resource addresses in the selected state without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure meets the requirement to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched, but its partner serves a different role: 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 document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched and enumerate the tracked resource addresses in the selected state. That second component is designed to compare declared intent with refreshed remote resource attributes, so the still-missing criterion is to enumerate the tracked resource addresses in the selected state, while the first criterion remains document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched.

B:

The second measure does meet the enumerate the tracked resource addresses in the selected state requirement, but the first is designed for another concern: 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 and enumerate the tracked resource addresses in the selected state. That first component is designed to download a copy of the current backend state for protected inspection, which does not accomplish the requested task to document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched, even though the other measure satisfies enumerate the tracked resource addresses in the selected state.

D:

The first measure is intended to change which Terraform address owns an existing object: 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 document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched and enumerate the tracked resource addresses in the selected state. 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 document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched and enumerate the tracked resource addresses in the selected state. Neither is the directly designated method for the separate goals of document a handoff where Terraform relinquishes ownership but leaves deployed infrastructure untouched and enumerate the tracked resource addresses in the selected state in this review.

Question 635

A reviewer has to approve a two-part design: make Terraform adopt the new local or remote state location; additionally, prevent Terraform from losing track of existing objects. Which option pairs the correct mechanisms?

  1. Understand a local backend's locking mechanism + Avoid deleting state to repair an ordinary HCL error
  2. Reinitialize after changing backend configuration + Distinguish terraform.tfstate from .terraform/terraform.tfstate
  3. Reinitialize after changing backend configuration + Avoid deleting state to repair an ordinary HCL error
  4. Recognize terraform.tfstate.backup + Keep local state out of Git

Explanation

Correct Answer

C:

For the first 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 make Terraform adopt the new local or remote state location and prevent Terraform from losing track of existing objects; this directly addresses the need to make Terraform adopt the new local or remote state location. For the separate second criterion, 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 make Terraform adopt the new local or remote state location and prevent Terraform from losing track of existing objects; this fulfills the need to prevent Terraform from losing track of existing objects. Together they cover the independent tasks of make Terraform adopt the new local or remote state location and prevent Terraform from losing track of existing objects without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the prevent Terraform from losing track of existing objects 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 make Terraform adopt the new local or remote state location and prevent Terraform from losing track of existing objects. 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 make Terraform adopt the new local or remote state location, even though the other measure satisfies prevent Terraform from losing track of existing objects.

B:

The first measure meets the requirement to make Terraform adopt the new local or remote state location, but its partner serves a different role: 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 make Terraform adopt the new local or remote state location and prevent Terraform from losing track of existing objects. That second component is designed to separate infrastructure state from local backend configuration metadata, so the still-missing criterion is to prevent Terraform from losing track of existing objects, while the first criterion remains make Terraform adopt the new local or remote state 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 make Terraform adopt the new local or remote state location and prevent Terraform from losing track of existing objects. 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 make Terraform adopt the new local or remote state location and prevent Terraform from losing track of existing objects. Neither is the directly designated method for the separate goals of make Terraform adopt the new local or remote state location and prevent Terraform from losing track of existing objects in this review.

Question 636

In an automated release, the requested result is to diagnose whether another run or process holds a state lock. What should the engineer select?

  1. Understand a crash can leave a stale lock
  2. Use terraform force-unlock LOCK_ID only after verification
  3. Recognize lock ownership metadata
  4. Avoid -lock=false for shared production state

Explanation

Correct Answer

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 diagnose whether another run or process holds a state lock. This directly supports the task to diagnose whether another run or process holds a state lock during a module implementation.

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 diagnose whether another run or process holds a state lock. That can be useful when the aim is to distinguish genuine active operations from abandoned lock records, but it does not directly deliver the requested ability to diagnose whether another run or process holds a state lock.

B:

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 diagnose whether another run or process holds a state lock. 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 diagnose whether another run or process holds a state lock unmet.

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 diagnose whether another run or process holds a state lock. The stated requirement is to diagnose whether another run or process holds a state lock, not to keep concurrency protection during normal writes; this alternative addresses a different control or phase.

Question 637

A build pipeline must initialize an external state service. The team must both retain recoverable previous snapshots for disaster response and share selected information from another state rather than taking over its resources. Which paired choice implements those distinct goals?

  1. Recognize backend blocks cannot use var.* expressions + Understand terraform_remote_state reads root outputs
  2. Use a backend with versioned object storage when possible + Use terraform init -reconfigure when not migrating
  3. Use terraform init -migrate-state for a backend switch + Declare terraform { backend "s3" { ... } }
  4. Use a backend with versioned object storage when possible + Understand terraform_remote_state reads root outputs

Explanation

Correct Answer

D:

For the first criterion, 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 share selected information from another state rather than taking over its resources; this directly addresses the need to retain recoverable previous snapshots for disaster response. For the separate second criterion, 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 retain recoverable previous snapshots for disaster response and share selected information from another state rather than taking over its resources; this fulfills the need to share selected information from another state rather than taking over its resources. Together they cover the independent tasks of retain recoverable previous snapshots for disaster response and share selected information from another state rather than taking over its resources without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the share selected information from another state rather than taking over its resources requirement, but the first is designed for another concern: 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 share selected information from another state rather than taking over its resources. That first component is designed to avoid treating backend setup like an ordinary runtime variable evaluation, which does not accomplish the requested task to retain recoverable previous snapshots for disaster response, even though the other measure satisfies share selected information from another state rather than taking over its resources.

B:

The first measure meets the requirement to retain recoverable previous snapshots for disaster response, but its partner serves a different role: Reconfiguration forgets the previously initialized backend relationship; it is dangerous if the operator mistakenly believes existing bindings moved with it; this behavior should be assessed against the concrete need to retain recoverable previous snapshots for disaster response and share selected information from another state rather than taking over its resources. That second component is designed to accept new backend settings without copying old state, so the still-missing criterion is to share selected information from another state rather than taking over its resources, while the first criterion remains retain recoverable previous snapshots for disaster response.

C:

The first measure is intended to copy existing state to the new location during reinitialization: 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 share selected information from another state rather than taking over its resources. The second measure is intended to select a supported remote state storage implementation: A backend block chooses Terraform state storage and related settings; it does not configure the AWS provider used for managed resources; this behavior should be assessed against the concrete need to retain recoverable previous snapshots for disaster response and share selected information from another state rather than taking over its resources. Neither is the directly designated method for the separate goals of retain recoverable previous snapshots for disaster response and share selected information from another state rather than taking over its resources in this review.

Question 638

An operator finds differences between state and reality. Two independent changes are requested: first, compare declared intent with refreshed remote resource attributes; second, commit the newly observed remote attributes to state without altering cloud objects. Which pair of measures fulfills both?

  1. Use terraform plan -refresh-only + Use terraform apply -refresh-only when appropriate
  2. Use a normal terraform plan to assess drift + Use terraform state pull for an administrative snapshot
  3. Use terraform state mv for imperative state relocation + Use terraform state rm to forget an object
  4. Use a normal terraform plan to assess drift + Use terraform apply -refresh-only when appropriate

Explanation

Correct Answer

D:

For the first criterion, 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 and commit the newly observed remote attributes to state without altering cloud objects; this directly addresses the need to compare declared intent with refreshed remote resource attributes. For the separate second criterion, 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 compare declared intent with refreshed remote resource attributes and commit the newly observed remote attributes to state without altering cloud objects; this fulfills the need to commit the newly observed remote attributes to state without altering cloud objects. Together they cover the independent tasks of compare declared intent with refreshed remote resource attributes and commit the newly observed remote attributes to state without altering cloud objects without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the commit the newly observed remote attributes to state without altering cloud objects requirement, but the first is designed for another concern: Refresh-only does not plan corrective resource changes; applying that plan updates Terraform's state representation of the observed infrastructure; this behavior should be assessed against the concrete need to compare declared intent with refreshed remote resource attributes and commit the newly observed remote attributes to state without altering cloud objects. That first component is designed to preview a state update that accepts the current remote attributes, which does not accomplish the requested task to compare declared intent with refreshed remote resource attributes, even though the other measure satisfies commit the newly observed remote attributes to state without altering cloud objects.

B:

The first measure meets the requirement to compare declared intent with refreshed remote resource attributes, 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 compare declared intent with refreshed remote resource attributes and commit the newly observed remote attributes to state without altering cloud objects. That second component is designed to download a copy of the current backend state for protected inspection, so the still-missing criterion is to commit the newly observed remote attributes to state without altering cloud objects, while the first criterion remains compare declared intent with refreshed remote resource attributes.

C:

The first measure is intended to change which Terraform address owns an existing object: 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 compare declared intent with refreshed remote resource attributes and commit the newly observed remote attributes to state without altering cloud objects. The second measure is intended to stop managing a specific binding without deleting the infrastructure: 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 and commit the newly observed remote attributes to state without altering cloud objects. Neither is the directly designated method for the separate goals of compare declared intent with refreshed remote resource attributes and commit the newly observed remote attributes to state without altering cloud objects in this review.

Question 639

In an automated release, the requested result is to understand a local backup snapshot that may contain sensitive information. What should the engineer select?

  1. Change local state file paths via backend configuration
  2. Keep local state out of Git
  3. Reinitialize after changing backend configuration
  4. Recognize terraform.tfstate.backup

Explanation

Correct Answer

D:

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. This directly supports the task to understand a local backup snapshot that may contain sensitive information during a module implementation.

Incorrect Answers

A:

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. It may support a related workflow, but the question specifically requires the mechanism for understand a local backup snapshot that may contain sensitive information rather than control storage without editing internal state JSON manually.

B:

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 understand a local backup snapshot that may contain sensitive information. The stated requirement is to understand a local backup snapshot that may contain sensitive information, not to avoid exposing sensitive resource attributes in repository history; this alternative addresses a different control or phase.

C:

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. That can be useful when the aim is to make Terraform adopt the new local or remote state location, but it does not directly deliver the requested ability to understand a local backup snapshot that may contain sensitive information.

Question 640

An operator is resolving a blocked state update. The team must both prevent simultaneous runs from overwriting shared state and let a Terraform operation retry acquiring a busy state lock. Which paired choice implements those distinct goals?

  1. Use a backend with state locking + Distinguish backend locking support from remote storage
  2. Use a backend with state locking + Use -lock-timeout=5m where supported
  3. Recognize lock ownership metadata + Use -lock-timeout=5m where supported
  4. Keep lock tokens or IDs private to administrators + Understand a crash can leave a stale lock

Explanation

Correct Answer

B:

For the first criterion, 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 prevent simultaneous runs from overwriting shared state and let a Terraform operation retry acquiring a busy state lock; this directly addresses the need to prevent simultaneous runs from overwriting shared state. For the separate second criterion, 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 prevent simultaneous runs from overwriting shared state and let a Terraform operation retry acquiring a busy state lock; this fulfills the need to let a Terraform operation retry acquiring a busy state lock. Together they cover the independent tasks of prevent simultaneous runs from overwriting shared state and let a Terraform operation retry acquiring a busy state lock without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure meets the requirement to prevent simultaneous runs from overwriting shared state, but its partner serves a different role: 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 prevent simultaneous runs from overwriting shared state and let a Terraform operation retry acquiring a busy state lock. That second component is designed to verify that the selected backend actually coordinates operations, so the still-missing criterion is to let a Terraform operation retry acquiring a busy state lock, while the first criterion remains prevent simultaneous runs from overwriting shared state.

C:

The second measure does meet the let a Terraform operation retry acquiring a busy state lock requirement, but the first is designed for another concern: 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 prevent simultaneous runs from overwriting shared state and let a Terraform operation retry acquiring a busy state lock. That first component is designed to diagnose whether another run or process holds a state lock, which does not accomplish the requested task to prevent simultaneous runs from overwriting shared state, even though the other measure satisfies let a Terraform operation retry acquiring a busy state lock.

D:

The first measure is intended to avoid accidental interference with someone else's active run: 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 prevent simultaneous runs from overwriting shared state and let a Terraform operation retry acquiring a busy state lock. The second measure is intended to distinguish genuine active operations from abandoned lock records: 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 prevent simultaneous runs from overwriting shared state and let a Terraform operation retry acquiring a busy state lock. Neither is the directly designated method for the separate goals of prevent simultaneous runs from overwriting shared state and let a Terraform operation retry acquiring a busy state lock in this review.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests