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

Question 900

A Terraform rollout has two separate requirements: first, record the result of successful provider operations for subsequent reconciliation; second, set an input variable for a particular deployment without editing its declaration. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Apply the current configuration; then use Apply a previously saved plan.
  2. First use Updated state after apply; then use Apply the current configuration.
  3. First use Apply a previously saved plan; then use Apply variable overrides.
  4. First use Apply variable overrides; then use Updated state after apply.
  5. First use Updated state after apply; then use Apply variable overrides.

Explanation

Correct Answer

E:

The first requirement, to record the result of successful provider operations for subsequent reconciliation, is handled by Updated state after apply: Terraform persists state reflecting actions and known attributes after apply operations. The second requirement, to set an input variable for a particular deployment without editing its declaration, is handled by Apply variable overrides: terraform apply -var='name=value' supplies root-module input during that run. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to record the result of successful provider operations for subsequent reconciliation and set an input variable for a particular deployment without editing its declaration, the first candidate Apply the current configuration addresses execute proposed operations after reviewing their impact; the second candidate Apply a previously saved plan addresses execute precisely a previously generated binary execution plan. This mapping fails because the first mechanism primarily supports the task to execute proposed operations after reviewing their impact and the second mechanism primarily supports the task to execute precisely a previously generated binary execution plan; the actual requirements are record the result of successful provider operations for subsequent reconciliation first and set an input variable for a particular deployment without editing its declaration second.

B:

For the requested tasks to record the result of successful provider operations for subsequent reconciliation and set an input variable for a particular deployment without editing its declaration, the first candidate Updated state after apply addresses record the result of successful provider operations for subsequent reconciliation; the second candidate Apply the current configuration addresses execute proposed operations after reviewing their impact. This mapping fails because the second mechanism primarily supports the task to execute proposed operations after reviewing their impact; the actual requirements are record the result of successful provider operations for subsequent reconciliation first and set an input variable for a particular deployment without editing its declaration second.

C:

For the requested tasks to record the result of successful provider operations for subsequent reconciliation and set an input variable for a particular deployment without editing its declaration, the first candidate Apply a previously saved plan addresses execute precisely a previously generated binary execution plan; the second candidate Apply variable overrides addresses set an input variable for a particular deployment without editing its declaration. This mapping fails because the first mechanism primarily supports the task to execute precisely a previously generated binary execution plan; the actual requirements are record the result of successful provider operations for subsequent reconciliation first and set an input variable for a particular deployment without editing its declaration second.

D:

For the requested tasks to record the result of successful provider operations for subsequent reconciliation and set an input variable for a particular deployment without editing its declaration, the first candidate Apply variable overrides addresses set an input variable for a particular deployment without editing its declaration; the second candidate Updated state after apply addresses record the result of successful provider operations for subsequent reconciliation. This mapping fails because the first mechanism primarily supports the task to set an input variable for a particular deployment without editing its declaration and the second mechanism primarily supports the task to record the result of successful provider operations for subsequent reconciliation; the actual requirements are record the result of successful provider operations for subsequent reconciliation first and set an input variable for a particular deployment without editing its declaration second.

Question 901

The deployment owner requests a reliable way to assert a property after Terraform has planned or applied a resource operation. Which mechanism most directly meets this particular need?

  1. Output precondition
  2. Cross-object validation constraint
  3. Resource postcondition
  4. Custom condition error_message

Explanation

Correct Answer

C:

The task is to assert a property after Terraform has planned or applied a resource operation; Resource postcondition directly supports that requirement: A postcondition can check provider-derived attributes and block dependent work when it fails. Its relevant boundary is: It is not primarily a way to change the desired resource argument value.

Incorrect Answers

A:

Output precondition is designed to refuse to publish a result when its required assumption fails, whereas this task is to assert a property after Terraform has planned or applied a resource operation: An output block can include a precondition to validate assumptions about the published value. Against Resource postcondition, its limitation is: An output condition is not a replacement for supplying module output definitions.

B:

Cross-object validation constraint is designed to enforce a relationship among known attributes instead of only checking types, whereas this task is to assert a property after Terraform has planned or applied a resource operation: Lifecycle conditions can evaluate appropriate referenced values to enforce infrastructure invariants. Against Resource postcondition, its limitation is: Dependencies must remain acyclic and values may only be available at apply time.

D:

Custom condition error_message is designed to give a useful explanation when an assertion evaluates to false, whereas this task is to assert a property after Terraform has planned or applied a resource operation: Variable validations and lifecycle conditions provide error_message text for failed assertions. Against Resource postcondition, its limitation is: A message alone has no effect unless a corresponding condition is evaluated.

Question 902

The deployment owner requests a reliable way to rerun a plan after a partial apply rather than assuming complete rollback. Which mechanism most directly meets this particular need?

  1. Apply variable overrides
  2. Dependency-ordered apply
  3. Apply the current configuration
  4. Apply failure diagnosis

Explanation

Correct Answer

D:

The task is to rerun a plan after a partial apply rather than assuming complete rollback; Apply failure diagnosis directly supports that requirement: Terraform does not guarantee all-or-nothing rollback across external provider APIs. Its relevant boundary is: Inspecting real objects and current state is necessary after a failed apply.

Incorrect Answers

A:

Apply variable overrides is designed to set an input variable for a particular deployment without editing its declaration, whereas this task is to rerun a plan after a partial apply rather than assuming complete rollback: terraform apply -var='name=value' supplies root-module input during that run. Against Apply failure diagnosis, its limitation is: The same variable inputs must be accounted for when using a saved plan.

B:

Dependency-ordered apply is designed to create an upstream object before a dependent reference is resolved, whereas this task is to rerun a plan after a partial apply rather than assuming complete rollback: Terraform uses references and explicit dependencies to order apply graph operations. Against Apply failure diagnosis, its limitation is: The order is not determined by the placement of resource blocks in files.

C:

Apply the current configuration addresses the different requirement to execute proposed operations after reviewing their impact: terraform apply normally creates a plan and asks for approval before making changes; this does not by itself satisfy the requested task to rerun a plan after a partial apply rather than assuming complete rollback. For the stated need, Apply failure diagnosis is the more direct mechanism.

Question 903

Before continuing an infrastructure rollout, the operator must retain IDs and other provider-returned values for future runs. Which mechanism most directly meets this particular need?

  1. State binding identity
  2. Terraform state serial
  3. Computed resource attributes in state
  4. Terraform state lineage

Explanation

Correct Answer

C:

The task is to retain IDs and other provider-returned values for future runs; Computed resource attributes in state directly supports that requirement: State captures attribute values used to compare current managed objects with desired configuration. Its relevant boundary is: State is not a safe public document because it can contain sensitive values.

Incorrect Answers

A:

State binding identity is designed to map a Terraform resource address to its real remote object, whereas this task is to retain IDs and other provider-returned values for future runs: State records bindings between resource instances and provider-managed objects and holds related metadata. Against Computed resource attributes in state, its limitation is: Removing the configuration alone may plan destruction of the bound object.

B:

Terraform state serial is designed to identify the revision of a state snapshot, whereas this task is to retain IDs and other provider-returned values for future runs: Terraform state snapshots contain metadata including a serial that advances as the state changes. Against Computed resource attributes in state, its limitation is: Editing serials manually is not a supported everyday collaboration strategy.

D:

Terraform state lineage is designed to distinguish snapshots belonging to different histories, whereas this task is to retain IDs and other provider-returned values for future runs: The lineage identifies a state history and helps detect unrelated snapshots when moving or replacing state. Against Computed resource attributes in state, its limitation is: It does not grant access to the remote backend.

Question 904

A colleague recommends the Terraform concept "Resource postcondition". Which use case best matches it?

  1. assert a property after Terraform has planned or applied a resource operation
  2. give a useful explanation when an assertion evaluates to false
  3. refuse to publish a result when its required assumption fails
  4. enforce a relationship among known attributes instead of only checking types

Explanation

Correct Answer

A:

The practical result of Resource postcondition, used to assert a property after Terraform has planned or applied a resource operation, is: A postcondition can check provider-derived attributes and block dependent work when it fails. A qualification for this effect is: It is not primarily a way to change the desired resource argument value.

Incorrect Answers

B:

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 Resource postcondition: Variable validations and lifecycle conditions provide error_message text for failed assertions. Unlike Custom condition error_message, Resource postcondition is intended to assert a property after Terraform has planned or applied a resource operation, not to give a useful explanation when an assertion evaluates to false.

C:

That outcome applies to Output precondition, intended to refuse to publish a result when its required assumption fails, rather than the question's feature Resource postcondition: An output block can include a precondition to validate assumptions about the published value. Unlike Output precondition, Resource postcondition is intended to assert a property after Terraform has planned or applied a resource operation, not to refuse to publish a result when its required assumption fails.

D:

That outcome applies to Cross-object validation constraint, intended to enforce a relationship among known attributes instead of only checking types, rather than the question's feature Resource postcondition: Lifecycle conditions can evaluate appropriate referenced values to enforce infrastructure invariants. Unlike Cross-object validation constraint, Resource postcondition is intended to assert a property after Terraform has planned or applied a resource operation, not to enforce a relationship among known attributes instead of only checking types.

Question 905

A colleague recommends the Terraform concept "Apply failure diagnosis". Which use case best matches it?

  1. create an upstream object before a dependent reference is resolved
  2. execute proposed operations after reviewing their impact
  3. record the result of successful provider operations for subsequent reconciliation
  4. set an input variable for a particular deployment without editing its declaration
  5. rerun a plan after a partial apply rather than assuming complete rollback
  6. execute precisely a previously generated binary execution plan

Explanation

Correct Answer

E:

The practical result of Apply failure diagnosis, used to rerun a plan after a partial apply rather than assuming complete rollback, is: Terraform does not guarantee all-or-nothing rollback across external provider APIs. A qualification for this effect is: Inspecting real objects and current state is necessary after a failed apply.

Incorrect Answers

A:

That outcome applies to Dependency-ordered apply, intended to create an upstream object before a dependent reference is resolved, rather than the question's feature Apply failure diagnosis: Terraform uses references and explicit dependencies to order apply graph operations. Unlike Dependency-ordered apply, Apply failure diagnosis is intended to rerun a plan after a partial apply rather than assuming complete rollback, not to create an upstream object before a dependent reference is resolved.

B:

That outcome applies to Apply the current configuration, intended to execute proposed operations after reviewing their impact, rather than the question's feature Apply failure diagnosis: terraform apply normally creates a plan and asks for approval before making changes. Unlike Apply the current configuration, Apply failure diagnosis is intended to rerun a plan after a partial apply rather than assuming complete rollback, not to execute proposed operations after reviewing their impact.

C:

That outcome applies to Updated state after apply, intended to record the result of successful provider operations for subsequent reconciliation, rather than the question's feature Apply failure diagnosis: Terraform persists state reflecting actions and known attributes after apply operations. Unlike Updated state after apply, Apply failure diagnosis is intended to rerun a plan after a partial apply rather than assuming complete rollback, not to record the result of successful provider operations for subsequent reconciliation.

D:

That outcome applies to Apply variable overrides, intended to set an input variable for a particular deployment without editing its declaration, rather than the question's feature Apply failure diagnosis: terraform apply -var='name=value' supplies root-module input during that run. Unlike Apply variable overrides, Apply failure diagnosis is intended to rerun a plan after a partial apply rather than assuming complete rollback, not to set an input variable for a particular deployment without editing its declaration.

F:

That outcome applies to Apply a previously saved plan, intended to execute precisely a previously generated binary execution plan, rather than the question's feature Apply failure diagnosis: terraform apply change.tfplan applies that saved plan rather than recalculating a fresh interactive plan. Unlike Apply a previously saved plan, Apply failure diagnosis is intended to rerun a plan after a partial apply rather than assuming complete rollback, not to execute precisely a previously generated binary execution plan.

Question 906

Before adopting Resource postcondition to assert a property after Terraform has planned or applied a resource operation, which statement sets an accurate boundary?

  1. A message alone has no effect unless a corresponding condition is evaluated.
  2. An output condition is not a replacement for supplying module output definitions.
  3. It is not primarily a way to change the desired resource argument value.
  4. Dependencies must remain acyclic and values may only be available at apply time.

Explanation

Correct Answer

C:

For Resource postcondition in the task to assert a property after Terraform has planned or applied a resource operation, the important caution is: It is not primarily a way to change the desired resource argument value. The reason this matters is its actual behavior: A postcondition can check provider-derived attributes and block dependent work when it fails.

Incorrect Answers

A:

The proposed warning belongs to Custom condition error_message, which serves the different goal to give a useful explanation when an assertion evaluates to false, rather than to Resource postcondition: Variable validations and lifecycle conditions provide error_message text for failed assertions. The question concerns Resource postcondition acting to assert a property after Terraform has planned or applied a resource operation, not a limit of Custom condition error_message.

B:

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 Resource postcondition: An output block can include a precondition to validate assumptions about the published value. The question concerns Resource postcondition acting to assert a property after Terraform has planned or applied a resource operation, not a limit of Output precondition.

D:

The proposed warning belongs to Cross-object validation constraint, which serves the different goal to enforce a relationship among known attributes instead of only checking types, rather than to Resource postcondition: Lifecycle conditions can evaluate appropriate referenced values to enforce infrastructure invariants. The question concerns Resource postcondition acting to assert a property after Terraform has planned or applied a resource operation, not a limit of Cross-object validation constraint.

Question 907

A configuration walkthrough identifies "Computed resource attributes in state". Which task is it principally intended to support?

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

Explanation

Correct Answer

D:

The practical result of Computed resource attributes in state, used to retain IDs and other provider-returned values for future runs, is: State captures attribute values used to compare current managed objects with desired configuration. A qualification for this effect is: State is not a safe public document because it can contain sensitive values.

Incorrect Answers

A:

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 Computed resource attributes in state: State records bindings between resource instances and provider-managed objects and holds related metadata. Unlike State binding identity, Computed resource attributes in state is intended to retain IDs and other provider-returned values for future runs, not to map a Terraform resource address to its real remote object.

B:

That outcome applies to Terraform state serial, intended to identify the revision of a state snapshot, rather than the question's feature Computed resource attributes in state: Terraform state snapshots contain metadata including a serial that advances as the state changes. Unlike Terraform state serial, Computed resource attributes in state is intended to retain IDs and other provider-returned values for future runs, not to identify the revision of a state snapshot.

C:

That outcome applies to Terraform state lineage, intended to distinguish snapshots belonging to different histories, rather than the question's feature Computed resource attributes in state: The lineage identifies a state history and helps detect unrelated snapshots when moving or replacing state. Unlike Terraform state lineage, Computed resource attributes in state is intended to retain IDs and other provider-returned values for future runs, not to distinguish snapshots belonging to different histories.

Question 908

A Terraform rollout has two separate requirements: first, assert a property after Terraform has planned or applied a resource operation; second, give a useful explanation when an assertion evaluates to false. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Cross-object validation constraint; then use Custom condition error_message.
  2. First use Resource postcondition; then use Custom condition error_message.
  3. First use Custom condition error_message; then use Resource postcondition.
  4. First use Output precondition; then use Cross-object validation constraint.
  5. First use Resource postcondition; then use Output precondition.

Explanation

Correct Answer

B:

The first requirement, to assert a property after Terraform has planned or applied a resource operation, is handled by Resource postcondition: A postcondition can check provider-derived attributes and block dependent work when it fails. The second requirement, to give a useful explanation when an assertion evaluates to false, is handled by Custom condition error_message: Variable validations and lifecycle conditions provide error_message text for failed assertions. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to assert a property after Terraform has planned or applied a resource operation and give a useful explanation when an assertion evaluates to false, the first candidate Cross-object validation constraint addresses enforce a relationship among known attributes instead of only checking types; the second candidate Custom condition error_message addresses give a useful explanation when an assertion evaluates to false. This mapping fails because the first mechanism primarily supports the task to enforce a relationship among known attributes instead of only checking types; the actual requirements are assert a property after Terraform has planned or applied a resource operation first and give a useful explanation when an assertion evaluates to false second.

C:

For the requested tasks to assert a property after Terraform has planned or applied a resource operation and give a useful explanation when an assertion evaluates to false, the first candidate Custom condition error_message addresses give a useful explanation when an assertion evaluates to false; the second candidate Resource postcondition addresses assert a property after Terraform has planned or applied a resource operation. This mapping fails because the first mechanism primarily supports the task to give a useful explanation when an assertion evaluates to false and the second mechanism primarily supports the task to assert a property after Terraform has planned or applied a resource operation; the actual requirements are assert a property after Terraform has planned or applied a resource operation first and give a useful explanation when an assertion evaluates to false second.

D:

For the requested tasks to assert a property after Terraform has planned or applied a resource operation and give a useful explanation when an assertion evaluates to false, the first candidate Output precondition addresses refuse to publish a result when its required assumption fails; 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 refuse to publish a result when its required assumption fails and the second mechanism primarily supports the task to enforce a relationship among known attributes instead of only checking types; the actual requirements are assert a property after Terraform has planned or applied a resource operation first and give a useful explanation when an assertion evaluates to false second.

E:

For the requested tasks to assert a property after Terraform has planned or applied a resource operation and give a useful explanation when an assertion evaluates to false, the first candidate Resource postcondition addresses assert a property after Terraform has planned or applied a resource operation; the second candidate Output precondition addresses refuse to publish a result when its required assumption fails. This mapping fails because the second mechanism primarily supports the task to refuse to publish a result when its required assumption fails; the actual requirements are assert a property after Terraform has planned or applied a resource operation first and give a useful explanation when an assertion evaluates to false second.

Question 909

Before adopting Apply failure diagnosis to rerun a plan after a partial apply rather than assuming complete rollback, which statement sets an accurate boundary?

  1. Inspecting real objects and current state is necessary after a failed apply.
  2. The same variable inputs must be accounted for when using a saved plan.
  3. The order is not determined by the placement of resource blocks in files.
  4. A plan might fail during execution if a provider API rejects an action.

Explanation

Correct Answer

A:

For Apply failure diagnosis in the task to rerun a plan after a partial apply rather than assuming complete rollback, the important caution is: Inspecting real objects and current state is necessary after a failed apply. The reason this matters is its actual behavior: Terraform does not guarantee all-or-nothing rollback across external provider APIs.

Incorrect Answers

B:

The proposed warning belongs to Apply variable overrides, which serves the different goal to set an input variable for a particular deployment without editing its declaration, rather than to Apply failure diagnosis: terraform apply -var='name=value' supplies root-module input during that run. The question concerns Apply failure diagnosis acting to rerun a plan after a partial apply rather than assuming complete rollback, not a limit of Apply variable overrides.

C:

The proposed warning belongs to Dependency-ordered apply, which serves the different goal to create an upstream object before a dependent reference is resolved, rather than to Apply failure diagnosis: Terraform uses references and explicit dependencies to order apply graph operations. The question concerns Apply failure diagnosis acting to rerun a plan after a partial apply rather than assuming complete rollback, not a limit of Dependency-ordered apply.

D:

The listed caution belongs specifically to Apply the current configuration, used to execute proposed operations after reviewing their impact: terraform apply normally creates a plan and asks for approval before making changes; the feature under review is instead Apply failure diagnosis, so this answer attaches another feature's qualification to the wrong mechanism.

Question 910

A platform engineering group needs to evaluate an advisory assertion about deployed infrastructure. Which mechanism most directly meets this particular need?

  1. Resource precondition
  2. Input variable validation
  3. Check block health assessment
  4. Resource postcondition

Explanation

Correct Answer

C:

The task is to evaluate an advisory assertion about deployed infrastructure; Check block health assessment directly supports that requirement: A check block can report a warning when an assertion fails without typically blocking the run. Its relevant boundary is: Use a precondition when failure must halt a protected operation.

Incorrect Answers

A:

Resource precondition is designed to require an assertion to pass before a resource operation proceeds, whereas this task is to evaluate an advisory assertion about deployed infrastructure: A precondition in lifecycle validates a condition before the applicable resource operation. Against Check block health assessment, its limitation is: It is not an after-deployment health signal like a postcondition.

B:

Input variable validation is designed to reject a caller-provided input that violates a semantic rule, whereas this task is to evaluate an advisory assertion about deployed infrastructure: A variable validation block defines a condition and error_message to enforce an expected input constraint. Against Check block health assessment, its limitation is: A valid variable type alone cannot enforce every business-specific allowed range.

D:

Resource postcondition is designed to assert a property after Terraform has planned or applied a resource operation, whereas this task is to evaluate an advisory assertion about deployed infrastructure: A postcondition can check provider-derived attributes and block dependent work when it fails. Against Check block health assessment, its limitation is: It is not primarily a way to change the desired resource argument value.

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