HashiCorp Terraform Associate 004 (HashiCorp Certified: Terraform Associate (004)) Practice Test 96

Question 950

A team is adjusting its declarative infrastructure process to plan removal of a managed resource no longer declared in HCL. Which mechanism most directly meets this particular need?

  1. terraform destroy
  2. Targeted destruction caution
  3. Specific resource removal from configuration
  4. Destroy plan preview
  5. Destroy approval safeguards
  6. Destroy scope and workspace selection

Explanation

Correct Answer

C:

The task is to plan removal of a managed resource no longer declared in HCL; Specific resource removal from configuration directly supports that requirement: Removing a resource block normally proposes destroying its bound remote object on the next apply. Its relevant boundary is: Use an intentional state-forgetting workflow when the object must remain.

Incorrect Answers

A:

terraform destroy is designed to remove all resources managed by a selected configuration and state, whereas this task is to plan removal of a managed resource no longer declared in HCL: terraform destroy plans and applies destruction for tracked managed objects in that workspace. Against Specific resource removal from configuration, its limitation is: It does not normally destroy unrelated objects absent from that state.

B:

Targeted destruction caution is designed to limit a destructive operation to a selected object only when necessary, whereas this task is to plan removal of a managed resource no longer declared in HCL: terraform destroy -target=ADDRESS restricts action scope for exceptional situations. Against Specific resource removal from configuration, its limitation is: Targeting can bypass parts of the normal complete dependency reconciliation.

D:

Destroy plan preview is designed to review a destruction proposal before running it, whereas this task is to plan removal of a managed resource no longer declared in HCL: terraform plan -destroy produces a plan whose intended effect is to remove managed infrastructure. Against Specific resource removal from configuration, its limitation is: A destroy plan itself makes no remote changes.

E:

Destroy approval safeguards is designed to keep confirmation and review around irreversible resource deletion, whereas this task is to plan removal of a managed resource no longer declared in HCL: An interactive destroy presents planned removal before approval unless automation bypasses it. Against Specific resource removal from configuration, its limitation is: Provider delete behavior and retention policies differ by object type.

F:

Destroy scope and workspace selection is designed to avoid deleting another environment by checking the active state context, whereas this task is to plan removal of a managed resource no longer declared in HCL: Destroy affects managed resources bound to the selected workspace or backend state. Against Specific resource removal from configuration, its limitation is: Identical Terraform files can manage different objects when their states differ.

Question 951

Before adopting Sensitive variable flag to redact secret values from normal Terraform CLI displays, which statement sets an accurate boundary?

  1. Provider schema support and Terraform 1.11 or later are required.
  2. Such a value can be referenced only in allowed ephemeral contexts.
  3. The underlying value can still be stored in state and plan artifacts.
  4. Ephemeral resources cannot be referenced in arbitrary persistent resource arguments.

Explanation

Correct Answer

C:

For Sensitive variable flag in the task to redact secret values from normal Terraform CLI displays, the important caution is: The underlying value can still be stored in state and plan artifacts. The reason this matters is its actual behavior: sensitive=true marks an input as sensitive and propagates that sensitivity into derived expressions.

Incorrect Answers

A:

The proposed warning belongs to Provider write-only argument, which serves the different goal to send a secret to a supporting resource without retaining it in Terraform state, rather than to Sensitive variable flag: A write-only provider argument consumes a value during apply without persisting the argument in state or plan. The question concerns Sensitive variable flag acting to redact secret values from normal Terraform CLI displays, not a limit of Provider write-only argument.

B:

The proposed warning belongs to Ephemeral input variable, which serves the different goal to use a temporary credential without persisting its value into state or plan, rather than to Sensitive variable flag: ephemeral=true on a variable keeps its value available during the operation but omits it from state and plan files. The question concerns Sensitive variable flag acting to redact secret values from normal Terraform CLI displays, not a limit of Ephemeral input variable.

D:

The proposed warning belongs to Ephemeral resource block, which serves the different goal to read or generate temporary data for an operation without tracking it in state, rather than to Sensitive variable flag: An ephemeral block uses provider-defined temporary resources for supported runtime-only inputs. The question concerns Sensitive variable flag acting to redact secret values from normal Terraform CLI displays, not a limit of Ephemeral resource block.

Question 952

A Terraform rollout has two separate requirements: first, distinguish snapshots belonging to different histories; second, protect state files even when outputs are marked sensitive. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Terraform state lineage; then use State sensitivity.
  2. First use Terraform state lineage; then use State and resource addresses.
  3. First use State binding identity; then use State sensitivity.
  4. First use State sensitivity; then use Terraform state lineage.
  5. First use State and resource addresses; then use State binding identity.

Explanation

Correct Answer

A:

The first requirement, to distinguish snapshots belonging to different histories, is handled by Terraform state lineage: The lineage identifies a state history and helps detect unrelated snapshots when moving or replacing state. The second requirement, to protect state files even when outputs are marked sensitive, is handled by State sensitivity: Secrets and credentials can occur in Terraform state regardless of CLI redaction settings. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

B:

For the requested tasks to distinguish snapshots belonging to different histories and protect state files even when outputs are marked sensitive, the first candidate Terraform state lineage addresses distinguish snapshots belonging to different histories; the second candidate State and resource addresses addresses track repeated instances independently under count or for_each. This mapping fails because the second mechanism primarily supports the task to track repeated instances independently under count or for_each; the actual requirements are distinguish snapshots belonging to different histories first and protect state files even when outputs are marked sensitive second.

C:

For the requested tasks to distinguish snapshots belonging to different histories and protect state files even when outputs are marked sensitive, the first candidate State binding identity addresses map a Terraform resource address to its real remote object; the second candidate State sensitivity addresses protect state files even when outputs are marked sensitive. This mapping fails because the first mechanism primarily supports the task to map a Terraform resource address to its real remote object; the actual requirements are distinguish snapshots belonging to different histories first and protect state files even when outputs are marked sensitive second.

D:

For the requested tasks to distinguish snapshots belonging to different histories and protect state files even when outputs are marked sensitive, the first candidate State sensitivity addresses protect state files even when outputs are marked sensitive; the second candidate Terraform state lineage addresses distinguish snapshots belonging to different histories. This mapping fails because the first mechanism primarily supports the task to protect state files even when outputs are marked sensitive and the second mechanism primarily supports the task to distinguish snapshots belonging to different histories; the actual requirements are distinguish snapshots belonging to different histories first and protect state files even when outputs are marked sensitive second.

E:

For the requested tasks to distinguish snapshots belonging to different histories and protect state files even when outputs are marked sensitive, the first candidate State and resource addresses addresses track repeated instances independently under count or for_each; the second candidate State binding identity addresses map a Terraform resource address to its real remote object. This mapping fails because the first mechanism primarily supports the task to track repeated instances independently under count or for_each and the second mechanism primarily supports the task to map a Terraform resource address to its real remote object; the actual requirements are distinguish snapshots belonging to different histories first and protect state files even when outputs are marked sensitive second.

Question 953

A Terraform rollout has two separate requirements: first, redact secret values from normal Terraform CLI displays; second, send a secret to a supporting resource without retaining it in Terraform state. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Vault dynamic credentials; then use Provider write-only argument.
  2. First use Provider write-only argument; then use Sensitive variable flag.
  3. First use Sensitive variable flag; then use Ephemeral resource block.
  4. First use Ephemeral resource block; then use Vault dynamic credentials.
  5. First use Sensitive variable flag; then use Provider write-only argument.

Explanation

Correct Answer

E:

The first requirement, to redact secret values from normal Terraform CLI displays, is handled by Sensitive variable flag: sensitive=true marks an input as sensitive and propagates that sensitivity into derived expressions. The second requirement, to send a secret to a supporting resource without retaining it in Terraform state, is handled by Provider write-only argument: A write-only provider argument consumes a value during apply without persisting the argument in state or plan. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to redact secret values from normal Terraform CLI displays and send a secret to a supporting resource without retaining it in Terraform state, the first candidate Vault dynamic credentials addresses retrieve short-lived credentials instead of hardcoding long-term secrets; the second candidate Provider write-only argument addresses send a secret to a supporting resource without retaining it in Terraform state. This mapping fails because the first mechanism primarily supports the task to retrieve short-lived credentials instead of hardcoding long-term secrets; the actual requirements are redact secret values from normal Terraform CLI displays first and send a secret to a supporting resource without retaining it in Terraform state second.

B:

For the requested tasks to redact secret values from normal Terraform CLI displays and send a secret to a supporting resource without retaining it in Terraform state, the first candidate Provider write-only argument addresses send a secret to a supporting resource without retaining it in Terraform state; the second candidate Sensitive variable flag addresses redact secret values from normal Terraform CLI displays. This mapping fails because the first mechanism primarily supports the task to send a secret to a supporting resource without retaining it in Terraform state and the second mechanism primarily supports the task to redact secret values from normal Terraform CLI displays; the actual requirements are redact secret values from normal Terraform CLI displays first and send a secret to a supporting resource without retaining it in Terraform state second.

C:

For the requested tasks to redact secret values from normal Terraform CLI displays and send a secret to a supporting resource without retaining it in Terraform state, the first candidate Sensitive variable flag addresses redact secret values from normal Terraform CLI displays; the second candidate Ephemeral resource block addresses read or generate temporary data for an operation without tracking it in state. This mapping fails because the second mechanism primarily supports the task to read or generate temporary data for an operation without tracking it in state; the actual requirements are redact secret values from normal Terraform CLI displays first and send a secret to a supporting resource without retaining it in Terraform state second.

D:

For the requested tasks to redact secret values from normal Terraform CLI displays and send a secret to a supporting resource without retaining it in Terraform state, the first candidate Ephemeral resource block addresses read or generate temporary data for an operation without tracking it in state; the second candidate Vault dynamic credentials addresses retrieve short-lived credentials instead of hardcoding long-term secrets. This mapping fails because the first mechanism primarily supports the task to read or generate temporary data for an operation without tracking it in state and the second mechanism primarily supports the task to retrieve short-lived credentials instead of hardcoding long-term secrets; the actual requirements are redact secret values from normal Terraform CLI displays first and send a secret to a supporting resource without retaining it in Terraform state second.

Question 954

A Terraform runbook describes the mechanism "Specific resource removal from configuration". Which responsibility should a reviewer associate with it?

  1. limit a destructive operation to a selected object only when necessary
  2. keep confirmation and review around irreversible resource deletion
  3. plan removal of a managed resource no longer declared in HCL
  4. avoid deleting another environment by checking the active state context

Explanation

Correct Answer

C:

The practical result of Specific resource removal from configuration, used to plan removal of a managed resource no longer declared in HCL, is: Removing a resource block normally proposes destroying its bound remote object on the next apply. A qualification for this effect is: Use an intentional state-forgetting workflow when the object must remain.

Incorrect Answers

A:

That outcome applies to Targeted destruction caution, intended to limit a destructive operation to a selected object only when necessary, rather than the question's feature Specific resource removal from configuration: terraform destroy -target=ADDRESS restricts action scope for exceptional situations. Unlike Targeted destruction caution, Specific resource removal from configuration is intended to plan removal of a managed resource no longer declared in HCL, not to limit a destructive operation to a selected object only when necessary.

B:

That outcome applies to Destroy approval safeguards, intended to keep confirmation and review around irreversible resource deletion, rather than the question's feature Specific resource removal from configuration: An interactive destroy presents planned removal before approval unless automation bypasses it. Unlike Destroy approval safeguards, Specific resource removal from configuration is intended to plan removal of a managed resource no longer declared in HCL, not to keep confirmation and review around irreversible resource deletion.

D:

That outcome applies to Destroy scope and workspace selection, intended to avoid deleting another environment by checking the active state context, rather than the question's feature Specific resource removal from configuration: Destroy affects managed resources bound to the selected workspace or backend state. Unlike Destroy scope and workspace selection, Specific resource removal from configuration is intended to plan removal of a managed resource no longer declared in HCL, not to avoid deleting another environment by checking the active state context.

Question 955

An engineer must update an existing Terraform workflow to use a temporary credential without persisting its value into state or plan. Which mechanism most directly meets this particular need?

  1. Secret rotation and state boundary
  2. Vault dynamic credentials
  3. Ephemeral input variable
  4. Secure remote state storage

Explanation

Correct Answer

C:

The task is to use a temporary credential without persisting its value into state or plan; Ephemeral input variable directly supports that requirement: ephemeral=true on a variable keeps its value available during the operation but omits it from state and plan files. Its relevant boundary is: Such a value can be referenced only in allowed ephemeral contexts.

Incorrect Answers

A:

Secret rotation and state boundary is designed to choose an ephemeral or write-only route when a credential must not persist, whereas this task is to use a temporary credential without persisting its value into state or plan: Terraform's ephemeral support and provider write-only arguments can avoid persisting supported temporary values. Against Ephemeral input variable, its limitation is: Ordinary resource arguments marked sensitive can still end up in state.

B:

Vault dynamic credentials is designed to retrieve short-lived credentials instead of hardcoding long-term secrets, whereas this task is to use a temporary credential without persisting its value into state or plan: Vault and supported integrations can issue time-limited credentials that reduce long-lived secret exposure. Against Ephemeral input variable, its limitation is: Credentials and provider configuration still require secure authentication and appropriate permissions.

D:

Secure remote state storage is designed to reduce exposure of potentially sensitive values in Terraform state, whereas this task is to use a temporary credential without persisting its value into state or plan: An access-controlled remote backend with encryption protects stored snapshots and collaboration. Against Ephemeral input variable, its limitation is: Marking outputs sensitive is not a substitute for backend access restrictions.

Question 956

The team is documenting risks of Specific resource removal from configuration while planning to plan removal of a managed resource no longer declared in HCL. Which caveat specifically applies to that mechanism?

  1. Identical Terraform files can manage different objects when their states differ.
  2. Targeting can bypass parts of the normal complete dependency reconciliation.
  3. Provider delete behavior and retention policies differ by object type.
  4. Use an intentional state-forgetting workflow when the object must remain.

Explanation

Correct Answer

D:

For Specific resource removal from configuration in the task to plan removal of a managed resource no longer declared in HCL, the important caution is: Use an intentional state-forgetting workflow when the object must remain. The reason this matters is its actual behavior: Removing a resource block normally proposes destroying its bound remote object on the next apply.

Incorrect Answers

A:

The proposed warning belongs to Destroy scope and workspace selection, which serves the different goal to avoid deleting another environment by checking the active state context, rather than to Specific resource removal from configuration: Destroy affects managed resources bound to the selected workspace or backend state. The question concerns Specific resource removal from configuration acting to plan removal of a managed resource no longer declared in HCL, not a limit of Destroy scope and workspace selection.

B:

The proposed warning belongs to Targeted destruction caution, which serves the different goal to limit a destructive operation to a selected object only when necessary, rather than to Specific resource removal from configuration: terraform destroy -target=ADDRESS restricts action scope for exceptional situations. The question concerns Specific resource removal from configuration acting to plan removal of a managed resource no longer declared in HCL, not a limit of Targeted destruction caution.

C:

The proposed warning belongs to Destroy approval safeguards, which serves the different goal to keep confirmation and review around irreversible resource deletion, rather than to Specific resource removal from configuration: An interactive destroy presents planned removal before approval unless automation bypasses it. The question concerns Specific resource removal from configuration acting to plan removal of a managed resource no longer declared in HCL, not a limit of Destroy approval safeguards.

Question 957

The deployment owner requests a reliable way to support incremental reconciliation against existing remote objects. Which mechanism most directly meets this particular need?

  1. State as synchronization metadata
  2. State and resource addresses
  3. State sensitivity
  4. Terraform state lineage

Explanation

Correct Answer

A:

The task is to support incremental reconciliation against existing remote objects; State as synchronization metadata directly supports that requirement: Terraform consults state rather than treating each run as a completely new unmanaged deployment. Its relevant boundary is: State still needs refresh checks to recognize external infrastructure changes.

Incorrect Answers

B:

State and resource addresses is designed to track repeated instances independently under count or for_each, whereas this task is to support incremental reconciliation against existing remote objects: State holds individual addresses such as example[0] or example["dev"] for separate instances. Against State as synchronization metadata, its limitation is: Changing the addressing model can require a migration to preserve bindings.

C:

State sensitivity is designed to protect state files even when outputs are marked sensitive, whereas this task is to support incremental reconciliation against existing remote objects: Secrets and credentials can occur in Terraform state regardless of CLI redaction settings. Against State as synchronization metadata, its limitation is: The sensitive flag hides display but does not guarantee data is absent from state.

D:

Terraform state lineage is designed to distinguish snapshots belonging to different histories, whereas this task is to support incremental reconciliation against existing remote objects: The lineage identifies a state history and helps detect unrelated snapshots when moving or replacing state. Against State as synchronization metadata, its limitation is: It does not grant access to the remote backend.

Question 958

A colleague recommends the Terraform concept "Ephemeral input variable". Which use case best matches it?

  1. retrieve short-lived credentials instead of hardcoding long-term secrets
  2. reduce exposure of potentially sensitive values in Terraform state
  3. use a temporary credential without persisting its value into state or plan
  4. choose an ephemeral or write-only route when a credential must not persist

Explanation

Correct Answer

C:

The practical result of Ephemeral input variable, used to use a temporary credential without persisting its value into state or plan, is: ephemeral=true on a variable keeps its value available during the operation but omits it from state and plan files. A qualification for this effect is: Such a value can be referenced only in allowed ephemeral contexts.

Incorrect Answers

A:

That outcome applies to Vault dynamic credentials, intended to retrieve short-lived credentials instead of hardcoding long-term secrets, rather than the question's feature Ephemeral input variable: Vault and supported integrations can issue time-limited credentials that reduce long-lived secret exposure. Unlike Vault dynamic credentials, Ephemeral input variable is intended to use a temporary credential without persisting its value into state or plan, not to retrieve short-lived credentials instead of hardcoding long-term secrets.

B:

That outcome applies to Secure remote state storage, intended to reduce exposure of potentially sensitive values in Terraform state, rather than the question's feature Ephemeral input variable: An access-controlled remote backend with encryption protects stored snapshots and collaboration. Unlike Secure remote state storage, Ephemeral input variable is intended to use a temporary credential without persisting its value into state or plan, not to reduce exposure of potentially sensitive values in Terraform state.

D:

That outcome applies to Secret rotation and state boundary, intended to choose an ephemeral or write-only route when a credential must not persist, rather than the question's feature Ephemeral input variable: Terraform's ephemeral support and provider write-only arguments can avoid persisting supported temporary values. Unlike Secret rotation and state boundary, Ephemeral input variable is intended to use a temporary credential without persisting its value into state or plan, not to choose an ephemeral or write-only route when a credential must not persist.

Question 959

A Terraform rollout has two separate requirements: first, plan removal of a managed resource no longer declared in HCL; second, limit a destructive operation to a selected object only when necessary. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Specific resource removal from configuration; then use Destroy approval safeguards.
  2. First use Destroy scope and workspace selection; then use Targeted destruction caution.
  3. First use Destroy approval safeguards; then use Destroy scope and workspace selection.
  4. First use Specific resource removal from configuration; then use Targeted destruction caution.
  5. First use Targeted destruction caution; then use Specific resource removal from configuration.

Explanation

Correct Answer

D:

The first requirement, to plan removal of a managed resource no longer declared in HCL, is handled by Specific resource removal from configuration: Removing a resource block normally proposes destroying its bound remote object on the next apply. The second requirement, to limit a destructive operation to a selected object only when necessary, is handled by Targeted destruction caution: terraform destroy -target=ADDRESS restricts action scope for exceptional situations. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to plan removal of a managed resource no longer declared in HCL and limit a destructive operation to a selected object only when necessary, the first candidate Specific resource removal from configuration addresses plan removal of a managed resource no longer declared in HCL; the second candidate Destroy approval safeguards addresses keep confirmation and review around irreversible resource deletion. This mapping fails because the second mechanism primarily supports the task to keep confirmation and review around irreversible resource deletion; the actual requirements are plan removal of a managed resource no longer declared in HCL first and limit a destructive operation to a selected object only when necessary second.

B:

For the requested tasks to plan removal of a managed resource no longer declared in HCL and limit a destructive operation to a selected object only when necessary, the first candidate Destroy scope and workspace selection addresses avoid deleting another environment by checking the active state context; the second candidate Targeted destruction caution addresses limit a destructive operation to a selected object only when necessary. This mapping fails because the first mechanism primarily supports the task to avoid deleting another environment by checking the active state context; the actual requirements are plan removal of a managed resource no longer declared in HCL first and limit a destructive operation to a selected object only when necessary second.

C:

For the requested tasks to plan removal of a managed resource no longer declared in HCL and limit a destructive operation to a selected object only when necessary, the first candidate Destroy approval safeguards addresses keep confirmation and review around irreversible resource deletion; the second candidate Destroy scope and workspace selection addresses avoid deleting another environment by checking the active state context. This mapping fails because the first mechanism primarily supports the task to keep confirmation and review around irreversible resource deletion and the second mechanism primarily supports the task to avoid deleting another environment by checking the active state context; the actual requirements are plan removal of a managed resource no longer declared in HCL first and limit a destructive operation to a selected object only when necessary second.

E:

For the requested tasks to plan removal of a managed resource no longer declared in HCL and limit a destructive operation to a selected object only when necessary, the first candidate Targeted destruction caution addresses limit a destructive operation to a selected object only when necessary; the second candidate Specific resource removal from configuration addresses plan removal of a managed resource no longer declared in HCL. This mapping fails because the first mechanism primarily supports the task to limit a destructive operation to a selected object only when necessary and the second mechanism primarily supports the task to plan removal of a managed resource no longer declared in HCL; the actual requirements are plan removal of a managed resource no longer declared in HCL first and limit a destructive operation to a selected object only when necessary second.

Question 960

The rollout owner asks whether Ephemeral input variable is sufficient to use a temporary credential without persisting its value into state or plan. Which limitation specifically concerns that mechanism?

  1. Such a value can be referenced only in allowed ephemeral contexts.
  2. Ordinary resource arguments marked sensitive can still end up in state.
  3. Credentials and provider configuration still require secure authentication and appropriate permissions.
  4. Marking outputs sensitive is not a substitute for backend access restrictions.

Explanation

Correct Answer

A:

For Ephemeral input variable in the task to use a temporary credential without persisting its value into state or plan, the important caution is: Such a value can be referenced only in allowed ephemeral contexts. The reason this matters is its actual behavior: ephemeral=true on a variable keeps its value available during the operation but omits it from state and plan files.

Incorrect Answers

B:

The proposed warning belongs to Secret rotation and state boundary, which serves the different goal to choose an ephemeral or write-only route when a credential must not persist, rather than to Ephemeral input variable: Terraform's ephemeral support and provider write-only arguments can avoid persisting supported temporary values. The question concerns Ephemeral input variable acting to use a temporary credential without persisting its value into state or plan, not a limit of Secret rotation and state boundary.

C:

The proposed warning belongs to Vault dynamic credentials, which serves the different goal to retrieve short-lived credentials instead of hardcoding long-term secrets, rather than to Ephemeral input variable: Vault and supported integrations can issue time-limited credentials that reduce long-lived secret exposure. The question concerns Ephemeral input variable acting to use a temporary credential without persisting its value into state or plan, not a limit of Vault dynamic credentials.

D:

The proposed warning belongs to Secure remote state storage, which serves the different goal to reduce exposure of potentially sensitive values in Terraform state, rather than to Ephemeral input variable: An access-controlled remote backend with encryption protects stored snapshots and collaboration. The question concerns Ephemeral input variable acting to use a temporary credential without persisting its value into state or plan, not a limit of Secure remote state storage.

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