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

Question 660

The implementation must both enable Terraform debugging output while investigating a CLI failure and focus debugging on Terraform Core behavior rather than provider messages. Which TWO mechanisms directly address these two separate requirements? Choose TWO.

  1. TF_LOG_PATH environment variable
  2. TF_LOG_CORE environment variable
  3. TRACE diagnostic level
  4. TF_LOG environment variable
  5. TF_LOG_PROVIDER environment variable

Explanation

Correct Answers

B:

Among the paired tasks to enable Terraform debugging output while investigating a CLI failure and focus debugging on Terraform Core behavior rather than provider messages, TF_LOG_CORE environment variable serves the requirement 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. The other task must be covered by a separate mechanism.

D:

Among the paired tasks to enable Terraform debugging output while investigating a CLI failure and focus debugging on Terraform Core behavior rather than provider messages, TF_LOG environment variable serves the requirement 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. The other task must be covered by a separate mechanism.

Incorrect Answers

A:

The requirements are enable Terraform debugging output while investigating a CLI failure and focus debugging on Terraform Core behavior rather than provider messages, while TF_LOG_PATH environment variable supports the different task to write Terraform debug logging to a named file: TF_LOG_PATH controls a file destination for Terraform logging when logging is enabled. That capability is outside the two selected responsibilities.

C:

The requirements are enable Terraform debugging output while investigating a CLI failure and focus debugging on Terraform Core behavior rather than provider messages, while TRACE diagnostic level supports the different task to capture highly detailed events for a stubborn Terraform problem: TRACE is a very verbose Terraform logging level useful for deep troubleshooting. That capability is outside the two selected responsibilities.

E:

The requirements are enable Terraform debugging output while investigating a CLI failure and focus debugging on Terraform Core behavior rather than provider messages, while TF_LOG_PROVIDER environment variable supports the different task to focus verbose diagnostics on provider-side activity: TF_LOG_PROVIDER controls the provider logging level to aid plugin or API troubleshooting. That capability is outside the two selected responsibilities.

Question 661

In a reusable deployment, the primary objective is to choose between two values based on a boolean condition. Which mechanism most directly meets this particular need?

  1. Conditional expression
  2. Built-in collection function
  3. for_each resource replication
  4. Dynamic nested block
  5. for expression list projection

Explanation

Correct Answer

A:

The task is to choose between two values based on a boolean condition; Conditional expression directly supports that requirement: Terraform's condition ? true_value : false_value expression selects a value based on a predicate. Its relevant boundary is: The two branches need compatible types for Terraform to reconcile the result.

Incorrect Answers

B:

Built-in collection function is designed to calculate collection values without an external provisioner, whereas this task is to choose between two values based on a boolean condition: Functions such as length, concat, and merge manipulate Terraform values during expression evaluation. Against Conditional expression, its limitation is: A function call does not fetch remote provider resources unless a data source is used.

C:

for_each resource replication is designed to create one resource instance per unique map or set key, whereas this task is to choose between two values based on a boolean condition: for_each expands a resource into stable keyed instances when its collection is known at planning. Against Conditional expression, its limitation is: Keys cannot be unknown or derived directly from sensitive values.

D:

Dynamic nested block is designed to generate repeated nested configuration blocks from a collection, whereas this task is to choose between two values based on a boolean condition: A dynamic block emits nested blocks where the enclosing resource schema permits them. Against Conditional expression, its limitation is: Dynamic cannot generate resource or provider blocks at the root level.

E:

for expression list projection is designed to transform a collection into a list of calculated values, whereas this task is to choose between two values based on a boolean condition: A bracketed for expression maps each element to a new value using a declared iterator. Against Conditional expression, its limitation is: A for expression calculates values but does not itself create resource instances.

Question 662

The team is documenting risks of Plan saved to file while planning to capture one execution plan for later approval and application. Which caveat specifically applies to that mechanism?

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

Explanation

Correct Answer

A:

For Plan saved to file in the task to capture one execution plan for later approval and application, the important caution is: Saved plans can include sensitive data and should not be committed publicly. The reason this matters is its actual behavior: terraform plan -out=change.tfplan saves an executable binary plan artifact.

Incorrect Answers

B:

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 Plan saved to file: terraform plan -target=ADDRESS limits the planner's focus to the selected graph portion. The question concerns Plan saved to file acting to capture one execution plan for later approval and application, not a limit of Targeted planning.

C:

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 Plan saved to file: terraform plan shows changes Terraform expects, including creates, updates, deletes, and replacements. The question concerns Plan saved to file acting to capture one execution plan for later approval and application, not a limit of terraform plan command.

D:

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 Plan saved to file: terraform plan -refresh-only proposes updates to state and outputs based on remote observations. The question concerns Plan saved to file acting to capture one execution plan for later approval and application, not a limit of Refresh-only planning.

Question 663

During a Terraform 1.12 implementation, the immediate requirement is to direct an individual resource to the intended aliased provider. Which mechanism most directly meets this particular need?

  1. Provider alias reference address
  2. Multiple regions in one configuration
  3. Resource provider meta-argument
  4. Default provider configuration inheritance

Explanation

Correct Answer

C:

The task is to direct an individual resource to the intended aliased provider; Resource provider meta-argument directly supports that requirement: The provider meta-argument can select a configured instance such as aws.west for that resource. Its relevant boundary is: The alias must be declared and satisfy provider requirements.

Incorrect Answers

A:

Provider alias reference address is designed to refer to a provider configuration by its local name and alias, whereas this task is to direct an individual resource to the intended aliased provider: An address such as aws.audit identifies a specific configured instance of the aws provider. Against Resource provider meta-argument, its limitation is: A provider alias is not a separate package with its own source address.

B:

Multiple regions in one configuration is designed to create similar resources in different regions without duplicating the root module, whereas this task is to direct an individual resource to the intended aliased provider: Two provider instances with different region settings can serve explicitly assigned resources or modules. Against Resource provider meta-argument, its limitation is: A default provider does not infer a resource's desired region from its name.

D:

Default provider configuration inheritance is designed to let a child module use default provider settings from its parent, whereas this task is to direct an individual resource to the intended aliased provider: Child modules commonly inherit default provider configurations from the calling module. Against Resource provider meta-argument, its limitation is: Aliases and complex configurations often require explicit mapping.

Question 664

A design uses Refresh-only reconciliation to accept an external change into Terraform state without modifying remote infrastructure. Which qualification applies to the named mechanism?

  1. It does not make the live object conform to an old configuration value.
  2. Configuration reconciliation requires a subsequent reviewed apply.
  3. If its configuration remains, a later plan can propose creating another object.
  4. A refresh-only apply instead accepts observed remote values into state.
  5. It does not rename or migrate the remote object through its provider API.

Explanation

Correct Answer

A:

For Refresh-only reconciliation in the task to accept an external change into Terraform state without modifying remote infrastructure, the important caution is: It does not make the live object conform to an old configuration value. The reason this matters is its actual behavior: A refresh-only plan or apply updates state and outputs to observed values.

Incorrect Answers

B:

The proposed warning belongs to Remote drift detection during plan, which serves the different goal to recognize that a resource was changed outside Terraform, rather than to Refresh-only reconciliation: Normal plan refresh reads can reveal drift between state and the remote object. The question concerns Refresh-only reconciliation acting to accept an external change into Terraform state without modifying remote infrastructure, not a limit of Remote drift detection during plan.

C:

The proposed warning belongs to terraform state rm, which serves the different goal to detach a resource address from state while leaving the remote object intact, rather than to Refresh-only reconciliation: state rm forgets the binding but does not delete the real infrastructure object. The question concerns Refresh-only reconciliation acting to accept an external change into Terraform state without modifying remote infrastructure, not a limit of terraform state rm.

D:

The proposed warning belongs to Drift reconciliation to configuration, which serves the different goal to restore externally modified resource settings to desired code values, rather than to Refresh-only reconciliation: A regular plan and apply can propose changing a drifted object back to configured settings. The question concerns Refresh-only reconciliation acting to accept an external change into Terraform state without modifying remote infrastructure, not a limit of Drift reconciliation to configuration.

E:

The proposed warning belongs to terraform state mv, which serves the different goal to change a resource state address to match a configuration refactor, rather than to Refresh-only reconciliation: state mv rebinds an existing object under a new compatible address. The question concerns Refresh-only reconciliation acting to accept an external change into Terraform state without modifying remote infrastructure, not a limit of terraform state mv.

Question 665

The team is documenting risks of Exact registry module version while planning to make a published module dependency deterministic across clean installs. Which caveat specifically applies to that mechanism?

  1. Assuming .terraform.lock.hcl freezes registry modules can surprise a new installation.
  2. Pinning a module does not pin its provider dependencies unless constrained separately.
  3. A local edit can still change the next plan and should be reviewed.
  4. Version constraints cannot guarantee every patch release is defect-free.

Explanation

Correct Answer

B:

For Exact registry module version in the task to make a published module dependency deterministic across clean installs, the important caution is: Pinning a module does not pin its provider dependencies unless constrained separately. The reason this matters is its actual behavior: An exact version requirement identifies one registry module release.

Incorrect Answers

A:

The proposed warning belongs to Module versus provider version lock, which serves the different goal to track module release selection separately from provider lock file behavior, rather than to Exact registry module version: Module versions are selected by module source and version settings, whereas the lock file records providers. The question concerns Exact registry module version acting to make a published module dependency deterministic across clean installs, not a limit of Module versus provider version lock.

C:

The proposed warning belongs to Local module development lifecycle, which serves the different goal to update a local path module without applying registry release versioning, rather than to Exact registry module version: Local module source code is read from its path and does not use a version argument. The question concerns Exact registry module version acting to make a published module dependency deterministic across clean installs, not a limit of Local module development lifecycle.

D:

The proposed warning belongs to Module release compatibility, which serves the different goal to constrain a module to releases with an expected interface, rather than to Exact registry module version: A version range helps avoid inadvertently selecting a module revision with breaking input or output changes. The question concerns Exact registry module version acting to make a published module dependency deterministic across clean installs, not a limit of Module release compatibility.

Question 666

The rollout owner asks whether cloud block HCP integration is sufficient to associate a Terraform root configuration with an HCP Terraform organization and workspace. Which limitation specifically concerns that mechanism?

  1. A migration should be backed up and verified before discarding the local copy.
  2. Selecting the wrong workspace can target a different infrastructure state.
  3. A CLI token is not a cloud provider's deployment credential.
  4. It should not be combined with a separate backend block in the same root configuration.

Explanation

Correct Answer

D:

For cloud block HCP integration in the task to associate a Terraform root configuration with an HCP Terraform organization and workspace, the important caution is: It should not be combined with a separate backend block in the same root configuration. The reason this matters is its actual behavior: A cloud block in terraform settings configures the HCP Terraform integration for that root module.

Incorrect Answers

A:

The proposed warning belongs to Local to HCP state migration, which serves the different goal to move a locally managed state history into an HCP Terraform workspace, rather than to cloud block HCP integration: Changing state integration and reinitializing can migrate state into HCP Terraform when configured correctly. The question concerns cloud block HCP integration acting to associate a Terraform root configuration with an HCP Terraform organization and workspace, not a limit of Local to HCP state migration.

B:

The proposed warning belongs to HCP Terraform workspace selection, which serves the different goal to route CLI-driven operations to the intended HCP workspace, rather than to cloud block HCP integration: The cloud block workspace settings determine which HCP workspace the configuration uses. The question concerns cloud block HCP integration acting to associate a Terraform root configuration with an HCP Terraform organization and workspace, not a limit of HCP Terraform workspace selection.

C:

The proposed warning belongs to Terraform CLI login to HCP, which serves the different goal to authenticate local Terraform CLI operations against HCP Terraform, rather than to cloud block HCP integration: terraform login starts an authentication workflow and stores a token for HCP Terraform access. The question concerns cloud block HCP integration acting to associate a Terraform root configuration with an HCP Terraform organization and workspace, not a limit of Terraform CLI login to HCP.

Question 667

A Terraform runbook describes the mechanism "Conditional expression". Which responsibility should a reviewer associate with it?

  1. generate repeated nested configuration blocks from a collection
  2. choose between two values based on a boolean condition
  3. calculate collection values without an external provisioner
  4. create one resource instance per unique map or set key

Explanation

Correct Answer

B:

The practical result of Conditional expression, used to choose between two values based on a boolean condition, is: Terraform's condition ? true_value : false_value expression selects a value based on a predicate. A qualification for this effect is: The two branches need compatible types for Terraform to reconcile the result.

Incorrect Answers

A:

That outcome applies to Dynamic nested block, intended to generate repeated nested configuration blocks from a collection, rather than the question's feature Conditional expression: A dynamic block emits nested blocks where the enclosing resource schema permits them. Unlike Dynamic nested block, Conditional expression is intended to choose between two values based on a boolean condition, not to generate repeated nested configuration blocks from a collection.

C:

That outcome applies to Built-in collection function, intended to calculate collection values without an external provisioner, rather than the question's feature Conditional expression: Functions such as length, concat, and merge manipulate Terraform values during expression evaluation. Unlike Built-in collection function, Conditional expression is intended to choose between two values based on a boolean condition, not to calculate collection values without an external provisioner.

D:

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 Conditional expression: for_each expands a resource into stable keyed instances when its collection is known at planning. Unlike for_each resource replication, Conditional expression is intended to choose between two values based on a boolean condition, not to create one resource instance per unique map or set key.

Question 668

A deployment design calls for a supported way to configure cloud and on-premises platforms through a common workflow. Which mechanism most directly meets this particular need?

  1. Multi-cloud provider configuration
  2. Provider-specific implementation
  3. Hybrid infrastructure automation
  4. Service-agnostic orchestration

Explanation

Correct Answer

C:

The task is to configure cloud and on-premises platforms through a common workflow; Hybrid infrastructure automation directly supports that requirement: Terraform can coordinate providers for hosted services and private infrastructure without imposing one cloud API. Its relevant boundary is: An appropriate provider or integration must exist for each target system.

Incorrect Answers

A:

Multi-cloud provider configuration is designed to manage different clouds from one Terraform root module, whereas this task is to configure cloud and on-premises platforms through a common workflow: Separate provider plugins can reconcile resources on multiple platforms within the same configuration. Against Hybrid infrastructure automation, its limitation is: Each provider still needs suitable credentials and service permissions.

B:

Provider-specific implementation is designed to use a common language without pretending providers expose identical capabilities, whereas this task is to configure cloud and on-premises platforms through a common workflow: HCL and workflow are common while each provider defines its own resource schema and service-specific behavior. Against Hybrid infrastructure automation, its limitation is: A resource type from one provider cannot be substituted blindly for another.

D:

Service-agnostic orchestration is designed to control DNS, SaaS, and cloud resources through a common configuration tool, whereas this task is to configure cloud and on-premises platforms through a common workflow: Terraform providers expose resource and data types beyond infrastructure hosted by a cloud vendor. Against Hybrid infrastructure automation, its limitation is: Service-agnostic does not mean resource schemas are interchangeable.

Question 669

A Terraform operator is specifically tasked to write Terraform debug logging to a named file. Which mechanism most directly meets this particular need?

  1. TF_LOG_CORE environment variable
  2. TF_LOG environment variable
  3. TF_LOG_PROVIDER environment variable
  4. TF_LOG_PATH environment variable

Explanation

Correct Answer

D:

The task is to write Terraform debug logging to a named file; TF_LOG_PATH environment variable directly supports that requirement: TF_LOG_PATH controls a file destination for Terraform logging when logging is enabled. Its relevant boundary is: Setting a log path alone does not necessarily enable logging.

Incorrect Answers

A:

TF_LOG_CORE environment variable is designed to focus debugging on Terraform Core behavior rather than provider messages, whereas this task is to write Terraform debug logging to a named file: TF_LOG_CORE can set logging for Terraform Core separately from provider plugin output. Against TF_LOG_PATH environment variable, its limitation is: Core logging does not substitute for investigating remote API authorization errors.

B:

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

C:

TF_LOG_PROVIDER environment variable is designed to focus verbose diagnostics on provider-side activity, whereas this task is to write Terraform debug logging to a named file: TF_LOG_PROVIDER controls the provider logging level to aid plugin or API troubleshooting. Against TF_LOG_PATH environment variable, its limitation is: Provider logs may reveal credentials or request data and require caution.

Question 670

A Terraform rollout has two separate requirements: first, capture one execution plan for later approval and application; second, inspect externally changed infrastructure without planning configuration reconciliation. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Plan without state refresh; then use Machine-readable plan inspection.
  2. First use Plan saved to file; then use Refresh-only planning.
  3. First use Refresh-only planning; then use Plan saved to file.
  4. First use Machine-readable plan inspection; then use Refresh-only planning.
  5. First use Plan saved to file; then use Plan without state refresh.

Explanation

Correct Answer

B:

The first requirement, to capture one execution plan for later approval and application, is handled by Plan saved to file: terraform plan -out=change.tfplan saves an executable binary plan artifact. The second requirement, to inspect externally changed infrastructure without planning configuration reconciliation, is handled by Refresh-only planning: terraform plan -refresh-only proposes updates to state and outputs based on remote observations. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to capture one execution plan for later approval and application and inspect externally changed infrastructure without planning configuration reconciliation, the first candidate Plan without state refresh addresses avoid remote refresh reads when an intentional troubleshooting constraint requires it; the second candidate Machine-readable plan inspection addresses convert a saved plan into JSON for automated analysis. This mapping fails because the first mechanism primarily supports the task to avoid remote refresh reads when an intentional troubleshooting constraint requires it and the second mechanism primarily supports the task to convert a saved plan into JSON for automated analysis; the actual requirements are capture one execution plan for later approval and application first and inspect externally changed infrastructure without planning configuration reconciliation second.

C:

For the requested tasks to capture one execution plan for later approval and application and inspect externally changed infrastructure without planning configuration reconciliation, the first candidate Refresh-only planning addresses inspect externally changed infrastructure without planning configuration reconciliation; the second candidate Plan saved to file addresses capture one execution plan for later approval and application. 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 capture one execution plan for later approval and application; the actual requirements are capture one execution plan for later approval and application first and inspect externally changed infrastructure without planning configuration reconciliation second.

D:

For the requested tasks to capture one execution plan for later approval and application and inspect externally changed infrastructure without planning configuration reconciliation, the first candidate Machine-readable plan inspection addresses convert a saved plan into JSON for automated analysis; the second candidate Refresh-only planning addresses inspect externally changed infrastructure without planning configuration reconciliation. This mapping fails because the first mechanism primarily supports the task to convert a saved plan into JSON for automated analysis; the actual requirements are capture one execution plan for later approval and application first and inspect externally changed infrastructure without planning configuration reconciliation second.

E:

For the requested tasks to capture one execution plan for later approval and application and inspect externally changed infrastructure without planning configuration reconciliation, the first candidate Plan saved to file addresses capture one execution plan for later approval and application; the second candidate Plan without state refresh addresses avoid remote refresh reads when an intentional troubleshooting constraint requires it. This mapping fails because the second mechanism primarily supports the task to avoid remote refresh reads when an intentional troubleshooting constraint requires it; the actual requirements are capture one execution plan for later approval and application first and inspect externally changed infrastructure without planning configuration reconciliation second.

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