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

Question 840

A Terraform rollout has two separate requirements: first, protect a declared resource from plans that destroy its managed object; second, replace a resource when a specified managed resource change occurs. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use replace_triggered_by lifecycle; then use prevent_destroy lifecycle.
  2. First use prevent_destroy lifecycle; then use replace_triggered_by lifecycle.
  3. First use prevent_destroy lifecycle; then use Terraform resource graph cycle.
  4. First use Terraform resource graph cycle; then use Implicit dependency from expression.
  5. First use Implicit dependency from expression; then use replace_triggered_by lifecycle.

Explanation

Correct Answer

B:

The first requirement, to protect a declared resource from plans that destroy its managed object, is handled by prevent_destroy lifecycle: prevent_destroy causes an error if a plan includes destruction while the rule is present in configuration. The second requirement, to replace a resource when a specified managed resource change occurs, is handled by replace_triggered_by lifecycle: replace_triggered_by adds replacement behavior tied to changes in other managed objects or attributes. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to protect a declared resource from plans that destroy its managed object and replace a resource when a specified managed resource change occurs, the first candidate replace_triggered_by lifecycle addresses replace a resource when a specified managed resource change occurs; the second candidate prevent_destroy lifecycle addresses protect a declared resource from plans that destroy its managed object. This mapping fails because the first mechanism primarily supports the task to replace a resource when a specified managed resource change occurs and the second mechanism primarily supports the task to protect a declared resource from plans that destroy its managed object; the actual requirements are protect a declared resource from plans that destroy its managed object first and replace a resource when a specified managed resource change occurs second.

C:

For the requested tasks to protect a declared resource from plans that destroy its managed object and replace a resource when a specified managed resource change occurs, the first candidate prevent_destroy lifecycle addresses protect a declared resource from plans that destroy its managed object; the second candidate Terraform resource graph cycle addresses detect an impossible dependency ordering caused by circular references. This mapping fails because the second mechanism primarily supports the task to detect an impossible dependency ordering caused by circular references; the actual requirements are protect a declared resource from plans that destroy its managed object first and replace a resource when a specified managed resource change occurs second.

D:

For the requested tasks to protect a declared resource from plans that destroy its managed object and replace a resource when a specified managed resource change occurs, the first candidate Terraform resource graph cycle addresses detect an impossible dependency ordering caused by circular references; the second candidate Implicit dependency from expression addresses order resources when one consumes an attribute produced by another. This mapping fails because the first mechanism primarily supports the task to detect an impossible dependency ordering caused by circular references and the second mechanism primarily supports the task to order resources when one consumes an attribute produced by another; the actual requirements are protect a declared resource from plans that destroy its managed object first and replace a resource when a specified managed resource change occurs second.

E:

For the requested tasks to protect a declared resource from plans that destroy its managed object and replace a resource when a specified managed resource change occurs, the first candidate Implicit dependency from expression addresses order resources when one consumes an attribute produced by another; the second candidate replace_triggered_by lifecycle addresses replace a resource when a specified managed resource change occurs. This mapping fails because the first mechanism primarily supports the task to order resources when one consumes an attribute produced by another; the actual requirements are protect a declared resource from plans that destroy its managed object first and replace a resource when a specified managed resource change occurs second.

Question 841

A configuration review identifies the need to execute precisely a previously generated binary execution plan. Which mechanism most directly meets this particular need?

  1. Apply a previously saved plan
  2. Updated state after apply
  3. Apply variable overrides
  4. Apply failure diagnosis

Explanation

Correct Answer

A:

The task is to execute precisely a previously generated binary execution plan; Apply a previously saved plan directly supports that requirement: terraform apply change.tfplan applies that saved plan rather than recalculating a fresh interactive plan. Its relevant boundary is: The saved artifact may become stale if state changes after its creation.

Incorrect Answers

B:

Updated state after apply is designed to record the result of successful provider operations for subsequent reconciliation, whereas this task is to execute precisely a previously generated binary execution plan: Terraform persists state reflecting actions and known attributes after apply operations. Against Apply a previously saved plan, its limitation is: A partial failure can leave partial changes requiring another plan and review.

C:

Apply variable overrides is designed to set an input variable for a particular deployment without editing its declaration, whereas this task is to execute precisely a previously generated binary execution plan: terraform apply -var='name=value' supplies root-module input during that run. Against Apply a previously saved plan, its limitation is: The same variable inputs must be accounted for when using a saved plan.

D:

Apply failure diagnosis is designed to rerun a plan after a partial apply rather than assuming complete rollback, whereas this task is to execute precisely a previously generated binary execution plan: Terraform does not guarantee all-or-nothing rollback across external provider APIs. Against Apply a previously saved plan, its limitation is: Inspecting real objects and current state is necessary after a failed apply.

Question 842

A configuration walkthrough identifies "Vendor portability through modules". Which task is it principally intended to support?

  1. use a common language without pretending providers expose identical capabilities
  2. manage different clouds from one Terraform root module
  3. configure cloud and on-premises platforms through a common workflow
  4. use output from one service to configure another supported service
  5. control DNS, SaaS, and cloud resources through a common configuration tool
  6. abstract a deployment pattern while keeping provider details explicit

Explanation

Correct Answer

F:

The practical result of Vendor portability through modules, used to abstract a deployment pattern while keeping provider details explicit, is: A module can offer common input and output conventions even if its implementation uses provider-specific resources. A qualification for this effect is: Replacing a cloud provider normally requires rewriting provider-dependent resources.

Incorrect Answers

A:

That outcome applies to Provider-specific implementation, intended to use a common language without pretending providers expose identical capabilities, rather than the question's feature Vendor portability through modules: HCL and workflow are common while each provider defines its own resource schema and service-specific behavior. Unlike Provider-specific implementation, Vendor portability through modules is intended to abstract a deployment pattern while keeping provider details explicit, not to use a common language without pretending providers expose identical capabilities.

B:

That outcome applies to Multi-cloud provider configuration, intended to manage different clouds from one Terraform root module, rather than the question's feature Vendor portability through modules: Separate provider plugins can reconcile resources on multiple platforms within the same configuration. Unlike Multi-cloud provider configuration, Vendor portability through modules is intended to abstract a deployment pattern while keeping provider details explicit, not to manage different clouds from one Terraform root module.

C:

That outcome applies to Hybrid infrastructure automation, intended to configure cloud and on-premises platforms through a common workflow, rather than the question's feature Vendor portability through modules: Terraform can coordinate providers for hosted services and private infrastructure without imposing one cloud API. Unlike Hybrid infrastructure automation, Vendor portability through modules is intended to abstract a deployment pattern while keeping provider details explicit, not to configure cloud and on-premises platforms through a common workflow.

D:

That outcome applies to Cross-platform dependency references, intended to use output from one service to configure another supported service, rather than the question's feature Vendor portability through modules: References can establish ordering when a resource on one platform consumes attributes from another resource. Unlike Cross-platform dependency references, Vendor portability through modules is intended to abstract a deployment pattern while keeping provider details explicit, not to use output from one service to configure another supported service.

E:

That outcome applies to Service-agnostic orchestration, intended to control DNS, SaaS, and cloud resources through a common configuration tool, rather than the question's feature Vendor portability through modules: Terraform providers expose resource and data types beyond infrastructure hosted by a cloud vendor. Unlike Service-agnostic orchestration, Vendor portability through modules is intended to abstract a deployment pattern while keeping provider details explicit, not to control DNS, SaaS, and cloud resources through a common configuration tool.

Question 843

A configuration walkthrough identifies "Disable debug logging after diagnosis". Which task is it principally intended to support?

  1. write Terraform debug logging to a named file
  2. focus verbose diagnostics on provider-side activity
  3. capture highly detailed events for a stubborn Terraform problem
  4. avoid collecting unnecessary sensitive operational output
  5. enable Terraform debugging output while investigating a CLI failure
  6. focus debugging on Terraform Core behavior rather than provider messages

Explanation

Correct Answer

D:

The practical result of Disable debug logging after diagnosis, used to avoid collecting unnecessary sensitive operational output, is: Unset debug environment variables or restore normal log settings when the investigation ends. A qualification for this effect is: Leaving verbose logs enabled can produce large sensitive artifacts.

Incorrect Answers

A:

That outcome applies to TF_LOG_PATH environment variable, intended to write Terraform debug logging to a named file, rather than the question's feature Disable debug logging after diagnosis: TF_LOG_PATH controls a file destination for Terraform logging when logging is enabled. Unlike TF_LOG_PATH environment variable, Disable debug logging after diagnosis is intended to avoid collecting unnecessary sensitive operational output, not to write Terraform debug logging to a named file.

B:

That outcome applies to TF_LOG_PROVIDER environment variable, intended to focus verbose diagnostics on provider-side activity, rather than the question's feature Disable debug logging after diagnosis: TF_LOG_PROVIDER controls the provider logging level to aid plugin or API troubleshooting. Unlike TF_LOG_PROVIDER environment variable, Disable debug logging after diagnosis is intended to avoid collecting unnecessary sensitive operational output, not to focus verbose diagnostics on provider-side activity.

C:

That outcome applies to TRACE diagnostic level, intended to capture highly detailed events for a stubborn Terraform problem, rather than the question's feature Disable debug logging after diagnosis: TRACE is a very verbose Terraform logging level useful for deep troubleshooting. Unlike TRACE diagnostic level, Disable debug logging after diagnosis is intended to avoid collecting unnecessary sensitive operational output, not to capture highly detailed events for a stubborn Terraform problem.

E:

That outcome applies to TF_LOG environment variable, intended to enable Terraform debugging output while investigating a CLI failure, rather than the question's feature Disable debug logging after diagnosis: TF_LOG sets a supported logging level such as DEBUG or TRACE for a Terraform process. Unlike TF_LOG environment variable, Disable debug logging after diagnosis is intended to avoid collecting unnecessary sensitive operational output, not to enable Terraform debugging output while investigating a CLI failure.

F:

That outcome applies to TF_LOG_CORE environment variable, intended to focus debugging on Terraform Core behavior rather than provider messages, rather than the question's feature Disable debug logging after diagnosis: TF_LOG_CORE can set logging for Terraform Core separately from provider plugin output. Unlike TF_LOG_CORE environment variable, Disable debug logging after diagnosis is intended to avoid collecting unnecessary sensitive operational output, not to focus debugging on Terraform Core behavior rather than provider messages.

Question 844

For a new infrastructure repository, the team wants to suppress planned updates for selected externally managed attributes. Which mechanism most directly meets this particular need?

  1. Implicit dependency from expression
  2. create_before_destroy lifecycle
  3. prevent_destroy lifecycle
  4. ignore_changes lifecycle

Explanation

Correct Answer

D:

The task is to suppress planned updates for selected externally managed attributes; ignore_changes lifecycle directly supports that requirement: ignore_changes tells Terraform to disregard specified differences when planning updates to an existing resource. Its relevant boundary is: Ignored attributes may still be used during initial resource creation.

Incorrect Answers

A:

Implicit dependency from expression is designed to order resources when one consumes an attribute produced by another, whereas this task is to suppress planned updates for selected externally managed attributes: Terraform derives an edge from an expression reference and schedules the producer first. Against ignore_changes lifecycle, its limitation is: No extra depends_on is needed for an already represented relationship.

B:

create_before_destroy lifecycle is designed to favor replacement resource creation before deletion of its predecessor, whereas this task is to suppress planned updates for selected externally managed attributes: The lifecycle rule changes replacement ordering when the provider and external constraints permit it. Against ignore_changes lifecycle, its limitation is: A uniqueness constraint or quota can still prevent parallel old and new objects.

C:

prevent_destroy lifecycle addresses the different requirement to protect a declared resource from plans that destroy its managed object: prevent_destroy causes an error if a plan includes destruction while the rule is present in configuration; this does not by itself satisfy the requested task to suppress planned updates for selected externally managed attributes. For the stated need, ignore_changes lifecycle is the more direct mechanism.

Question 845

A team reviews the use of Apply a previously saved plan in Terraform 1.12. Which purpose matches its actual behavior?

  1. record the result of successful provider operations for subsequent reconciliation
  2. rerun a plan after a partial apply rather than assuming complete rollback
  3. execute precisely a previously generated binary execution plan
  4. set an input variable for a particular deployment without editing its declaration

Explanation

Correct Answer

C:

The practical result of Apply a previously saved plan, used to execute precisely a previously generated binary execution plan, is: terraform apply change.tfplan applies that saved plan rather than recalculating a fresh interactive plan. A qualification for this effect is: The saved artifact may become stale if state changes after its creation.

Incorrect Answers

A:

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 a previously saved plan: Terraform persists state reflecting actions and known attributes after apply operations. Unlike Updated state after apply, Apply a previously saved plan is intended to execute precisely a previously generated binary execution plan, not to record the result of successful provider operations for subsequent reconciliation.

B:

That outcome applies to Apply failure diagnosis, intended to rerun a plan after a partial apply rather than assuming complete rollback, rather than the question's feature Apply a previously saved plan: Terraform does not guarantee all-or-nothing rollback across external provider APIs. Unlike Apply failure diagnosis, Apply a previously saved plan is intended to execute precisely a previously generated binary execution plan, not to rerun a plan after a partial apply rather than assuming complete rollback.

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 a previously saved plan: terraform apply -var='name=value' supplies root-module input during that run. Unlike Apply variable overrides, Apply a previously saved plan is intended to execute precisely a previously generated binary execution plan, not to set an input variable for a particular deployment without editing its declaration.

Question 846

A change proposal relies on Provider alias reference address for the task to refer to a provider configuration by its local name and alias. Which limitation specifically applies to it?

  1. Aliases and complex configurations often require explicit mapping.
  2. A provider alias is not a separate package with its own source address.
  3. A child module cannot automatically see every parent alias just because it exists.
  4. The existence of an alias does not move existing resources to that configuration automatically.

Explanation

Correct Answer

B:

For Provider alias reference address in the task to refer to a provider configuration by its local name and alias, the important caution is: A provider alias is not a separate package with its own source address. The reason this matters is its actual behavior: An address such as aws.audit identifies a specific configured instance of the aws provider.

Incorrect Answers

A:

The proposed warning belongs to Default provider configuration inheritance, which serves the different goal to let a child module use default provider settings from its parent, rather than to Provider alias reference address: Child modules commonly inherit default provider configurations from the calling module. The question concerns Provider alias reference address acting to refer to a provider configuration by its local name and alias, not a limit of Default provider configuration inheritance.

C:

The proposed warning belongs to Explicit child module provider mapping, which serves the different goal to pass an aliased provider to resources inside a child module, rather than to Provider alias reference address: The providers map in a module block maps the child's provider name to a parent provider configuration. The question concerns Provider alias reference address acting to refer to a provider configuration by its local name and alias, not a limit of Explicit child module provider mapping.

D:

The listed caution belongs specifically to Aliased provider instance, used to configure a second instance of the same provider for another account or region: The alias argument gives a provider configuration an additional address that resources can select; the feature under review is instead Provider alias reference address, so this answer attaches another feature's qualification to the wrong mechanism.

Question 847

An operator chooses the mechanism "ignore_changes lifecycle" for a Terraform project. Which outcome should this choice support?

  1. suppress planned updates for selected externally managed attributes
  2. order otherwise unreferenced actions that have a hidden operational dependency
  3. protect a declared resource from plans that destroy its managed object
  4. order resources when one consumes an attribute produced by another
  5. favor replacement resource creation before deletion of its predecessor

Explanation

Correct Answer

A:

The practical result of ignore_changes lifecycle, used to suppress planned updates for selected externally managed attributes, is: ignore_changes tells Terraform to disregard specified differences when planning updates to an existing resource. A qualification for this effect is: Ignored attributes may still be used during initial resource creation.

Incorrect Answers

B:

That outcome applies to Explicit depends_on relationship, intended to order otherwise unreferenced actions that have a hidden operational dependency, rather than the question's feature ignore_changes lifecycle: depends_on declares an ordering relationship when there is no suitable value reference. Unlike Explicit depends_on relationship, ignore_changes lifecycle is intended to suppress planned updates for selected externally managed attributes, not to order otherwise unreferenced actions that have a hidden operational dependency.

C:

That outcome applies to prevent_destroy lifecycle, intended to protect a declared resource from plans that destroy its managed object, rather than the question's feature ignore_changes lifecycle: prevent_destroy causes an error if a plan includes destruction while the rule is present in configuration. Unlike prevent_destroy lifecycle, ignore_changes lifecycle is intended to suppress planned updates for selected externally managed attributes, not to protect a declared resource from plans that destroy its managed object.

D:

That outcome applies to Implicit dependency from expression, intended to order resources when one consumes an attribute produced by another, rather than the question's feature ignore_changes lifecycle: Terraform derives an edge from an expression reference and schedules the producer first. Unlike Implicit dependency from expression, ignore_changes lifecycle is intended to suppress planned updates for selected externally managed attributes, not to order resources when one consumes an attribute produced by another.

E:

That outcome applies to create_before_destroy lifecycle, intended to favor replacement resource creation before deletion of its predecessor, rather than the question's feature ignore_changes lifecycle: The lifecycle rule changes replacement ordering when the provider and external constraints permit it. Unlike create_before_destroy lifecycle, ignore_changes lifecycle is intended to suppress planned updates for selected externally managed attributes, not to favor replacement resource creation before deletion of its predecessor.

Question 848

A design uses Vendor portability through modules to abstract a deployment pattern while keeping provider details explicit. Which qualification applies to the named mechanism?

  1. Replacing a cloud provider normally requires rewriting provider-dependent resources.
  2. Service-agnostic does not mean resource schemas are interchangeable.
  3. An appropriate provider or integration must exist for each target system.
  4. Each provider still needs suitable credentials and service permissions.

Explanation

Correct Answer

A:

For Vendor portability through modules in the task to abstract a deployment pattern while keeping provider details explicit, the important caution is: Replacing a cloud provider normally requires rewriting provider-dependent resources. The reason this matters is its actual behavior: A module can offer common input and output conventions even if its implementation uses provider-specific resources.

Incorrect Answers

B:

The proposed warning belongs to Service-agnostic orchestration, which serves the different goal to control DNS, SaaS, and cloud resources through a common configuration tool, rather than to Vendor portability through modules: Terraform providers expose resource and data types beyond infrastructure hosted by a cloud vendor. The question concerns Vendor portability through modules acting to abstract a deployment pattern while keeping provider details explicit, not a limit of Service-agnostic orchestration.

C:

The proposed warning belongs to Hybrid infrastructure automation, which serves the different goal to configure cloud and on-premises platforms through a common workflow, rather than to Vendor portability through modules: Terraform can coordinate providers for hosted services and private infrastructure without imposing one cloud API. The question concerns Vendor portability through modules acting to abstract a deployment pattern while keeping provider details explicit, not a limit of Hybrid infrastructure automation.

D:

The proposed warning belongs to Multi-cloud provider configuration, which serves the different goal to manage different clouds from one Terraform root module, rather than to Vendor portability through modules: Separate provider plugins can reconcile resources on multiple platforms within the same configuration. The question concerns Vendor portability through modules acting to abstract a deployment pattern while keeping provider details explicit, not a limit of Multi-cloud provider configuration.

Question 849

A design uses Disable debug logging after diagnosis to avoid collecting unnecessary sensitive operational output. Which qualification applies to the named mechanism?

  1. Verbose logs can contain sensitive data and should be protected.
  2. Core logging does not substitute for investigating remote API authorization errors.
  3. Leaving verbose logs enabled can produce large sensitive artifacts.
  4. Setting a log path alone does not necessarily enable logging.

Explanation

Correct Answer

C:

For Disable debug logging after diagnosis in the task to avoid collecting unnecessary sensitive operational output, the important caution is: Leaving verbose logs enabled can produce large sensitive artifacts. The reason this matters is its actual behavior: Unset debug environment variables or restore normal log settings when the investigation ends.

Incorrect Answers

A:

The proposed warning belongs to TF_LOG environment variable, which serves the different goal to enable Terraform debugging output while investigating a CLI failure, rather than to Disable debug logging after diagnosis: TF_LOG sets a supported logging level such as DEBUG or TRACE for a Terraform process. The question concerns Disable debug logging after diagnosis acting to avoid collecting unnecessary sensitive operational output, not a limit of TF_LOG environment variable.

B:

The proposed warning belongs to TF_LOG_CORE environment variable, which serves the different goal to focus debugging on Terraform Core behavior rather than provider messages, rather than to Disable debug logging after diagnosis: TF_LOG_CORE can set logging for Terraform Core separately from provider plugin output. The question concerns Disable debug logging after diagnosis acting to avoid collecting unnecessary sensitive operational output, not a limit of TF_LOG_CORE environment variable.

D:

The proposed warning belongs to TF_LOG_PATH environment variable, which serves the different goal to write Terraform debug logging to a named file, rather than to Disable debug logging after diagnosis: TF_LOG_PATH controls a file destination for Terraform logging when logging is enabled. The question concerns Disable debug logging after diagnosis acting to avoid collecting unnecessary sensitive operational output, not a limit of TF_LOG_PATH environment variable.

Question 850

The rollout owner asks whether Apply a previously saved plan is sufficient to execute precisely a previously generated binary execution plan. Which limitation specifically concerns that mechanism?

  1. A partial failure can leave partial changes requiring another plan and review.
  2. The same variable inputs must be accounted for when using a saved plan.
  3. The saved artifact may become stale if state changes after its creation.
  4. Inspecting real objects and current state is necessary after a failed apply.

Explanation

Correct Answer

C:

For Apply a previously saved plan in the task to execute precisely a previously generated binary execution plan, the important caution is: The saved artifact may become stale if state changes after its creation. The reason this matters is its actual behavior: terraform apply change.tfplan applies that saved plan rather than recalculating a fresh interactive plan.

Incorrect Answers

A:

The proposed warning belongs to Updated state after apply, which serves the different goal to record the result of successful provider operations for subsequent reconciliation, rather than to Apply a previously saved plan: Terraform persists state reflecting actions and known attributes after apply operations. The question concerns Apply a previously saved plan acting to execute precisely a previously generated binary execution plan, not a limit of Updated state after apply.

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 a previously saved plan: terraform apply -var='name=value' supplies root-module input during that run. The question concerns Apply a previously saved plan acting to execute precisely a previously generated binary execution plan, not a limit of Apply variable overrides.

D:

The proposed warning belongs to Apply failure diagnosis, which serves the different goal to rerun a plan after a partial apply rather than assuming complete rollback, rather than to Apply a previously saved plan: Terraform does not guarantee all-or-nothing rollback across external provider APIs. The question concerns Apply a previously saved plan acting to execute precisely a previously generated binary execution plan, not a limit of Apply failure diagnosis.

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