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

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.

Question 631

An operator chooses the mechanism "Aliased provider instance" for a Terraform project. Which outcome should this choice support?

  1. pass an aliased provider to resources inside a child module
  2. direct an individual resource to the intended aliased provider
  3. configure a second instance of the same provider for another account or region
  4. declare several provider types in the same root module

Explanation

Correct Answer

C:

The practical result of Aliased provider instance, used to configure a second instance of the same provider for another account or region, is: The alias argument gives a provider configuration an additional address that resources can select. A qualification for this effect is: The existence of an alias does not move existing resources to that configuration automatically.

Incorrect Answers

A:

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 Aliased provider instance: The providers map in a module block maps the child's provider name to a parent provider configuration. Unlike Explicit child module provider mapping, Aliased provider instance is intended to configure a second instance of the same provider for another account or region, not to pass an aliased provider to resources inside a child module.

B:

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 Aliased provider instance: The provider meta-argument can select a configured instance such as aws.west for that resource. Unlike Resource provider meta-argument, Aliased provider instance is intended to configure a second instance of the same provider for another account or region, not to direct an individual resource to the intended aliased provider.

D:

That outcome applies to Different provider local names, intended to declare several provider types in the same root module, rather than the question's feature Aliased provider instance: The required_providers map can list multiple source addresses with distinct local names. Unlike Different provider local names, Aliased provider instance is intended to configure a second instance of the same provider for another account or region, not to declare several provider types in the same root module.

Question 632

A Terraform rollout has two separate requirements: first, transform a collection into a list of calculated values; second, choose between two values based on a boolean condition. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use for expression list projection; then use Template interpolation.
  2. First use for expression list projection; then use Conditional expression.
  3. First use Template interpolation; then use Built-in collection function.
  4. First use Conditional expression; then use for expression list projection.
  5. First use Built-in collection function; then use Conditional expression.

Explanation

Correct Answer

B:

The first requirement, to transform a collection into a list of calculated values, is handled by for expression list projection: A bracketed for expression maps each element to a new value using a declared iterator. The second requirement, to choose between two values based on a boolean condition, is handled by Conditional expression: Terraform's condition ? true_value : false_value expression selects a value based on a predicate. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to transform a collection into a list of calculated values and choose between two values based on a boolean condition, the first candidate for expression list projection addresses transform a collection into a list of calculated values; the second candidate Template interpolation addresses embed evaluated expressions in a Terraform string. This mapping fails because the second mechanism primarily supports the task to embed evaluated expressions in a Terraform string; the actual requirements are transform a collection into a list of calculated values first and choose between two values based on a boolean condition second.

C:

For the requested tasks to transform a collection into a list of calculated values and choose between two values based on a boolean condition, the first candidate Template interpolation addresses embed evaluated expressions in a Terraform string; the second candidate Built-in collection function addresses calculate collection values without an external provisioner. This mapping fails because the first mechanism primarily supports the task to embed evaluated expressions in a Terraform string and the second mechanism primarily supports the task to calculate collection values without an external provisioner; the actual requirements are transform a collection into a list of calculated values first and choose between two values based on a boolean condition second.

D:

For the requested tasks to transform a collection into a list of calculated values and choose between two values based on a boolean condition, the first candidate Conditional expression addresses choose between two values based on a boolean condition; the second candidate for expression list projection addresses transform a collection into a list of calculated values. This mapping fails because the first mechanism primarily supports the task to choose between two values based on a boolean condition and the second mechanism primarily supports the task to transform a collection into a list of calculated values; the actual requirements are transform a collection into a list of calculated values first and choose between two values based on a boolean condition second.

E:

For the requested tasks to transform a collection into a list of calculated values and choose between two values based on a boolean condition, the first candidate Built-in collection function addresses calculate collection values without an external provisioner; the second candidate Conditional expression addresses choose between two values based on a boolean condition. This mapping fails because the first mechanism primarily supports the task to calculate collection values without an external provisioner; the actual requirements are transform a collection into a list of calculated values first and choose between two values based on a boolean condition second.

Question 633

A change proposal relies on terraform plan command for the task to preview actions required to reach the declared infrastructure state. Which limitation specifically applies to it?

  1. A plan based on stale state can be inaccurate about real infrastructure.
  2. Plan does not persist the proposed changes to remote infrastructure.
  3. The JSON can expose secrets and requires secure handling.
  4. An in-place update is represented differently and preserves the existing instance.

Explanation

Correct Answer

B:

For terraform plan command in the task to preview actions required to reach the declared infrastructure state, the important caution is: Plan does not persist the proposed changes to remote infrastructure. The reason this matters is its actual behavior: terraform plan shows changes Terraform expects, including creates, updates, deletes, and replacements.

Incorrect Answers

A:

The proposed warning belongs to Plan without state refresh, which serves the different goal to avoid remote refresh reads when an intentional troubleshooting constraint requires it, rather than to terraform plan command: terraform plan -refresh=false uses existing state without refreshing live objects before planning. The question concerns terraform plan command acting to preview actions required to reach the declared infrastructure state, not a limit of Plan without state refresh.

C:

The proposed warning belongs to Machine-readable plan inspection, which serves the different goal to convert a saved plan into JSON for automated analysis, rather than to terraform plan command: terraform show -json change.tfplan exposes plan details for tooling. The question concerns terraform plan command acting to preview actions required to reach the declared infrastructure state, not a limit of Machine-readable plan inspection.

D:

The proposed warning belongs to Replacement plan indicator, which serves the different goal to recognize that a proposed change will replace an existing resource, rather than to terraform plan command: The plan symbols -/+ or +/- indicate replacement behavior and its creation/destruction ordering. The question concerns terraform plan command acting to preview actions required to reach the declared infrastructure state, not a limit of Replacement plan indicator.

Question 634

The rollout owner asks whether Remote drift detection during plan is sufficient to recognize that a resource was changed outside Terraform. Which limitation specifically concerns that mechanism?

  1. Configuration reconciliation requires a subsequent reviewed apply.
  2. It does not make the live object conform to an old configuration value.
  3. It does not transfer a resource between unrelated provider types.
  4. Ordinary resource removal from HCL can instead lead to destruction.

Explanation

Correct Answer

A:

For Remote drift detection during plan in the task to recognize that a resource was changed outside Terraform, the important caution is: Configuration reconciliation requires a subsequent reviewed apply. The reason this matters is its actual behavior: Normal plan refresh reads can reveal drift between state and the remote object.

Incorrect Answers

B:

The proposed warning belongs to Refresh-only reconciliation, which serves the different goal to accept an external change into Terraform state without modifying remote infrastructure, rather than to Remote drift detection during plan: A refresh-only plan or apply updates state and outputs to observed values. The question concerns Remote drift detection during plan acting to recognize that a resource was changed outside Terraform, not a limit of Refresh-only reconciliation.

C:

The proposed warning belongs to moved block for refactoring, which serves the different goal to rename a managed resource address without destroying its remote object, rather than to Remote drift detection during plan: A moved block describes an address migration as part of configuration history. The question concerns Remote drift detection during plan acting to recognize that a resource was changed outside Terraform, not a limit of moved block for refactoring.

D:

The proposed warning belongs to removed block with destroy=false, which serves the different goal to stop tracking an object in state but deliberately leave it deployed, rather than to Remote drift detection during plan: A removed block declares that Terraform should forget a resource without deleting it when destroy=false. The question concerns Remote drift detection during plan acting to recognize that a resource was changed outside Terraform, not a limit of removed block with destroy=false.

Question 635

A Terraform runbook describes the mechanism "Multi-cloud provider configuration". Which responsibility should a reviewer associate with it?

  1. plan and apply resources from several providers in one run
  2. abstract a deployment pattern while keeping provider details explicit
  3. use output from one service to configure another supported service
  4. manage different clouds from one Terraform root module

Explanation

Correct Answer

D:

The practical result of Multi-cloud provider configuration, used to manage different clouds from one Terraform root module, is: Separate provider plugins can reconcile resources on multiple platforms within the same configuration. A qualification for this effect is: Each provider still needs suitable credentials and service permissions.

Incorrect Answers

A:

That outcome applies to Common Terraform lifecycle across providers, intended to plan and apply resources from several providers in one run, rather than the question's feature Multi-cloud provider configuration: Terraform Core constructs a dependency graph and asks installed providers to implement their own actions. Unlike Common Terraform lifecycle across providers, Multi-cloud provider configuration is intended to manage different clouds from one Terraform root module, not to plan and apply resources from several providers in one run.

B:

That outcome applies to Vendor portability through modules, intended to abstract a deployment pattern while keeping provider details explicit, rather than the question's feature Multi-cloud provider configuration: A module can offer common input and output conventions even if its implementation uses provider-specific resources. Unlike Vendor portability through modules, Multi-cloud provider configuration is intended to manage different clouds from one Terraform root module, not to abstract a deployment pattern while keeping provider details explicit.

C:

That outcome applies to Cross-platform dependency references, intended to use output from one service to configure another supported service, rather than the question's feature Multi-cloud provider configuration: References can establish ordering when a resource on one platform consumes attributes from another resource. Unlike Cross-platform dependency references, Multi-cloud provider configuration is intended to manage different clouds from one Terraform root module, not to use output from one service to configure another supported service.

Question 636

A change proposal relies on Registry module version constraint for the task to select module releases meeting a declared compatibility range. Which limitation specifically applies to it?

  1. Pinning a module does not pin its provider dependencies unless constrained separately.
  2. terraform apply does not automatically fetch newly declared module packages.
  3. An unpinned module version may drift as newer releases appear.
  4. The registry module version argument does not apply to generic Git sources.

Explanation

Correct Answer

C:

For Registry module version constraint in the task to select module releases meeting a declared compatibility range, the important caution is: An unpinned module version may drift as newer releases appear. The reason this matters is its actual behavior: A registry module call accepts a version argument that chooses supported release versions.

Incorrect Answers

A:

The proposed warning belongs to Exact registry module version, which serves the different goal to make a published module dependency deterministic across clean installs, rather than to Registry module version constraint: An exact version requirement identifies one registry module release. The question concerns Registry module version constraint acting to select module releases meeting a declared compatibility range, not a limit of Exact registry module version.

B:

The proposed warning belongs to Module upgrade through init, which serves the different goal to fetch a newly allowed version after editing the module version requirement, rather than to Registry module version constraint: Rerunning terraform init downloads compatible module source versions when module requirements change. The question concerns Registry module version constraint acting to select module releases meeting a declared compatibility range, not a limit of Module upgrade through init.

D:

The proposed warning belongs to Version of Git module, which serves the different goal to pin a VCS module using its source ref rather than registry version, rather than to Registry module version constraint: A ?ref=tag or commit in a Git module source selects the VCS revision to fetch. The question concerns Registry module version constraint acting to select module releases meeting a declared compatibility range, not a limit of Version of Git module.

Question 637

Before adopting Terraform CLI login to HCP to authenticate local Terraform CLI operations against HCP Terraform, which statement sets an accurate boundary?

  1. A CLI token is not a cloud provider's deployment credential.
  2. Actual execution behavior depends on the workspace and integration settings.
  3. Provider version constraints remain a separate configuration concern.
  4. Sensitive values should be marked appropriately and access limited.

Explanation

Correct Answer

A:

For Terraform CLI login to HCP in the task to authenticate local Terraform CLI operations against HCP Terraform, the important caution is: A CLI token is not a cloud provider's deployment credential. The reason this matters is its actual behavior: terraform login starts an authentication workflow and stores a token for HCP Terraform access.

Incorrect Answers

B:

The proposed warning belongs to CLI-driven HCP runs, which serves the different goal to initiate workspace operations through familiar Terraform commands, rather than to Terraform CLI login to HCP: HCP Terraform supports CLI-driven workflows connected to remote workspace state and operations. The question concerns Terraform CLI login to HCP acting to authenticate local Terraform CLI operations against HCP Terraform, not a limit of CLI-driven HCP runs.

C:

The proposed warning belongs to HCP Terraform workspace version settings, which serves the different goal to control the Terraform version used for remote runs, rather than to Terraform CLI login to HCP: Workspace settings can select the Terraform Core version used in HCP remote execution. The question concerns Terraform CLI login to HCP acting to authenticate local Terraform CLI operations against HCP Terraform, not a limit of HCP Terraform workspace version settings.

D:

The proposed warning belongs to HCP Terraform workspace variable configuration, which serves the different goal to provide Terraform and environment variables to a hosted run, rather than to Terraform CLI login to HCP: Workspace variables and variable sets can supply inputs or environment settings to HCP Terraform operations. The question concerns Terraform CLI login to HCP acting to authenticate local Terraform CLI operations against HCP Terraform, not a limit of HCP Terraform workspace variable configuration.

Question 638

A Terraform runbook describes the mechanism "TF_LOG environment variable". Which responsibility should a reviewer associate with it?

  1. avoid collecting unnecessary sensitive operational output
  2. capture highly detailed events for a stubborn Terraform problem
  3. review debugging evidence without publishing API secrets
  4. enable Terraform debugging output while investigating a CLI failure

Explanation

Correct Answer

D:

The practical result of TF_LOG environment variable, used to enable Terraform debugging output while investigating a CLI failure, is: TF_LOG sets a supported logging level such as DEBUG or TRACE for a Terraform process. A qualification for this effect is: Verbose logs can contain sensitive data and should be protected.

Incorrect Answers

A:

That outcome applies to Disable debug logging after diagnosis, intended to avoid collecting unnecessary sensitive operational output, rather than the question's feature TF_LOG environment variable: Unset debug environment variables or restore normal log settings when the investigation ends. Unlike Disable debug logging after diagnosis, TF_LOG environment variable is intended to enable Terraform debugging output while investigating a CLI failure, not to avoid collecting unnecessary sensitive operational output.

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 environment variable: TRACE is a very verbose Terraform logging level useful for deep troubleshooting. Unlike TRACE diagnostic level, TF_LOG environment variable is intended to enable Terraform debugging output while investigating a CLI failure, not to capture highly detailed events for a stubborn Terraform problem.

C:

That outcome applies to Log analysis and source protection, intended to review debugging evidence without publishing API secrets, rather than the question's feature TF_LOG environment variable: Diagnostic logs should be stored and shared according to secret-handling policy. Unlike Log analysis and source protection, TF_LOG environment variable is intended to enable Terraform debugging output while investigating a CLI failure, not to review debugging evidence without publishing API secrets.

Question 639

Before continuing an infrastructure rollout, the operator must include only elements satisfying an if condition in a derived collection. Which mechanism most directly meets this particular need?

  1. Template interpolation
  2. for expression filtering
  3. Built-in collection function
  4. for expression list projection
  5. Conditional expression

Explanation

Correct Answer

B:

The task is to include only elements satisfying an if condition in a derived collection; for expression filtering directly supports that requirement: A for expression's optional if clause filters elements while projecting results. Its relevant boundary is: Filtering a collection is different from lifecycle ignore_changes.

Incorrect Answers

A:

Template interpolation is designed to embed evaluated expressions in a Terraform string, whereas this task is to include only elements satisfying an if condition in a derived collection: The ${...} syntax can interpolate an expression into a quoted string or template. Against for expression filtering, its limitation is: Interpolation is not required when an argument can take a direct expression reference.

C:

Built-in collection function is designed to calculate collection values without an external provisioner, whereas this task is to include only elements satisfying an if condition in a derived collection: Functions such as length, concat, and merge manipulate Terraform values during expression evaluation. Against for expression filtering, its limitation is: A function call does not fetch remote provider resources unless a data source is used.

D:

for expression list projection is designed to transform a collection into a list of calculated values, whereas this task is to include only elements satisfying an if condition in a derived collection: A bracketed for expression maps each element to a new value using a declared iterator. Against for expression filtering, its limitation is: A for expression calculates values but does not itself create resource instances.

E:

Conditional expression is designed to choose between two values based on a boolean condition, whereas this task is to include only elements satisfying an if condition in a derived collection: Terraform's condition ? true_value : false_value expression selects a value based on a predicate. Against for expression filtering, its limitation is: The two branches need compatible types for Terraform to reconcile the result.

Question 640

A Terraform rollout has two separate requirements: first, preview actions required to reach the declared infrastructure state; second, focus on a small subset for exceptional repair or troubleshooting. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Plan without state refresh; then use Targeted planning.
  2. First use terraform plan command; then use Refresh-only planning.
  3. First use terraform plan command; then use Targeted planning.
  4. First use Refresh-only planning; then use Plan without state refresh.
  5. First use Targeted planning; then use terraform plan command.

Explanation

Correct Answer

C:

The first requirement, to preview actions required to reach the declared infrastructure state, is handled by terraform plan command: terraform plan shows changes Terraform expects, including creates, updates, deletes, and replacements. The second requirement, to focus on a small subset for exceptional repair or troubleshooting, is handled by Targeted planning: terraform plan -target=ADDRESS limits the planner's focus to the selected graph portion. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to preview actions required to reach the declared infrastructure state and focus on a small subset for exceptional repair or troubleshooting, the first candidate Plan without state refresh addresses avoid remote refresh reads when an intentional troubleshooting constraint requires it; the second candidate Targeted planning addresses focus on a small subset for exceptional repair or troubleshooting. This mapping fails because the first mechanism primarily supports the task to avoid remote refresh reads when an intentional troubleshooting constraint requires it; the actual requirements are preview actions required to reach the declared infrastructure state first and focus on a small subset for exceptional repair or troubleshooting second.

B:

For the requested tasks to preview actions required to reach the declared infrastructure state and focus on a small subset for exceptional repair or troubleshooting, the first candidate terraform plan command addresses preview actions required to reach the declared infrastructure state; the second candidate Refresh-only planning addresses inspect externally changed infrastructure without planning configuration reconciliation. This mapping fails because the second mechanism primarily supports the task to inspect externally changed infrastructure without planning configuration reconciliation; the actual requirements are preview actions required to reach the declared infrastructure state first and focus on a small subset for exceptional repair or troubleshooting second.

D:

For the requested tasks to preview actions required to reach the declared infrastructure state and focus on a small subset for exceptional repair or troubleshooting, the first candidate Refresh-only planning addresses inspect externally changed infrastructure without planning configuration reconciliation; the second candidate Plan without state refresh addresses avoid remote refresh reads when an intentional troubleshooting constraint requires it. This mapping fails because the first mechanism primarily supports the task to inspect externally changed infrastructure without planning configuration reconciliation and the second mechanism primarily supports the task to avoid remote refresh reads when an intentional troubleshooting constraint requires it; the actual requirements are preview actions required to reach the declared infrastructure state first and focus on a small subset for exceptional repair or troubleshooting second.

E:

For the requested tasks to preview actions required to reach the declared infrastructure state and focus on a small subset for exceptional repair or troubleshooting, the first candidate Targeted planning addresses focus on a small subset for exceptional repair or troubleshooting; the second candidate terraform plan command addresses preview actions required to reach the declared infrastructure state. This mapping fails because the first mechanism primarily supports the task to focus on a small subset for exceptional repair or troubleshooting and the second mechanism primarily supports the task to preview actions required to reach the declared infrastructure state; the actual requirements are preview actions required to reach the declared infrastructure state first and focus on a small subset for exceptional repair or troubleshooting second.

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