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

Question 770

An operator chooses the mechanism "TF_LOG_PROVIDER environment variable" for a Terraform project. Which outcome should this choice support?

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

Explanation

Correct Answer

C:

The practical result of TF_LOG_PROVIDER environment variable, used to focus verbose diagnostics on provider-side activity, is: TF_LOG_PROVIDER controls the provider logging level to aid plugin or API troubleshooting. A qualification for this effect is: Provider logs may reveal credentials or request data and require caution.

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 TF_LOG_PROVIDER environment variable: TF_LOG_PATH controls a file destination for Terraform logging when logging is enabled. Unlike TF_LOG_PATH environment variable, TF_LOG_PROVIDER environment variable is intended to focus verbose diagnostics on provider-side activity, not to write Terraform debug logging to a named file.

B:

That outcome applies to TRACE diagnostic level, intended to capture highly detailed events for a stubborn Terraform problem, rather than the question's feature TF_LOG_PROVIDER environment variable: TRACE is a very verbose Terraform logging level useful for deep troubleshooting. Unlike TRACE diagnostic level, TF_LOG_PROVIDER environment variable is intended to focus verbose diagnostics on provider-side activity, not to capture highly detailed events for a stubborn Terraform problem.

D:

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 TF_LOG_PROVIDER environment variable: TF_LOG_CORE can set logging for Terraform Core separately from provider plugin output. Unlike TF_LOG_CORE environment variable, TF_LOG_PROVIDER environment variable is intended to focus verbose diagnostics on provider-side activity, not to focus debugging on Terraform Core behavior rather than provider messages.

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 TF_LOG_PROVIDER environment variable: TF_LOG sets a supported logging level such as DEBUG or TRACE for a Terraform process. Unlike TF_LOG environment variable, TF_LOG_PROVIDER environment variable is intended to focus verbose diagnostics on provider-side activity, not to enable Terraform debugging output while investigating a CLI failure.

Question 771

A reviewer is asked to choose a mechanism to order resources when one consumes an attribute produced by another. Which mechanism most directly meets this particular need?

  1. create_before_destroy lifecycle
  2. Implicit dependency from expression
  3. prevent_destroy lifecycle
  4. Explicit depends_on relationship

Explanation

Correct Answer

B:

The task is to order resources when one consumes an attribute produced by another; Implicit dependency from expression directly supports that requirement: Terraform derives an edge from an expression reference and schedules the producer first. Its relevant boundary is: No extra depends_on is needed for an already represented relationship.

Incorrect Answers

A:

create_before_destroy lifecycle is designed to favor replacement resource creation before deletion of its predecessor, whereas this task is to order resources when one consumes an attribute produced by another: The lifecycle rule changes replacement ordering when the provider and external constraints permit it. Against Implicit dependency from expression, its limitation is: A uniqueness constraint or quota can still prevent parallel old and new objects.

C:

prevent_destroy lifecycle is designed to protect a declared resource from plans that destroy its managed object, whereas this task is to order resources when one consumes an attribute produced by another: prevent_destroy causes an error if a plan includes destruction while the rule is present in configuration. Against Implicit dependency from expression, its limitation is: Removing the entire resource configuration also removes this protective rule.

D:

Explicit depends_on relationship is designed to order otherwise unreferenced actions that have a hidden operational dependency, whereas this task is to order resources when one consumes an attribute produced by another: depends_on declares an ordering relationship when there is no suitable value reference. Against Implicit dependency from expression, its limitation is: Excessive explicit dependencies can make planning conservative and values unknown.

Question 772

During an implementation review, a Terraform team encounters "Machine-readable plan inspection". Which purpose is associated with that mechanism?

  1. avoid remote refresh reads when an intentional troubleshooting constraint requires it
  2. focus on a small subset for exceptional repair or troubleshooting
  3. capture one execution plan for later approval and application
  4. convert a saved plan into JSON for automated analysis
  5. inspect externally changed infrastructure without planning configuration reconciliation
  6. preview actions required to reach the declared infrastructure state

Explanation

Correct Answer

D:

The practical result of Machine-readable plan inspection, used to convert a saved plan into JSON for automated analysis, is: terraform show -json change.tfplan exposes plan details for tooling. A qualification for this effect is: The JSON can expose secrets and requires secure handling.

Incorrect Answers

A:

That outcome applies to Plan without state refresh, intended to avoid remote refresh reads when an intentional troubleshooting constraint requires it, rather than the question's feature Machine-readable plan inspection: terraform plan -refresh=false uses existing state without refreshing live objects before planning. Unlike Plan without state refresh, Machine-readable plan inspection is intended to convert a saved plan into JSON for automated analysis, not to avoid remote refresh reads when an intentional troubleshooting constraint requires it.

B:

That outcome applies to Targeted planning, intended to focus on a small subset for exceptional repair or troubleshooting, rather than the question's feature Machine-readable plan inspection: terraform plan -target=ADDRESS limits the planner's focus to the selected graph portion. Unlike Targeted planning, Machine-readable plan inspection is intended to convert a saved plan into JSON for automated analysis, not to focus on a small subset for exceptional repair or troubleshooting.

C:

That outcome applies to Plan saved to file, intended to capture one execution plan for later approval and application, rather than the question's feature Machine-readable plan inspection: terraform plan -out=change.tfplan saves an executable binary plan artifact. Unlike Plan saved to file, Machine-readable plan inspection is intended to convert a saved plan into JSON for automated analysis, not to capture one execution plan for later approval and application.

E:

That outcome applies to Refresh-only planning, intended to inspect externally changed infrastructure without planning configuration reconciliation, rather than the question's feature Machine-readable plan inspection: terraform plan -refresh-only proposes updates to state and outputs based on remote observations. Unlike Refresh-only planning, Machine-readable plan inspection is intended to convert a saved plan into JSON for automated analysis, not to inspect externally changed infrastructure without planning configuration reconciliation.

F:

That outcome applies to terraform plan command, intended to preview actions required to reach the declared infrastructure state, rather than the question's feature Machine-readable plan inspection: terraform plan shows changes Terraform expects, including creates, updates, deletes, and replacements. Unlike terraform plan command, Machine-readable plan inspection is intended to convert a saved plan into JSON for automated analysis, not to preview actions required to reach the declared infrastructure state.

Question 773

The rollout owner asks whether Explicit child module provider mapping is sufficient to pass an aliased provider to resources inside a child module. Which limitation specifically concerns that mechanism?

  1. A provider alias is not a separate package with its own source address.
  2. Aliases and complex configurations often require explicit mapping.
  3. A child module cannot automatically see every parent alias just because it exists.
  4. A default provider does not infer a resource's desired region from its name.

Explanation

Correct Answer

C:

For Explicit child module provider mapping in the task to pass an aliased provider to resources inside a child module, the important caution is: A child module cannot automatically see every parent alias just because it exists. The reason this matters is its actual behavior: The providers map in a module block maps the child's provider name to a parent provider configuration.

Incorrect Answers

A:

The proposed warning belongs to Provider alias reference address, which serves the different goal to refer to a provider configuration by its local name and alias, rather than to Explicit child module provider mapping: An address such as aws.audit identifies a specific configured instance of the aws provider. The question concerns Explicit child module provider mapping acting to pass an aliased provider to resources inside a child module, not a limit of Provider alias reference address.

B:

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 Explicit child module provider mapping: Child modules commonly inherit default provider configurations from the calling module. The question concerns Explicit child module provider mapping acting to pass an aliased provider to resources inside a child module, not a limit of Default provider configuration inheritance.

D:

The proposed warning belongs to Multiple regions in one configuration, which serves the different goal to create similar resources in different regions without duplicating the root module, rather than to Explicit child module provider mapping: Two provider instances with different region settings can serve explicitly assigned resources or modules. The question concerns Explicit child module provider mapping acting to pass an aliased provider to resources inside a child module, not a limit of Multiple regions in one configuration.

Question 774

A colleague recommends the Terraform concept "terraform state mv". Which use case best matches it?

  1. restore externally modified resource settings to desired code values
  2. recognize that a resource was changed outside Terraform
  3. accept an external change into Terraform state without modifying remote infrastructure
  4. stop tracking an object in state but deliberately leave it deployed
  5. change a resource state address to match a configuration refactor
  6. detach a resource address from state while leaving the remote object intact

Explanation

Correct Answer

E:

The practical result of terraform state mv, used to change a resource state address to match a configuration refactor, is: state mv rebinds an existing object under a new compatible address. A qualification for this effect is: It does not rename or migrate the remote object through its provider API.

Incorrect Answers

A:

That outcome applies to Drift reconciliation to configuration, intended to restore externally modified resource settings to desired code values, rather than the question's feature terraform state mv: A regular plan and apply can propose changing a drifted object back to configured settings. Unlike Drift reconciliation to configuration, terraform state mv is intended to change a resource state address to match a configuration refactor, not to restore externally modified resource settings to desired code values.

B:

That outcome applies to Remote drift detection during plan, intended to recognize that a resource was changed outside Terraform, rather than the question's feature terraform state mv: Normal plan refresh reads can reveal drift between state and the remote object. Unlike Remote drift detection during plan, terraform state mv is intended to change a resource state address to match a configuration refactor, not to recognize that a resource was changed outside Terraform.

C:

That outcome applies to Refresh-only reconciliation, intended to accept an external change into Terraform state without modifying remote infrastructure, rather than the question's feature terraform state mv: A refresh-only plan or apply updates state and outputs to observed values. Unlike Refresh-only reconciliation, terraform state mv is intended to change a resource state address to match a configuration refactor, not to accept an external change into Terraform state without modifying remote infrastructure.

D:

That outcome applies to removed block with destroy=false, intended to stop tracking an object in state but deliberately leave it deployed, rather than the question's feature terraform state mv: A removed block declares that Terraform should forget a resource without deleting it when destroy=false. Unlike removed block with destroy=false, terraform state mv is intended to change a resource state address to match a configuration refactor, not to stop tracking an object in state but deliberately leave it deployed.

F:

That outcome applies to terraform state rm, intended to detach a resource address from state while leaving the remote object intact, rather than the question's feature terraform state mv: state rm forgets the binding but does not delete the real infrastructure object. Unlike terraform state rm, terraform state mv is intended to change a resource state address to match a configuration refactor, not to detach a resource address from state while leaving the remote object intact.

Question 775

A team reviews the use of Module release compatibility in Terraform 1.12. Which purpose matches its actual behavior?

  1. update a local path module without applying registry release versioning
  2. select module releases meeting a declared compatibility range
  3. track module release selection separately from provider lock file behavior
  4. constrain a module to releases with an expected interface
  5. make a published module dependency deterministic across clean installs
  6. pin a VCS module using its source ref rather than registry version

Explanation

Correct Answer

D:

The practical result of Module release compatibility, used to constrain a module to releases with an expected interface, is: A version range helps avoid inadvertently selecting a module revision with breaking input or output changes. A qualification for this effect is: Version constraints cannot guarantee every patch release is defect-free.

Incorrect Answers

A:

That outcome applies to Local module development lifecycle, intended to update a local path module without applying registry release versioning, rather than the question's feature Module release compatibility: Local module source code is read from its path and does not use a version argument. Unlike Local module development lifecycle, Module release compatibility is intended to constrain a module to releases with an expected interface, not to update a local path module without applying registry release versioning.

B:

That outcome applies to Registry module version constraint, intended to select module releases meeting a declared compatibility range, rather than the question's feature Module release compatibility: A registry module call accepts a version argument that chooses supported release versions. Unlike Registry module version constraint, Module release compatibility is intended to constrain a module to releases with an expected interface, not to select module releases meeting a declared compatibility range.

C:

That outcome applies to Module versus provider version lock, intended to track module release selection separately from provider lock file behavior, rather than the question's feature Module release compatibility: Module versions are selected by module source and version settings, whereas the lock file records providers. Unlike Module versus provider version lock, Module release compatibility is intended to constrain a module to releases with an expected interface, not to track module release selection separately from provider lock file behavior.

E:

That outcome applies to Exact registry module version, intended to make a published module dependency deterministic across clean installs, rather than the question's feature Module release compatibility: An exact version requirement identifies one registry module release. Unlike Exact registry module version, Module release compatibility is intended to constrain a module to releases with an expected interface, not to make a published module dependency deterministic across clean installs.

F:

That outcome applies to Version of Git module, intended to pin a VCS module using its source ref rather than registry version, rather than the question's feature Module release compatibility: A ?ref=tag or commit in a Git module source selects the VCS revision to fetch. Unlike Version of Git module, Module release compatibility is intended to constrain a module to releases with an expected interface, not to pin a VCS module using its source ref rather than registry version.

Question 776

An operator chooses the mechanism "HCP Terraform workspace version settings" for a Terraform project. Which outcome should this choice support?

  1. authenticate local Terraform CLI operations against HCP Terraform
  2. control the Terraform version used for remote runs
  3. move a locally managed state history into an HCP Terraform workspace
  4. associate a Terraform root configuration with an HCP Terraform organization and workspace
  5. route CLI-driven operations to the intended HCP workspace
  6. initiate workspace operations through familiar Terraform commands

Explanation

Correct Answer

B:

The practical result of HCP Terraform workspace version settings, used to control the Terraform version used for remote runs, is: Workspace settings can select the Terraform Core version used in HCP remote execution. A qualification for this effect is: Provider version constraints remain a separate configuration concern.

Incorrect Answers

A:

That outcome applies to Terraform CLI login to HCP, intended to authenticate local Terraform CLI operations against HCP Terraform, rather than the question's feature HCP Terraform workspace version settings: terraform login starts an authentication workflow and stores a token for HCP Terraform access. Unlike Terraform CLI login to HCP, HCP Terraform workspace version settings is intended to control the Terraform version used for remote runs, not to authenticate local Terraform CLI operations against HCP Terraform.

C:

That outcome applies to Local to HCP state migration, intended to move a locally managed state history into an HCP Terraform workspace, rather than the question's feature HCP Terraform workspace version settings: Changing state integration and reinitializing can migrate state into HCP Terraform when configured correctly. Unlike Local to HCP state migration, HCP Terraform workspace version settings is intended to control the Terraform version used for remote runs, not to move a locally managed state history into an HCP Terraform workspace.

D:

That outcome applies to cloud block HCP integration, intended to associate a Terraform root configuration with an HCP Terraform organization and workspace, rather than the question's feature HCP Terraform workspace version settings: A cloud block in terraform settings configures the HCP Terraform integration for that root module. Unlike cloud block HCP integration, HCP Terraform workspace version settings is intended to control the Terraform version used for remote runs, not to associate a Terraform root configuration with an HCP Terraform organization and workspace.

E:

That outcome applies to HCP Terraform workspace selection, intended to route CLI-driven operations to the intended HCP workspace, rather than the question's feature HCP Terraform workspace version settings: The cloud block workspace settings determine which HCP workspace the configuration uses. Unlike HCP Terraform workspace selection, HCP Terraform workspace version settings is intended to control the Terraform version used for remote runs, not to route CLI-driven operations to the intended HCP workspace.

F:

That outcome applies to CLI-driven HCP runs, intended to initiate workspace operations through familiar Terraform commands, rather than the question's feature HCP Terraform workspace version settings: HCP Terraform supports CLI-driven workflows connected to remote workspace state and operations. Unlike CLI-driven HCP runs, HCP Terraform workspace version settings is intended to control the Terraform version used for remote runs, not to initiate workspace operations through familiar Terraform commands.

Question 777

A configuration walkthrough identifies "Implicit dependency from expression". Which task is it principally intended to support?

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

Explanation

Correct Answer

D:

The practical result of Implicit dependency from expression, used to order resources when one consumes an attribute produced by another, is: Terraform derives an edge from an expression reference and schedules the producer first. A qualification for this effect is: No extra depends_on is needed for an already represented relationship.

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 Implicit dependency from expression: prevent_destroy causes an error if a plan includes destruction while the rule is present in configuration. Unlike prevent_destroy lifecycle, Implicit dependency from expression is intended to order resources when one consumes an attribute produced by another, not to protect a declared resource from plans that destroy its managed object.

B:

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 Implicit dependency from expression: The lifecycle rule changes replacement ordering when the provider and external constraints permit it. Unlike create_before_destroy lifecycle, Implicit dependency from expression is intended to order resources when one consumes an attribute produced by another, not to favor replacement resource creation before deletion of its predecessor.

C:

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 Implicit dependency from expression: depends_on declares an ordering relationship when there is no suitable value reference. Unlike Explicit depends_on relationship, Implicit dependency from expression is intended to order resources when one consumes an attribute produced by another, not to order otherwise unreferenced actions that have a hidden operational dependency.

Question 778

Before adopting Provider-specific implementation to use a common language without pretending providers expose identical capabilities, which statement sets an accurate boundary?

  1. A resource type from one provider cannot be substituted blindly for another.
  2. An appropriate provider or integration must exist for each target system.
  3. Service-agnostic does not mean resource schemas are interchangeable.
  4. The dependency does not remove authentication or network prerequisites on either platform.

Explanation

Correct Answer

A:

For Provider-specific implementation in the task to use a common language without pretending providers expose identical capabilities, the important caution is: A resource type from one provider cannot be substituted blindly for another. The reason this matters is its actual behavior: HCL and workflow are common while each provider defines its own resource schema and service-specific behavior.

Incorrect Answers

B:

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 Provider-specific implementation: Terraform can coordinate providers for hosted services and private infrastructure without imposing one cloud API. The question concerns Provider-specific implementation acting to use a common language without pretending providers expose identical capabilities, not a limit of Hybrid infrastructure automation.

C:

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 Provider-specific implementation: Terraform providers expose resource and data types beyond infrastructure hosted by a cloud vendor. The question concerns Provider-specific implementation acting to use a common language without pretending providers expose identical capabilities, not a limit of Service-agnostic orchestration.

D:

The listed caution belongs specifically to Cross-platform dependency references, used to use output from one service to configure another supported service: References can establish ordering when a resource on one platform consumes attributes from another resource; the feature under review is instead Provider-specific implementation, so this answer attaches another feature's qualification to the wrong mechanism.

Question 779

Before adopting TF_LOG_PROVIDER environment variable to focus verbose diagnostics on provider-side activity, which statement sets an accurate boundary?

  1. Provider logs may reveal credentials or request data and require caution.
  2. Setting a log path alone does not necessarily enable logging.
  3. Core logging does not substitute for investigating remote API authorization errors.
  4. It is too noisy and potentially sensitive for routine production pipelines.

Explanation

Correct Answer

A:

For TF_LOG_PROVIDER environment variable in the task to focus verbose diagnostics on provider-side activity, the important caution is: Provider logs may reveal credentials or request data and require caution. The reason this matters is its actual behavior: TF_LOG_PROVIDER controls the provider logging level to aid plugin or API troubleshooting.

Incorrect Answers

B:

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 TF_LOG_PROVIDER environment variable: TF_LOG_PATH controls a file destination for Terraform logging when logging is enabled. The question concerns TF_LOG_PROVIDER environment variable acting to focus verbose diagnostics on provider-side activity, not a limit of TF_LOG_PATH environment variable.

C:

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 TF_LOG_PROVIDER environment variable: TF_LOG_CORE can set logging for Terraform Core separately from provider plugin output. The question concerns TF_LOG_PROVIDER environment variable acting to focus verbose diagnostics on provider-side activity, not a limit of TF_LOG_CORE environment variable.

D:

The listed caution belongs specifically to TRACE diagnostic level, used to capture highly detailed events for a stubborn Terraform problem: TRACE is a very verbose Terraform logging level useful for deep troubleshooting; the feature under review is instead TF_LOG_PROVIDER environment variable, so this answer attaches another feature's qualification to the wrong mechanism.

Question 780

A change proposal relies on Machine-readable plan inspection for the task to convert a saved plan into JSON for automated analysis. Which limitation specifically applies to it?

  1. It does not use configuration to correct drift in the remote service.
  2. The JSON can expose secrets and requires secure handling.
  3. Routine targeted planning can overlook intended changes elsewhere.
  4. Plan does not persist the proposed changes to remote infrastructure.
  5. Saved plans can include sensitive data and should not be committed publicly.

Explanation

Correct Answer

B:

For Machine-readable plan inspection in the task to convert a saved plan into JSON for automated analysis, the important caution is: The JSON can expose secrets and requires secure handling. The reason this matters is its actual behavior: terraform show -json change.tfplan exposes plan details for tooling.

Incorrect Answers

A:

The proposed warning belongs to Refresh-only planning, which serves the different goal to inspect externally changed infrastructure without planning configuration reconciliation, rather than to Machine-readable plan inspection: terraform plan -refresh-only proposes updates to state and outputs based on remote observations. The question concerns Machine-readable plan inspection acting to convert a saved plan into JSON for automated analysis, not a limit of Refresh-only planning.

C:

The proposed warning belongs to Targeted planning, which serves the different goal to focus on a small subset for exceptional repair or troubleshooting, rather than to Machine-readable plan inspection: terraform plan -target=ADDRESS limits the planner's focus to the selected graph portion. The question concerns Machine-readable plan inspection acting to convert a saved plan into JSON for automated analysis, not a limit of Targeted planning.

D:

The proposed warning belongs to terraform plan command, which serves the different goal to preview actions required to reach the declared infrastructure state, rather than to Machine-readable plan inspection: terraform plan shows changes Terraform expects, including creates, updates, deletes, and replacements. The question concerns Machine-readable plan inspection acting to convert a saved plan into JSON for automated analysis, not a limit of terraform plan command.

E:

The proposed warning belongs to Plan saved to file, which serves the different goal to capture one execution plan for later approval and application, rather than to Machine-readable plan inspection: terraform plan -out=change.tfplan saves an executable binary plan artifact. The question concerns Machine-readable plan inspection acting to convert a saved plan into JSON for automated analysis, not a limit of Plan saved to file.

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