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

Question 940

A Terraform runbook describes the mechanism "Cross-object validation constraint". Which responsibility should a reviewer associate with it?

  1. give a useful explanation when an assertion evaluates to false
  2. refuse to publish a result when its required assumption fails
  3. evaluate an advisory assertion about deployed infrastructure
  4. enforce a relationship among known attributes instead of only checking types

Explanation

Correct Answer

D:

The practical result of Cross-object validation constraint, used to enforce a relationship among known attributes instead of only checking types, is: Lifecycle conditions can evaluate appropriate referenced values to enforce infrastructure invariants. A qualification for this effect is: Dependencies must remain acyclic and values may only be available at apply time.

Incorrect Answers

A:

That outcome applies to Custom condition error_message, intended to give a useful explanation when an assertion evaluates to false, rather than the question's feature Cross-object validation constraint: Variable validations and lifecycle conditions provide error_message text for failed assertions. Unlike Custom condition error_message, Cross-object validation constraint is intended to enforce a relationship among known attributes instead of only checking types, not to give a useful explanation when an assertion evaluates to false.

B:

That outcome applies to Output precondition, intended to refuse to publish a result when its required assumption fails, rather than the question's feature Cross-object validation constraint: An output block can include a precondition to validate assumptions about the published value. Unlike Output precondition, Cross-object validation constraint is intended to enforce a relationship among known attributes instead of only checking types, not to refuse to publish a result when its required assumption fails.

C:

That outcome applies to Check block health assessment, intended to evaluate an advisory assertion about deployed infrastructure, rather than the question's feature Cross-object validation constraint: A check block can report a warning when an assertion fails without typically blocking the run. Unlike Check block health assessment, Cross-object validation constraint is intended to enforce a relationship among known attributes instead of only checking types, not to evaluate an advisory assertion about deployed infrastructure.

Question 941

A configuration walkthrough identifies "Destroy plan preview". Which task is it principally intended to support?

  1. plan removal of a managed resource no longer declared in HCL
  2. stop managing a resource while keeping its real object intact
  3. review a destruction proposal before running it
  4. remove all resources managed by a selected configuration and state

Explanation

Correct Answer

C:

The practical result of Destroy plan preview, used to review a destruction proposal before running it, is: terraform plan -destroy produces a plan whose intended effect is to remove managed infrastructure. A qualification for this effect is: A destroy plan itself makes no remote changes.

Incorrect Answers

A:

That outcome applies to Specific resource removal from configuration, intended to plan removal of a managed resource no longer declared in HCL, rather than the question's feature Destroy plan preview: Removing a resource block normally proposes destroying its bound remote object on the next apply. Unlike Specific resource removal from configuration, Destroy plan preview is intended to review a destruction proposal before running it, not to plan removal of a managed resource no longer declared in HCL.

B:

That outcome applies to Destroy with preserved external object, intended to stop managing a resource while keeping its real object intact, rather than the question's feature Destroy plan preview: A removed block with destroy=false or careful state removal can break Terraform management without deleting the object. Unlike Destroy with preserved external object, Destroy plan preview is intended to review a destruction proposal before running it, not to stop managing a resource while keeping its real object intact.

D:

That outcome applies to terraform destroy, intended to remove all resources managed by a selected configuration and state, rather than the question's feature Destroy plan preview: terraform destroy plans and applies destruction for tracked managed objects in that workspace. Unlike terraform destroy, Destroy plan preview is intended to review a destruction proposal before running it, not to remove all resources managed by a selected configuration and state.

Question 942

The team is documenting risks of Cross-object validation constraint while planning to enforce a relationship among known attributes instead of only checking types. Which caveat specifically applies to that mechanism?

  1. An output condition is not a replacement for supplying module output definitions.
  2. Dependencies must remain acyclic and values may only be available at apply time.
  3. Use a precondition when failure must halt a protected operation.
  4. A valid variable type alone cannot enforce every business-specific allowed range.

Explanation

Correct Answer

B:

For Cross-object validation constraint in the task to enforce a relationship among known attributes instead of only checking types, the important caution is: Dependencies must remain acyclic and values may only be available at apply time. The reason this matters is its actual behavior: Lifecycle conditions can evaluate appropriate referenced values to enforce infrastructure invariants.

Incorrect Answers

A:

The proposed warning belongs to Output precondition, which serves the different goal to refuse to publish a result when its required assumption fails, rather than to Cross-object validation constraint: An output block can include a precondition to validate assumptions about the published value. The question concerns Cross-object validation constraint acting to enforce a relationship among known attributes instead of only checking types, not a limit of Output precondition.

C:

The proposed warning belongs to Check block health assessment, which serves the different goal to evaluate an advisory assertion about deployed infrastructure, rather than to Cross-object validation constraint: A check block can report a warning when an assertion fails without typically blocking the run. The question concerns Cross-object validation constraint acting to enforce a relationship among known attributes instead of only checking types, not a limit of Check block health assessment.

D:

The listed caution belongs specifically to Input variable validation, used to reject a caller-provided input that violates a semantic rule: A variable validation block defines a condition and error_message to enforce an expected input constraint; the feature under review is instead Cross-object validation constraint, so this answer attaches another feature's qualification to the wrong mechanism.

Question 943

During an implementation review, a Terraform team encounters "Terraform state lineage". Which purpose is associated with that mechanism?

  1. distinguish snapshots belonging to different histories
  2. identify the revision of a state snapshot
  3. support incremental reconciliation against existing remote objects
  4. retain IDs and other provider-returned values for future runs
  5. map a Terraform resource address to its real remote object

Explanation

Correct Answer

A:

The practical result of Terraform state lineage, used to distinguish snapshots belonging to different histories, is: The lineage identifies a state history and helps detect unrelated snapshots when moving or replacing state. A qualification for this effect is: It does not grant access to the remote backend.

Incorrect Answers

B:

That outcome applies to Terraform state serial, intended to identify the revision of a state snapshot, rather than the question's feature Terraform state lineage: Terraform state snapshots contain metadata including a serial that advances as the state changes. Unlike Terraform state serial, Terraform state lineage is intended to distinguish snapshots belonging to different histories, not to identify the revision of a state snapshot.

C:

That outcome applies to State as synchronization metadata, intended to support incremental reconciliation against existing remote objects, rather than the question's feature Terraform state lineage: Terraform consults state rather than treating each run as a completely new unmanaged deployment. Unlike State as synchronization metadata, Terraform state lineage is intended to distinguish snapshots belonging to different histories, not to support incremental reconciliation against existing remote objects.

D:

That outcome applies to Computed resource attributes in state, intended to retain IDs and other provider-returned values for future runs, rather than the question's feature Terraform state lineage: State captures attribute values used to compare current managed objects with desired configuration. Unlike Computed resource attributes in state, Terraform state lineage is intended to distinguish snapshots belonging to different histories, not to retain IDs and other provider-returned values for future runs.

E:

That outcome applies to State binding identity, intended to map a Terraform resource address to its real remote object, rather than the question's feature Terraform state lineage: State records bindings between resource instances and provider-managed objects and holds related metadata. Unlike State binding identity, Terraform state lineage is intended to distinguish snapshots belonging to different histories, not to map a Terraform resource address to its real remote object.

Question 944

A Terraform rollout has two separate requirements: first, enforce a relationship among known attributes instead of only checking types; second, require an assertion to pass before a resource operation proceeds. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Cross-object validation constraint; then use Resource postcondition.
  2. First use Resource postcondition; then use Check block health assessment.
  3. First use Cross-object validation constraint; then use Resource precondition.
  4. First use Check block health assessment; then use Resource precondition.
  5. First use Resource precondition; then use Cross-object validation constraint.

Explanation

Correct Answer

C:

The first requirement, to enforce a relationship among known attributes instead of only checking types, is handled by Cross-object validation constraint: Lifecycle conditions can evaluate appropriate referenced values to enforce infrastructure invariants. The second requirement, to require an assertion to pass before a resource operation proceeds, is handled by Resource precondition: A precondition in lifecycle validates a condition before the applicable resource operation. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to enforce a relationship among known attributes instead of only checking types and require an assertion to pass before a resource operation proceeds, the first candidate Cross-object validation constraint addresses enforce a relationship among known attributes instead of only checking types; the second candidate Resource postcondition addresses assert a property after Terraform has planned or applied a resource operation. This mapping fails because the second mechanism primarily supports the task to assert a property after Terraform has planned or applied a resource operation; the actual requirements are enforce a relationship among known attributes instead of only checking types first and require an assertion to pass before a resource operation proceeds second.

B:

For the requested tasks to enforce a relationship among known attributes instead of only checking types and require an assertion to pass before a resource operation proceeds, the first candidate Resource postcondition addresses assert a property after Terraform has planned or applied a resource operation; the second candidate Check block health assessment addresses evaluate an advisory assertion about deployed infrastructure. This mapping fails because the first mechanism primarily supports the task to assert a property after Terraform has planned or applied a resource operation and the second mechanism primarily supports the task to evaluate an advisory assertion about deployed infrastructure; the actual requirements are enforce a relationship among known attributes instead of only checking types first and require an assertion to pass before a resource operation proceeds second.

D:

For the requested tasks to enforce a relationship among known attributes instead of only checking types and require an assertion to pass before a resource operation proceeds, the first candidate Check block health assessment addresses evaluate an advisory assertion about deployed infrastructure; the second candidate Resource precondition addresses require an assertion to pass before a resource operation proceeds. This mapping fails because the first mechanism primarily supports the task to evaluate an advisory assertion about deployed infrastructure; the actual requirements are enforce a relationship among known attributes instead of only checking types first and require an assertion to pass before a resource operation proceeds second.

E:

For the requested tasks to enforce a relationship among known attributes instead of only checking types and require an assertion to pass before a resource operation proceeds, the first candidate Resource precondition addresses require an assertion to pass before a resource operation proceeds; the second candidate Cross-object validation constraint addresses enforce a relationship among known attributes instead of only checking types. This mapping fails because the first mechanism primarily supports the task to require an assertion to pass before a resource operation proceeds and the second mechanism primarily supports the task to enforce a relationship among known attributes instead of only checking types; the actual requirements are enforce a relationship among known attributes instead of only checking types first and require an assertion to pass before a resource operation proceeds second.

Question 945

A change proposal relies on Destroy plan preview for the task to review a destruction proposal before running it. Which limitation specifically applies to it?

  1. It does not normally destroy unrelated objects absent from that state.
  2. Use an intentional state-forgetting workflow when the object must remain.
  3. A destroy plan itself makes no remote changes.
  4. Deleting configuration without an appropriate state transition generally triggers destruction.

Explanation

Correct Answer

C:

For Destroy plan preview in the task to review a destruction proposal before running it, the important caution is: A destroy plan itself makes no remote changes. The reason this matters is its actual behavior: terraform plan -destroy produces a plan whose intended effect is to remove managed infrastructure.

Incorrect Answers

A:

The proposed warning belongs to terraform destroy, which serves the different goal to remove all resources managed by a selected configuration and state, rather than to Destroy plan preview: terraform destroy plans and applies destruction for tracked managed objects in that workspace. The question concerns Destroy plan preview acting to review a destruction proposal before running it, not a limit of terraform destroy.

B:

The proposed warning belongs to Specific resource removal from configuration, which serves the different goal to plan removal of a managed resource no longer declared in HCL, rather than to Destroy plan preview: Removing a resource block normally proposes destroying its bound remote object on the next apply. The question concerns Destroy plan preview acting to review a destruction proposal before running it, not a limit of Specific resource removal from configuration.

D:

The proposed warning belongs to Destroy with preserved external object, which serves the different goal to stop managing a resource while keeping its real object intact, rather than to Destroy plan preview: A removed block with destroy=false or careful state removal can break Terraform management without deleting the object. The question concerns Destroy plan preview acting to review a destruction proposal before running it, not a limit of Destroy with preserved external object.

Question 946

A deployment design calls for a supported way to redact secret values from normal Terraform CLI displays. Which mechanism most directly meets this particular need?

  1. Sensitive variable flag
  2. Ephemeral input variable
  3. Ephemeral resource block
  4. Provider write-only argument

Explanation

Correct Answer

A:

The task is to redact secret values from normal Terraform CLI displays; Sensitive variable flag directly supports that requirement: sensitive=true marks an input as sensitive and propagates that sensitivity into derived expressions. Its relevant boundary is: The underlying value can still be stored in state and plan artifacts.

Incorrect Answers

B:

Ephemeral input variable is designed to use a temporary credential without persisting its value into state or plan, whereas this task is to redact secret values from normal Terraform CLI displays: ephemeral=true on a variable keeps its value available during the operation but omits it from state and plan files. Against Sensitive variable flag, its limitation is: Such a value can be referenced only in allowed ephemeral contexts.

C:

Ephemeral resource block is designed to read or generate temporary data for an operation without tracking it in state, whereas this task is to redact secret values from normal Terraform CLI displays: An ephemeral block uses provider-defined temporary resources for supported runtime-only inputs. Against Sensitive variable flag, its limitation is: Ephemeral resources cannot be referenced in arbitrary persistent resource arguments.

D:

Provider write-only argument is designed to send a secret to a supporting resource without retaining it in Terraform state, whereas this task is to redact secret values from normal Terraform CLI displays: A write-only provider argument consumes a value during apply without persisting the argument in state or plan. Against Sensitive variable flag, its limitation is: Provider schema support and Terraform 1.11 or later are required.

Question 947

A Terraform rollout has two separate requirements: first, review a destruction proposal before running it; second, stop managing a resource while keeping its real object intact. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Destroy plan preview; then use Destroy with preserved external object.
  2. First use Destroy plan preview; then use Targeted destruction caution.
  3. First use Destroy with preserved external object; then use Destroy plan preview.
  4. First use Targeted destruction caution; then use Destroy approval safeguards.
  5. First use Destroy approval safeguards; then use Destroy with preserved external object.

Explanation

Correct Answer

A:

The first requirement, to review a destruction proposal before running it, is handled by Destroy plan preview: terraform plan -destroy produces a plan whose intended effect is to remove managed infrastructure. The second requirement, to stop managing a resource while keeping its real object intact, is handled by Destroy with preserved external object: A removed block with destroy=false or careful state removal can break Terraform management without deleting the object. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

B:

For the requested tasks to review a destruction proposal before running it and stop managing a resource while keeping its real object intact, the first candidate Destroy plan preview addresses review a destruction proposal before running it; the second candidate Targeted destruction caution addresses limit a destructive operation to a selected object only when necessary. This mapping fails because the second mechanism primarily supports the task to limit a destructive operation to a selected object only when necessary; the actual requirements are review a destruction proposal before running it first and stop managing a resource while keeping its real object intact second.

C:

For the requested tasks to review a destruction proposal before running it and stop managing a resource while keeping its real object intact, the first candidate Destroy with preserved external object addresses stop managing a resource while keeping its real object intact; the second candidate Destroy plan preview addresses review a destruction proposal before running it. This mapping fails because the first mechanism primarily supports the task to stop managing a resource while keeping its real object intact and the second mechanism primarily supports the task to review a destruction proposal before running it; the actual requirements are review a destruction proposal before running it first and stop managing a resource while keeping its real object intact second.

D:

For the requested tasks to review a destruction proposal before running it and stop managing a resource while keeping its real object intact, the first candidate Targeted destruction caution addresses limit a destructive operation to a selected object only when necessary; the second candidate Destroy approval safeguards addresses keep confirmation and review around irreversible resource deletion. 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 keep confirmation and review around irreversible resource deletion; the actual requirements are review a destruction proposal before running it first and stop managing a resource while keeping its real object intact second.

E:

For the requested tasks to review a destruction proposal before running it and stop managing a resource while keeping its real object intact, the first candidate Destroy approval safeguards addresses keep confirmation and review around irreversible resource deletion; the second candidate Destroy with preserved external object addresses stop managing a resource while keeping its real object intact. This mapping fails because the first mechanism primarily supports the task to keep confirmation and review around irreversible resource deletion; the actual requirements are review a destruction proposal before running it first and stop managing a resource while keeping its real object intact second.

Question 948

A change proposal relies on Terraform state lineage for the task to distinguish snapshots belonging to different histories. Which limitation specifically applies to it?

  1. Removing the configuration alone may plan destruction of the bound object.
  2. Editing serials manually is not a supported everyday collaboration strategy.
  3. It does not grant access to the remote backend.
  4. State still needs refresh checks to recognize external infrastructure changes.

Explanation

Correct Answer

C:

For Terraform state lineage in the task to distinguish snapshots belonging to different histories, the important caution is: It does not grant access to the remote backend. The reason this matters is its actual behavior: The lineage identifies a state history and helps detect unrelated snapshots when moving or replacing state.

Incorrect Answers

A:

The proposed warning belongs to State binding identity, which serves the different goal to map a Terraform resource address to its real remote object, rather than to Terraform state lineage: State records bindings between resource instances and provider-managed objects and holds related metadata. The question concerns Terraform state lineage acting to distinguish snapshots belonging to different histories, not a limit of State binding identity.

B:

The proposed warning belongs to Terraform state serial, which serves the different goal to identify the revision of a state snapshot, rather than to Terraform state lineage: Terraform state snapshots contain metadata including a serial that advances as the state changes. The question concerns Terraform state lineage acting to distinguish snapshots belonging to different histories, not a limit of Terraform state serial.

D:

The listed caution belongs specifically to State as synchronization metadata, used to support incremental reconciliation against existing remote objects: Terraform consults state rather than treating each run as a completely new unmanaged deployment; the feature under review is instead Terraform state lineage, so this answer attaches another feature's qualification to the wrong mechanism.

Question 949

During an implementation review, a Terraform team encounters "Sensitive variable flag". Which purpose is associated with that mechanism?

  1. use a temporary credential without persisting its value into state or plan
  2. redact secret values from normal Terraform CLI displays
  3. read or generate temporary data for an operation without tracking it in state
  4. send a secret to a supporting resource without retaining it in Terraform state

Explanation

Correct Answer

B:

The practical result of Sensitive variable flag, used to redact secret values from normal Terraform CLI displays, is: sensitive=true marks an input as sensitive and propagates that sensitivity into derived expressions. A qualification for this effect is: The underlying value can still be stored in state and plan artifacts.

Incorrect Answers

A:

That outcome applies to Ephemeral input variable, intended to use a temporary credential without persisting its value into state or plan, rather than the question's feature Sensitive variable flag: ephemeral=true on a variable keeps its value available during the operation but omits it from state and plan files. Unlike Ephemeral input variable, Sensitive variable flag is intended to redact secret values from normal Terraform CLI displays, not to use a temporary credential without persisting its value into state or plan.

C:

That outcome applies to Ephemeral resource block, intended to read or generate temporary data for an operation without tracking it in state, rather than the question's feature Sensitive variable flag: An ephemeral block uses provider-defined temporary resources for supported runtime-only inputs. Unlike Ephemeral resource block, Sensitive variable flag is intended to redact secret values from normal Terraform CLI displays, not to read or generate temporary data for an operation without tracking it in state.

D:

That outcome applies to Provider write-only argument, intended to send a secret to a supporting resource without retaining it in Terraform state, rather than the question's feature Sensitive variable flag: A write-only provider argument consumes a value during apply without persisting the argument in state or plan. Unlike Provider write-only argument, Sensitive variable flag is intended to redact secret values from normal Terraform CLI displays, not to send a secret to a supporting resource without retaining it in Terraform state.

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.

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