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

Question 860

A team reviews the use of replace_triggered_by lifecycle in Terraform 1.12. Which purpose matches its actual behavior?

  1. protect a declared resource from plans that destroy its managed object
  2. suppress planned updates for selected externally managed attributes
  3. order resources when one consumes an attribute produced by another
  4. replace a resource when a specified managed resource change occurs
  5. detect an impossible dependency ordering caused by circular references
  6. order otherwise unreferenced actions that have a hidden operational dependency

Explanation

Correct Answer

D:

The practical result of replace_triggered_by lifecycle, used to replace a resource when a specified managed resource change occurs, is: replace_triggered_by adds replacement behavior tied to changes in other managed objects or attributes. A qualification for this effect is: It is not a general string-based condition on arbitrary local values.

Incorrect Answers

A:

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 replace_triggered_by lifecycle: prevent_destroy causes an error if a plan includes destruction while the rule is present in configuration. Unlike prevent_destroy lifecycle, replace_triggered_by lifecycle is intended to replace a resource when a specified managed resource change occurs, not to protect a declared resource from plans that destroy its managed object.

B:

That outcome applies to ignore_changes lifecycle, intended to suppress planned updates for selected externally managed attributes, rather than the question's feature replace_triggered_by lifecycle: ignore_changes tells Terraform to disregard specified differences when planning updates to an existing resource. Unlike ignore_changes lifecycle, replace_triggered_by lifecycle is intended to replace a resource when a specified managed resource change occurs, not to suppress planned updates for selected externally managed attributes.

C:

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 replace_triggered_by lifecycle: Terraform derives an edge from an expression reference and schedules the producer first. Unlike Implicit dependency from expression, replace_triggered_by lifecycle is intended to replace a resource when a specified managed resource change occurs, not to order resources when one consumes an attribute produced by another.

E:

That outcome applies to Terraform resource graph cycle, intended to detect an impossible dependency ordering caused by circular references, rather than the question's feature replace_triggered_by lifecycle: Terraform reports cycles when resources depend on one another in a way it cannot order. Unlike Terraform resource graph cycle, replace_triggered_by lifecycle is intended to replace a resource when a specified managed resource change occurs, not to detect an impossible dependency ordering caused by circular references.

F:

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 replace_triggered_by lifecycle: depends_on declares an ordering relationship when there is no suitable value reference. Unlike Explicit depends_on relationship, replace_triggered_by lifecycle is intended to replace a resource when a specified managed resource change occurs, not to order otherwise unreferenced actions that have a hidden operational dependency.

Question 861

In a reusable deployment, the primary objective is to plan and apply resources from several providers in one run. Which mechanism most directly meets this particular need?

  1. Multi-cloud provider configuration
  2. Vendor portability through modules
  3. Common Terraform lifecycle across providers
  4. Hybrid infrastructure automation
  5. Provider-specific implementation
  6. Cross-platform dependency references

Explanation

Correct Answer

C:

The task is to plan and apply resources from several providers in one run; Common Terraform lifecycle across providers directly supports that requirement: Terraform Core constructs a dependency graph and asks installed providers to implement their own actions. Its relevant boundary is: A unified plan cannot guarantee a distributed transaction across separate providers.

Incorrect Answers

A:

Multi-cloud provider configuration is designed to manage different clouds from one Terraform root module, whereas this task is to plan and apply resources from several providers in one run: Separate provider plugins can reconcile resources on multiple platforms within the same configuration. Against Common Terraform lifecycle across providers, its limitation is: Each provider still needs suitable credentials and service permissions.

B:

Vendor portability through modules is designed to abstract a deployment pattern while keeping provider details explicit, whereas this task is to plan and apply resources from several providers in one run: A module can offer common input and output conventions even if its implementation uses provider-specific resources. Against Common Terraform lifecycle across providers, its limitation is: Replacing a cloud provider normally requires rewriting provider-dependent resources.

D:

Hybrid infrastructure automation is designed to configure cloud and on-premises platforms through a common workflow, whereas this task is to plan and apply resources from several providers in one run: Terraform can coordinate providers for hosted services and private infrastructure without imposing one cloud API. Against Common Terraform lifecycle across providers, its limitation is: An appropriate provider or integration must exist for each target system.

E:

Provider-specific implementation is designed to use a common language without pretending providers expose identical capabilities, whereas this task is to plan and apply resources from several providers in one run: HCL and workflow are common while each provider defines its own resource schema and service-specific behavior. Against Common Terraform lifecycle across providers, its limitation is: A resource type from one provider cannot be substituted blindly for another.

F:

Cross-platform dependency references is designed to use output from one service to configure another supported service, whereas this task is to plan and apply resources from several providers in one run: References can establish ordering when a resource on one platform consumes attributes from another resource. Against Common Terraform lifecycle across providers, its limitation is: The dependency does not remove authentication or network prerequisites on either platform.

Question 862

A team is adjusting its declarative infrastructure process to review debugging evidence without publishing API secrets. Which mechanism most directly meets this particular need?

  1. TRACE diagnostic level
  2. Log analysis and source protection
  3. TF_LOG_PROVIDER environment variable
  4. Disable debug logging after diagnosis

Explanation

Correct Answer

B:

The task is to review debugging evidence without publishing API secrets; Log analysis and source protection directly supports that requirement: Diagnostic logs should be stored and shared according to secret-handling policy. Its relevant boundary is: A log that shows an error does not automatically identify the root cause without context.

Incorrect Answers

A:

TRACE diagnostic level is designed to capture highly detailed events for a stubborn Terraform problem, whereas this task is to review debugging evidence without publishing API secrets: TRACE is a very verbose Terraform logging level useful for deep troubleshooting. Against Log analysis and source protection, its limitation is: It is too noisy and potentially sensitive for routine production pipelines.

C:

TF_LOG_PROVIDER environment variable is designed to focus verbose diagnostics on provider-side activity, whereas this task is to review debugging evidence without publishing API secrets: TF_LOG_PROVIDER controls the provider logging level to aid plugin or API troubleshooting. Against Log analysis and source protection, its limitation is: Provider logs may reveal credentials or request data and require caution.

D:

Disable debug logging after diagnosis is designed to avoid collecting unnecessary sensitive operational output, whereas this task is to review debugging evidence without publishing API secrets: Unset debug environment variables or restore normal log settings when the investigation ends. Against Log analysis and source protection, its limitation is: Leaving verbose logs enabled can produce large sensitive artifacts.

Question 863

A configuration walkthrough identifies "Apply without interactive approval". Which task is it principally intended to support?

  1. execute precisely a previously generated binary execution plan
  2. run a controlled automated deployment from current configuration
  3. create an upstream object before a dependent reference is resolved
  4. record the result of successful provider operations for subsequent reconciliation

Explanation

Correct Answer

B:

The practical result of Apply without interactive approval, used to run a controlled automated deployment from current configuration, is: terraform apply -auto-approve skips the interactive approval prompt for an unsaved plan. A qualification for this effect is: It is appropriate only when automation has separate policy and authorization controls.

Incorrect Answers

A:

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 without interactive approval: terraform apply change.tfplan applies that saved plan rather than recalculating a fresh interactive plan. Unlike Apply a previously saved plan, Apply without interactive approval is intended to run a controlled automated deployment from current configuration, not to execute precisely a previously generated binary execution plan.

C:

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 without interactive approval: Terraform uses references and explicit dependencies to order apply graph operations. Unlike Dependency-ordered apply, Apply without interactive approval is intended to run a controlled automated deployment from current configuration, not to create an upstream object before a dependent reference is resolved.

D:

The outcome in this option belongs to Updated state after apply: Terraform persists state reflecting actions and known attributes after apply operations; by contrast, the feature actually named in the stem, Apply without interactive approval, has a distinct purpose: to run a controlled automated deployment from current configuration.

Question 864

The rollout owner asks whether replace_triggered_by lifecycle is sufficient to replace a resource when a specified managed resource change occurs. Which limitation specifically concerns that mechanism?

  1. It is not a general string-based condition on arbitrary local values.
  2. Ignored attributes may still be used during initial resource creation.
  3. Removing the entire resource configuration also removes this protective rule.
  4. No extra depends_on is needed for an already represented relationship.

Explanation

Correct Answer

A:

For replace_triggered_by lifecycle in the task to replace a resource when a specified managed resource change occurs, the important caution is: It is not a general string-based condition on arbitrary local values. The reason this matters is its actual behavior: replace_triggered_by adds replacement behavior tied to changes in other managed objects or attributes.

Incorrect Answers

B:

The proposed warning belongs to ignore_changes lifecycle, which serves the different goal to suppress planned updates for selected externally managed attributes, rather than to replace_triggered_by lifecycle: ignore_changes tells Terraform to disregard specified differences when planning updates to an existing resource. The question concerns replace_triggered_by lifecycle acting to replace a resource when a specified managed resource change occurs, not a limit of ignore_changes lifecycle.

C:

The proposed warning belongs to prevent_destroy lifecycle, which serves the different goal to protect a declared resource from plans that destroy its managed object, rather than to replace_triggered_by lifecycle: prevent_destroy causes an error if a plan includes destruction while the rule is present in configuration. The question concerns replace_triggered_by lifecycle acting to replace a resource when a specified managed resource change occurs, not a limit of prevent_destroy lifecycle.

D:

The listed caution belongs specifically to Implicit dependency from expression, used to order resources when one consumes an attribute produced by another: Terraform derives an edge from an expression reference and schedules the producer first; the feature under review is instead replace_triggered_by lifecycle, so this answer attaches another feature's qualification to the wrong mechanism.

Question 865

An operator chooses the mechanism "Multiple regions in one configuration" for a Terraform project. Which outcome should this choice support?

  1. create similar resources in different regions without duplicating the root module
  2. configure a second instance of the same provider for another account or region
  3. direct an individual resource to the intended aliased provider
  4. declare several provider types in the same root module

Explanation

Correct Answer

A:

The practical result of Multiple regions in one configuration, used to create similar resources in different regions without duplicating the root module, is: Two provider instances with different region settings can serve explicitly assigned resources or modules. A qualification for this effect is: A default provider does not infer a resource's desired region from its name.

Incorrect Answers

B:

That outcome applies to Aliased provider instance, intended to configure a second instance of the same provider for another account or region, rather than the question's feature Multiple regions in one configuration: The alias argument gives a provider configuration an additional address that resources can select. Unlike Aliased provider instance, Multiple regions in one configuration is intended to create similar resources in different regions without duplicating the root module, not to configure a second instance of the same provider for another account or region.

C:

That outcome applies to Resource provider meta-argument, intended to direct an individual resource to the intended aliased provider, rather than the question's feature Multiple regions in one configuration: The provider meta-argument can select a configured instance such as aws.west for that resource. Unlike Resource provider meta-argument, Multiple regions in one configuration is intended to create similar resources in different regions without duplicating the root module, not to direct an individual resource to the intended aliased provider.

D:

That outcome applies to Different provider local names, intended to declare several provider types in the same root module, rather than the question's feature Multiple regions in one configuration: The required_providers map can list multiple source addresses with distinct local names. Unlike Different provider local names, Multiple regions in one configuration is intended to create similar resources in different regions without duplicating the root module, not to declare several provider types in the same root module.

Question 866

A Terraform rollout has two separate requirements: first, replace a resource when a specified managed resource change occurs; second, order resources when one consumes an attribute produced by another. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use replace_triggered_by lifecycle; then use Implicit dependency from expression.
  2. First use Implicit dependency from expression; then use replace_triggered_by lifecycle.
  3. First use Explicit depends_on relationship; then use create_before_destroy lifecycle.
  4. First use replace_triggered_by lifecycle; then use Explicit depends_on relationship.
  5. First use create_before_destroy lifecycle; then use Implicit dependency from expression.

Explanation

Correct Answer

A:

The first 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. The second requirement, to order resources when one consumes an attribute produced by another, is handled by Implicit dependency from expression: Terraform derives an edge from an expression reference and schedules the producer first. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

B:

For the requested tasks to replace a resource when a specified managed resource change occurs and order resources when one consumes an attribute produced by another, 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 and the second mechanism primarily supports the task to replace a resource when a specified managed resource change occurs; the actual requirements are replace a resource when a specified managed resource change occurs first and order resources when one consumes an attribute produced by another second.

C:

For the requested tasks to replace a resource when a specified managed resource change occurs and order resources when one consumes an attribute produced by another, the first candidate Explicit depends_on relationship addresses order otherwise unreferenced actions that have a hidden operational dependency; the second candidate create_before_destroy lifecycle addresses favor replacement resource creation before deletion of its predecessor. This mapping fails because the first mechanism primarily supports the task to order otherwise unreferenced actions that have a hidden operational dependency and the second mechanism primarily supports the task to favor replacement resource creation before deletion of its predecessor; the actual requirements are replace a resource when a specified managed resource change occurs first and order resources when one consumes an attribute produced by another second.

D:

For the requested tasks to replace a resource when a specified managed resource change occurs and order resources when one consumes an attribute produced by another, the first candidate replace_triggered_by lifecycle addresses replace a resource when a specified managed resource change occurs; the second candidate Explicit depends_on relationship addresses order otherwise unreferenced actions that have a hidden operational dependency. This mapping fails because the second mechanism primarily supports the task to order otherwise unreferenced actions that have a hidden operational dependency; the actual requirements are replace a resource when a specified managed resource change occurs first and order resources when one consumes an attribute produced by another second.

E:

For the requested tasks to replace a resource when a specified managed resource change occurs and order resources when one consumes an attribute produced by another, the first candidate create_before_destroy lifecycle addresses favor replacement resource creation before deletion of its predecessor; 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 favor replacement resource creation before deletion of its predecessor; the actual requirements are replace a resource when a specified managed resource change occurs first and order resources when one consumes an attribute produced by another second.

Question 867

A design uses Apply without interactive approval to run a controlled automated deployment from current configuration. Which qualification applies to the named mechanism?

  1. The order is not determined by the placement of resource blocks in files.
  2. The saved artifact may become stale if state changes after its creation.
  3. It is appropriate only when automation has separate policy and authorization controls.
  4. A partial failure can leave partial changes requiring another plan and review.

Explanation

Correct Answer

C:

For Apply without interactive approval in the task to run a controlled automated deployment from current configuration, the important caution is: It is appropriate only when automation has separate policy and authorization controls. The reason this matters is its actual behavior: terraform apply -auto-approve skips the interactive approval prompt for an unsaved plan.

Incorrect Answers

A:

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 without interactive approval: Terraform uses references and explicit dependencies to order apply graph operations. The question concerns Apply without interactive approval acting to run a controlled automated deployment from current configuration, not a limit of Dependency-ordered apply.

B:

The proposed warning belongs to Apply a previously saved plan, which serves the different goal to execute precisely a previously generated binary execution plan, rather than to Apply without interactive approval: terraform apply change.tfplan applies that saved plan rather than recalculating a fresh interactive plan. The question concerns Apply without interactive approval acting to run a controlled automated deployment from current configuration, not a limit of Apply a previously saved plan.

D:

The listed caution belongs specifically to Updated state after apply, used to record the result of successful provider operations for subsequent reconciliation: Terraform persists state reflecting actions and known attributes after apply operations; the feature under review is instead Apply without interactive approval, so this answer attaches another feature's qualification to the wrong mechanism.

Question 868

A Terraform runbook describes the mechanism "Common Terraform lifecycle across providers". Which responsibility should a reviewer associate with it?

  1. use a common language without pretending providers expose identical capabilities
  2. abstract a deployment pattern while keeping provider details explicit
  3. use output from one service to configure another supported service
  4. plan and apply resources from several providers in one run

Explanation

Correct Answer

D:

The practical result of Common Terraform lifecycle across providers, used to plan and apply resources from several providers in one run, is: Terraform Core constructs a dependency graph and asks installed providers to implement their own actions. A qualification for this effect is: A unified plan cannot guarantee a distributed transaction across separate providers.

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 Common Terraform lifecycle across providers: HCL and workflow are common while each provider defines its own resource schema and service-specific behavior. Unlike Provider-specific implementation, Common Terraform lifecycle across providers is intended to plan and apply resources from several providers in one run, not to use a common language without pretending providers expose identical capabilities.

B:

That outcome applies to Vendor portability through modules, intended to abstract a deployment pattern while keeping provider details explicit, rather than the question's feature Common Terraform lifecycle across providers: A module can offer common input and output conventions even if its implementation uses provider-specific resources. Unlike Vendor portability through modules, Common Terraform lifecycle across providers is intended to plan and apply resources from several providers in one run, not to abstract a deployment pattern while keeping provider details explicit.

C:

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 Common Terraform lifecycle across providers: References can establish ordering when a resource on one platform consumes attributes from another resource. Unlike Cross-platform dependency references, Common Terraform lifecycle across providers is intended to plan and apply resources from several providers in one run, not to use output from one service to configure another supported service.

Question 869

A Terraform runbook describes the mechanism "Log analysis and source protection". Which responsibility should a reviewer associate with it?

  1. avoid collecting unnecessary sensitive operational output
  2. review debugging evidence without publishing API secrets
  3. capture highly detailed events for a stubborn Terraform problem
  4. focus verbose diagnostics on provider-side activity

Explanation

Correct Answer

B:

The practical result of Log analysis and source protection, used to review debugging evidence without publishing API secrets, is: Diagnostic logs should be stored and shared according to secret-handling policy. A qualification for this effect is: A log that shows an error does not automatically identify the root cause without context.

Incorrect Answers

A:

That outcome applies to Disable debug logging after diagnosis, intended to avoid collecting unnecessary sensitive operational output, rather than the question's feature Log analysis and source protection: Unset debug environment variables or restore normal log settings when the investigation ends. Unlike Disable debug logging after diagnosis, Log analysis and source protection is intended to review debugging evidence without publishing API secrets, not to avoid collecting unnecessary sensitive operational output.

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 Log analysis and source protection: TRACE is a very verbose Terraform logging level useful for deep troubleshooting. Unlike TRACE diagnostic level, Log analysis and source protection is intended to review debugging evidence without publishing API secrets, not to capture highly detailed events for a stubborn Terraform problem.

D:

That outcome applies to TF_LOG_PROVIDER environment variable, intended to focus verbose diagnostics on provider-side activity, rather than the question's feature Log analysis and source protection: TF_LOG_PROVIDER controls the provider logging level to aid plugin or API troubleshooting. Unlike TF_LOG_PROVIDER environment variable, Log analysis and source protection is intended to review debugging evidence without publishing API secrets, not to focus verbose diagnostics on provider-side activity.

Question 870

Before continuing an infrastructure rollout, the operator must detect an impossible dependency ordering caused by circular references. Which mechanism most directly meets this particular need?

  1. Explicit depends_on relationship
  2. Terraform resource graph cycle
  3. create_before_destroy lifecycle
  4. prevent_destroy lifecycle
  5. Implicit dependency from expression

Explanation

Correct Answer

B:

The task is to detect an impossible dependency ordering caused by circular references; Terraform resource graph cycle directly supports that requirement: Terraform reports cycles when resources depend on one another in a way it cannot order. Its relevant boundary is: Changing file order does not resolve a cyclic dependency graph.

Incorrect Answers

A:

Explicit depends_on relationship is designed to order otherwise unreferenced actions that have a hidden operational dependency, whereas this task is to detect an impossible dependency ordering caused by circular references: depends_on declares an ordering relationship when there is no suitable value reference. Against Terraform resource graph cycle, its limitation is: Excessive explicit dependencies can make planning conservative and values unknown.

C:

create_before_destroy lifecycle is designed to favor replacement resource creation before deletion of its predecessor, whereas this task is to detect an impossible dependency ordering caused by circular references: The lifecycle rule changes replacement ordering when the provider and external constraints permit it. Against Terraform resource graph cycle, its limitation is: A uniqueness constraint or quota can still prevent parallel old and new objects.

D:

prevent_destroy lifecycle is designed to protect a declared resource from plans that destroy its managed object, whereas this task is to detect an impossible dependency ordering caused by circular references: prevent_destroy causes an error if a plan includes destruction while the rule is present in configuration. Against Terraform resource graph cycle, its limitation is: Removing the entire resource configuration also removes this protective rule.

E:

Implicit dependency from expression is designed to order resources when one consumes an attribute produced by another, whereas this task is to detect an impossible dependency ordering caused by circular references: Terraform derives an edge from an expression reference and schedules the producer first. Against Terraform resource graph cycle, its limitation is: No extra depends_on is needed for an already represented relationship.

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