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

Question 620

A platform engineering group needs to recognize that a resource was changed outside Terraform. Which mechanism most directly meets this particular need?

  1. Refresh-only reconciliation
  2. Remote drift detection during plan
  3. removed block with destroy=false
  4. moved block for refactoring

Explanation

Correct Answer

B:

The task is to recognize that a resource was changed outside Terraform; Remote drift detection during plan directly supports that requirement: Normal plan refresh reads can reveal drift between state and the remote object. Its relevant boundary is: Configuration reconciliation requires a subsequent reviewed apply.

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 recognize that a resource was changed outside Terraform: A refresh-only plan or apply updates state and outputs to observed values. Against Remote drift detection during plan, its limitation is: It does not make the live object conform to an old configuration value.

C:

removed block with destroy=false is designed to stop tracking an object in state but deliberately leave it deployed, whereas this task is to recognize that a resource was changed outside Terraform: A removed block declares that Terraform should forget a resource without deleting it when destroy=false. Against Remote drift detection during plan, its limitation is: Ordinary resource removal from HCL can instead lead to destruction.

D:

moved block for refactoring is designed to rename a managed resource address without destroying its remote object, whereas this task is to recognize that a resource was changed outside Terraform: A moved block describes an address migration as part of configuration history. Against Remote drift detection during plan, its limitation is: It does not transfer a resource between unrelated provider types.

Question 621

Before continuing an infrastructure rollout, the operator must select module releases meeting a declared compatibility range. Which mechanism most directly meets this particular need?

  1. Module upgrade through init
  2. Version of Git module
  3. Registry module version constraint
  4. Exact registry module version

Explanation

Correct Answer

C:

The task is to select module releases meeting a declared compatibility range; Registry module version constraint directly supports that requirement: A registry module call accepts a version argument that chooses supported release versions. Its relevant boundary is: An unpinned module version may drift as newer releases appear.

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 select module releases meeting a declared compatibility range: Rerunning terraform init downloads compatible module source versions when module requirements change. Against Registry module version constraint, its limitation is: terraform apply does not automatically fetch newly declared module packages.

B:

Version of Git module is designed to pin a VCS module using its source ref rather than registry version, whereas this task is to select module releases meeting a declared compatibility range: A ?ref=tag or commit in a Git module source selects the VCS revision to fetch. Against Registry module version constraint, its limitation is: The registry module version argument does not apply to generic Git sources.

D:

Exact registry module version is designed to make a published module dependency deterministic across clean installs, whereas this task is to select module releases meeting a declared compatibility range: An exact version requirement identifies one registry module release. Against Registry module version constraint, its limitation is: Pinning a module does not pin its provider dependencies unless constrained separately.

Question 622

During a Terraform 1.12 implementation, the immediate requirement is to authenticate local Terraform CLI operations against HCP Terraform. Which mechanism most directly meets this particular need?

  1. Terraform CLI login to HCP
  2. CLI-driven HCP runs
  3. HCP Terraform workspace version settings
  4. HCP Terraform workspace variable configuration

Explanation

Correct Answer

A:

The task is to authenticate local Terraform CLI operations against HCP Terraform; Terraform CLI login to HCP directly supports that requirement: terraform login starts an authentication workflow and stores a token for HCP Terraform access. Its relevant boundary is: A CLI token is not a cloud provider's deployment credential.

Incorrect Answers

B:

CLI-driven HCP runs is designed to initiate workspace operations through familiar Terraform commands, whereas this task is to authenticate local Terraform CLI operations against HCP Terraform: HCP Terraform supports CLI-driven workflows connected to remote workspace state and operations. Against Terraform CLI login to HCP, its limitation is: Actual execution behavior depends on the workspace and integration settings.

C:

HCP Terraform workspace version settings is designed to control the Terraform version used for remote runs, whereas this task is to authenticate local Terraform CLI operations against HCP Terraform: Workspace settings can select the Terraform Core version used in HCP remote execution. Against Terraform CLI login to HCP, its limitation is: Provider version constraints remain a separate configuration concern.

D:

HCP Terraform workspace variable configuration is designed to provide Terraform and environment variables to a hosted run, whereas this task is to authenticate local Terraform CLI operations against HCP Terraform: Workspace variables and variable sets can supply inputs or environment settings to HCP Terraform operations. Against Terraform CLI login to HCP, its limitation is: Sensitive values should be marked appropriately and access limited.

Question 623

A team reviews the use of for expression list projection in Terraform 1.12. Which purpose matches its actual behavior?

  1. calculate collection values without an external provisioner
  2. transform a collection into a list of calculated values
  3. create one resource instance per unique map or set key
  4. generate repeated nested configuration blocks from a collection

Explanation

Correct Answer

B:

The practical result of for expression list projection, used to transform a collection into a list of calculated values, is: A bracketed for expression maps each element to a new value using a declared iterator. A qualification for this effect is: A for expression calculates values but does not itself create resource instances.

Incorrect Answers

A:

That outcome applies to Built-in collection function, intended to calculate collection values without an external provisioner, rather than the question's feature for expression list projection: Functions such as length, concat, and merge manipulate Terraform values during expression evaluation. Unlike Built-in collection function, for expression list projection is intended to transform a collection into a list of calculated values, not to calculate collection values without an external provisioner.

C:

That outcome applies to for_each resource replication, intended to create one resource instance per unique map or set key, rather than the question's feature for expression list projection: for_each expands a resource into stable keyed instances when its collection is known at planning. Unlike for_each resource replication, for expression list projection is intended to transform a collection into a list of calculated values, not to create one resource instance per unique map or set key.

D:

That outcome applies to Dynamic nested block, intended to generate repeated nested configuration blocks from a collection, rather than the question's feature for expression list projection: A dynamic block emits nested blocks where the enclosing resource schema permits them. Unlike Dynamic nested block, for expression list projection is intended to transform a collection into a list of calculated values, not to generate repeated nested configuration blocks from a collection.

Question 624

A team is adjusting its declarative infrastructure process to manage different clouds from one Terraform root module. Which mechanism most directly meets this particular need?

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

Explanation

Correct Answer

A:

The task is to manage different clouds from one Terraform root module; Multi-cloud provider configuration directly supports that requirement: Separate provider plugins can reconcile resources on multiple platforms within the same configuration. Its relevant boundary is: Each provider still needs suitable credentials and service permissions.

Incorrect Answers

B:

Common Terraform lifecycle across providers is designed to plan and apply resources from several providers in one run, whereas this task is to manage different clouds from one Terraform root module: Terraform Core constructs a dependency graph and asks installed providers to implement their own actions. Against Multi-cloud provider configuration, its limitation is: A unified plan cannot guarantee a distributed transaction across separate providers.

C:

Cross-platform dependency references is designed to use output from one service to configure another supported service, whereas this task is to manage different clouds from one Terraform root module: References can establish ordering when a resource on one platform consumes attributes from another resource. Against Multi-cloud provider configuration, its limitation is: The dependency does not remove authentication or network prerequisites on either platform.

D:

Vendor portability through modules is designed to abstract a deployment pattern while keeping provider details explicit, whereas this task is to manage different clouds from one Terraform root module: A module can offer common input and output conventions even if its implementation uses provider-specific resources. Against Multi-cloud provider configuration, its limitation is: Replacing a cloud provider normally requires rewriting provider-dependent resources.

Question 625

In a reusable deployment, the primary objective is to enable Terraform debugging output while investigating a CLI failure. Which mechanism most directly meets this particular need?

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

Explanation

Correct Answer

C:

The task is to enable Terraform debugging output while investigating a CLI failure; TF_LOG environment variable directly supports that requirement: TF_LOG sets a supported logging level such as DEBUG or TRACE for a Terraform process. Its relevant boundary is: Verbose logs can contain sensitive data and should be protected.

Incorrect Answers

A:

Disable debug logging after diagnosis is designed to avoid collecting unnecessary sensitive operational output, whereas this task is to enable Terraform debugging output while investigating a CLI failure: Unset debug environment variables or restore normal log settings when the investigation ends. Against TF_LOG environment variable, its limitation is: Leaving verbose logs enabled can produce large sensitive artifacts.

B:

TRACE diagnostic level is designed to capture highly detailed events for a stubborn Terraform problem, whereas this task is to enable Terraform debugging output while investigating a CLI failure: TRACE is a very verbose Terraform logging level useful for deep troubleshooting. Against TF_LOG environment variable, its limitation is: It is too noisy and potentially sensitive for routine production pipelines.

D:

Log analysis and source protection is designed to review debugging evidence without publishing API secrets, whereas this task is to enable Terraform debugging output while investigating a CLI failure: Diagnostic logs should be stored and shared according to secret-handling policy. Against TF_LOG environment variable, its limitation is: A log that shows an error does not automatically identify the root cause without context.

Question 626

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

  1. convert a saved plan into JSON for automated analysis
  2. preview actions required to reach the declared infrastructure state
  3. avoid remote refresh reads when an intentional troubleshooting constraint requires it
  4. recognize that a proposed change will replace an existing resource

Explanation

Correct Answer

B:

The practical result of terraform plan command, used to preview actions required to reach the declared infrastructure state, is: terraform plan shows changes Terraform expects, including creates, updates, deletes, and replacements. A qualification for this effect is: Plan does not persist the proposed changes to remote infrastructure.

Incorrect Answers

A:

That outcome applies to Machine-readable plan inspection, intended to convert a saved plan into JSON for automated analysis, rather than the question's feature terraform plan command: terraform show -json change.tfplan exposes plan details for tooling. Unlike Machine-readable plan inspection, terraform plan command is intended to preview actions required to reach the declared infrastructure state, not to convert a saved plan into JSON for automated analysis.

C:

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 terraform plan command: terraform plan -refresh=false uses existing state without refreshing live objects before planning. Unlike Plan without state refresh, terraform plan command is intended to preview actions required to reach the declared infrastructure state, not to avoid remote refresh reads when an intentional troubleshooting constraint requires it.

D:

That outcome applies to Replacement plan indicator, intended to recognize that a proposed change will replace an existing resource, rather than the question's feature terraform plan command: The plan symbols -/+ or +/- indicate replacement behavior and its creation/destruction ordering. Unlike Replacement plan indicator, terraform plan command is intended to preview actions required to reach the declared infrastructure state, not to recognize that a proposed change will replace an existing resource.

Question 627

An operator chooses the mechanism "Remote drift detection during plan" for a Terraform project. Which outcome should this choice support?

  1. rename a managed resource address without destroying its remote object
  2. recognize that a resource was changed outside Terraform
  3. stop tracking an object in state but deliberately leave it deployed
  4. accept an external change into Terraform state without modifying remote infrastructure

Explanation

Correct Answer

B:

The practical result of Remote drift detection during plan, used to recognize that a resource was changed outside Terraform, is: Normal plan refresh reads can reveal drift between state and the remote object. A qualification for this effect is: Configuration reconciliation requires a subsequent reviewed apply.

Incorrect Answers

A:

That outcome applies to moved block for refactoring, intended to rename a managed resource address without destroying its remote object, rather than the question's feature Remote drift detection during plan: A moved block describes an address migration as part of configuration history. Unlike moved block for refactoring, Remote drift detection during plan is intended to recognize that a resource was changed outside Terraform, not to rename a managed resource address without destroying its remote object.

C:

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 Remote drift detection during plan: A removed block declares that Terraform should forget a resource without deleting it when destroy=false. Unlike removed block with destroy=false, Remote drift detection during plan is intended to recognize that a resource was changed outside Terraform, not to stop tracking an object in state but deliberately leave it deployed.

D:

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 Remote drift detection during plan: A refresh-only plan or apply updates state and outputs to observed values. Unlike Refresh-only reconciliation, Remote drift detection during plan is intended to recognize that a resource was changed outside Terraform, not to accept an external change into Terraform state without modifying remote infrastructure.

Question 628

The team is documenting risks of for expression list projection while planning to transform a collection into a list of calculated values. Which caveat specifically applies to that mechanism?

  1. Filtering a collection is different from lifecycle ignore_changes.
  2. Dynamic cannot generate resource or provider blocks at the root level.
  3. A function call does not fetch remote provider resources unless a data source is used.
  4. Keys cannot be unknown or derived directly from sensitive values.
  5. A for expression calculates values but does not itself create resource instances.

Explanation

Correct Answer

E:

For for expression list projection in the task to transform a collection into a list of calculated values, the important caution is: A for expression calculates values but does not itself create resource instances. The reason this matters is its actual behavior: A bracketed for expression maps each element to a new value using a declared iterator.

Incorrect Answers

A:

The proposed warning belongs to for expression filtering, which serves the different goal to include only elements satisfying an if condition in a derived collection, rather than to for expression list projection: A for expression's optional if clause filters elements while projecting results. The question concerns for expression list projection acting to transform a collection into a list of calculated values, not a limit of for expression filtering.

B:

The proposed warning belongs to Dynamic nested block, which serves the different goal to generate repeated nested configuration blocks from a collection, rather than to for expression list projection: A dynamic block emits nested blocks where the enclosing resource schema permits them. The question concerns for expression list projection acting to transform a collection into a list of calculated values, not a limit of Dynamic nested block.

C:

The proposed warning belongs to Built-in collection function, which serves the different goal to calculate collection values without an external provisioner, rather than to for expression list projection: Functions such as length, concat, and merge manipulate Terraform values during expression evaluation. The question concerns for expression list projection acting to transform a collection into a list of calculated values, not a limit of Built-in collection function.

D:

The proposed warning belongs to for_each resource replication, which serves the different goal to create one resource instance per unique map or set key, rather than to for expression list projection: for_each expands a resource into stable keyed instances when its collection is known at planning. The question concerns for expression list projection acting to transform a collection into a list of calculated values, not a limit of for_each resource replication.

Question 629

A configuration walkthrough identifies "Registry module version constraint". Which task is it principally intended to support?

  1. select module releases meeting a declared compatibility range
  2. fetch a newly allowed version after editing the module version requirement
  3. pin a VCS module using its source ref rather than registry version
  4. make a published module dependency deterministic across clean installs

Explanation

Correct Answer

A:

The practical result of Registry module version constraint, used to select module releases meeting a declared compatibility range, is: A registry module call accepts a version argument that chooses supported release versions. A qualification for this effect is: An unpinned module version may drift as newer releases appear.

Incorrect Answers

B:

That outcome applies to Module upgrade through init, intended to fetch a newly allowed version after editing the module version requirement, rather than the question's feature Registry module version constraint: Rerunning terraform init downloads compatible module source versions when module requirements change. Unlike Module upgrade through init, Registry module version constraint is intended to select module releases meeting a declared compatibility range, not to fetch a newly allowed version after editing the module version requirement.

C:

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 Registry module version constraint: A ?ref=tag or commit in a Git module source selects the VCS revision to fetch. Unlike Version of Git module, Registry module version constraint is intended to select module releases meeting a declared compatibility range, not to pin a VCS module using its source ref rather than registry version.

D:

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 Registry module version constraint: An exact version requirement identifies one registry module release. Unlike Exact registry module version, Registry module version constraint is intended to select module releases meeting a declared compatibility range, not to make a published module dependency deterministic across clean installs.

Question 630

A team reviews the use of Terraform CLI login to HCP in Terraform 1.12. Which purpose matches its actual behavior?

  1. provide Terraform and environment variables to a hosted run
  2. authenticate local Terraform CLI operations against HCP Terraform
  3. initiate workspace operations through familiar Terraform commands
  4. control the Terraform version used for remote runs

Explanation

Correct Answer

B:

The practical result of Terraform CLI login to HCP, used to authenticate local Terraform CLI operations against HCP Terraform, is: terraform login starts an authentication workflow and stores a token for HCP Terraform access. A qualification for this effect is: A CLI token is not a cloud provider's deployment credential.

Incorrect Answers

A:

That outcome applies to HCP Terraform workspace variable configuration, intended to provide Terraform and environment variables to a hosted run, rather than the question's feature Terraform CLI login to HCP: Workspace variables and variable sets can supply inputs or environment settings to HCP Terraform operations. Unlike HCP Terraform workspace variable configuration, Terraform CLI login to HCP is intended to authenticate local Terraform CLI operations against HCP Terraform, not to provide Terraform and environment variables to a hosted run.

C:

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

D:

That outcome applies to HCP Terraform workspace version settings, intended to control the Terraform version used for remote runs, rather than the question's feature Terraform CLI login to HCP: Workspace settings can select the Terraform Core version used in HCP remote execution. Unlike HCP Terraform workspace version settings, Terraform CLI login to HCP is intended to authenticate local Terraform CLI operations against HCP Terraform, not to control the Terraform version used for remote runs.

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