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

Question 790

A Terraform rollout has two separate requirements: first, constrain a module to releases with an expected interface; second, select module releases meeting a declared compatibility range. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Exact registry module version; then use Module upgrade through init.
  2. First use Registry module version constraint; then use Module release compatibility.
  3. First use Module release compatibility; then use Registry module version constraint.
  4. First use Module release compatibility; then use Exact registry module version.
  5. First use Module upgrade through init; then use Registry module version constraint.

Explanation

Correct Answer

C:

The first requirement, to constrain a module to releases with an expected interface, is handled by Module release compatibility: A version range helps avoid inadvertently selecting a module revision with breaking input or output changes. The second requirement, to select module releases meeting a declared compatibility range, is handled by Registry module version constraint: A registry module call accepts a version argument that chooses supported release versions. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to constrain a module to releases with an expected interface and select module releases meeting a declared compatibility range, the first candidate Exact registry module version addresses make a published module dependency deterministic across clean installs; the second candidate Module upgrade through init addresses fetch a newly allowed version after editing the module version requirement. This mapping fails because the first mechanism primarily supports the task to make a published module dependency deterministic across clean installs and the second mechanism primarily supports the task to fetch a newly allowed version after editing the module version requirement; the actual requirements are constrain a module to releases with an expected interface first and select module releases meeting a declared compatibility range second.

B:

For the requested tasks to constrain a module to releases with an expected interface and select module releases meeting a declared compatibility range, the first candidate Registry module version constraint addresses select module releases meeting a declared compatibility range; the second candidate Module release compatibility addresses constrain a module to releases with an expected interface. This mapping fails because the first mechanism primarily supports the task to select module releases meeting a declared compatibility range and the second mechanism primarily supports the task to constrain a module to releases with an expected interface; the actual requirements are constrain a module to releases with an expected interface first and select module releases meeting a declared compatibility range second.

D:

For the requested tasks to constrain a module to releases with an expected interface and select module releases meeting a declared compatibility range, the first candidate Module release compatibility addresses constrain a module to releases with an expected interface; the second candidate Exact registry module version addresses make a published module dependency deterministic across clean installs. This mapping fails because the second mechanism primarily supports the task to make a published module dependency deterministic across clean installs; the actual requirements are constrain a module to releases with an expected interface first and select module releases meeting a declared compatibility range second.

E:

For the requested tasks to constrain a module to releases with an expected interface and select module releases meeting a declared compatibility range, the first candidate Module upgrade through init addresses fetch a newly allowed version after editing the module version requirement; the second candidate Registry module version constraint addresses select module releases meeting a declared compatibility range. This mapping fails because the first mechanism primarily supports the task to fetch a newly allowed version after editing the module version requirement; the actual requirements are constrain a module to releases with an expected interface first and select module releases meeting a declared compatibility range second.

Question 791

A Terraform rollout has two separate requirements: first, control the Terraform version used for remote runs; second, authenticate local Terraform CLI operations against HCP Terraform. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use cloud block HCP integration; then use HCP Terraform workspace selection.
  2. First use HCP Terraform workspace version settings; then use Terraform CLI login to HCP.
  3. First use HCP Terraform workspace version settings; then use cloud block HCP integration.
  4. First use Terraform CLI login to HCP; then use HCP Terraform workspace version settings.
  5. First use HCP Terraform workspace selection; then use Terraform CLI login to HCP.

Explanation

Correct Answer

B:

The first requirement, to control the Terraform version used for remote runs, is handled by HCP Terraform workspace version settings: Workspace settings can select the Terraform Core version used in HCP remote execution. The second requirement, to authenticate local Terraform CLI operations against HCP Terraform, is handled by Terraform CLI login to HCP: terraform login starts an authentication workflow and stores a token for HCP Terraform access. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to control the Terraform version used for remote runs and authenticate local Terraform CLI operations against HCP Terraform, the first candidate cloud block HCP integration addresses associate a Terraform root configuration with an HCP Terraform organization and workspace; the second candidate HCP Terraform workspace selection addresses route CLI-driven operations to the intended HCP workspace. This mapping fails because the first mechanism primarily supports the task to associate a Terraform root configuration with an HCP Terraform organization and workspace and the second mechanism primarily supports the task to route CLI-driven operations to the intended HCP workspace; the actual requirements are control the Terraform version used for remote runs first and authenticate local Terraform CLI operations against HCP Terraform second.

C:

For the requested tasks to control the Terraform version used for remote runs and authenticate local Terraform CLI operations against HCP Terraform, the first candidate HCP Terraform workspace version settings addresses control the Terraform version used for remote runs; the second candidate cloud block HCP integration addresses associate a Terraform root configuration with an HCP Terraform organization and workspace. This mapping fails because the second mechanism primarily supports the task to associate a Terraform root configuration with an HCP Terraform organization and workspace; the actual requirements are control the Terraform version used for remote runs first and authenticate local Terraform CLI operations against HCP Terraform second.

D:

For the requested tasks to control the Terraform version used for remote runs and authenticate local Terraform CLI operations against HCP Terraform, the first candidate Terraform CLI login to HCP addresses authenticate local Terraform CLI operations against HCP Terraform; the second candidate HCP Terraform workspace version settings addresses control the Terraform version used for remote runs. This mapping fails because the first mechanism primarily supports the task to authenticate local Terraform CLI operations against HCP Terraform and the second mechanism primarily supports the task to control the Terraform version used for remote runs; the actual requirements are control the Terraform version used for remote runs first and authenticate local Terraform CLI operations against HCP Terraform second.

E:

For the requested tasks to control the Terraform version used for remote runs and authenticate local Terraform CLI operations against HCP Terraform, the first candidate HCP Terraform workspace selection addresses route CLI-driven operations to the intended HCP workspace; the second candidate Terraform CLI login to HCP addresses authenticate local Terraform CLI operations against HCP Terraform. This mapping fails because the first mechanism primarily supports the task to route CLI-driven operations to the intended HCP workspace; the actual requirements are control the Terraform version used for remote runs first and authenticate local Terraform CLI operations against HCP Terraform second.

Question 792

A technical review has three distinct objectives: focus verbose diagnostics on provider-side activity; avoid collecting unnecessary sensitive operational output; and enable Terraform debugging output while investigating a CLI failure. Which THREE mechanisms should the team identify for these respective needs? Choose THREE.

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

Explanation

Correct Answers

A:

In the workflow combining focus verbose diagnostics on provider-side activity, avoid collecting unnecessary sensitive operational output, and enable Terraform debugging output while investigating a CLI failure, TF_LOG environment variable correctly addresses the individual goal to enable Terraform debugging output while investigating a CLI failure: TF_LOG sets a supported logging level such as DEBUG or TRACE for a Terraform process. It is one of three separately required capabilities.

C:

In the workflow combining focus verbose diagnostics on provider-side activity, avoid collecting unnecessary sensitive operational output, and enable Terraform debugging output while investigating a CLI failure, TF_LOG_PROVIDER environment variable correctly addresses the individual goal to focus verbose diagnostics on provider-side activity: TF_LOG_PROVIDER controls the provider logging level to aid plugin or API troubleshooting. It is one of three separately required capabilities.

E:

In the workflow combining focus verbose diagnostics on provider-side activity, avoid collecting unnecessary sensitive operational output, and enable Terraform debugging output while investigating a CLI failure, Disable debug logging after diagnosis correctly addresses the individual goal to avoid collecting unnecessary sensitive operational output: Unset debug environment variables or restore normal log settings when the investigation ends. It is one of three separately required capabilities.

Incorrect Answers

B:

Compared with the three tasks to focus verbose diagnostics on provider-side activity, avoid collecting unnecessary sensitive operational output, and enable Terraform debugging output while investigating a CLI failure, TF_LOG_CORE environment variable primarily supports an unrelated request to focus debugging on Terraform Core behavior rather than provider messages: TF_LOG_CORE can set logging for Terraform Core separately from provider plugin output. Therefore this option is not among the three specified mechanisms.

D:

Compared with the three tasks to focus verbose diagnostics on provider-side activity, avoid collecting unnecessary sensitive operational output, and enable Terraform debugging output while investigating a CLI failure, TF_LOG_PATH environment variable primarily supports an unrelated request to write Terraform debug logging to a named file: TF_LOG_PATH controls a file destination for Terraform logging when logging is enabled. Therefore this option is not among the three specified mechanisms.

Question 793

A team is adjusting its declarative infrastructure process to order otherwise unreferenced actions that have a hidden operational dependency. Which mechanism most directly meets this particular need?

  1. Terraform resource graph cycle
  2. replace_triggered_by lifecycle
  3. Explicit depends_on relationship
  4. ignore_changes lifecycle

Explanation

Correct Answer

C:

The task is to order otherwise unreferenced actions that have a hidden operational dependency; Explicit depends_on relationship directly supports that requirement: depends_on declares an ordering relationship when there is no suitable value reference. Its relevant boundary is: Excessive explicit dependencies can make planning conservative and values unknown.

Incorrect Answers

A:

Terraform resource graph cycle is designed to detect an impossible dependency ordering caused by circular references, whereas this task is to order otherwise unreferenced actions that have a hidden operational dependency: Terraform reports cycles when resources depend on one another in a way it cannot order. Against Explicit depends_on relationship, its limitation is: Changing file order does not resolve a cyclic dependency graph.

B:

replace_triggered_by lifecycle is designed to replace a resource when a specified managed resource change occurs, whereas this task is to order otherwise unreferenced actions that have a hidden operational dependency: replace_triggered_by adds replacement behavior tied to changes in other managed objects or attributes. Against Explicit depends_on relationship, 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 order otherwise unreferenced actions that have a hidden operational dependency: ignore_changes tells Terraform to disregard specified differences when planning updates to an existing resource. Against Explicit depends_on relationship, its limitation is: Ignored attributes may still be used during initial resource creation.

Question 794

An engineer must update an existing Terraform workflow to recognize that a proposed change will replace an existing resource. Which mechanism most directly meets this particular need?

  1. Replacement plan indicator
  2. Refresh-only planning
  3. Plan without state refresh
  4. Machine-readable plan inspection

Explanation

Correct Answer

A:

The task is to recognize that a proposed change will replace an existing resource; Replacement plan indicator directly supports that requirement: The plan symbols -/+ or +/- indicate replacement behavior and its creation/destruction ordering. Its relevant boundary is: An in-place update is represented differently and preserves the existing instance.

Incorrect Answers

B:

Refresh-only planning is designed to inspect externally changed infrastructure without planning configuration reconciliation, whereas this task is to recognize that a proposed change will replace an existing resource: terraform plan -refresh-only proposes updates to state and outputs based on remote observations. Against Replacement plan indicator, its limitation is: It does not use configuration to correct drift in the remote service.

C:

Plan without state refresh is designed to avoid remote refresh reads when an intentional troubleshooting constraint requires it, whereas this task is to recognize that a proposed change will replace an existing resource: terraform plan -refresh=false uses existing state without refreshing live objects before planning. Against Replacement plan indicator, its limitation is: A plan based on stale state can be inaccurate about real infrastructure.

D:

Machine-readable plan inspection is designed to convert a saved plan into JSON for automated analysis, whereas this task is to recognize that a proposed change will replace an existing resource: terraform show -json change.tfplan exposes plan details for tooling. Against Replacement plan indicator, its limitation is: The JSON can expose secrets and requires secure handling.

Question 795

A deployment design calls for a supported way to let a child module use default provider settings from its parent. Which mechanism most directly meets this particular need?

  1. Explicit child module provider mapping
  2. Resource provider meta-argument
  3. Different provider local names
  4. Default provider configuration inheritance
  5. Aliased provider instance

Explanation

Correct Answer

D:

The task is to let a child module use default provider settings from its parent; Default provider configuration inheritance directly supports that requirement: Child modules commonly inherit default provider configurations from the calling module. Its relevant boundary is: Aliases and complex configurations often require explicit mapping.

Incorrect Answers

A:

Explicit child module provider mapping is designed to pass an aliased provider to resources inside a child module, whereas this task is to let a child module use default provider settings from its parent: The providers map in a module block maps the child's provider name to a parent provider configuration. Against Default provider configuration inheritance, its limitation is: A child module cannot automatically see every parent alias just because it exists.

B:

Resource provider meta-argument is designed to direct an individual resource to the intended aliased provider, whereas this task is to let a child module use default provider settings from its parent: The provider meta-argument can select a configured instance such as aws.west for that resource. Against Default provider configuration inheritance, its limitation is: The alias must be declared and satisfy provider requirements.

C:

Different provider local names is designed to declare several provider types in the same root module, whereas this task is to let a child module use default provider settings from its parent: The required_providers map can list multiple source addresses with distinct local names. Against Default provider configuration inheritance, its limitation is: Resources still use their provider-defined schemas and credentials.

E:

Aliased provider instance is designed to configure a second instance of the same provider for another account or region, whereas this task is to let a child module use default provider settings from its parent: The alias argument gives a provider configuration an additional address that resources can select. Against Default provider configuration inheritance, its limitation is: The existence of an alias does not move existing resources to that configuration automatically.

Question 796

For a new infrastructure repository, the team wants to restore externally modified resource settings to desired code values. Which mechanism most directly meets this particular need?

  1. Refresh-only reconciliation
  2. Drift reconciliation to configuration
  3. moved block for refactoring
  4. Remote drift detection during plan

Explanation

Correct Answer

B:

The task is to restore externally modified resource settings to desired code values; Drift reconciliation to configuration directly supports that requirement: A regular plan and apply can propose changing a drifted object back to configured settings. Its relevant boundary is: A refresh-only apply instead accepts observed remote values into state.

Incorrect Answers

A:

Refresh-only reconciliation is designed to accept an external change into Terraform state without modifying remote infrastructure, whereas this task is to restore externally modified resource settings to desired code values: A refresh-only plan or apply updates state and outputs to observed values. Against Drift reconciliation to configuration, its limitation is: It does not make the live object conform to an old configuration value.

C:

moved block for refactoring is designed to rename a managed resource address without destroying its remote object, whereas this task is to restore externally modified resource settings to desired code values: A moved block describes an address migration as part of configuration history. Against Drift reconciliation to configuration, its limitation is: It does not transfer a resource between unrelated provider types.

D:

Remote drift detection during plan is designed to recognize that a resource was changed outside Terraform, whereas this task is to restore externally modified resource settings to desired code values: Normal plan refresh reads can reveal drift between state and the remote object. Against Drift reconciliation to configuration, its limitation is: Configuration reconciliation requires a subsequent reviewed apply.

Question 797

A reviewer is asked to choose a mechanism to track module release selection separately from provider lock file behavior. Which mechanism most directly meets this particular need?

  1. Module upgrade through init
  2. Registry module version constraint
  3. Exact registry module version
  4. Module versus provider version lock

Explanation

Correct Answer

D:

The task is to track module release selection separately from provider lock file behavior; Module versus provider version lock directly supports that requirement: Module versions are selected by module source and version settings, whereas the lock file records providers. Its relevant boundary is: Assuming .terraform.lock.hcl freezes registry modules can surprise a new installation.

Incorrect Answers

A:

Module upgrade through init is designed to fetch a newly allowed version after editing the module version requirement, whereas this task is to track module release selection separately from provider lock file behavior: Rerunning terraform init downloads compatible module source versions when module requirements change. Against Module versus provider version lock, its limitation is: terraform apply does not automatically fetch newly declared module packages.

B:

Registry module version constraint is designed to select module releases meeting a declared compatibility range, whereas this task is to track module release selection separately from provider lock file behavior: A registry module call accepts a version argument that chooses supported release versions. Against Module versus provider version lock, its limitation is: An unpinned module version may drift as newer releases appear.

C:

Exact registry module version is designed to make a published module dependency deterministic across clean installs, whereas this task is to track module release selection separately from provider lock file behavior: An exact version requirement identifies one registry module release. Against Module versus provider version lock, its limitation is: Pinning a module does not pin its provider dependencies unless constrained separately.

Question 798

A configuration review identifies the need to provide Terraform and environment variables to a hosted run. Which mechanism most directly meets this particular need?

  1. Local to HCP state migration
  2. CLI-driven HCP runs
  3. HCP Terraform workspace variable configuration
  4. Terraform CLI login to HCP

Explanation

Correct Answer

C:

The task is to provide Terraform and environment variables to a hosted run; HCP Terraform workspace variable configuration directly supports that requirement: Workspace variables and variable sets can supply inputs or environment settings to HCP Terraform operations. Its relevant boundary is: Sensitive values should be marked appropriately and access limited.

Incorrect Answers

A:

Local to HCP state migration is designed to move a locally managed state history into an HCP Terraform workspace, whereas this task is to provide Terraform and environment variables to a hosted run: Changing state integration and reinitializing can migrate state into HCP Terraform when configured correctly. Against HCP Terraform workspace variable configuration, its limitation is: A migration should be backed up and verified before discarding the local copy.

B:

CLI-driven HCP runs is designed to initiate workspace operations through familiar Terraform commands, whereas this task is to provide Terraform and environment variables to a hosted run: HCP Terraform supports CLI-driven workflows connected to remote workspace state and operations. Against HCP Terraform workspace variable configuration, its limitation is: Actual execution behavior depends on the workspace and integration settings.

D:

Terraform CLI login to HCP addresses the different requirement to authenticate local Terraform CLI operations against HCP Terraform: terraform login starts an authentication workflow and stores a token for HCP Terraform access; this does not by itself satisfy the requested task to provide Terraform and environment variables to a hosted run. For the stated need, HCP Terraform workspace variable configuration is the more direct mechanism.

Question 799

A Terraform runbook describes the mechanism "Explicit depends_on relationship". Which responsibility should a reviewer associate with it?

  1. suppress planned updates for selected externally managed attributes
  2. detect an impossible dependency ordering caused by circular references
  3. replace a resource when a specified managed resource change occurs
  4. order otherwise unreferenced actions that have a hidden operational dependency

Explanation

Correct Answer

D:

The practical result of Explicit depends_on relationship, used to order otherwise unreferenced actions that have a hidden operational dependency, is: depends_on declares an ordering relationship when there is no suitable value reference. A qualification for this effect is: Excessive explicit dependencies can make planning conservative and values unknown.

Incorrect Answers

A:

That outcome applies to ignore_changes lifecycle, intended to suppress planned updates for selected externally managed attributes, rather than the question's feature Explicit depends_on relationship: ignore_changes tells Terraform to disregard specified differences when planning updates to an existing resource. Unlike ignore_changes lifecycle, Explicit depends_on relationship is intended to order otherwise unreferenced actions that have a hidden operational dependency, not to suppress planned updates for selected externally managed attributes.

B:

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 Explicit depends_on relationship: Terraform reports cycles when resources depend on one another in a way it cannot order. Unlike Terraform resource graph cycle, Explicit depends_on relationship is intended to order otherwise unreferenced actions that have a hidden operational dependency, not to detect an impossible dependency ordering caused by circular references.

C:

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 Explicit depends_on relationship: replace_triggered_by adds replacement behavior tied to changes in other managed objects or attributes. Unlike replace_triggered_by lifecycle, Explicit depends_on relationship is intended to order otherwise unreferenced actions that have a hidden operational dependency, not to replace a resource when a specified managed resource change occurs.

Question 800

A configuration review identifies the need to use output from one service to configure another supported service. Which mechanism most directly meets this particular need?

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

Explanation

Correct Answer

E:

The task is to use output from one service to configure another supported service; Cross-platform dependency references directly supports that requirement: References can establish ordering when a resource on one platform consumes attributes from another resource. Its relevant boundary is: The dependency does not remove authentication or network prerequisites on either platform.

Incorrect Answers

A:

Vendor portability through modules is designed to abstract a deployment pattern while keeping provider details explicit, whereas this task is to use output from one service to configure another supported service: A module can offer common input and output conventions even if its implementation uses provider-specific resources. Against Cross-platform dependency references, its limitation is: Replacing a cloud provider normally requires rewriting provider-dependent resources.

B:

Multi-cloud provider configuration is designed to manage different clouds from one Terraform root module, whereas this task is to use output from one service to configure another supported service: Separate provider plugins can reconcile resources on multiple platforms within the same configuration. Against Cross-platform dependency references, its limitation is: Each provider still needs suitable credentials and service permissions.

C:

Provider-specific implementation is designed to use a common language without pretending providers expose identical capabilities, whereas this task is to use output from one service to configure another supported service: HCL and workflow are common while each provider defines its own resource schema and service-specific behavior. Against Cross-platform dependency references, its limitation is: A resource type from one provider cannot be substituted blindly for another.

D:

Common Terraform lifecycle across providers is designed to plan and apply resources from several providers in one run, whereas this task is to use output from one service to configure another supported service: Terraform Core constructs a dependency graph and asks installed providers to implement their own actions. Against Cross-platform dependency references, its limitation is: A unified plan cannot guarantee a distributed transaction across separate providers.

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