Question 590
A Terraform rollout has separate acceptance criteria: stop managing a specific binding without deleting the infrastructure and add an unmanaged object into the current state under a declared address. Which combined approach directly satisfies the two criteria?
- Use
terraform apply -refresh-only when appropriate + Use an import block to adopt a preexisting object
- Use
terraform state rm to forget an object + Use an import block to adopt a preexisting object
- Use
terraform state rm to forget an object + Use terraform plan -refresh-only
- Use a
moved block for an address rename + Use terraform state list to inspect bindings
Explanation
Correct Answer
B:For the first criterion, 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 stop managing a specific binding without deleting the infrastructure and add an unmanaged object into the current state under a declared address; this directly addresses the need to stop managing a specific binding without deleting the infrastructure. For the separate second criterion, 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 stop managing a specific binding without deleting the infrastructure and add an unmanaged object into the current state under a declared address; this fulfills the need to add an unmanaged object into the current state under a declared address. Together they cover the independent tasks of stop managing a specific binding without deleting the infrastructure and add an unmanaged object into the current state under a declared address without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the add an unmanaged object into the current state under a declared address requirement, but the first is designed for another concern: 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 stop managing a specific binding without deleting the infrastructure and add an unmanaged object into the current state under a declared address. That first component is designed to commit the newly observed remote attributes to state without altering cloud objects, which does not accomplish the requested task to stop managing a specific binding without deleting the infrastructure, even though the other measure satisfies add an unmanaged object into the current state under a declared address.
C:The first measure meets the requirement to stop managing a specific binding without deleting the infrastructure, but its partner serves a different role: 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 stop managing a specific binding without deleting the infrastructure and add an unmanaged object into the current state under a declared address. That second component is designed to preview a state update that accepts the current remote attributes, so the still-missing criterion is to add an unmanaged object into the current state under a declared address, while the first criterion remains stop managing a specific binding without deleting the infrastructure.
D:The first measure is intended to rename a Terraform resource address while preserving ongoing management of the same remote object: 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 stop managing a specific binding without deleting the infrastructure and add an unmanaged object into the current state under a declared address. The second measure is intended to enumerate the tracked resource addresses in the selected state: 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 stop managing a specific binding without deleting the infrastructure and add an unmanaged object into the current state under a declared address. Neither is the directly designated method for the separate goals of stop managing a specific binding without deleting the infrastructure and add an unmanaged object into the current state under a declared address in this review.
Question 591
During a deployment checklist, one task is to separate infrastructure state from local backend configuration metadata, while another is to isolate environments while sharing the same root configuration. Select the matching pair of techniques.
- Set
backend "local" { path = "..." } + Use a remote backend for collaborative state
- Change local state file paths via backend configuration + Use CLI workspaces for separate local state snapshots
- Distinguish
terraform.tfstate from .terraform/terraform.tfstate + Use CLI workspaces for separate local state snapshots
- Distinguish
terraform.tfstate from .terraform/terraform.tfstate + Use the default local backend
- Understand a local backend's locking mechanism + Use CLI workspaces for separate local state snapshots
Explanation
Correct Answer
C:For the first criterion, 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 and isolate environments while sharing the same root configuration; this directly addresses the need to separate infrastructure state from local backend configuration metadata. For the separate second 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 separate infrastructure state from local backend configuration metadata and isolate environments while sharing the same root configuration; this fulfills the need to isolate environments while sharing the same root configuration. Together they cover the independent tasks of separate infrastructure state from local backend configuration metadata and isolate environments while sharing the same root configuration without exchanging the responsibilities of these features.
Incorrect Answers
A:The first 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 separate infrastructure state from local backend configuration metadata and isolate environments while sharing the same root configuration. The second 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 separate infrastructure state from local backend configuration metadata and isolate environments while sharing the same root configuration. Neither is the directly designated method for the separate goals of separate infrastructure state from local backend configuration metadata and isolate environments while sharing the same root configuration in this review.
B:The second measure does meet the isolate environments while sharing the same root configuration requirement, but the first is designed for another concern: 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 and isolate environments while sharing the same root configuration. That first component is designed to control storage without editing internal state JSON manually, which does not accomplish the requested task to separate infrastructure state from local backend configuration metadata, even though the other measure satisfies isolate environments while sharing the same root configuration.
D:The first measure meets the requirement to separate infrastructure state from local backend configuration metadata, 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 separate infrastructure state from local backend configuration metadata and isolate environments while sharing the same root configuration. 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 isolate environments while sharing the same root configuration, while the first criterion remains separate infrastructure state from local backend configuration metadata.
E:The second measure does meet the isolate environments while sharing the same root configuration 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 separate infrastructure state from local backend configuration metadata and isolate environments while sharing the same root configuration. 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 separate infrastructure state from local backend configuration metadata, even though the other measure satisfies isolate environments while sharing the same root configuration.
Question 592
The immediate Terraform task is to understand why a run can fail before any resource creation. Which method handles that task most directly?
- Recognize lock ownership metadata
- Distinguish backend locking support from remote storage
- Use separate states to reduce unrelated lock contention
- Recognize lock acquisition occurs around state operations
- Use
terraform force-unlock LOCK_ID only after verification
Explanation
Correct Answer
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 understand why a run can fail before any resource creation. This directly supports the task to understand why a run can fail before any resource creation during a configuration change.
Incorrect Answers
A: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 understand why a run can fail before any resource creation. The distinction matters here: using that mechanism to diagnose whether another run or process holds a state lock would still leave the objective to understand why a run can fail before any resource creation unmet.
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 understand why a run can fail before any resource creation. It may support a related workflow, but the question specifically requires the mechanism for understand why a run can fail before any resource creation rather than verify that the selected backend actually coordinates operations.
C: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 understand why a run can fail before any resource creation. The stated requirement is to understand why a run can fail before any resource creation, not to isolate independently managed infrastructure components; this alternative addresses a different control or phase.
E: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 understand why a run can fail before any resource creation. 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 understand why a run can fail before any resource creation unmet.
Question 593
In an automated release, the requested result is to separate staging and production resource bindings. What should the engineer select?
- Use backend migration instead of copying arbitrary JSON
- Avoid committing
.terraform/ backend metadata
- Use distinct state keys or workspaces for environments
- Use
terraform init -reconfigure when not migrating
- Understand
terraform_remote_state reads root outputs
- Use
terraform init -migrate-state for a backend switch
Explanation
Correct Answer
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 separate staging and production resource bindings. This directly supports the task to separate staging and production resource bindings during a module implementation.
Incorrect Answers
A: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 separate staging and production resource bindings. That can be useful when the aim is to preserve state metadata while switching storage, but it does not directly deliver the requested ability to separate staging and production resource bindings.
B: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 separate staging and production resource bindings. The distinction matters here: using that mechanism to prevent local initialization secrets and settings from entering Git would still leave the objective to separate staging and production resource bindings unmet.
D: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 separate staging and production resource bindings. The stated requirement is to separate staging and production resource bindings, not to accept new backend settings without copying old state; this alternative addresses a different control or phase.
E: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 separate staging and production resource bindings. 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 separate staging and production resource bindings.
F: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 separate staging and production resource bindings. The distinction matters here: using that mechanism to copy existing state to the new location during reinitialization would still leave the objective to separate staging and production resource bindings unmet.
Question 594
An engineer needs to understand reconciliation when provider-observed values differ from HCL as part of an automated release. Which option is the best fit?
- Use a normal
terraform plan to assess drift
- Use
terraform state list to inspect bindings
- Treat out-of-band tag updates as drift
- Use
terraform state rm to forget an object
Explanation
Correct Answer
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 understand reconciliation when provider-observed values differ from HCL. This directly supports the task to understand reconciliation when provider-observed values differ from HCL during an infrastructure audit.
Incorrect Answers
A: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 understand reconciliation when provider-observed values differ from HCL. The stated requirement is to understand reconciliation when provider-observed values differ from HCL, not to compare declared intent with refreshed remote resource attributes; this alternative addresses a different control or phase.
B: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 understand reconciliation when provider-observed values differ from HCL. That can be useful when the aim is to enumerate the tracked resource addresses in the selected state, but it does not directly deliver the requested ability to understand reconciliation when provider-observed values differ from HCL.
D: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 understand reconciliation when provider-observed values differ from HCL. It may support a related workflow, but the question specifically requires the mechanism for understand reconciliation when provider-observed values differ from HCL rather than stop managing a specific binding without deleting the infrastructure.
Question 595
The immediate Terraform task is to control storage without editing internal state JSON manually. Which method handles that task most directly?
- Change local state file paths via backend configuration
- Keep local state out of Git
- Protect local workstation backups
- Understand a local backend's locking mechanism
- Use a remote backend for collaborative state
Explanation
Correct Answer
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 control storage without editing internal state JSON manually. This directly supports the task to control storage without editing internal state JSON manually during a configuration change.
Incorrect Answers
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 control storage without editing internal state JSON manually. That can be useful when the aim is to avoid exposing sensitive resource attributes in repository history, but it does not directly deliver the requested ability to control storage without editing internal state JSON manually.
C:Copies of state and plan files can expose provider-returned secrets; encrypting disks and limiting file access remain important even for demonstration environments; this behavior should be assessed against the concrete need to control storage without editing internal state JSON manually. The distinction matters here: using that mechanism to include state confidentiality in developer-machine security would still leave the objective to control storage without editing internal state JSON manually unmet.
D: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 control storage without editing internal state JSON manually. It may support a related workflow, but the question specifically requires the mechanism for control storage without editing internal state JSON manually rather than recognize that local state can be locked to avoid concurrent local access.
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 control storage without editing internal state JSON manually. The stated requirement is to control storage without editing internal state JSON manually, not to share one authoritative object mapping across team members; this alternative addresses a different control or phase.
Question 596
A Terraform rollout has separate acceptance criteria: avoid overlapping infrastructure modifications even when locks exist and isolate independently managed infrastructure components. Which combined approach directly satisfies the two criteria?
- Recognize lock acquisition occurs around state operations + Use separate states to reduce unrelated lock contention
- Keep lock tokens or IDs private to administrators + Use a backend with state locking
- Serialize applies in CI for a shared workspace + Use separate states to reduce unrelated lock contention
- Serialize applies in CI for a shared workspace + Recognize lock ownership metadata
- Understand a crash can leave a stale lock + Use separate states to reduce unrelated lock contention
Explanation
Correct Answer
C:For the first criterion, 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 overlapping infrastructure modifications even when locks exist and isolate independently managed infrastructure components; this directly addresses the need to avoid overlapping infrastructure modifications even when locks exist. For the separate second criterion, 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 overlapping infrastructure modifications even when locks exist and isolate independently managed infrastructure components; this fulfills the need to isolate independently managed infrastructure components. Together they cover the independent tasks of avoid overlapping infrastructure modifications even when locks exist and isolate independently managed infrastructure components without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the isolate independently managed infrastructure components 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 overlapping infrastructure modifications even when locks exist and isolate independently managed infrastructure components. 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 overlapping infrastructure modifications even when locks exist, even though the other measure satisfies isolate independently managed infrastructure components.
B: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 avoid overlapping infrastructure modifications even when locks exist and isolate independently managed infrastructure components. 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 overlapping infrastructure modifications even when locks exist and isolate independently managed infrastructure components. Neither is the directly designated method for the separate goals of avoid overlapping infrastructure modifications even when locks exist and isolate independently managed infrastructure components in this review.
D:The first measure meets the requirement to avoid overlapping infrastructure modifications even when locks exist, but its partner serves a different role: 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 overlapping infrastructure modifications even when locks exist and isolate independently managed infrastructure components. That second component is designed to diagnose whether another run or process holds a state lock, so the still-missing criterion is to isolate independently managed infrastructure components, while the first criterion remains avoid overlapping infrastructure modifications even when locks exist.
E:The second measure does meet the isolate independently managed infrastructure components requirement, but the first is designed for another concern: 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 overlapping infrastructure modifications even when locks exist and isolate independently managed infrastructure components. That first component is designed to distinguish genuine active operations from abandoned lock records, which does not accomplish the requested task to avoid overlapping infrastructure modifications even when locks exist, even though the other measure satisfies isolate independently managed infrastructure components.
Question 597
An engineer needs to preserve state metadata while switching storage as part of an automated release. Which option is the best fit?
- Use
terraform init -reconfigure when not migrating
- Use
terraform init -migrate-state for a backend switch
- Recognize backend blocks cannot use
var.* expressions
- Use backend migration instead of copying arbitrary JSON
- Enable state locking when supported
Explanation
Correct Answer
D: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 preserve state metadata while switching storage. This directly supports the task to preserve state metadata while switching storage during an infrastructure audit.
Incorrect Answers
A: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 preserve state metadata while switching storage. The distinction matters here: using that mechanism to accept new backend settings without copying old state would still leave the objective to preserve state metadata while switching storage unmet.
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 preserve state metadata while switching storage. It may support a related workflow, but the question specifically requires the mechanism for preserve state metadata while switching storage rather than copy existing state to the new location during reinitialization.
C: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 preserve state metadata while switching storage. The stated requirement is to preserve state metadata while switching storage, not to avoid treating backend setup like an ordinary runtime variable evaluation; this alternative addresses a different control or phase.
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 preserve state metadata while switching storage. The distinction matters here: using that mechanism to protect the authoritative snapshot from concurrent writers would still leave the objective to preserve state metadata while switching storage unmet.
Question 598
An infrastructure team is choosing safe state-refactoring and drift actions. Two independent changes are requested: first, download a copy of the current backend state for protected inspection; second, understand why Terraform may propose creation again. Which pair of measures fulfills both?
- Use
terraform state pull for an administrative snapshot + Use terraform apply -refresh-only when appropriate
- Use
terraform state pull for an administrative snapshot + Treat a deleted remote object as drift
- Treat out-of-band tag updates as drift + Use
terraform plan -refresh-only
- Use
terraform state rm to forget an object + Treat a deleted remote object as drift
Explanation
Correct Answer
B:For the first criterion, 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 and understand why Terraform may propose creation again; this directly addresses the need to download a copy of the current backend state for protected inspection. For the separate second criterion, 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 download a copy of the current backend state for protected inspection and understand why Terraform may propose creation again; this fulfills the need to understand why Terraform may propose creation again. Together they cover the independent tasks of download a copy of the current backend state for protected inspection and understand why Terraform may propose creation again without exchanging the responsibilities of these features.
Incorrect Answers
A:The first measure meets the requirement to download a copy of the current backend state for protected inspection, but its partner serves a different role: 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 download a copy of the current backend state for protected inspection and understand why Terraform may propose creation again. That second component is designed to commit the newly observed remote attributes to state without altering cloud objects, so the still-missing criterion is to understand why Terraform may propose creation again, while the first criterion remains download a copy of the current backend state for protected inspection.
C:The first 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 download a copy of the current backend state for protected inspection and understand why Terraform may propose creation again. The second measure is intended to preview a state update that accepts the current remote attributes: 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 download a copy of the current backend state for protected inspection and understand why Terraform may propose creation again. Neither is the directly designated method for the separate goals of download a copy of the current backend state for protected inspection and understand why Terraform may propose creation again in this review.
D:The second measure does meet the understand why Terraform may propose creation again 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 download a copy of the current backend state for protected inspection and understand why Terraform may propose creation again. That first component is designed to stop managing a specific binding without deleting the infrastructure, which does not accomplish the requested task to download a copy of the current backend state for protected inspection, even though the other measure satisfies understand why Terraform may propose creation again.
Question 599
In an automated release, the requested result is to prevent Terraform from losing track of existing objects. What should the engineer select?
- Use the default
local backend
- Avoid deleting state to repair an ordinary HCL error
- Understand a local backend's locking mechanism
- Recognize
terraform.tfstate.backup
- Keep local state out of Git
Explanation
Correct Answer
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 prevent Terraform from losing track of existing objects. This directly supports the task to prevent Terraform from losing track of existing objects during a module implementation.
Incorrect Answers
A: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 prevent Terraform from losing track of existing objects. That can be useful when the aim is to store state in a local filesystem file without configuring a remote backend, but it does not directly deliver the requested ability to prevent Terraform from losing track of existing objects.
C: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 prevent Terraform from losing track of existing objects. It may support a related workflow, but the question specifically requires the mechanism for prevent Terraform from losing track of existing objects rather than recognize that local state can be locked to avoid concurrent local access.
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 prevent Terraform from losing track of existing objects. The stated requirement is to prevent Terraform from losing track of existing objects, not to understand a local backup snapshot that may contain sensitive information; this alternative addresses a different control or phase.
E: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 prevent Terraform from losing track of existing objects. That can be useful when the aim is to avoid exposing sensitive resource attributes in repository history, but it does not directly deliver the requested ability to prevent Terraform from losing track of existing objects.
Question 600
A team needs to understand lock contention. The team must both keep concurrency protection during normal writes and diagnose whether another run or process holds a state lock. Which paired choice implements those distinct goals?
- Recognize lock acquisition occurs around state operations + Recognize lock ownership metadata
- Use
terraform force-unlock LOCK_ID only after verification + Recognize lock ownership metadata
- Distinguish backend locking support from remote storage + Wait for a held lock to be released
- Avoid
-lock=false for shared production state + Use a backend with state locking
- Avoid
-lock=false for shared production state + Recognize lock ownership metadata
Explanation
Correct Answer
E:For the first criterion, 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 and diagnose whether another run or process holds a state lock; this directly addresses the need to keep concurrency protection during normal writes. For the separate second criterion, 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 keep concurrency protection during normal writes and diagnose whether another run or process holds a state lock; this fulfills the need to diagnose whether another run or process holds a state lock. Together they cover the independent tasks of keep concurrency protection during normal writes and diagnose whether another run or process holds a state lock without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the diagnose whether another run or process holds a state lock 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 keep concurrency protection during normal writes and diagnose whether another run or process holds a state lock. That first component is designed to understand why a run can fail before any resource creation, which does not accomplish the requested task to keep concurrency protection during normal writes, even though the other measure satisfies diagnose whether another run or process holds a state lock.
B:The second measure does meet the diagnose whether another run or process holds a state lock requirement, but the first is designed for another concern: 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 keep concurrency protection during normal writes and diagnose whether another run or process holds a state lock. That first component is designed to clear a stale lock when the original owner is definitely inactive, which does not accomplish the requested task to keep concurrency protection during normal writes, even though the other measure satisfies diagnose whether another run or process holds a state lock.
C:The first measure is intended to verify that the selected backend actually coordinates operations: 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 and diagnose whether another run or process holds a state lock. The second measure is intended to avoid interrupting an active legitimate Terraform operation: 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 keep concurrency protection during normal writes and diagnose whether another run or process holds a state lock. Neither is the directly designated method for the separate goals of keep concurrency protection during normal writes and diagnose whether another run or process holds a state lock in this review.
D:The first measure meets the requirement to keep concurrency protection during normal writes, but its partner serves a different role: 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 keep concurrency protection during normal writes and diagnose whether another run or process holds a state lock. That second component is designed to prevent simultaneous runs from overwriting shared state, so the still-missing criterion is to diagnose whether another run or process holds a state lock, while the first criterion remains keep concurrency protection during normal writes.