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 59

Question 580

A financial-services CI platform needs separate privileges for downloading state and modifying remote cloud infrastructure. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Define a supported backend in the terraform block, initialize it with approved credentials and secure remote state storage with encryption and scoped access. Verify: Run a clean test initialization with a scoped CI identity and verify that source and saved artifacts contain no plaintext backend password.
  2. Implement: Provide backend authentication using supported environment or workload identity and inject backend settings safely rather than embedding long-lived access tokens in HCL. Verify: Initialize a disposable remote backend, apply a test resource and verify the resulting state is in the intended restricted location rather than the local directory.
  3. Implement: Use the local backend only for isolated or small controlled contexts and secure the terraform.tfstate file from loss, accidental commits and parallel writers. Verify: Apply a disposable resource, locate its local state and compare a second isolated checkout to show why it lacks a shared authoritative state snapshot.
  4. Implement: Provide backend authentication using supported environment or workload identity and inject backend settings safely rather than embedding long-lived access tokens in HCL. Verify: Run a clean test initialization with a scoped CI identity and verify that source and saved artifacts contain no plaintext backend password.

Answer & Explanations

Correct answer: D

A.

The question is set in this situation: A financial-services CI platform needs separate privileges for downloading state and modifying remote cloud infrastructure. The test would be relevant: Run a clean test initialization with a scoped CI identity and verify that source and saved artifacts contain no plaintext backend password. But the offered implementation—Define a supported backend in the terraform block, initialize it with approved credentials and secure remote state storage with encryption and scoped access.—addresses “Configure a supported remote state backend with access controls”. The action needed here is: Provide backend authentication using supported environment or workload identity and inject backend settings safely rather than embedding long-lived access tokens in HCL.

B.

The question is set in this situation: A financial-services CI platform needs separate privileges for downloading state and modifying remote cloud infrastructure. The action is applicable: Provide backend authentication using supported environment or workload identity and inject backend settings safely rather than embedding long-lived access tokens in HCL. But its proposed test—Initialize a disposable remote backend, apply a test resource and verify the resulting state is in the intended restricted location rather than the local directory.—addresses “Configure a supported remote state backend with access controls”. This requirement is confirmed instead by: Run a clean test initialization with a scoped CI identity and verify that source and saved artifacts contain no plaintext backend password.

C.

This action/test pair addresses “Recognize the limits of the local Terraform state backend”. Use the local backend only for isolated or small controlled contexts and secure the terraform.tfstate file from loss, accidental commits and parallel writers. Apply a disposable resource, locate its local state and compare a second isolated checkout to show why it lacks a shared authoritative state snapshot. The case instead calls for: Provide backend authentication using supported environment or workload identity and inject backend settings safely rather than embedding long-lived access tokens in HCL.

D.

The question is set in this situation: A financial-services CI platform needs separate privileges for downloading state and modifying remote cloud infrastructure. Provide backend authentication using supported environment or workload identity and inject backend settings safely rather than embedding long-lived access tokens in HCL. Confirm it through this test: Run a clean test initialization with a scoped CI identity and verify that source and saved artifacts contain no plaintext backend password. Backends are initialized before providers and have their own authentication flow; committed secrets can be exposed through source history and initialization metadata.

Question 581

A network engineer modifies a test firewall rule manually and operations must decide whether to accept the actual change or restore code. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure.
  2. Define a supported backend in the terraform block, initialize it with approved credentials and secure remote state storage with encryption and scoped access.
  3. Declare a moved block mapping an old resource address to its new address during a configuration refactor, then review a plan for preserved remote identity.
  4. Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

Answer & Explanations

Correct answer: D

A.

Investigate a persisted state lock, establish that no run remains active, and use terraform force-unlock only with the exact known lock ID under approved recovery procedure. This addresses “Use force-unlock only after verifying a stale lock”, where the governing principle is: Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts. The stated case instead calls for: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

B.

Define a supported backend in the terraform block, initialize it with approved credentials and secure remote state storage with encryption and scoped access. This addresses “Configure a supported remote state backend with access controls”, where the governing principle is: A backend determines where authoritative state is stored and often provides locking; provider authentication alone does not grant or configure remote backend access. The stated case instead calls for: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

C.

Declare a moved block mapping an old resource address to its new address during a configuration refactor, then review a plan for preserved remote identity. This addresses “Use moved blocks for resource address refactors without intentional recreation”, where the governing principle is: Moved blocks update Terraform's knowledge of resource addresses so renaming code does not by itself imply destroy and recreate of the same remote resource. The stated case instead calls for: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

D.

Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs. Verify the result with this test: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.

Question 582

A network engineer modifies a test firewall rule manually and operations must decide whether to accept the actual change or restore code. The infrastructure engineer proposes this change: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. Which mechanism explains why it works?

  1. A backend determines where authoritative state is stored and often provides locking; provider authentication alone does not grant or configure remote backend access.
  2. Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs.
  3. Moved blocks update Terraform's knowledge of resource addresses so renaming code does not by itself imply destroy and recreate of the same remote resource.
  4. Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts.

Answer & Explanations

Correct answer: B

A.

A backend determines where authoritative state is stored and often provides locking; provider authentication alone does not grant or configure remote backend access. That explains “Configure a supported remote state backend with access controls”, not the mechanism behind the described change. The relevant principle is: Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs.

B.

Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs. The corresponding implementation is: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

C.

Moved blocks update Terraform's knowledge of resource addresses so renaming code does not by itself imply destroy and recreate of the same remote resource. That explains “Use moved blocks for resource address refactors without intentional recreation”, not the mechanism behind the described change. The relevant principle is: Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs.

D.

Force-unlock removes locking protection rather than safely terminating a still-running Terraform operation; using it during an active apply can create conflicts. That explains “Use force-unlock only after verifying a stale lock”, not the mechanism behind the described change. The relevant principle is: Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs.

Question 583

A network engineer modifies a test firewall rule manually and operations must decide whether to accept the actual change or restore code. After implementing this change—Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.—which test most directly validates its intended outcome?

  1. Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.
  2. Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation.
  3. Initialize a disposable remote backend, apply a test resource and verify the resulting state is in the intended restricted location rather than the local directory.
  4. Rename a disposable managed resource, add the corresponding moved mapping and verify the plan retains the original remote ID.

Answer & Explanations

Correct answer: A

A.

Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either. This check is decisive because refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs.

B.

Simulate an abandoned test lock, inspect its reported ID and confirm an authorized unlock followed by a normal plan restores safe operation. That would help test “Use force-unlock only after verifying a stale lock”, not the outcome required in this scenario. The relevant acceptance check is: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.

C.

Initialize a disposable remote backend, apply a test resource and verify the resulting state is in the intended restricted location rather than the local directory. That would help test “Configure a supported remote state backend with access controls”, not the outcome required in this scenario. The relevant acceptance check is: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.

D.

Rename a disposable managed resource, add the corresponding moved mapping and verify the plan retains the original remote ID. That would help test “Use moved blocks for resource address refactors without intentional recreation”, not the outcome required in this scenario. The relevant acceptance check is: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.

Question 584

A network engineer modifies a test firewall rule manually and operations must decide whether to accept the actual change or restore code. Which proposed shortcut most directly risks unrepaired infrastructure drift because state refresh was confused with configuration enforcement and should therefore be rejected?

  1. Write a remote backend block without running terraform init and assume existing local state instantly migrates to the new storage.
  2. Rename a resource block in production without a moved mapping and assume Terraform always recognizes it as the same object by cloud display name.
  3. Assume terraform apply -refresh-only will forcibly restore every cloud resource to its old configured values after an external manual edit.
  4. Force-unlock a backend whenever planning is slow without checking whether a live CI job currently owns the lock.

Answer & Explanations

Correct answer: C

A.

Write a remote backend block without running terraform init and assume existing local state instantly migrates to the new storage. That shortcut risks multiple authoritative state copies or loss of tracking after backend changes. Here the specific shortcut is: Assume terraform apply -refresh-only will forcibly restore every cloud resource to its old configured values after an external manual edit.

B.

Rename a resource block in production without a moved mapping and assume Terraform always recognizes it as the same object by cloud display name. That shortcut risks unintended destroy-and-create operations during harmless code organization. Here the specific shortcut is: Assume terraform apply -refresh-only will forcibly restore every cloud resource to its old configured values after an external manual edit.

C.

Assume terraform apply -refresh-only will forcibly restore every cloud resource to its old configured values after an external manual edit. The foreseeable failure is unrepaired infrastructure drift because state refresh was confused with configuration enforcement. The safer response is: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

D.

Force-unlock a backend whenever planning is slow without checking whether a live CI job currently owns the lock. That shortcut risks overlapping operations and potential state corruption after premature unlock. Here the specific shortcut is: Assume terraform apply -refresh-only will forcibly restore every cloud resource to its old configured values after an external manual edit.

Question 585

A network engineer modifies a test firewall rule manually and operations must decide whether to accept the actual change or restore code. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. Verify: Rename a disposable managed resource, add the corresponding moved mapping and verify the plan retains the original remote ID.
  2. Implement: Define a supported backend in the terraform block, initialize it with approved credentials and secure remote state storage with encryption and scoped access. Verify: Initialize a disposable remote backend, apply a test resource and verify the resulting state is in the intended restricted location rather than the local directory.
  3. Implement: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. Verify: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.
  4. Implement: Declare a moved block mapping an old resource address to its new address during a configuration refactor, then review a plan for preserved remote identity. Verify: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.

Answer & Explanations

Correct answer: C

A.

The action is applicable: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. But its proposed test—Rename a disposable managed resource, add the corresponding moved mapping and verify the plan retains the original remote ID.—addresses “Use moved blocks for resource address refactors without intentional recreation”. This requirement is confirmed instead by: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.

B.

This action/test pair addresses “Configure a supported remote state backend with access controls”. Define a supported backend in the terraform block, initialize it with approved credentials and secure remote state storage with encryption and scoped access. Initialize a disposable remote backend, apply a test resource and verify the resulting state is in the intended restricted location rather than the local directory. The case instead calls for: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

C.

Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. Confirm it through this test: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either. Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs.

D.

The test would be relevant: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either. But the offered implementation—Declare a moved block mapping an old resource address to its new address during a configuration refactor, then review a plan for preserved remote identity.—addresses “Use moved blocks for resource address refactors without intentional recreation”. The action needed here is: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

Question 586

A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Declare a moved block mapping an old resource address to its new address during a configuration refactor, then review a plan for preserved remote identity.
  2. Define a supported backend in the terraform block, initialize it with approved credentials and secure remote state storage with encryption and scoped access.
  3. Protect the working directory's local state with appropriate encrypted backups and avoid manual file edits while preparing a move to an approved shared backend.
  4. Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

Answer & Explanations

Correct answer: D

A.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Declare a moved block mapping an old resource address to its new address during a configuration refactor, then review a plan for preserved remote identity. This addresses “Use moved blocks for resource address refactors without intentional recreation”, where the governing principle is: Moved blocks update Terraform's knowledge of resource addresses so renaming code does not by itself imply destroy and recreate of the same remote resource. The stated case instead calls for: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

B.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Define a supported backend in the terraform block, initialize it with approved credentials and secure remote state storage with encryption and scoped access. This addresses “Configure a supported remote state backend with access controls”, where the governing principle is: A backend determines where authoritative state is stored and often provides locking; provider authentication alone does not grant or configure remote backend access. The stated case instead calls for: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

C.

Protect the working directory's local state with appropriate encrypted backups and avoid manual file edits while preparing a move to an approved shared backend. This addresses “Do not assume local backend state is automatically backed up”, where the governing principle is: The local backend does not inherently provide centralized recovery, cross-host synchronization or immutable history; a damaged state file can lose resource identity bindings. The stated case instead calls for: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

D.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs. Verify the result with this test: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.

Question 587

A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. The infrastructure engineer proposes this change: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. Which mechanism explains why it works?

  1. The local backend does not inherently provide centralized recovery, cross-host synchronization or immutable history; a damaged state file can lose resource identity bindings.
  2. Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs.
  3. Moved blocks update Terraform's knowledge of resource addresses so renaming code does not by itself imply destroy and recreate of the same remote resource.
  4. A backend determines where authoritative state is stored and often provides locking; provider authentication alone does not grant or configure remote backend access.

Answer & Explanations

Correct answer: B

A.

The local backend does not inherently provide centralized recovery, cross-host synchronization or immutable history; a damaged state file can lose resource identity bindings. That explains “Do not assume local backend state is automatically backed up”, not the mechanism behind the described change. The relevant principle is: Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs.

B.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs. The corresponding implementation is: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

C.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Moved blocks update Terraform's knowledge of resource addresses so renaming code does not by itself imply destroy and recreate of the same remote resource. That explains “Use moved blocks for resource address refactors without intentional recreation”, not the mechanism behind the described change. The relevant principle is: Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs.

D.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. A backend determines where authoritative state is stored and often provides locking; provider authentication alone does not grant or configure remote backend access. That explains “Configure a supported remote state backend with access controls”, not the mechanism behind the described change. The relevant principle is: Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs.

Question 588

A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. After implementing this change—Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.—which test most directly validates its intended outcome?

  1. Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.
  2. Initialize a disposable remote backend, apply a test resource and verify the resulting state is in the intended restricted location rather than the local directory.
  3. Create a controlled state backup before an isolated lab change and demonstrate restoring it to recover the original resource addresses.
  4. Rename a disposable managed resource, add the corresponding moved mapping and verify the plan retains the original remote ID.

Answer & Explanations

Correct answer: A

A.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either. This check is decisive because refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs.

B.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Initialize a disposable remote backend, apply a test resource and verify the resulting state is in the intended restricted location rather than the local directory. That would help test “Configure a supported remote state backend with access controls”, not the outcome required in this scenario. The relevant acceptance check is: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.

C.

Create a controlled state backup before an isolated lab change and demonstrate restoring it to recover the original resource addresses. That would help test “Do not assume local backend state is automatically backed up”, not the outcome required in this scenario. The relevant acceptance check is: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.

D.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Rename a disposable managed resource, add the corresponding moved mapping and verify the plan retains the original remote ID. That would help test “Use moved blocks for resource address refactors without intentional recreation”, not the outcome required in this scenario. The relevant acceptance check is: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.

Question 589

A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Which proposed shortcut most directly risks unrepaired infrastructure drift because state refresh was confused with configuration enforcement and should therefore be rejected?

  1. Rename a resource block in production without a moved mapping and assume Terraform always recognizes it as the same object by cloud display name.
  2. Write a remote backend block without running terraform init and assume existing local state instantly migrates to the new storage.
  3. Delete a locally stored state file after an apply because the configuration source code alone can reconstruct every remote object ID.
  4. Assume terraform apply -refresh-only will forcibly restore every cloud resource to its old configured values after an external manual edit.

Answer & Explanations

Correct answer: D

A.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Rename a resource block in production without a moved mapping and assume Terraform always recognizes it as the same object by cloud display name. That shortcut risks unintended destroy-and-create operations during harmless code organization. Here the specific shortcut is: Assume terraform apply -refresh-only will forcibly restore every cloud resource to its old configured values after an external manual edit.

B.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Write a remote backend block without running terraform init and assume existing local state instantly migrates to the new storage. That shortcut risks multiple authoritative state copies or loss of tracking after backend changes. Here the specific shortcut is: Assume terraform apply -refresh-only will forcibly restore every cloud resource to its old configured values after an external manual edit.

C.

Delete a locally stored state file after an apply because the configuration source code alone can reconstruct every remote object ID. That shortcut risks orphaned infrastructure or costly duplicate resources after losing state identities. Here the specific shortcut is: Assume terraform apply -refresh-only will forcibly restore every cloud resource to its old configured values after an external manual edit.

D.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Assume terraform apply -refresh-only will forcibly restore every cloud resource to its old configured values after an external manual edit. The foreseeable failure is unrepaired infrastructure drift because state refresh was confused with configuration enforcement. The safer response is: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

Question 590

A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. Verify: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.
  2. Implement: Declare a moved block mapping an old resource address to its new address during a configuration refactor, then review a plan for preserved remote identity. Verify: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.
  3. Implement: Protect the working directory's local state with appropriate encrypted backups and avoid manual file edits while preparing a move to an approved shared backend. Verify: Create a controlled state backup before an isolated lab change and demonstrate restoring it to recover the original resource addresses.
  4. Implement: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. Verify: Rename a disposable managed resource, add the corresponding moved mapping and verify the plan retains the original remote ID.

Answer & Explanations

Correct answer: A

A.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. Confirm it through this test: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either. Refresh-only mode updates Terraform's observed state and outputs without reconciling remote objects toward configuration; normal plans may instead propose repairs.

B.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. The test would be relevant: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either. But the offered implementation—Declare a moved block mapping an old resource address to its new address during a configuration refactor, then review a plan for preserved remote identity.—addresses “Use moved blocks for resource address refactors without intentional recreation”. The action needed here is: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

C.

This action/test pair addresses “Do not assume local backend state is automatically backed up”. Protect the working directory's local state with appropriate encrypted backups and avoid manual file edits while preparing a move to an approved shared backend. Create a controlled state backup before an isolated lab change and demonstrate restoring it to recover the original resource addresses. The case instead calls for: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality.

D.

The question is set in this situation: A retailer wants to update state after a provider detects a harmless externally assigned attribute but not silently override declared settings. The action is applicable: Run terraform plan -refresh-only to inspect externally changed resource attributes and review a refresh-only apply only when state should accept the remote reality. But its proposed test—Rename a disposable managed resource, add the corresponding moved mapping and verify the plan retains the original remote ID.—addresses “Use moved blocks for resource address refactors without intentional recreation”. This requirement is confirmed instead by: Change a safe remote tag on a disposable resource, compare normal and refresh-only plans and verify their effects differ before approving either.

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