Question 150
A Terraform rollout has separate acceptance criteria: plan and delete resources tracked by the current configuration and state and preview the deletions without executing them. Which combined approach directly satisfies the two criteria?
- Use
terraform destroy for a managed deployment + Use terraform plan -destroy for teardown review
- Use
terraform destroy for a managed deployment + Check the selected workspace before destroying
- Understand
prevent_destroy during planned deletion + Preserve required records before teardown
- Use
terraform destroy -target=ADDRESS cautiously + Use terraform plan -destroy for teardown review
- Remove a resource from state without destroying it + Use
terraform plan -destroy for teardown review
Explanation
Correct Answer
A:For the first criterion, destroy requests deletion of Terraform-managed objects in the selected state; it does not search all cloud resources or remove unmanaged objects; this behavior should be assessed against the concrete need to plan and delete resources tracked by the current configuration and state and preview the deletions without executing them; this directly addresses the need to plan and delete resources tracked by the current configuration and state. For the separate second criterion, a destroy plan lists what would be removed and can be saved for approval; it is appropriate before potentially disruptive cleanup; this behavior should be assessed against the concrete need to plan and delete resources tracked by the current configuration and state and preview the deletions without executing them; this fulfills the need to preview the deletions without executing them. Together they cover the independent tasks of plan and delete resources tracked by the current configuration and state and preview the deletions without executing them without exchanging the responsibilities of these features.
Incorrect Answers
B:The first measure meets the requirement to plan and delete resources tracked by the current configuration and state, but its partner serves a different role: Terraform operates on the selected state and current configuration; similar resource names in separate states can refer to entirely different real objects; this behavior should be assessed against the concrete need to plan and delete resources tracked by the current configuration and state and preview the deletions without executing them. That second component is designed to avoid deleting resources belonging to a different environment, so the still-missing criterion is to preview the deletions without executing them, while the first criterion remains plan and delete resources tracked by the current configuration and state.
C:The first measure is intended to recognize a guard against destructive changes while the resource block remains configured: The lifecycle setting can make a normal destroy plan fail for a protected block; removing the block altogether removes the guard from evaluation; this behavior should be assessed against the concrete need to plan and delete resources tracked by the current configuration and state and preview the deletions without executing them. The second measure is intended to avoid assuming Terraform can restore deleted provider objects from state alone: State is a management map, not a full backup of application data or cloud resources; deletion may be irreversible without separate backups; this behavior should be assessed against the concrete need to plan and delete resources tracked by the current configuration and state and preview the deletions without executing them. Neither is the directly designated method for the separate goals of plan and delete resources tracked by the current configuration and state and preview the deletions without executing them in this review.
D:The second measure does meet the preview the deletions without executing them requirement, but the first is designed for another concern: Targeting is intended for exceptional recovery, not routine architecture management; the rest of the state can remain dependent on objects that were removed; this behavior should be assessed against the concrete need to plan and delete resources tracked by the current configuration and state and preview the deletions without executing them. That first component is designed to limit a teardown to a selected resource or dependency subset, which does not accomplish the requested task to plan and delete resources tracked by the current configuration and state, even though the other measure satisfies preview the deletions without executing them.
E:The second measure does meet the preview the deletions without executing them requirement, but the first is designed for another concern: terraform state rm or a supported removed block can forget an object; it is different from instructing a provider to delete infrastructure; this behavior should be assessed against the concrete need to plan and delete resources tracked by the current configuration and state and preview the deletions without executing them. That first component is designed to stop Terraform management while leaving a real object intact, which does not accomplish the requested task to plan and delete resources tracked by the current configuration and state, even though the other measure satisfies preview the deletions without executing them.
Question 151
A repository maintainer wants to normalize HCL without changing infrastructure. The team must both rewrite Terraform files into canonical HCL style and format Terraform configurations in nested directories. Which paired choice implements those distinct goals?
- Run
terraform fmt -diff + Run terraform fmt -check in CI
- Run
terraform fmt in the working directory + Use terraform fmt -write=false
- Apply style checks to module directories + Run
terraform fmt -recursive
- Use standard indentation and alignment from
fmt + Run terraform fmt -recursive
- Run
terraform fmt in the working directory + Run terraform fmt -recursive
Explanation
Correct Answer
E:For the first criterion, the formatter adjusts layout and spacing according to Terraform conventions; it does not modify remote infrastructure or update state; this behavior should be assessed against the concrete need to rewrite Terraform files into canonical HCL style and format Terraform configurations in nested directories; this directly addresses the need to rewrite Terraform files into canonical HCL style. For the separate second criterion, recursive mode traverses child directories rather than just the current location; it is useful in repositories containing multiple roots and modules; this behavior should be assessed against the concrete need to rewrite Terraform files into canonical HCL style and format Terraform configurations in nested directories; this fulfills the need to format Terraform configurations in nested directories. Together they cover the independent tasks of rewrite Terraform files into canonical HCL style and format Terraform configurations in nested directories without exchanging the responsibilities of these features.
Incorrect Answers
A:The first measure is intended to display the textual adjustments a formatter would make: Diff mode shows the before-and-after formatting changes; it cannot indicate whether a proposed resource change is safe; this behavior should be assessed against the concrete need to rewrite Terraform files into canonical HCL style and format Terraform configurations in nested directories. The second measure is intended to detect files whose formatting differs from Terraform conventions: Check mode reports whether formatting changes are needed and can fail a pipeline; it does not itself rewrite source files; this behavior should be assessed against the concrete need to rewrite Terraform files into canonical HCL style and format Terraform configurations in nested directories. Neither is the directly designated method for the separate goals of rewrite Terraform files into canonical HCL style and format Terraform configurations in nested directories in this review.
B:The first measure meets the requirement to rewrite Terraform files into canonical HCL style, but its partner serves a different role: Disabling write avoids persisting formatting edits while retaining the formatting analysis; it is not a semantic validation of the resource schema; this behavior should be assessed against the concrete need to rewrite Terraform files into canonical HCL style and format Terraform configurations in nested directories. That second component is designed to inspect formatting requirements without modifying files, so the still-missing criterion is to format Terraform configurations in nested directories, while the first criterion remains rewrite Terraform files into canonical HCL style.
C:The second measure does meet the format Terraform configurations in nested directories requirement, but the first is designed for another concern: Module source code is Terraform configuration and can be formatted with the same tool; formatting never pins which module release is used; this behavior should be assessed against the concrete need to rewrite Terraform files into canonical HCL style and format Terraform configurations in nested directories. That first component is designed to enforce a consistent codebase without changing module behavior, which does not accomplish the requested task to rewrite Terraform files into canonical HCL style, even though the other measure satisfies format Terraform configurations in nested directories.
D:The second measure does meet the format Terraform configurations in nested directories requirement, but the first is designed for another concern: Canonical layout gives team members predictable formatting; hand-crafted alignment rules are not necessary to make Terraform parse HCL correctly; this behavior should be assessed against the concrete need to rewrite Terraform files into canonical HCL style and format Terraform configurations in nested directories. That first component is designed to reduce noisy diff conflicts across contributors, which does not accomplish the requested task to rewrite Terraform files into canonical HCL style, even though the other measure satisfies format Terraform configurations in nested directories.
Question 152
An engineer needs to verify convergence after a completed deployment as part of a planned migration. Which option is the best fit?
- Avoid applying an outdated reviewed plan
- Review results with a follow-up plan
- Apply reviewed changes with
terraform apply
- Validate configuration before requesting a plan
Explanation
Correct Answer
B:When inputs and real infrastructure are unchanged, a later normal plan generally shows no changes; a follow-up plan can also detect external drift; this behavior should be assessed against the concrete need to verify convergence after a completed deployment. This directly supports the task to verify convergence after a completed deployment during a maintenance request.
Incorrect Answers
A:Saved plans encode assumptions about the state snapshot and inputs; if the state changes, applying a stale plan may be rejected rather than silently reinterpreted; this behavior should be assessed against the concrete need to verify convergence after a completed deployment. It may support a related workflow, but the question specifically requires the mechanism for verify convergence after a completed deployment rather than ensure the approved actions still correspond to current state.
C:Apply coordinates provider operations and updates state after effects are known; it needs valid authentication and can still fail if the API rejects an operation; this behavior should be assessed against the concrete need to verify convergence after a completed deployment. That can be useful when the aim is to execute the actions Terraform has selected for managed infrastructure, but it does not directly deliver the requested ability to verify convergence after a completed deployment.
D:Validation checks the HCL configuration against available schemas; it is useful in CI but cannot replace a plan based on actual state and provider data; this behavior should be assessed against the concrete need to verify convergence after a completed deployment. The distinction matters here: using that mechanism to identify structural issues early in a workflow would still leave the objective to verify convergence after a completed deployment unmet.
Question 153
A Terraform backend has just been changed. The requirement is to supply missing backend settings during initialization. Which Terraform mechanism directly meets this requirement?
- Reinitialize after adding a module source
- Use
terraform init -reconfigure
- Use
terraform init -backend-config=FILE
- Use
terraform init -input=false in automation
Explanation
Correct Answer
C:Partial backend configuration can be completed from a separate file; values supplied this way may still be recorded in local Terraform metadata or saved plans; this behavior should be assessed against the concrete need to supply missing backend settings during initialization. This directly supports the task to supply missing backend settings during initialization during an automated release.
Incorrect Answers
A:Init downloads module packages from their sources; merely declaring a module block does not put remote module code onto disk; this behavior should be assessed against the concrete need to supply missing backend settings during initialization. The distinction matters here: using that mechanism to fetch externally sourced child module code would still leave the objective to supply missing backend settings during initialization unmet.
B:Reconfiguration initializes the directory against the new backend settings; it is not a replacement for migrating state that must be preserved; this behavior should be assessed against the concrete need to supply missing backend settings during initialization. It may support a related workflow, but the question specifically requires the mechanism for supply missing backend settings during initialization rather than discard the previously remembered backend configuration without migrating state.
D:Noninteractive jobs fail instead of waiting for a prompt when required values cannot be supplied; this supports predictable CI behavior; this behavior should be assessed against the concrete need to supply missing backend settings during initialization. That can be useful when the aim is to disallow interactive answers during initialization, but it does not directly deliver the requested ability to supply missing backend settings during initialization.
Question 154
During a deployment checklist, one task is to detect code style deviations without rewriting files, while another is to understand why validation alone may pass with no values supplied. Select the matching pair of techniques.
- Use
terraform fmt -check for formatting enforcement + Run terraform validate after init
- Use preconditions for runtime assumptions + Use
terraform plan for state-dependent checking
- Use
terraform fmt -check for formatting enforcement + Check for missing required variable values at planning time
- Interpret a clean validate as limited assurance + Check for missing required variable values at planning time
Explanation
Correct Answer
C:For the first criterion, fmt -check exits nonzero when files need canonical formatting; it is a style check, not a replacement for Terraform semantic validation; this behavior should be assessed against the concrete need to detect code style deviations without rewriting files and understand why validation alone may pass with no values supplied; this directly addresses the need to detect code style deviations without rewriting files. For the separate second criterion, a variable declaration may be structurally valid even though a specific run has not supplied its required input; planning or applying requests those values when needed; this behavior should be assessed against the concrete need to detect code style deviations without rewriting files and understand why validation alone may pass with no values supplied; this fulfills the need to understand why validation alone may pass with no values supplied. Together they cover the independent tasks of detect code style deviations without rewriting files and understand why validation alone may pass with no values supplied without exchanging the responsibilities of these features.
Incorrect Answers
A:The first measure meets the requirement to detect code style deviations without rewriting files, but its partner serves a different role: Validate checks syntax, types, and provider-schema rules without generating a cloud execution plan; initialization is normally required so schemas and modules are present; this behavior should be assessed against the concrete need to detect code style deviations without rewriting files and understand why validation alone may pass with no values supplied. That second component is designed to check configuration consistency independently of managed infrastructure operations, so the still-missing criterion is to understand why validation alone may pass with no values supplied, while the first criterion remains detect code style deviations without rewriting files.
B:The first measure is intended to enforce environment-specific prerequisites that static validation cannot prove: A lifecycle precondition can validate context-dependent values before acting on a resource; a general syntax check alone cannot confirm runtime facts; this behavior should be assessed against the concrete need to detect code style deviations without rewriting files and understand why validation alone may pass with no values supplied. The second measure is intended to detect proposed infrastructure differences as well as dynamic provider evaluations: Plan evaluates the current infrastructure context and produces intended actions; validate cannot establish whether remote permissions and quotas will permit those actions; this behavior should be assessed against the concrete need to detect code style deviations without rewriting files and understand why validation alone may pass with no values supplied. Neither is the directly designated method for the separate goals of detect code style deviations without rewriting files and understand why validation alone may pass with no values supplied in this review.
D:The second measure does meet the understand why validation alone may pass with no values supplied requirement, but the first is designed for another concern: Provider API authorization, remote conflicts, and real infrastructure drift can still produce failures; validation checks supported configuration structure rather than deployment success; this behavior should be assessed against the concrete need to detect code style deviations without rewriting files and understand why validation alone may pass with no values supplied. That first component is designed to avoid inferring a successful future apply from successful static checks, which does not accomplish the requested task to detect code style deviations without rewriting files, even though the other measure satisfies understand why validation alone may pass with no values supplied.
Question 155
The immediate Terraform task is to propose state reconciliation for external changes without correcting real resources. Which method handles that task most directly?
- Use
terraform plan -var-file=env.tfvars
- Use
terraform plan -refresh=false carefully
- Use
terraform plan -refresh-only
- Use
terraform show -json tfplan
Explanation
Correct Answer
C:Refresh-only mode updates Terraform's view to remote reality when applied; it does not make cloud objects conform to the old configuration; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources. This directly supports the task to propose state reconciliation for external changes without correcting real resources during a configuration change.
Incorrect Answers
A:An explicitly selected tfvars file feeds input values into that run; a .tfvars file is not a provider dependency lock; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources. The stated requirement is to propose state reconciliation for external changes without correcting real resources, not to load an explicit environment input file; this alternative addresses a different control or phase.
B:Skipping remote refresh can produce an inaccurate plan when out-of-band changes have occurred; it is not a drift-detection strategy; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources. That can be useful when the aim is to omit the usual state refresh while creating an ordinary plan, but it does not directly deliver the requested ability to propose state reconciliation for external changes without correcting real resources.
D:JSON output exposes structured planned values and actions; the output can contain sensitive values even when terminal formatting hides them; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources. It may support a related workflow, but the question specifically requires the mechanism for propose state reconciliation for external changes without correcting real resources rather than export machine-readable plan details for a policy tool.
Question 156
In an automated release, the requested result is to supply planned environment-specific input values in a direct apply. What should the engineer select?
- Keep sensitive saved plans secure
- Use
terraform apply -replace=ADDRESS for an intentional rebuild
- Use
terraform apply -var-file=prod.tfvars
- Use
terraform apply -input=false in unattended execution
Explanation
Correct Answer
C:Variable files set input variables for that run; their contents do not overwrite provider schemas or module source code; this behavior should be assessed against the concrete need to supply planned environment-specific input values in a direct apply. This directly supports the task to supply planned environment-specific input values in a direct apply during a module implementation.
Incorrect Answers
A:Plan files are not sanitized public reports; their embedded values and backend details require protective storage and restricted access; this behavior should be assessed against the concrete need to supply planned environment-specific input values in a direct apply. It may support a related workflow, but the question specifically requires the mechanism for supply planned environment-specific input values in a direct apply rather than avoid leaking provider settings and input values through artifacts.
B:The CLI adds a replacement request to the plan it creates; a saved plan should instead be prepared with the replacement request at planning time; this behavior should be assessed against the concrete need to supply planned environment-specific input values in a direct apply. The stated requirement is to supply planned environment-specific input values in a direct apply, not to force a targeted resource to be replaced during an ordinary apply; this alternative addresses a different control or phase.
D:The run fails if required input cannot be obtained in noninteractive mode; this avoids jobs hanging on missing variables; this behavior should be assessed against the concrete need to supply planned environment-specific input values in a direct apply. The distinction matters here: using that mechanism to prevent the run from waiting for interactive variable input would still leave the objective to supply planned environment-specific input values in a direct apply unmet.
Question 157
An infrastructure team is planning a safe teardown. The team must both bypass interactive confirmation for a controlled teardown job and recognize a guard against destructive changes while the resource block remains configured. Which paired choice implements those distinct goals?
- Use
terraform destroy -target=ADDRESS cautiously + Understand prevent_destroy during planned deletion
- Remove a resource from state without destroying it + Check the selected workspace before destroying
- Use
terraform destroy -auto-approve only with safeguards + Understand prevent_destroy during planned deletion
- Use
terraform plan -destroy for teardown review + Understand prevent_destroy during planned deletion
- Use
terraform destroy -auto-approve only with safeguards + Inspect dependencies during teardown
Explanation
Correct Answer
C:For the first criterion, automatic approval suppresses the prompt but not provider deletion restrictions or external dependencies; the operation remains destructive; this behavior should be assessed against the concrete need to bypass interactive confirmation for a controlled teardown job and recognize a guard against destructive changes while the resource block remains configured; this directly addresses the need to bypass interactive confirmation for a controlled teardown job. For the separate second criterion, the lifecycle setting can make a normal destroy plan fail for a protected block; removing the block altogether removes the guard from evaluation; this behavior should be assessed against the concrete need to bypass interactive confirmation for a controlled teardown job and recognize a guard against destructive changes while the resource block remains configured; this fulfills the need to recognize a guard against destructive changes while the resource block remains configured. Together they cover the independent tasks of bypass interactive confirmation for a controlled teardown job and recognize a guard against destructive changes while the resource block remains configured without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the recognize a guard against destructive changes while the resource block remains configured requirement, but the first is designed for another concern: Targeting is intended for exceptional recovery, not routine architecture management; the rest of the state can remain dependent on objects that were removed; this behavior should be assessed against the concrete need to bypass interactive confirmation for a controlled teardown job and recognize a guard against destructive changes while the resource block remains configured. That first component is designed to limit a teardown to a selected resource or dependency subset, which does not accomplish the requested task to bypass interactive confirmation for a controlled teardown job, even though the other measure satisfies recognize a guard against destructive changes while the resource block remains configured.
B:The first measure is intended to stop Terraform management while leaving a real object intact: terraform state rm or a supported removed block can forget an object; it is different from instructing a provider to delete infrastructure; this behavior should be assessed against the concrete need to bypass interactive confirmation for a controlled teardown job and recognize a guard against destructive changes while the resource block remains configured. The second measure is intended to avoid deleting resources belonging to a different environment: Terraform operates on the selected state and current configuration; similar resource names in separate states can refer to entirely different real objects; this behavior should be assessed against the concrete need to bypass interactive confirmation for a controlled teardown job and recognize a guard against destructive changes while the resource block remains configured. Neither is the directly designated method for the separate goals of bypass interactive confirmation for a controlled teardown job and recognize a guard against destructive changes while the resource block remains configured in this review.
D:The second measure does meet the recognize a guard against destructive changes while the resource block remains configured requirement, but the first is designed for another concern: A destroy plan lists what would be removed and can be saved for approval; it is appropriate before potentially disruptive cleanup; this behavior should be assessed against the concrete need to bypass interactive confirmation for a controlled teardown job and recognize a guard against destructive changes while the resource block remains configured. That first component is designed to preview the deletions without executing them, which does not accomplish the requested task to bypass interactive confirmation for a controlled teardown job, even though the other measure satisfies recognize a guard against destructive changes while the resource block remains configured.
E:The first measure meets the requirement to bypass interactive confirmation for a controlled teardown job, but its partner serves a different role: Terraform reverses dependency relationships where necessary to delete objects safely; explicit and implicit graph edges influence safe order; this behavior should be assessed against the concrete need to bypass interactive confirmation for a controlled teardown job and recognize a guard against destructive changes while the resource block remains configured. That second component is designed to understand why child objects may be destroyed before prerequisites, so the still-missing criterion is to recognize a guard against destructive changes while the resource block remains configured, while the first criterion remains bypass interactive confirmation for a controlled teardown job.
Question 158
A pull request contains inconsistent Terraform formatting. Two independent changes are requested: first, check configuration meaning after enforcing consistent style; second, reduce noisy diff conflicts across contributors. Which pair of measures fulfills both?
- Apply style checks to module directories + Use standard indentation and alignment from
fmt
- Separate
fmt from provider installation + Use standard indentation and alignment from fmt
- Run
terraform fmt -recursive + Run terraform fmt -check in CI
- Run
terraform validate separately + Use standard indentation and alignment from fmt
- Run
terraform validate separately + Use terraform fmt -write=false
Explanation
Correct Answer
D:For the first criterion, validate checks references, argument types, and other configuration rules; nicely formatted HCL may still be invalid or operationally wrong; this behavior should be assessed against the concrete need to check configuration meaning after enforcing consistent style and reduce noisy diff conflicts across contributors; this directly addresses the need to check configuration meaning after enforcing consistent style. For the separate second criterion, canonical layout gives team members predictable formatting; hand-crafted alignment rules are not necessary to make Terraform parse HCL correctly; this behavior should be assessed against the concrete need to check configuration meaning after enforcing consistent style and reduce noisy diff conflicts across contributors; this fulfills the need to reduce noisy diff conflicts across contributors. Together they cover the independent tasks of check configuration meaning after enforcing consistent style and reduce noisy diff conflicts across contributors without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the reduce noisy diff conflicts across contributors requirement, but the first is designed for another concern: Module source code is Terraform configuration and can be formatted with the same tool; formatting never pins which module release is used; this behavior should be assessed against the concrete need to check configuration meaning after enforcing consistent style and reduce noisy diff conflicts across contributors. That first component is designed to enforce a consistent codebase without changing module behavior, which does not accomplish the requested task to check configuration meaning after enforcing consistent style, even though the other measure satisfies reduce noisy diff conflicts across contributors.
B:The second measure does meet the reduce noisy diff conflicts across contributors requirement, but the first is designed for another concern: Formatting reads local HCL and does not initialize backends or download provider packages; dependency preparation remains the role of init; this behavior should be assessed against the concrete need to check configuration meaning after enforcing consistent style and reduce noisy diff conflicts across contributors. That first component is designed to avoid expecting style normalization to fetch plugin binaries, which does not accomplish the requested task to check configuration meaning after enforcing consistent style, even though the other measure satisfies reduce noisy diff conflicts across contributors.
C:The first measure is intended to format Terraform configurations in nested directories: Recursive mode traverses child directories rather than just the current location; it is useful in repositories containing multiple roots and modules; this behavior should be assessed against the concrete need to check configuration meaning after enforcing consistent style and reduce noisy diff conflicts across contributors. The second measure is intended to detect files whose formatting differs from Terraform conventions: Check mode reports whether formatting changes are needed and can fail a pipeline; it does not itself rewrite source files; this behavior should be assessed against the concrete need to check configuration meaning after enforcing consistent style and reduce noisy diff conflicts across contributors. Neither is the directly designated method for the separate goals of check configuration meaning after enforcing consistent style and reduce noisy diff conflicts across contributors in this review.
E:The first measure meets the requirement to check configuration meaning after enforcing consistent style, but its partner serves a different role: Disabling write avoids persisting formatting edits while retaining the formatting analysis; it is not a semantic validation of the resource schema; this behavior should be assessed against the concrete need to check configuration meaning after enforcing consistent style and reduce noisy diff conflicts across contributors. That second component is designed to inspect formatting requirements without modifying files, so the still-missing criterion is to reduce noisy diff conflicts across contributors, while the first criterion remains check configuration meaning after enforcing consistent style.
Question 159
A new engineer is learning the operational workflow. Two independent changes are requested: first, establish the intended infrastructure before Terraform evaluates changes; second, ensure the approved actions still correspond to current state. Which pair of measures fulfills both?
- Preview changes with
terraform plan + Keep environment state separated
- Write the desired configuration first + Initialize the working directory before planning
- Write the desired configuration first + Avoid applying an outdated reviewed plan
- Validate configuration before requesting a plan + Avoid applying an outdated reviewed plan
Explanation
Correct Answer
C:For the first criterion, resource blocks, variables, and modules define the target arrangement; running the CLI without an intended configuration cannot infer a team's architecture goals; this behavior should be assessed against the concrete need to establish the intended infrastructure before Terraform evaluates changes and ensure the approved actions still correspond to current state; this directly addresses the need to establish the intended infrastructure before Terraform evaluates changes. For the separate second criterion, saved plans encode assumptions about the state snapshot and inputs; if the state changes, applying a stale plan may be rejected rather than silently reinterpreted; this behavior should be assessed against the concrete need to establish the intended infrastructure before Terraform evaluates changes and ensure the approved actions still correspond to current state; this fulfills the need to ensure the approved actions still correspond to current state. Together they cover the independent tasks of establish the intended infrastructure before Terraform evaluates changes and ensure the approved actions still correspond to current state without exchanging the responsibilities of these features.
Incorrect Answers
A:The first measure is intended to inspect intended create, change, and delete actions before execution: Planning compares desired configuration with current state and provider observations; no planned infrastructure actions are applied by the plan command; this behavior should be assessed against the concrete need to establish the intended infrastructure before Terraform evaluates changes and ensure the approved actions still correspond to current state. The second measure is intended to ensure independent deployments do not accidentally share object bindings: Multiple root working directories or CLI workspaces can carry different states; the isolation of state prevents Terraform from treating two environments as one inventory; this behavior should be assessed against the concrete need to establish the intended infrastructure before Terraform evaluates changes and ensure the approved actions still correspond to current state. Neither is the directly designated method for the separate goals of establish the intended infrastructure before Terraform evaluates changes and ensure the approved actions still correspond to current state in this review.
B:The first measure meets the requirement to establish the intended infrastructure before Terraform evaluates changes, but its partner serves a different role: terraform init sets up the directory so subsequent validation, planning, and applying can use the correct plugins and backend; initialization itself does not deploy resources; this behavior should be assessed against the concrete need to establish the intended infrastructure before Terraform evaluates changes and ensure the approved actions still correspond to current state. That second component is designed to prepare backend, providers, and external module dependencies, so the still-missing criterion is to ensure the approved actions still correspond to current state, while the first criterion remains establish the intended infrastructure before Terraform evaluates changes.
D:The second measure does meet the ensure the approved actions still correspond to current state requirement, but the first is designed for another concern: Validation checks the HCL configuration against available schemas; it is useful in CI but cannot replace a plan based on actual state and provider data; this behavior should be assessed against the concrete need to establish the intended infrastructure before Terraform evaluates changes and ensure the approved actions still correspond to current state. That first component is designed to identify structural issues early in a workflow, which does not accomplish the requested task to establish the intended infrastructure before Terraform evaluates changes, even though the other measure satisfies ensure the approved actions still correspond to current state.
Question 160
A build worker must initialize a reproducible working directory. A reviewer must determine how to discard the previously remembered backend configuration without migrating state. Which action is the appropriate choice?
- Use
terraform init -reconfigure
- Use
terraform init -migrate-state
- Use
terraform init -upgrade
- Inspect
.terraform/ as generated local metadata
Explanation
Correct Answer
A:Reconfiguration initializes the directory against the new backend settings; it is not a replacement for migrating state that must be preserved; this behavior should be assessed against the concrete need to discard the previously remembered backend configuration without migrating state. This directly supports the task to discard the previously remembered backend configuration without migrating state during a staged rollout.
Incorrect Answers
B:Migration attempts to move state into the newly configured backend; backups and confirmation are important before switching active state locations; this behavior should be assessed against the concrete need to discard the previously remembered backend configuration without migrating state. The stated requirement is to discard the previously remembered backend configuration without migrating state, not to copy existing state when changing storage backends; this alternative addresses a different control or phase.
C:Upgrade requests reconsideration of versions within declared constraints; it changes dependency selections, not infrastructure objects by itself; this behavior should be assessed against the concrete need to discard the previously remembered backend configuration without migrating state. That can be useful when the aim is to reselect newer eligible provider and module packages, but it does not directly deliver the requested ability to discard the previously remembered backend configuration without migrating state.
D:The directory can hold installed modules, provider metadata, and backend configuration; it should normally be excluded from Git and may contain sensitive settings; this behavior should be assessed against the concrete need to discard the previously remembered backend configuration without migrating state. The distinction matters here: using that mechanism to recognize initialization artifacts rather than versioned source would still leave the objective to discard the previously remembered backend configuration without migrating state unmet.