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

Question 240

A checked-out repository is being prepared on a new workstation. The team must both enforce a committed provider selection without lockfile edits and fetch externally sourced child module code. Which paired choice implements those distinct goals?

  1. Run terraform init in the root module directory + Reinitialize after adding a module source
  2. Use terraform init -migrate-state + Use terraform init -backend-config=FILE
  3. Use terraform init -reconfigure + Reinitialize after adding a module source
  4. Use terraform init -lockfile=readonly + Reinitialize after adding a module source
  5. Use terraform init -lockfile=readonly + Use terraform init -input=false in automation

Explanation

Correct Answer

D:

For the first criterion, read-only dependency locking catches selection drift in automated builds; the lock file applies to providers rather than pinning arbitrary local module directories; this behavior should be assessed against the concrete need to enforce a committed provider selection without lockfile edits and fetch externally sourced child module code; this directly addresses the need to enforce a committed provider selection without lockfile edits. For the separate second criterion, 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 enforce a committed provider selection without lockfile edits and fetch externally sourced child module code; this fulfills the need to fetch externally sourced child module code. Together they cover the independent tasks of enforce a committed provider selection without lockfile edits and fetch externally sourced child module code without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the fetch externally sourced child module code requirement, but the first is designed for another concern: Init configures the selected backend and installs required providers and child modules; it is safe to repeat but may need additional flags after backend changes; this behavior should be assessed against the concrete need to enforce a committed provider selection without lockfile edits and fetch externally sourced child module code. That first component is designed to initialize the working directory and fetch dependencies, which does not accomplish the requested task to enforce a committed provider selection without lockfile edits, even though the other measure satisfies fetch externally sourced child module code.

B:

The first measure is intended to copy existing state when changing storage backends: 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 enforce a committed provider selection without lockfile edits and fetch externally sourced child module code. The second measure is intended to supply missing backend settings during initialization: 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 enforce a committed provider selection without lockfile edits and fetch externally sourced child module code. Neither is the directly designated method for the separate goals of enforce a committed provider selection without lockfile edits and fetch externally sourced child module code in this review.

C:

The second measure does meet the fetch externally sourced child module code requirement, but the first is designed for another concern: 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 enforce a committed provider selection without lockfile edits and fetch externally sourced child module code. That first component is designed to discard the previously remembered backend configuration without migrating state, which does not accomplish the requested task to enforce a committed provider selection without lockfile edits, even though the other measure satisfies fetch externally sourced child module code.

E:

The first measure meets the requirement to enforce a committed provider selection without lockfile edits, but its partner serves a different role: 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 enforce a committed provider selection without lockfile edits and fetch externally sourced child module code. That second component is designed to disallow interactive answers during initialization, so the still-missing criterion is to fetch externally sourced child module code, while the first criterion remains enforce a committed provider selection without lockfile edits.

Question 241

During a module implementation, one task is to recognize a planned destroy-and-create operation rather than an in-place edit, while another is to distinguish modification of an existing object from creation or destruction. Select the matching pair of techniques.

  1. Read -/+ as replacement intent + Read ~ as in-place update intent
  2. Understand a (known after apply) value + Use terraform plan -detailed-exitcode
  3. Use terraform show tfplan + Read ~ as in-place update intent
  4. Read -/+ as replacement intent + Use terraform plan -refresh=false carefully
  5. Read -/+ as replacement intent + Use terraform plan -var='name=value'
  6. Use terraform plan -var-file=env.tfvars + Read ~ as in-place update intent

Explanation

Correct Answer

A:

For the first criterion, some argument changes cannot be updated remotely and require a new object; replacement can have downtime implications unless ordering or architecture mitigates it; this behavior should be assessed against the concrete need to recognize a planned destroy-and-create operation rather than an in-place edit and distinguish modification of an existing object from creation or destruction; this directly addresses the need to recognize a planned destroy-and-create operation rather than an in-place edit. For the separate second criterion, the plan symbol indicates updating a tracked resource without replacing its identity; whether a particular field supports this depends on the provider; this behavior should be assessed against the concrete need to recognize a planned destroy-and-create operation rather than an in-place edit and distinguish modification of an existing object from creation or destruction; this fulfills the need to distinguish modification of an existing object from creation or destruction. Together they cover the independent tasks of recognize a planned destroy-and-create operation rather than an in-place edit and distinguish modification of an existing object from creation or destruction without exchanging the responsibilities of these features.

Incorrect Answers

B:

The first measure is intended to interpret an attribute whose value is not available during planning: Computed provider attributes may be unknown until resource creation; terraform carries unknown values through dependent expressions rather than fabricating them; this behavior should be assessed against the concrete need to recognize a planned destroy-and-create operation rather than an in-place edit and distinguish modification of an existing object from creation or destruction. The second measure is intended to distinguish clean plans from plans with proposed changes in CI: The option uses exit code 0 for no differences, 2 for differences, and 1 for errors; a nonzero value is not always an execution failure; this behavior should be assessed against the concrete need to recognize a planned destroy-and-create operation rather than an in-place edit and distinguish modification of an existing object from creation or destruction. Neither is the directly designated method for the separate goals of recognize a planned destroy-and-create operation rather than an in-place edit and distinguish modification of an existing object from creation or destruction in this review.

C:

The second measure does meet the distinguish modification of an existing object from creation or destruction requirement, but the first is designed for another concern: Show decodes the saved plan for review; it does not run the provider operations represented by the plan; this behavior should be assessed against the concrete need to recognize a planned destroy-and-create operation rather than an in-place edit and distinguish modification of an existing object from creation or destruction. That first component is designed to render a saved execution plan in readable form, which does not accomplish the requested task to recognize a planned destroy-and-create operation rather than an in-place edit, even though the other measure satisfies distinguish modification of an existing object from creation or destruction.

D:

The first measure meets the requirement to recognize a planned destroy-and-create operation rather than an in-place edit, but its partner serves a different role: 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 recognize a planned destroy-and-create operation rather than an in-place edit and distinguish modification of an existing object from creation or destruction. That second component is designed to omit the usual state refresh while creating an ordinary plan, so the still-missing criterion is to distinguish modification of an existing object from creation or destruction, while the first criterion remains recognize a planned destroy-and-create operation rather than an in-place edit.

E:

The first measure meets the requirement to recognize a planned destroy-and-create operation rather than an in-place edit, but its partner serves a different role: CLI variable arguments supply run-specific values; they do not permanently modify the variable declaration or backend configuration; this behavior should be assessed against the concrete need to recognize a planned destroy-and-create operation rather than an in-place edit and distinguish modification of an existing object from creation or destruction. That second component is designed to override an input variable for one planned run, so the still-missing criterion is to distinguish modification of an existing object from creation or destruction, while the first criterion remains recognize a planned destroy-and-create operation rather than an in-place edit.

F:

The second measure does meet the distinguish modification of an existing object from creation or destruction requirement, but the first is designed for another concern: 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 recognize a planned destroy-and-create operation rather than an in-place edit and distinguish modification of an existing object from creation or destruction. That first component is designed to load an explicit environment input file, which does not accomplish the requested task to recognize a planned destroy-and-create operation rather than an in-place edit, even though the other measure satisfies distinguish modification of an existing object from creation or destruction.

Question 242

A reviewer has to approve a two-part design: prevent the run from waiting for interactive variable input; additionally, force a targeted resource to be replaced during an ordinary apply. Which option pairs the correct mechanisms?

  1. Run a new plan after unexpected apply behavior + Use terraform apply -replace=ADDRESS for an intentional rebuild
  2. Use terraform apply -input=false in unattended execution + Check apply output for partial failure
  3. Use terraform apply -input=false in unattended execution + Use terraform apply -replace=ADDRESS for an intentional rebuild
  4. Use terraform apply -var-file=prod.tfvars + Avoid concurrent applies against shared state

Explanation

Correct Answer

C:

For the first criterion, 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 prevent the run from waiting for interactive variable input and force a targeted resource to be replaced during an ordinary apply; this directly addresses the need to prevent the run from waiting for interactive variable input. For the separate second criterion, 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 prevent the run from waiting for interactive variable input and force a targeted resource to be replaced during an ordinary apply; this fulfills the need to force a targeted resource to be replaced during an ordinary apply. Together they cover the independent tasks of prevent the run from waiting for interactive variable input and force a targeted resource to be replaced during an ordinary apply without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the force a targeted resource to be replaced during an ordinary apply requirement, but the first is designed for another concern: A subsequent plan refreshes tracked objects and identifies outstanding changes; blindly rerunning unrelated commands may hide the failure's scope; this behavior should be assessed against the concrete need to prevent the run from waiting for interactive variable input and force a targeted resource to be replaced during an ordinary apply. That first component is designed to reconcile the state and observed API results before taking further action, which does not accomplish the requested task to prevent the run from waiting for interactive variable input, even though the other measure satisfies force a targeted resource to be replaced during an ordinary apply.

B:

The first measure meets the requirement to prevent the run from waiting for interactive variable input, but its partner serves a different role: Terraform may have completed earlier provider operations before a later step fails; state can record successful actions, so investigate the next plan rather than assuming a full rollback; this behavior should be assessed against the concrete need to prevent the run from waiting for interactive variable input and force a targeted resource to be replaced during an ordinary apply. That second component is designed to understand why an unsuccessful apply may still have changed some resources, so the still-missing criterion is to force a targeted resource to be replaced during an ordinary apply, while the first criterion remains prevent the run from waiting for interactive variable input.

D:

The first measure is intended to supply planned environment-specific input values in a direct apply: 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 prevent the run from waiting for interactive variable input and force a targeted resource to be replaced during an ordinary apply. The second measure is intended to prevent two runs from racing to write incompatible snapshots: A locking-capable backend serializes state modifications; even with a lock, proper approvals and pipeline serialization remain important; this behavior should be assessed against the concrete need to prevent the run from waiting for interactive variable input and force a targeted resource to be replaced during an ordinary apply. Neither is the directly designated method for the separate goals of prevent the run from waiting for interactive variable input and force a targeted resource to be replaced during an ordinary apply in this review.

Question 243

A Terraform backend has just been changed. Two independent changes are requested: first, skip backend initialization for a specific preparation task; second, recognize initialization artifacts rather than versioned source. Which pair of measures fulfills both?

  1. Use terraform init -get=false + Inspect .terraform/ as generated local metadata
  2. Use terraform init -backend=false cautiously + Use terraform init -upgrade
  3. Use terraform init -lockfile=readonly + Use terraform init -migrate-state
  4. Reinitialize after changing provider requirements + Inspect .terraform/ as generated local metadata
  5. Use terraform init -backend=false cautiously + Inspect .terraform/ as generated local metadata

Explanation

Correct Answer

E:

For the first criterion, disabling backend setup avoids configuring remote state, but some later operations require an initialized backend; it does not create a temporary safe state automatically; this behavior should be assessed against the concrete need to skip backend initialization for a specific preparation task and recognize initialization artifacts rather than versioned source; this directly addresses the need to skip backend initialization for a specific preparation task. For the separate second criterion, 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 skip backend initialization for a specific preparation task and recognize initialization artifacts rather than versioned source; this fulfills the need to recognize initialization artifacts rather than versioned source. Together they cover the independent tasks of skip backend initialization for a specific preparation task and recognize initialization artifacts rather than versioned source without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the recognize initialization artifacts rather than versioned source requirement, but the first is designed for another concern: This option avoids module download/update during initialization; it is appropriate only when required modules are already available; this behavior should be assessed against the concrete need to skip backend initialization for a specific preparation task and recognize initialization artifacts rather than versioned source. That first component is designed to skip installing child modules in a prepared directory, which does not accomplish the requested task to skip backend initialization for a specific preparation task, even though the other measure satisfies recognize initialization artifacts rather than versioned source.

B:

The first measure meets the requirement to skip backend initialization for a specific preparation task, but its partner serves a different role: 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 skip backend initialization for a specific preparation task and recognize initialization artifacts rather than versioned source. That second component is designed to reselect newer eligible provider and module packages, so the still-missing criterion is to recognize initialization artifacts rather than versioned source, while the first criterion remains skip backend initialization for a specific preparation task.

C:

The first measure is intended to enforce a committed provider selection without lockfile edits: Read-only dependency locking catches selection drift in automated builds; the lock file applies to providers rather than pinning arbitrary local module directories; this behavior should be assessed against the concrete need to skip backend initialization for a specific preparation task and recognize initialization artifacts rather than versioned source. The second measure is intended to copy existing state when changing storage backends: 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 skip backend initialization for a specific preparation task and recognize initialization artifacts rather than versioned source. Neither is the directly designated method for the separate goals of skip backend initialization for a specific preparation task and recognize initialization artifacts rather than versioned source in this review.

D:

The second measure does meet the recognize initialization artifacts rather than versioned source requirement, but the first is designed for another concern: Init reconciles the plugin installation and lock selections after changes in required_providers; running only fmt cannot install a newly required plugin; this behavior should be assessed against the concrete need to skip backend initialization for a specific preparation task and recognize initialization artifacts rather than versioned source. That first component is designed to pick up new dependencies and version constraints, which does not accomplish the requested task to skip backend initialization for a specific preparation task, even though the other measure satisfies recognize initialization artifacts rather than versioned source.

Question 244

The immediate Terraform task is to request replacement of a particular managed instance. Which method handles that task most directly?

  1. Use terraform show tfplan
  2. Use terraform plan -out=tfplan
  3. Read -/+ as replacement intent
  4. Use terraform plan -replace=ADDRESS
  5. Use terraform plan -refresh=false carefully

Explanation

Correct Answer

D:

The flag adds a replacement instruction to planning for an addressed resource; it is preferable to legacy manual taint workflows for deliberate replacement; this behavior should be assessed against the concrete need to request replacement of a particular managed instance. This directly supports the task to request replacement of a particular managed instance during a platform review.

Incorrect Answers

A:

Show decodes the saved plan for review; it does not run the provider operations represented by the plan; this behavior should be assessed against the concrete need to request replacement of a particular managed instance. It may support a related workflow, but the question specifically requires the mechanism for request replacement of a particular managed instance rather than render a saved execution plan in readable form.

B:

A saved plan captures selections and inputs for later use; it may include secrets and backend settings, so the artifact requires access controls; this behavior should be assessed against the concrete need to request replacement of a particular managed instance. The stated requirement is to request replacement of a particular managed instance, not to save a plan for later explicit approval and application; this alternative addresses a different control or phase.

C:

Some argument changes cannot be updated remotely and require a new object; replacement can have downtime implications unless ordering or architecture mitigates it; this behavior should be assessed against the concrete need to request replacement of a particular managed instance. That can be useful when the aim is to recognize a planned destroy-and-create operation rather than an in-place edit, but it does not directly deliver the requested ability to request replacement of a particular managed instance.

E:

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 request replacement of a particular managed instance. It may support a related workflow, but the question specifically requires the mechanism for request replacement of a particular managed instance rather than omit the usual state refresh while creating an ordinary plan.

Question 245

A Terraform rollout has separate acceptance criteria: reconcile the state and observed API results before taking further action and avoid leaking provider settings and input values through artifacts. Which combined approach directly satisfies the two criteria?

  1. Check apply output for partial failure + Keep sensitive saved plans secure
  2. Run a new plan after unexpected apply behavior + Run terraform apply tfplan for an approved saved plan
  3. Use terraform apply -replace=ADDRESS for an intentional rebuild + Keep sensitive saved plans secure
  4. Run a new plan after unexpected apply behavior + Keep sensitive saved plans secure
  5. Use terraform apply -input=false in unattended execution + Avoid concurrent applies against shared state
  6. Run a new plan after unexpected apply behavior + Use terraform apply -var-file=prod.tfvars

Explanation

Correct Answer

D:

For the first criterion, a subsequent plan refreshes tracked objects and identifies outstanding changes; blindly rerunning unrelated commands may hide the failure's scope; this behavior should be assessed against the concrete need to reconcile the state and observed API results before taking further action and avoid leaking provider settings and input values through artifacts; this directly addresses the need to reconcile the state and observed API results before taking further action. For the separate second criterion, 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 reconcile the state and observed API results before taking further action and avoid leaking provider settings and input values through artifacts; this fulfills the need to avoid leaking provider settings and input values through artifacts. Together they cover the independent tasks of reconcile the state and observed API results before taking further action and avoid leaking provider settings and input values through artifacts without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the avoid leaking provider settings and input values through artifacts requirement, but the first is designed for another concern: Terraform may have completed earlier provider operations before a later step fails; state can record successful actions, so investigate the next plan rather than assuming a full rollback; this behavior should be assessed against the concrete need to reconcile the state and observed API results before taking further action and avoid leaking provider settings and input values through artifacts. That first component is designed to understand why an unsuccessful apply may still have changed some resources, which does not accomplish the requested task to reconcile the state and observed API results before taking further action, even though the other measure satisfies avoid leaking provider settings and input values through artifacts.

B:

The first measure meets the requirement to reconcile the state and observed API results before taking further action, but its partner serves a different role: Applying a saved plan uses its captured decisions and state assumptions; a changed state can invalidate it instead of silently applying a different plan; this behavior should be assessed against the concrete need to reconcile the state and observed API results before taking further action and avoid leaking provider settings and input values through artifacts. That second component is designed to execute the exact plan artifact rather than replan with new input values, so the still-missing criterion is to avoid leaking provider settings and input values through artifacts, while the first criterion remains reconcile the state and observed API results before taking further action.

C:

The second measure does meet the avoid leaking provider settings and input values through artifacts requirement, but the first is designed for another concern: 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 reconcile the state and observed API results before taking further action and avoid leaking provider settings and input values through artifacts. That first component is designed to force a targeted resource to be replaced during an ordinary apply, which does not accomplish the requested task to reconcile the state and observed API results before taking further action, even though the other measure satisfies avoid leaking provider settings and input values through artifacts.

E:

The first measure is intended to prevent the run from waiting for interactive variable input: 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 reconcile the state and observed API results before taking further action and avoid leaking provider settings and input values through artifacts. The second measure is intended to prevent two runs from racing to write incompatible snapshots: A locking-capable backend serializes state modifications; even with a lock, proper approvals and pipeline serialization remain important; this behavior should be assessed against the concrete need to reconcile the state and observed API results before taking further action and avoid leaking provider settings and input values through artifacts. Neither is the directly designated method for the separate goals of reconcile the state and observed API results before taking further action and avoid leaking provider settings and input values through artifacts in this review.

F:

The first measure meets the requirement to reconcile the state and observed API results before taking further action, but its partner serves a different role: 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 reconcile the state and observed API results before taking further action and avoid leaking provider settings and input values through artifacts. That second component is designed to supply planned environment-specific input values in a direct apply, so the still-missing criterion is to avoid leaking provider settings and input values through artifacts, while the first criterion remains reconcile the state and observed API results before taking further action.

Question 246

A build worker must initialize a reproducible working directory. A reviewer must determine how to copy existing state when changing storage backends. Which action is the appropriate choice?

  1. Run terraform init in the root module directory
  2. Use terraform init -upgrade
  3. Use terraform init -get=false
  4. Use terraform init -migrate-state

Explanation

Correct Answer

D:

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 copy existing state when changing storage backends. This directly supports the task to copy existing state when changing storage backends during a cross-team handoff.

Incorrect Answers

A:

Init configures the selected backend and installs required providers and child modules; it is safe to repeat but may need additional flags after backend changes; this behavior should be assessed against the concrete need to copy existing state when changing storage backends. The distinction matters here: using that mechanism to initialize the working directory and fetch dependencies would still leave the objective to copy existing state when changing storage backends unmet.

B:

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 copy existing state when changing storage backends. It may support a related workflow, but the question specifically requires the mechanism for copy existing state when changing storage backends rather than reselect newer eligible provider and module packages.

C:

This option avoids module download/update during initialization; it is appropriate only when required modules are already available; this behavior should be assessed against the concrete need to copy existing state when changing storage backends. The stated requirement is to copy existing state when changing storage backends, not to skip installing child modules in a prepared directory; this alternative addresses a different control or phase.

Question 247

A Terraform rollout has separate acceptance criteria: override an input variable for one planned run and request replacement of a particular managed instance. Which combined approach directly satisfies the two criteria?

  1. Understand a (known after apply) value + Use terraform plan -replace=ADDRESS
  2. Use terraform plan -var='name=value' + Use terraform plan -replace=ADDRESS
  3. Read -/+ as replacement intent + Use terraform plan -replace=ADDRESS
  4. Use terraform plan -var='name=value' + Use terraform plan -out=tfplan
  5. Use terraform plan -refresh=false carefully + Run terraform plan without applying

Explanation

Correct Answer

B:

For the first criterion, cLI variable arguments supply run-specific values; they do not permanently modify the variable declaration or backend configuration; this behavior should be assessed against the concrete need to override an input variable for one planned run and request replacement of a particular managed instance; this directly addresses the need to override an input variable for one planned run. For the separate second criterion, the flag adds a replacement instruction to planning for an addressed resource; it is preferable to legacy manual taint workflows for deliberate replacement; this behavior should be assessed against the concrete need to override an input variable for one planned run and request replacement of a particular managed instance; this fulfills the need to request replacement of a particular managed instance. Together they cover the independent tasks of override an input variable for one planned run and request replacement of a particular managed instance without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the request replacement of a particular managed instance requirement, but the first is designed for another concern: Computed provider attributes may be unknown until resource creation; terraform carries unknown values through dependent expressions rather than fabricating them; this behavior should be assessed against the concrete need to override an input variable for one planned run and request replacement of a particular managed instance. That first component is designed to interpret an attribute whose value is not available during planning, which does not accomplish the requested task to override an input variable for one planned run, even though the other measure satisfies request replacement of a particular managed instance.

C:

The second measure does meet the request replacement of a particular managed instance requirement, but the first is designed for another concern: Some argument changes cannot be updated remotely and require a new object; replacement can have downtime implications unless ordering or architecture mitigates it; this behavior should be assessed against the concrete need to override an input variable for one planned run and request replacement of a particular managed instance. That first component is designed to recognize a planned destroy-and-create operation rather than an in-place edit, which does not accomplish the requested task to override an input variable for one planned run, even though the other measure satisfies request replacement of a particular managed instance.

D:

The first measure meets the requirement to override an input variable for one planned run, but its partner serves a different role: A saved plan captures selections and inputs for later use; it may include secrets and backend settings, so the artifact requires access controls; this behavior should be assessed against the concrete need to override an input variable for one planned run and request replacement of a particular managed instance. That second component is designed to save a plan for later explicit approval and application, so the still-missing criterion is to request replacement of a particular managed instance, while the first criterion remains override an input variable for one planned run.

E:

The first measure is intended to omit the usual state refresh while creating an ordinary plan: 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 override an input variable for one planned run and request replacement of a particular managed instance. The second measure is intended to preview the actions needed to reconcile the declared configuration: Plan evaluates dependencies and current state and reports create/update/replace/delete intentions; it normally performs no desired resource changes; this behavior should be assessed against the concrete need to override an input variable for one planned run and request replacement of a particular managed instance. Neither is the directly designated method for the separate goals of override an input variable for one planned run and request replacement of a particular managed instance in this review.

Question 248

A reviewer has to approve a two-part design: supply missing backend settings during initialization; additionally, discard the previously remembered backend configuration without migrating state. Which option pairs the correct mechanisms?

  1. Inspect .terraform/ as generated local metadata + Use terraform init -reconfigure
  2. Use terraform init -backend-config=FILE + Use terraform init -reconfigure
  3. Use terraform init -backend-config=FILE + Use terraform init -backend=false cautiously
  4. Use terraform init -get=false + Use terraform init -lockfile=readonly

Explanation

Correct Answer

B:

For the first criterion, 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 and discard the previously remembered backend configuration without migrating state; this directly addresses the need to supply missing backend settings during initialization. For the separate second criterion, 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 and discard the previously remembered backend configuration without migrating state; this fulfills the need to discard the previously remembered backend configuration without migrating state. Together they cover the independent tasks of supply missing backend settings during initialization and discard the previously remembered backend configuration without migrating state without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the discard the previously remembered backend configuration without migrating state requirement, but the first is designed for another concern: 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 supply missing backend settings during initialization and discard the previously remembered backend configuration without migrating state. That first component is designed to recognize initialization artifacts rather than versioned source, which does not accomplish the requested task to supply missing backend settings during initialization, even though the other measure satisfies discard the previously remembered backend configuration without migrating state.

C:

The first measure meets the requirement to supply missing backend settings during initialization, but its partner serves a different role: Disabling backend setup avoids configuring remote state, but some later operations require an initialized backend; it does not create a temporary safe state automatically; this behavior should be assessed against the concrete need to supply missing backend settings during initialization and discard the previously remembered backend configuration without migrating state. That second component is designed to skip backend initialization for a specific preparation task, so the still-missing criterion is to discard the previously remembered backend configuration without migrating state, while the first criterion remains supply missing backend settings during initialization.

D:

The first measure is intended to skip installing child modules in a prepared directory: This option avoids module download/update during initialization; it is appropriate only when required modules are already available; this behavior should be assessed against the concrete need to supply missing backend settings during initialization and discard the previously remembered backend configuration without migrating state. The second measure is intended to enforce a committed provider selection without lockfile edits: Read-only dependency locking catches selection drift in automated builds; the lock file applies to providers rather than pinning arbitrary local module directories; this behavior should be assessed against the concrete need to supply missing backend settings during initialization and discard the previously remembered backend configuration without migrating state. Neither is the directly designated method for the separate goals of supply missing backend settings during initialization and discard the previously remembered backend configuration without migrating state in this review.

Question 249

A reviewer is interpreting plan results before approval. The team must both save a plan for later explicit approval and application and export machine-readable plan details for a policy tool. Which paired choice implements those distinct goals?

  1. Use terraform plan -replace=ADDRESS + Use terraform plan -detailed-exitcode
  2. Run terraform plan without applying + Use terraform show -json tfplan
  3. Use terraform plan -out=tfplan + Use terraform show -json tfplan
  4. Read -/+ as replacement intent + Use terraform show -json tfplan
  5. Use terraform plan -out=tfplan + Use terraform plan -refresh=false carefully

Explanation

Correct Answer

C:

For the first criterion, a saved plan captures selections and inputs for later use; it may include secrets and backend settings, so the artifact requires access controls; this behavior should be assessed against the concrete need to save a plan for later explicit approval and application and export machine-readable plan details for a policy tool; this directly addresses the need to save a plan for later explicit approval and application. For the separate second criterion, 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 save a plan for later explicit approval and application and export machine-readable plan details for a policy tool; this fulfills the need to export machine-readable plan details for a policy tool. Together they cover the independent tasks of save a plan for later explicit approval and application and export machine-readable plan details for a policy tool without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure is intended to request replacement of a particular managed instance: The flag adds a replacement instruction to planning for an addressed resource; it is preferable to legacy manual taint workflows for deliberate replacement; this behavior should be assessed against the concrete need to save a plan for later explicit approval and application and export machine-readable plan details for a policy tool. The second measure is intended to distinguish clean plans from plans with proposed changes in CI: The option uses exit code 0 for no differences, 2 for differences, and 1 for errors; a nonzero value is not always an execution failure; this behavior should be assessed against the concrete need to save a plan for later explicit approval and application and export machine-readable plan details for a policy tool. Neither is the directly designated method for the separate goals of save a plan for later explicit approval and application and export machine-readable plan details for a policy tool in this review.

B:

The second measure does meet the export machine-readable plan details for a policy tool requirement, but the first is designed for another concern: Plan evaluates dependencies and current state and reports create/update/replace/delete intentions; it normally performs no desired resource changes; this behavior should be assessed against the concrete need to save a plan for later explicit approval and application and export machine-readable plan details for a policy tool. That first component is designed to preview the actions needed to reconcile the declared configuration, which does not accomplish the requested task to save a plan for later explicit approval and application, even though the other measure satisfies export machine-readable plan details for a policy tool.

D:

The second measure does meet the export machine-readable plan details for a policy tool requirement, but the first is designed for another concern: Some argument changes cannot be updated remotely and require a new object; replacement can have downtime implications unless ordering or architecture mitigates it; this behavior should be assessed against the concrete need to save a plan for later explicit approval and application and export machine-readable plan details for a policy tool. That first component is designed to recognize a planned destroy-and-create operation rather than an in-place edit, which does not accomplish the requested task to save a plan for later explicit approval and application, even though the other measure satisfies export machine-readable plan details for a policy tool.

E:

The first measure meets the requirement to save a plan for later explicit approval and application, but its partner serves a different role: 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 save a plan for later explicit approval and application and export machine-readable plan details for a policy tool. That second component is designed to omit the usual state refresh while creating an ordinary plan, so the still-missing criterion is to export machine-readable plan details for a policy tool, while the first criterion remains save a plan for later explicit approval and application.

Question 250

An operator is preparing a controlled Terraform change. Two independent changes are requested: first, propose state reconciliation for external changes without correcting real resources; second, interpret an attribute whose value is not available during planning. Which pair of measures fulfills both?

  1. Read -/+ as replacement intent + Understand a (known after apply) value
  2. Use terraform plan -replace=ADDRESS + Use terraform plan -refresh=false carefully
  3. Use terraform plan -detailed-exitcode + Understand a (known after apply) value
  4. Use terraform plan -refresh-only + Use terraform show -json tfplan
  5. Use terraform plan -refresh-only + Understand a (known after apply) value

Explanation

Correct Answer

E:

For the first criterion, 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 and interpret an attribute whose value is not available during planning; this directly addresses the need to propose state reconciliation for external changes without correcting real resources. For the separate second criterion, computed provider attributes may be unknown until resource creation; terraform carries unknown values through dependent expressions rather than fabricating them; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning; this fulfills the need to interpret an attribute whose value is not available during planning. Together they cover the independent tasks of propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the interpret an attribute whose value is not available during planning requirement, but the first is designed for another concern: Some argument changes cannot be updated remotely and require a new object; replacement can have downtime implications unless ordering or architecture mitigates it; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning. That first component is designed to recognize a planned destroy-and-create operation rather than an in-place edit, which does not accomplish the requested task to propose state reconciliation for external changes without correcting real resources, even though the other measure satisfies interpret an attribute whose value is not available during planning.

B:

The first measure is intended to request replacement of a particular managed instance: The flag adds a replacement instruction to planning for an addressed resource; it is preferable to legacy manual taint workflows for deliberate replacement; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning. The second measure is intended to omit the usual state refresh while creating an ordinary plan: 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 and interpret an attribute whose value is not available during planning. Neither is the directly designated method for the separate goals of propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning in this review.

C:

The second measure does meet the interpret an attribute whose value is not available during planning requirement, but the first is designed for another concern: The option uses exit code 0 for no differences, 2 for differences, and 1 for errors; a nonzero value is not always an execution failure; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning. That first component is designed to distinguish clean plans from plans with proposed changes in CI, which does not accomplish the requested task to propose state reconciliation for external changes without correcting real resources, even though the other measure satisfies interpret an attribute whose value is not available during planning.

D:

The first measure meets the requirement to propose state reconciliation for external changes without correcting real resources, but its partner serves a different role: 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 and interpret an attribute whose value is not available during planning. That second component is designed to export machine-readable plan details for a policy tool, so the still-missing criterion is to interpret an attribute whose value is not available during planning, while the first criterion remains propose state reconciliation for external changes without correcting real resources.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests