Practice Exams:

HashiCorp Terraform Associate 004 Dumps

EXAM: HashiCorp Certified: Terraform Associate (004)
Verified By Experts
Premium Bundle
$40.00
$59.97 $99.97

Terraform Associate 004 Premium Bundle


  • Premium File 167 Questions & Answers
  • Training Course 118 Lectures
  • Study Guide 285 Pages

HashiCorp Terraform Associate 004 Practice Test 26

Question 250

A research team decommissions a temporary test environment and must verify the plan does not include a shared persistent database. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency. Verify: Create a small isolated test stack, inspect the destroy plan, perform removal and verify the remote objects and state addresses are gone.
  2. Implement: When changing backend settings, choose the appropriate terraform init -migrate-state or -reconfigure workflow after safeguarding the existing state and validating target storage. Verify: Test a local-to-remote backend move on disposable state, inspect source and destination snapshots, and confirm a subsequent plan preserves resource addresses.
  3. Implement: Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove. Verify: Create a small isolated test stack, inspect the destroy plan, perform removal and verify the remote objects and state addresses are gone.
  4. Implement: Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove. Verify: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.

Answer & Explanations

Correct answer: C

A.

The question is set in this situation: A research team decommissions a temporary test environment and must verify the plan does not include a shared persistent database. The test would be relevant: Create a small isolated test stack, inspect the destroy plan, perform removal and verify the remote objects and state addresses are gone. But the offered implementation—Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.—addresses “Avoid routine targeting as a substitute for normal lifecycle review”. The action needed here is: Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove.

B.

This action/test pair addresses “Handle backend reconfiguration and migration deliberately”. When changing backend settings, choose the appropriate terraform init -migrate-state or -reconfigure workflow after safeguarding the existing state and validating target storage. Test a local-to-remote backend move on disposable state, inspect source and destination snapshots, and confirm a subsequent plan preserves resource addresses. The case instead calls for: Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove.

C.

The question is set in this situation: A research team decommissions a temporary test environment and must verify the plan does not include a shared persistent database. Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove. Confirm it through this test: Create a small isolated test stack, inspect the destroy plan, perform removal and verify the remote objects and state addresses are gone. Destroy asks providers to delete managed resources in the selected state, including dependencies; it can permanently remove data if safeguards are absent.

D.

The question is set in this situation: A research team decommissions a temporary test environment and must verify the plan does not include a shared persistent database. The action is applicable: Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove. But its proposed test—Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.—addresses “Avoid routine targeting as a substitute for normal lifecycle review”. This requirement is confirmed instead by: Create a small isolated test stack, inspect the destroy plan, perform removal and verify the remote objects and state addresses are gone.

Question 251

A deployment team needs to recover from a broken test resource but other resources refer to its attributes through Terraform expressions. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.
  2. Initialize providers and backend, validate configuration, inspect a plan and apply only reviewed changes under the appropriate identity.
  3. Run terraform plan -detailed-exitcode and distinguish exit code zero for no diff, two for proposed changes, and one for execution errors.
  4. Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove.

Answer & Explanations

Correct answer: A

A.

Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency. Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned. Verify the result with this test: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.

B.

Initialize providers and backend, validate configuration, inspect a plan and apply only reviewed changes under the appropriate identity. This addresses “Follow init-plan-apply workflow before changing infrastructure”, where the governing principle is: Terraform builds an execution plan from configuration, state and remote reality; separating review from apply helps control infrastructure effects. The stated case instead calls for: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

C.

Run terraform plan -detailed-exitcode and distinguish exit code zero for no diff, two for proposed changes, and one for execution errors. This addresses “Interpret terraform plan -detailed-exitcode in CI carefully”, where the governing principle is: The detailed exit status separates changed infrastructure from command failure, letting CI enforce review without confusing drift with a failed command. The stated case instead calls for: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

D.

Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove. This addresses “Use terraform destroy only after reviewing the removal plan”, where the governing principle is: Destroy asks providers to delete managed resources in the selected state, including dependencies; it can permanently remove data if safeguards are absent. The stated case instead calls for: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

Question 252

A deployment team needs to recover from a broken test resource but other resources refer to its attributes through Terraform expressions. The infrastructure engineer proposes this change: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency. Which mechanism explains why it works?

  1. The detailed exit status separates changed infrastructure from command failure, letting CI enforce review without confusing drift with a failed command.
  2. Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned.
  3. Destroy asks providers to delete managed resources in the selected state, including dependencies; it can permanently remove data if safeguards are absent.
  4. Terraform builds an execution plan from configuration, state and remote reality; separating review from apply helps control infrastructure effects.

Answer & Explanations

Correct answer: B

A.

The detailed exit status separates changed infrastructure from command failure, letting CI enforce review without confusing drift with a failed command. That explains “Interpret terraform plan -detailed-exitcode in CI carefully”, not the mechanism behind the described change. The relevant principle is: Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned.

B.

Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned. The corresponding implementation is: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

C.

Destroy asks providers to delete managed resources in the selected state, including dependencies; it can permanently remove data if safeguards are absent. That explains “Use terraform destroy only after reviewing the removal plan”, not the mechanism behind the described change. The relevant principle is: Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned.

D.

Terraform builds an execution plan from configuration, state and remote reality; separating review from apply helps control infrastructure effects. That explains “Follow init-plan-apply workflow before changing infrastructure”, not the mechanism behind the described change. The relevant principle is: Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned.

Question 253

A deployment team needs to recover from a broken test resource but other resources refer to its attributes through Terraform expressions. After implementing this change—Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.—which test most directly validates its intended outcome?

  1. Test a no-op configuration, a safe tagged change and a deliberately invalid credential, recording the separate Terraform exit codes.
  2. Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.
  3. In a sandbox, run init, validate, plan and apply with an approved test resource, then confirm an unchanged subsequent plan.
  4. Create a small isolated test stack, inspect the destroy plan, perform removal and verify the remote objects and state addresses are gone.

Answer & Explanations

Correct answer: B

A.

Test a no-op configuration, a safe tagged change and a deliberately invalid credential, recording the separate Terraform exit codes. That would help test “Interpret terraform plan -detailed-exitcode in CI carefully”, not the outcome required in this scenario. The relevant acceptance check is: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.

B.

Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains. This check is decisive because target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned.

C.

In a sandbox, run init, validate, plan and apply with an approved test resource, then confirm an unchanged subsequent plan. That would help test “Follow init-plan-apply workflow before changing infrastructure”, not the outcome required in this scenario. The relevant acceptance check is: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.

D.

Create a small isolated test stack, inspect the destroy plan, perform removal and verify the remote objects and state addresses are gone. That would help test “Use terraform destroy only after reviewing the removal plan”, not the outcome required in this scenario. The relevant acceptance check is: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.

Question 254

A deployment team needs to recover from a broken test resource but other resources refer to its attributes through Terraform expressions. Which proposed shortcut most directly risks broken dependent resources and incomplete infrastructure convergence and should therefore be rejected?

  1. Run terraform apply on an unfamiliar production directory before initialization and without reviewing the proposed resource changes.
  2. Run terraform destroy in a shared production backend assuming it deletes only temporary resources from the current terminal session.
  3. Destroy one selected resource with a targeted option and declare the environment fully reconciled without reviewing its dependencies.
  4. Treat exit code two as a plan crash and silently suppress a real changed-infrastructure review.

Answer & Explanations

Correct answer: C

A.

Run terraform apply on an unfamiliar production directory before initialization and without reviewing the proposed resource changes. That shortcut risks unintended production changes from skipping baseline validation and change review. Here the specific shortcut is: Destroy one selected resource with a targeted option and declare the environment fully reconciled without reviewing its dependencies.

B.

Run terraform destroy in a shared production backend assuming it deletes only temporary resources from the current terminal session. That shortcut risks permanent loss of unrelated managed infrastructure or stored data. Here the specific shortcut is: Destroy one selected resource with a targeted option and declare the environment fully reconciled without reviewing its dependencies.

C.

Destroy one selected resource with a targeted option and declare the environment fully reconciled without reviewing its dependencies. The foreseeable failure is broken dependent resources and incomplete infrastructure convergence. The safer response is: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

D.

Treat exit code two as a plan crash and silently suppress a real changed-infrastructure review. That shortcut risks invalid infrastructure approvals or missed change alerts caused by misinterpreted CI statuses. Here the specific shortcut is: Destroy one selected resource with a targeted option and declare the environment fully reconciled without reviewing its dependencies.

Question 255

A deployment team needs to recover from a broken test resource but other resources refer to its attributes through Terraform expressions. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency. Verify: Create a small isolated test stack, inspect the destroy plan, perform removal and verify the remote objects and state addresses are gone.
  2. Implement: Run terraform plan -detailed-exitcode and distinguish exit code zero for no diff, two for proposed changes, and one for execution errors. Verify: Test a no-op configuration, a safe tagged change and a deliberately invalid credential, recording the separate Terraform exit codes.
  3. Implement: Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove. Verify: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.
  4. Implement: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency. Verify: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.

Answer & Explanations

Correct answer: D

A.

The action is applicable: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency. But its proposed test—Create a small isolated test stack, inspect the destroy plan, perform removal and verify the remote objects and state addresses are gone.—addresses “Use terraform destroy only after reviewing the removal plan”. This requirement is confirmed instead by: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.

B.

This action/test pair addresses “Interpret terraform plan -detailed-exitcode in CI carefully”. Run terraform plan -detailed-exitcode and distinguish exit code zero for no diff, two for proposed changes, and one for execution errors. Test a no-op configuration, a safe tagged change and a deliberately invalid credential, recording the separate Terraform exit codes. The case instead calls for: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

C.

The test would be relevant: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains. But the offered implementation—Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove.—addresses “Use terraform destroy only after reviewing the removal plan”. The action needed here is: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

D.

Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency. Confirm it through this test: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains. Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned.

Question 256

A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.
  2. Require terraform fmt -check in CI and apply terraform fmt to the authoring branch when formatting does not match the canonical HCL style.
  3. Use validate for static configuration checks, then run terraform plan to assess credentials, current state, remote objects and proposed infrastructure effects.
  4. Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove.

Answer & Explanations

Correct answer: A

A.

The question is set in this situation: A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency. Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned. Verify the result with this test: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.

B.

Require terraform fmt -check in CI and apply terraform fmt to the authoring branch when formatting does not match the canonical HCL style. This addresses “Use terraform fmt -check before merging HCL”, where the governing principle is: The formatter normalizes whitespace and alignment, and the check flag detects differences without modifying the working directory. The stated case instead calls for: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

C.

Use validate for static configuration checks, then run terraform plan to assess credentials, current state, remote objects and proposed infrastructure effects. This addresses “Distinguish terraform validate from a provider-backed execution plan”, where the governing principle is: Validate generally does not assess actual provider-backed change impact; only planning against the chosen backend and provider can reveal replace or destroy actions. The stated case instead calls for: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

D.

The question is set in this situation: A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove. This addresses “Use terraform destroy only after reviewing the removal plan”, where the governing principle is: Destroy asks providers to delete managed resources in the selected state, including dependencies; it can permanently remove data if safeguards are absent. The stated case instead calls for: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

Question 257

A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. The infrastructure engineer proposes this change: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency. Which mechanism explains why it works?

  1. Destroy asks providers to delete managed resources in the selected state, including dependencies; it can permanently remove data if safeguards are absent.
  2. Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned.
  3. Validate generally does not assess actual provider-backed change impact; only planning against the chosen backend and provider can reveal replace or destroy actions.
  4. The formatter normalizes whitespace and alignment, and the check flag detects differences without modifying the working directory.

Answer & Explanations

Correct answer: B

A.

The question is set in this situation: A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. Destroy asks providers to delete managed resources in the selected state, including dependencies; it can permanently remove data if safeguards are absent. That explains “Use terraform destroy only after reviewing the removal plan”, not the mechanism behind the described change. The relevant principle is: Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned.

B.

The question is set in this situation: A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned. The corresponding implementation is: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

C.

Validate generally does not assess actual provider-backed change impact; only planning against the chosen backend and provider can reveal replace or destroy actions. That explains “Distinguish terraform validate from a provider-backed execution plan”, not the mechanism behind the described change. The relevant principle is: Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned.

D.

The formatter normalizes whitespace and alignment, and the check flag detects differences without modifying the working directory. That explains “Use terraform fmt -check before merging HCL”, not the mechanism behind the described change. The relevant principle is: Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned.

Question 258

A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. After implementing this change—Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.—which test most directly validates its intended outcome?

  1. Make a valid HCL change that requires replacing a disposable resource and verify validate succeeds while a plan correctly reports replacement.
  2. Create a small isolated test stack, inspect the destroy plan, perform removal and verify the remote objects and state addresses are gone.
  3. Introduce inconsistent indentation in a test .tf file, verify fmt -check reports it and a subsequent fmt produces a clean check.
  4. Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.

Answer & Explanations

Correct answer: D

A.

Make a valid HCL change that requires replacing a disposable resource and verify validate succeeds while a plan correctly reports replacement. That would help test “Distinguish terraform validate from a provider-backed execution plan”, not the outcome required in this scenario. The relevant acceptance check is: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.

B.

The question is set in this situation: A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. Create a small isolated test stack, inspect the destroy plan, perform removal and verify the remote objects and state addresses are gone. That would help test “Use terraform destroy only after reviewing the removal plan”, not the outcome required in this scenario. The relevant acceptance check is: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.

C.

Introduce inconsistent indentation in a test.tf file, verify fmt -check reports it and a subsequent fmt produces a clean check. That would help test “Use terraform fmt -check before merging HCL”, not the outcome required in this scenario. The relevant acceptance check is: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.

D.

The question is set in this situation: A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains. This check is decisive because target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned.

Question 259

A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. Which proposed shortcut most directly risks broken dependent resources and incomplete infrastructure convergence and should therefore be rejected?

  1. Destroy one selected resource with a targeted option and declare the environment fully reconciled without reviewing its dependencies.
  2. Approve a production resource rename solely because terraform validate succeeds, without looking at the proposed destroy or create operations.
  3. Run terraform destroy in a shared production backend assuming it deletes only temporary resources from the current terminal session.
  4. Treat terraform fmt as a provider-backed deployment validator and skip all other checks after it succeeds.

Answer & Explanations

Correct answer: A

A.

The question is set in this situation: A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. Destroy one selected resource with a targeted option and declare the environment fully reconciled without reviewing its dependencies. The foreseeable failure is broken dependent resources and incomplete infrastructure convergence. The safer response is: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

B.

Approve a production resource rename solely because terraform validate succeeds, without looking at the proposed destroy or create operations. That shortcut risks unreviewed replacements or authorization failures hidden by successful static validation. Here the specific shortcut is: Destroy one selected resource with a targeted option and declare the environment fully reconciled without reviewing its dependencies.

C.

The question is set in this situation: A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. Run terraform destroy in a shared production backend assuming it deletes only temporary resources from the current terminal session. That shortcut risks permanent loss of unrelated managed infrastructure or stored data. Here the specific shortcut is: Destroy one selected resource with a targeted option and declare the environment fully reconciled without reviewing its dependencies.

D.

Treat terraform fmt as a provider-backed deployment validator and skip all other checks after it succeeds. That shortcut risks invalid or unsafe infrastructure changes masked by a style-only check. Here the specific shortcut is: Destroy one selected resource with a targeted option and declare the environment fully reconciled without reviewing its dependencies.

Question 260

A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove. Verify: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.
  2. Implement: Require terraform fmt -check in CI and apply terraform fmt to the authoring branch when formatting does not match the canonical HCL style. Verify: Introduce inconsistent indentation in a test .tf file, verify fmt -check reports it and a subsequent fmt produces a clean check.
  3. Implement: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency. Verify: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.
  4. Implement: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency. Verify: Create a small isolated test stack, inspect the destroy plan, perform removal and verify the remote objects and state addresses are gone.

Answer & Explanations

Correct answer: C

A.

The question is set in this situation: A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. The test would be relevant: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains. But the offered implementation—Run terraform plan -destroy or a reviewed terraform destroy in the exact disposable environment and confirm all listed objects are safe to remove.—addresses “Use terraform destroy only after reviewing the removal plan”. The action needed here is: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

B.

This action/test pair addresses “Use terraform fmt -check before merging HCL”. Require terraform fmt -check in CI and apply terraform fmt to the authoring branch when formatting does not match the canonical HCL style. Introduce inconsistent indentation in a test.tf file, verify fmt -check reports it and a subsequent fmt produces a clean check. The case instead calls for: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency.

C.

The question is set in this situation: A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency. Confirm it through this test: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains. Target selection can produce partial changes outside normal graph reconciliation, so skipping a full follow-up plan can leave dependent infrastructure misaligned.

D.

The question is set in this situation: A lab operator is tempted to target only a few resources during cleanup and needs evidence that dependent objects remain consistent afterward. The action is applicable: Prefer a full configuration plan and use targeted operations only for carefully justified recovery after evaluating dependencies and state consistency. But its proposed test—Create a small isolated test stack, inspect the destroy plan, perform removal and verify the remote objects and state addresses are gone.—addresses “Use terraform destroy only after reviewing the removal plan”. This requirement is confirmed instead by: Execute a deliberately scoped disposable cleanup, then perform a full plan and verify no unintended dependency drift remains.

HashiCorp Certified: Terraform Associate (004) (Terraform Associate 004) Practice Tests