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

Question 830

A Terraform rollout has two separate requirements: first, capture highly detailed events for a stubborn Terraform problem; second, review debugging evidence without publishing API secrets. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use TF_LOG environment variable; then use TF_LOG_PATH environment variable.
  2. First use TF_LOG_PATH environment variable; then use Log analysis and source protection.
  3. First use TRACE diagnostic level; then use Log analysis and source protection.
  4. First use Log analysis and source protection; then use TRACE diagnostic level.
  5. First use TRACE diagnostic level; then use TF_LOG environment variable.

Explanation

Correct Answer

C:

The first requirement, to capture highly detailed events for a stubborn Terraform problem, is handled by TRACE diagnostic level: TRACE is a very verbose Terraform logging level useful for deep troubleshooting. The second requirement, to review debugging evidence without publishing API secrets, is handled by Log analysis and source protection: Diagnostic logs should be stored and shared according to secret-handling policy. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to capture highly detailed events for a stubborn Terraform problem and review debugging evidence without publishing API secrets, the first candidate TF_LOG environment variable addresses enable Terraform debugging output while investigating a CLI failure; the second candidate TF_LOG_PATH environment variable addresses write Terraform debug logging to a named file. This mapping fails because the first mechanism primarily supports the task to enable Terraform debugging output while investigating a CLI failure and the second mechanism primarily supports the task to write Terraform debug logging to a named file; the actual requirements are capture highly detailed events for a stubborn Terraform problem first and review debugging evidence without publishing API secrets second.

B:

For the requested tasks to capture highly detailed events for a stubborn Terraform problem and review debugging evidence without publishing API secrets, the first candidate TF_LOG_PATH environment variable addresses write Terraform debug logging to a named file; the second candidate Log analysis and source protection addresses review debugging evidence without publishing API secrets. This mapping fails because the first mechanism primarily supports the task to write Terraform debug logging to a named file; the actual requirements are capture highly detailed events for a stubborn Terraform problem first and review debugging evidence without publishing API secrets second.

D:

For the requested tasks to capture highly detailed events for a stubborn Terraform problem and review debugging evidence without publishing API secrets, the first candidate Log analysis and source protection addresses review debugging evidence without publishing API secrets; the second candidate TRACE diagnostic level addresses capture highly detailed events for a stubborn Terraform problem. This mapping fails because the first mechanism primarily supports the task to review debugging evidence without publishing API secrets and the second mechanism primarily supports the task to capture highly detailed events for a stubborn Terraform problem; the actual requirements are capture highly detailed events for a stubborn Terraform problem first and review debugging evidence without publishing API secrets second.

E:

For the requested tasks to capture highly detailed events for a stubborn Terraform problem and review debugging evidence without publishing API secrets, the first candidate TRACE diagnostic level addresses capture highly detailed events for a stubborn Terraform problem; the second candidate TF_LOG environment variable addresses enable Terraform debugging output while investigating a CLI failure. This mapping fails because the second mechanism primarily supports the task to enable Terraform debugging output while investigating a CLI failure; the actual requirements are capture highly detailed events for a stubborn Terraform problem first and review debugging evidence without publishing API secrets second.

Question 831

An engineer must update an existing Terraform workflow to protect a declared resource from plans that destroy its managed object. Which mechanism most directly meets this particular need?

  1. Terraform resource graph cycle
  2. prevent_destroy lifecycle
  3. replace_triggered_by lifecycle
  4. ignore_changes lifecycle

Explanation

Correct Answer

B:

The task is to protect a declared resource from plans that destroy its managed object; prevent_destroy lifecycle directly supports that requirement: prevent_destroy causes an error if a plan includes destruction while the rule is present in configuration. Its relevant boundary is: Removing the entire resource configuration also removes this protective rule.

Incorrect Answers

A:

Terraform resource graph cycle is designed to detect an impossible dependency ordering caused by circular references, whereas this task is to protect a declared resource from plans that destroy its managed object: Terraform reports cycles when resources depend on one another in a way it cannot order. Against prevent_destroy lifecycle, its limitation is: Changing file order does not resolve a cyclic dependency graph.

C:

replace_triggered_by lifecycle is designed to replace a resource when a specified managed resource change occurs, whereas this task is to protect a declared resource from plans that destroy its managed object: replace_triggered_by adds replacement behavior tied to changes in other managed objects or attributes. Against prevent_destroy lifecycle, its limitation is: It is not a general string-based condition on arbitrary local values.

D:

ignore_changes lifecycle is designed to suppress planned updates for selected externally managed attributes, whereas this task is to protect a declared resource from plans that destroy its managed object: ignore_changes tells Terraform to disregard specified differences when planning updates to an existing resource. Against prevent_destroy lifecycle, its limitation is: Ignored attributes may still be used during initial resource creation.

Question 832

Before adopting Apply the current configuration to execute proposed operations after reviewing their impact, which statement sets an accurate boundary?

  1. The saved artifact may become stale if state changes after its creation.
  2. The order is not determined by the placement of resource blocks in files.
  3. It is appropriate only when automation has separate policy and authorization controls.
  4. A plan might fail during execution if a provider API rejects an action.

Explanation

Correct Answer

D:

For Apply the current configuration in the task to execute proposed operations after reviewing their impact, the important caution is: A plan might fail during execution if a provider API rejects an action. The reason this matters is its actual behavior: terraform apply normally creates a plan and asks for approval before making changes.

Incorrect Answers

A:

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 the current configuration: terraform apply change.tfplan applies that saved plan rather than recalculating a fresh interactive plan. The question concerns Apply the current configuration acting to execute proposed operations after reviewing their impact, not a limit of Apply a previously saved plan.

B:

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 the current configuration: Terraform uses references and explicit dependencies to order apply graph operations. The question concerns Apply the current configuration acting to execute proposed operations after reviewing their impact, not a limit of Dependency-ordered apply.

C:

The proposed warning belongs to Apply without interactive approval, which serves the different goal to run a controlled automated deployment from current configuration, rather than to Apply the current configuration: terraform apply -auto-approve skips the interactive approval prompt for an unsaved plan. The question concerns Apply the current configuration acting to execute proposed operations after reviewing their impact, not a limit of Apply without interactive approval.

Question 833

An engineer must update an existing Terraform workflow to refer to a provider configuration by its local name and alias. Which mechanism most directly meets this particular need?

  1. Aliased provider instance
  2. Multiple regions in one configuration
  3. Explicit child module provider mapping
  4. Default provider configuration inheritance
  5. Provider alias reference address

Explanation

Correct Answer

E:

The task is to refer to a provider configuration by its local name and alias; Provider alias reference address directly supports that requirement: An address such as aws.audit identifies a specific configured instance of the aws provider. Its relevant boundary is: A provider alias is not a separate package with its own source address.

Incorrect Answers

A:

Aliased provider instance is designed to configure a second instance of the same provider for another account or region, whereas this task is to refer to a provider configuration by its local name and alias: The alias argument gives a provider configuration an additional address that resources can select. Against Provider alias reference address, its limitation is: The existence of an alias does not move existing resources to that configuration automatically.

B:

Multiple regions in one configuration is designed to create similar resources in different regions without duplicating the root module, whereas this task is to refer to a provider configuration by its local name and alias: Two provider instances with different region settings can serve explicitly assigned resources or modules. Against Provider alias reference address, its limitation is: A default provider does not infer a resource's desired region from its name.

C:

Explicit child module provider mapping is designed to pass an aliased provider to resources inside a child module, whereas this task is to refer to a provider configuration by its local name and alias: The providers map in a module block maps the child's provider name to a parent provider configuration. Against Provider alias reference address, its limitation is: A child module cannot automatically see every parent alias just because it exists.

D:

Default provider configuration inheritance is designed to let a child module use default provider settings from its parent, whereas this task is to refer to a provider configuration by its local name and alias: Child modules commonly inherit default provider configurations from the calling module. Against Provider alias reference address, its limitation is: Aliases and complex configurations often require explicit mapping.

Question 834

A colleague recommends the Terraform concept "prevent_destroy lifecycle". Which use case best matches it?

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

Explanation

Correct Answer

D:

The practical result of prevent_destroy lifecycle, used to protect a declared resource from plans that destroy its managed object, is: prevent_destroy causes an error if a plan includes destruction while the rule is present in configuration. A qualification for this effect is: Removing the entire resource configuration also removes this protective rule.

Incorrect Answers

A:

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 prevent_destroy lifecycle: Terraform derives an edge from an expression reference and schedules the producer first. Unlike Implicit dependency from expression, prevent_destroy lifecycle is intended to protect a declared resource from plans that destroy its managed object, not to order resources when one consumes an attribute produced by another.

B:

That outcome applies to ignore_changes lifecycle, intended to suppress planned updates for selected externally managed attributes, rather than the question's feature prevent_destroy lifecycle: ignore_changes tells Terraform to disregard specified differences when planning updates to an existing resource. Unlike ignore_changes lifecycle, prevent_destroy lifecycle is intended to protect a declared resource from plans that destroy its managed object, not to suppress planned updates for selected externally managed attributes.

C:

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 prevent_destroy lifecycle: Terraform reports cycles when resources depend on one another in a way it cannot order. Unlike Terraform resource graph cycle, prevent_destroy lifecycle is intended to protect a declared resource from plans that destroy its managed object, not to detect an impossible dependency ordering caused by circular references.

E:

That outcome applies to replace_triggered_by lifecycle, intended to replace a resource when a specified managed resource change occurs, rather than the question's feature prevent_destroy lifecycle: replace_triggered_by adds replacement behavior tied to changes in other managed objects or attributes. Unlike replace_triggered_by lifecycle, prevent_destroy lifecycle is intended to protect a declared resource from plans that destroy its managed object, not to replace a resource when a specified managed resource change occurs.

Question 835

Before continuing an infrastructure rollout, the operator must abstract a deployment pattern while keeping provider details explicit. Which mechanism most directly meets this particular need?

  1. Vendor portability through modules
  2. Service-agnostic orchestration
  3. Multi-cloud provider configuration
  4. Hybrid infrastructure automation
  5. Provider-specific implementation

Explanation

Correct Answer

A:

The task is to abstract a deployment pattern while keeping provider details explicit; Vendor portability through modules directly supports that requirement: A module can offer common input and output conventions even if its implementation uses provider-specific resources. Its relevant boundary is: Replacing a cloud provider normally requires rewriting provider-dependent resources.

Incorrect Answers

B:

Service-agnostic orchestration is designed to control DNS, SaaS, and cloud resources through a common configuration tool, whereas this task is to abstract a deployment pattern while keeping provider details explicit: Terraform providers expose resource and data types beyond infrastructure hosted by a cloud vendor. Against Vendor portability through modules, its limitation is: Service-agnostic does not mean resource schemas are interchangeable.

C:

Multi-cloud provider configuration is designed to manage different clouds from one Terraform root module, whereas this task is to abstract a deployment pattern while keeping provider details explicit: Separate provider plugins can reconcile resources on multiple platforms within the same configuration. Against Vendor portability through modules, its limitation is: Each provider still needs suitable credentials and service permissions.

D:

Hybrid infrastructure automation is designed to configure cloud and on-premises platforms through a common workflow, whereas this task is to abstract a deployment pattern while keeping provider details explicit: Terraform can coordinate providers for hosted services and private infrastructure without imposing one cloud API. Against Vendor portability through modules, 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 abstract a deployment pattern while keeping provider details explicit: HCL and workflow are common while each provider defines its own resource schema and service-specific behavior. Against Vendor portability through modules, its limitation is: A resource type from one provider cannot be substituted blindly for another.

Question 836

A reviewer is asked to choose a mechanism to avoid collecting unnecessary sensitive operational output. Which mechanism most directly meets this particular need?

  1. TF_LOG_CORE environment variable
  2. TF_LOG environment variable
  3. TF_LOG_PATH environment variable
  4. TF_LOG_PROVIDER environment variable
  5. TRACE diagnostic level
  6. Disable debug logging after diagnosis

Explanation

Correct Answer

F:

The task is to avoid collecting unnecessary sensitive operational output; Disable debug logging after diagnosis directly supports that requirement: Unset debug environment variables or restore normal log settings when the investigation ends. Its relevant boundary is: Leaving verbose logs enabled can produce large sensitive artifacts.

Incorrect Answers

A:

TF_LOG_CORE environment variable is designed to focus debugging on Terraform Core behavior rather than provider messages, whereas this task is to avoid collecting unnecessary sensitive operational output: TF_LOG_CORE can set logging for Terraform Core separately from provider plugin output. Against Disable debug logging after diagnosis, its limitation is: Core logging does not substitute for investigating remote API authorization errors.

B:

TF_LOG environment variable is designed to enable Terraform debugging output while investigating a CLI failure, whereas this task is to avoid collecting unnecessary sensitive operational output: TF_LOG sets a supported logging level such as DEBUG or TRACE for a Terraform process. Against Disable debug logging after diagnosis, its limitation is: Verbose logs can contain sensitive data and should be protected.

C:

TF_LOG_PATH environment variable is designed to write Terraform debug logging to a named file, whereas this task is to avoid collecting unnecessary sensitive operational output: TF_LOG_PATH controls a file destination for Terraform logging when logging is enabled. Against Disable debug logging after diagnosis, its limitation is: Setting a log path alone does not necessarily enable logging.

D:

TF_LOG_PROVIDER environment variable is designed to focus verbose diagnostics on provider-side activity, whereas this task is to avoid collecting unnecessary sensitive operational output: TF_LOG_PROVIDER controls the provider logging level to aid plugin or API troubleshooting. Against Disable debug logging after diagnosis, its limitation is: Provider logs may reveal credentials or request data and require caution.

E:

TRACE diagnostic level is designed to capture highly detailed events for a stubborn Terraform problem, whereas this task is to avoid collecting unnecessary sensitive operational output: TRACE is a very verbose Terraform logging level useful for deep troubleshooting. Against Disable debug logging after diagnosis, its limitation is: It is too noisy and potentially sensitive for routine production pipelines.

Question 837

A Terraform rollout has two separate requirements: first, execute proposed operations after reviewing their impact; second, run a controlled automated deployment from current configuration. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Apply the current configuration; then use Apply without interactive approval.
  2. First use Dependency-ordered apply; then use Updated state after apply.
  3. First use Apply the current configuration; then use Dependency-ordered apply.
  4. First use Updated state after apply; then use Apply without interactive approval.
  5. First use Apply without interactive approval; then use Apply the current configuration.

Explanation

Correct Answer

A:

The first requirement, to execute proposed operations after reviewing their impact, is handled by Apply the current configuration: terraform apply normally creates a plan and asks for approval before making changes. The second requirement, to run a controlled automated deployment from current configuration, is handled by Apply without interactive approval: terraform apply -auto-approve skips the interactive approval prompt for an unsaved plan. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

B:

For the requested tasks to execute proposed operations after reviewing their impact and run a controlled automated deployment from current configuration, the first candidate Dependency-ordered apply addresses create an upstream object before a dependent reference is resolved; 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 create an upstream object before a dependent reference is resolved and the second mechanism primarily supports the task to record the result of successful provider operations for subsequent reconciliation; the actual requirements are execute proposed operations after reviewing their impact first and run a controlled automated deployment from current configuration second.

C:

For the requested tasks to execute proposed operations after reviewing their impact and run a controlled automated deployment from current configuration, the first candidate Apply the current configuration addresses execute proposed operations after reviewing their impact; the second candidate Dependency-ordered apply addresses create an upstream object before a dependent reference is resolved. This mapping fails because the second mechanism primarily supports the task to create an upstream object before a dependent reference is resolved; the actual requirements are execute proposed operations after reviewing their impact first and run a controlled automated deployment from current configuration second.

D:

For the requested tasks to execute proposed operations after reviewing their impact and run a controlled automated deployment from current configuration, the first candidate Updated state after apply addresses record the result of successful provider operations for subsequent reconciliation; the second candidate Apply without interactive approval addresses run a controlled automated deployment from current configuration. This mapping fails because the first mechanism primarily supports the task to record the result of successful provider operations for subsequent reconciliation; the actual requirements are execute proposed operations after reviewing their impact first and run a controlled automated deployment from current configuration second.

E:

For the requested tasks to execute proposed operations after reviewing their impact and run a controlled automated deployment from current configuration, the first candidate Apply without interactive approval addresses run a controlled automated deployment from current configuration; the second candidate Apply the current configuration addresses execute proposed operations after reviewing their impact. This mapping fails because the first mechanism primarily supports the task to run a controlled automated deployment from current configuration and the second mechanism primarily supports the task to execute proposed operations after reviewing their impact; the actual requirements are execute proposed operations after reviewing their impact first and run a controlled automated deployment from current configuration second.

Question 838

The team is documenting risks of prevent_destroy lifecycle while planning to protect a declared resource from plans that destroy its managed object. Which caveat specifically applies to that mechanism?

  1. Ignored attributes may still be used during initial resource creation.
  2. It is not a general string-based condition on arbitrary local values.
  3. Changing file order does not resolve a cyclic dependency graph.
  4. Removing the entire resource configuration also removes this protective rule.

Explanation

Correct Answer

D:

For prevent_destroy lifecycle in the task to protect a declared resource from plans that destroy its managed object, the important caution is: Removing the entire resource configuration also removes this protective rule. The reason this matters is its actual behavior: prevent_destroy causes an error if a plan includes destruction while the rule is present in configuration.

Incorrect Answers

A:

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 prevent_destroy lifecycle: ignore_changes tells Terraform to disregard specified differences when planning updates to an existing resource. The question concerns prevent_destroy lifecycle acting to protect a declared resource from plans that destroy its managed object, not a limit of ignore_changes lifecycle.

B:

The proposed warning belongs to replace_triggered_by lifecycle, which serves the different goal to replace a resource when a specified managed resource change occurs, rather than to prevent_destroy lifecycle: replace_triggered_by adds replacement behavior tied to changes in other managed objects or attributes. The question concerns prevent_destroy lifecycle acting to protect a declared resource from plans that destroy its managed object, not a limit of replace_triggered_by lifecycle.

C:

The proposed warning belongs to Terraform resource graph cycle, which serves the different goal to detect an impossible dependency ordering caused by circular references, rather than to prevent_destroy lifecycle: Terraform reports cycles when resources depend on one another in a way it cannot order. The question concerns prevent_destroy lifecycle acting to protect a declared resource from plans that destroy its managed object, not a limit of Terraform resource graph cycle.

Question 839

A colleague recommends the Terraform concept "Provider alias reference address". Which use case best matches it?

  1. refer to a provider configuration by its local name and alias
  2. let a child module use default provider settings from its parent
  3. pass an aliased provider to resources inside a child module
  4. direct an individual resource to the intended aliased provider
  5. create similar resources in different regions without duplicating the root module
  6. configure a second instance of the same provider for another account or region

Explanation

Correct Answer

A:

The practical result of Provider alias reference address, used to refer to a provider configuration by its local name and alias, is: An address such as aws.audit identifies a specific configured instance of the aws provider. A qualification for this effect is: A provider alias is not a separate package with its own source address.

Incorrect Answers

B:

That outcome applies to Default provider configuration inheritance, intended to let a child module use default provider settings from its parent, rather than the question's feature Provider alias reference address: Child modules commonly inherit default provider configurations from the calling module. Unlike Default provider configuration inheritance, Provider alias reference address is intended to refer to a provider configuration by its local name and alias, not to let a child module use default provider settings from its parent.

C:

That outcome applies to Explicit child module provider mapping, intended to pass an aliased provider to resources inside a child module, rather than the question's feature Provider alias reference address: The providers map in a module block maps the child's provider name to a parent provider configuration. Unlike Explicit child module provider mapping, Provider alias reference address is intended to refer to a provider configuration by its local name and alias, not to pass an aliased provider to resources inside a child module.

D:

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 Provider alias reference address: The provider meta-argument can select a configured instance such as aws.west for that resource. Unlike Resource provider meta-argument, Provider alias reference address is intended to refer to a provider configuration by its local name and alias, not to direct an individual resource to the intended aliased provider.

E:

That outcome applies to Multiple regions in one configuration, intended to create similar resources in different regions without duplicating the root module, rather than the question's feature Provider alias reference address: Two provider instances with different region settings can serve explicitly assigned resources or modules. Unlike Multiple regions in one configuration, Provider alias reference address is intended to refer to a provider configuration by its local name and alias, not to create similar resources in different regions without duplicating the root module.

F:

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 Provider alias reference address: The alias argument gives a provider configuration an additional address that resources can select. Unlike Aliased provider instance, Provider alias reference address is intended to refer to a provider configuration by its local name and alias, not to configure a second instance of the same provider for another account or region.

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.

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