HashiCorp Terraform Associate (HashiCorp Certified: Terraform Associate) Practice Test 11

Question 100

A runbook lists “TF_LOG=DEBUG” for the task to enable diagnostic output with lower verbosity than TRACE. Which technical effect should its description include?

  1. Setting TF_LOG to DEBUG exposes useful troubleshooting messages without the full trace-level volume.
  2. Unsetting or disabling Terraform's TF_LOG environment setting removes extra diagnostic verbosity from later commands.
  3. INFO logging provides operational context with less detail than DEBUG and TRACE.
  4. Terraform diagnostic logs can include sensitive data, so access control and careful review are required before sharing them.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to enable diagnostic output with lower verbosity than TRACE, so it produces the behavior described. In contrast, disabling TF_LOG serves a different goal: return a shell session to ordinary Terraform logging after investigation, not enable diagnostic output with lower verbosity than TRACE.

Incorrect Answers

B:

The description applies to disabling TF_LOG when an engineer needs to return a shell session to ordinary Terraform logging after investigation; the named TF_LOG=DEBUG instead handles the requirement to enable diagnostic output with lower verbosity than TRACE, so this behavior does not describe TF_LOG=DEBUG in the situation named.

C:

The description applies to TF_LOG=INFO when an engineer needs to record higher-level operational messages during troubleshooting; the named TF_LOG=DEBUG instead handles the requirement to enable diagnostic output with lower verbosity than TRACE, so this behavior does not describe TF_LOG=DEBUG in the situation named.

D:

The description applies to redacting shared diagnostic logs when an engineer needs to prevent troubleshooting output from leaking credentials or resource attributes; the named TF_LOG=DEBUG instead handles the requirement to enable diagnostic output with lower verbosity than TRACE, so this behavior does not describe TF_LOG=DEBUG in the situation named.

Question 101

An engineer intends to build one delimited string from a list of strings and is reviewing “The join function”. What consequence follows from using it as intended?

  1. join takes a separator followed by a list and concatenates elements with that separator between them.
  2. dynamic constructs blocks required by resource schemas; it does not create standalone Terraform resource declarations.
  3. contains(collection, value) evaluates membership and returns a boolean.
  4. file reads existing local text; it does not wait for a provisioner to create the file during apply.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to build one delimited string from a list of strings, so it produces the behavior described. In contrast, the file function serves a different goal: read UTF-8 content already present in a local file during evaluation, not build one delimited string from a list of strings.

Incorrect Answers

B:

The description applies to the dynamic block when an engineer needs to generate repeated nested blocks from a collection; the named the join function instead handles the requirement to build one delimited string from a list of strings, so this behavior does not describe The join function in the situation named.

C:

The description applies to the contains function when an engineer needs to check whether a collection contains a specific element; the named the join function instead handles the requirement to build one delimited string from a list of strings, so this behavior does not describe The join function in the situation named.

D:

The description applies to the file function when an engineer needs to read UTF-8 content already present in a local file during evaluation; the named the join function instead handles the requirement to build one delimited string from a list of strings, so this behavior does not describe The join function in the situation named.

Question 102

A Terraform change proposal names “terraform plan -generate-config-out” to produce draft HCL for resources named in import blocks without matching configuration. Which outcome can reviewers attribute to that particular mechanism?

  1. The import workflow adds an existing remote object to state and can manage it through later plans instead of creating a replacement automatically.
  2. Imported infrastructure should have a corresponding resource block with configuration matching the desired attributes so the next plan is safe.
  3. The to argument points to an intended Terraform resource address rather than a provider account name or state backend.
  4. The experimental config-generation flag can write suggested resource declarations for review and correction before apply.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to produce draft HCL for resources named in import blocks without matching configuration, so it produces the behavior described. In contrast, a matching resource declaration serves a different goal: avoid unintended changes immediately after importing a remote object, not produce draft HCL for resources named in import blocks without matching configuration.

Incorrect Answers

A:

The description applies to importing without creating new infrastructure when an engineer needs to take ownership of an existing object rather than duplicating it; the named terraform plan -generate-config-out instead handles the requirement to produce draft HCL for resources named in import blocks without matching configuration, so this behavior does not describe terraform plan -generate-config-out in the situation named.

B:

The description applies to a matching resource declaration when an engineer needs to avoid unintended changes immediately after importing a remote object; the named terraform plan -generate-config-out instead handles the requirement to produce draft HCL for resources named in import blocks without matching configuration, so this behavior does not describe terraform plan -generate-config-out in the situation named.

C:

The description applies to an import block's to argument when an engineer needs to specify which resource instance address should receive the imported object; the named terraform plan -generate-config-out instead handles the requirement to produce draft HCL for resources named in import blocks without matching configuration, so this behavior does not describe terraform plan -generate-config-out in the situation named.

Question 103

A Terraform reviewer encounters “ignore_changes for shared ownership” while assessing how to stop Terraform from overwriting a field delegated to an external controller. Which statement correctly describes its actual behavior?

  1. Importing attaches the remote object's identity to state; compatible configuration is still needed to avoid unwanted changes afterward.
  2. The lifecycle ignore_changes rule suppresses post-creation update plans for selected attributes while leaving other attributes managed.
  3. State metadata such as lineage and serial helps protect against incompatible or stale state updates.
  4. The state pull command retrieves state from the configured backend and prints a snapshot that may contain secrets.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to stop Terraform from overwriting a field delegated to an external controller, so it produces the behavior described. In contrast, a state import workflow serves a different goal: associate existing infrastructure with a newly declared Terraform resource address, not stop Terraform from overwriting a field delegated to an external controller.

Incorrect Answers

A:

The description applies to a state import workflow when an engineer needs to associate existing infrastructure with a newly declared Terraform resource address; the named ignore_changes for shared ownership instead handles the requirement to stop Terraform from overwriting a field delegated to an external controller, so this behavior does not describe ignore_changes for shared ownership in the situation named.

C:

The description applies to serial and lineage checks when an engineer needs to detect that a state snapshot belongs to a different history or older generation; the named ignore_changes for shared ownership instead handles the requirement to stop Terraform from overwriting a field delegated to an external controller, so this behavior does not describe ignore_changes for shared ownership in the situation named.

D:

The description applies to terraform state pull when an engineer needs to obtain the current state snapshot for inspection or controlled backup; the named ignore_changes for shared ownership instead handles the requirement to stop Terraform from overwriting a field delegated to an external controller, so this behavior does not describe ignore_changes for shared ownership in the situation named.

Question 104

During a design review, the requirement is to append the elements of multiple lists into one sequence. Which option should the engineer select?

  1. The concat function
  2. The replace function
  3. The cidrhost function
  4. The dynamic block

Explanation

Correct Answer

A:

concat joins lists end to end and preserves their element ordering, including duplicate values; this directly meets the requirement to append the elements of multiple lists into one sequence. By comparison, the dynamic block is intended to generate repeated nested blocks from a collection, which is a different task from append the elements of multiple lists into one sequence.

Incorrect Answers

B:

replace searches a string for a matching substring or pattern and replaces matches with a new string; this mechanism is useful when the job is to substitute matching substrings within a value, whereas the current scenario requires the engineer to append the elements of multiple lists into one sequence. These operations have different effects in the stated Terraform workflow.

C:

cidrhost computes a host address inside the given prefix from a numeric host index; this mechanism is useful when the job is to calculate an IP address at an offset within a CIDR range, whereas the current scenario requires the engineer to append the elements of multiple lists into one sequence. These operations have different effects in the stated Terraform workflow.

D:

dynamic constructs blocks required by resource schemas; it does not create standalone Terraform resource declarations; this mechanism is useful when the job is to generate repeated nested blocks from a collection, whereas the current scenario requires the engineer to append the elements of multiple lists into one sequence. These operations have different effects in the stated Terraform workflow.

Question 105

A change request asks an engineer to select the first expression that evaluates without a dynamic error. Which choice best implements the requested behavior?

  1. The dynamic block
  2. The try function
  3. The file function
  4. The cidrsubnet function

Explanation

Correct Answer

B:

try evaluates expressions in order and returns the first successful result, rather than simply the first non-null value; this directly meets the requirement to select the first expression that evaluates without a dynamic error. By comparison, the file function is intended to read UTF-8 content already present in a local file during evaluation, which is a different task from select the first expression that evaluates without a dynamic error.

Incorrect Answers

A:

dynamic constructs blocks required by resource schemas; it does not create standalone Terraform resource declarations; this mechanism is useful when the job is to generate repeated nested blocks from a collection, whereas the current scenario requires the engineer to select the first expression that evaluates without a dynamic error. These operations have different effects in the stated Terraform workflow.

C:

file reads existing local text; it does not wait for a provisioner to create the file during apply; this mechanism is useful when the job is to read UTF-8 content already present in a local file during evaluation, whereas the current scenario requires the engineer to select the first expression that evaluates without a dynamic error. These operations have different effects in the stated Terraform workflow.

D:

cidrsubnet derives a subnet CIDR using additional prefix bits and a network number, without provisioning a network resource; this mechanism is useful when the job is to calculate a nested network prefix from a parent CIDR range, whereas the current scenario requires the engineer to select the first expression that evaluates without a dynamic error. These operations have different effects in the stated Terraform workflow.

Question 106

A change request asks an engineer to store Terraform state under managed service controls rather than a local file. Which choice best implements the requested behavior?

  1. The HCP run queue
  2. Workspace outputs
  3. A workspace variable
  4. HCP Terraform remote state

Explanation

Correct Answer

D:

HCP Terraform maintains workspace state versions and supports collaboration without exposing a machine-local canonical state file; this directly meets the requirement to store Terraform state under managed service controls rather than a local file. By comparison, a workspace variable is intended to supply a configuration input or environment value for HCP Terraform runs, which is a different task from store Terraform state under managed service controls rather than a local file.

Incorrect Answers

A:

Queued runs and workspace run management help serialize changes and avoid competing applies to one state; this mechanism is useful when the job is to coordinate multiple requested changes against the same workspace state, whereas the current scenario requires the engineer to store Terraform state under managed service controls rather than a local file. These operations have different effects in the stated Terraform workflow.

B:

Workspace output values come from root module output blocks and can be consumed through supported interfaces; this mechanism is useful when the job is to publish selected values produced by an HCP Terraform run, whereas the current scenario requires the engineer to store Terraform state under managed service controls rather than a local file. These operations have different effects in the stated Terraform workflow.

C:

HCP Terraform workspaces can hold Terraform input variables and environment variables for run-time use; this mechanism is useful when the job is to supply a configuration input or environment value for HCP Terraform runs, whereas the current scenario requires the engineer to store Terraform state under managed service controls rather than a local file. These operations have different effects in the stated Terraform workflow.

Question 107

The team evaluates “The .terraform.lock.hcl file” for a requirement to identify which file should be checked in to preserve selected provider packages. Which observed behavior belongs to that mechanism rather than a different Terraform feature?

  1. This option provides backend configuration values separately from static code, although locally cached backend settings may still contain secrets.
  2. Terraform requires reinitialization to adopt changed backend settings before normal operations continue.
  3. Terraform records provider version and checksum selections in its dependency lock file, which teams normally commit to source control.
  4. Initialization installs required providers and modules and establishes the working directory's backend configuration.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to identify which file should be checked in to preserve selected provider packages, so it produces the behavior described. In contrast, re-run init after a backend change serves a different goal: respond to a modified terraform backend block, not identify which file should be checked in to preserve selected provider packages.

Incorrect Answers

A:

The description applies to terraform init -backend-config when an engineer needs to inject partial backend settings at initialization time; the named the .terraform.lock.hcl file instead handles the requirement to identify which file should be checked in to preserve selected provider packages, so this behavior does not describe The .terraform.lock.hcl file in the situation named.

B:

The description applies to re-run init after a backend change when an engineer needs to respond to a modified terraform backend block; the named the .terraform.lock.hcl file instead handles the requirement to identify which file should be checked in to preserve selected provider packages, so this behavior does not describe The .terraform.lock.hcl file in the situation named.

D:

The description applies to terraform init for a new directory when an engineer needs to prepare a folder containing fresh .tf configuration files; the named the .terraform.lock.hcl file instead handles the requirement to identify which file should be checked in to preserve selected provider packages, so this behavior does not describe The .terraform.lock.hcl file in the situation named.

Question 108

During an infrastructure design review about how to feed a saved plan to a machine-readable analysis tool, a maintainer asks what “terraform show -json on a plan” does. Which description is accurate?

  1. Terraform graph nodes can run concurrently when no dependency edge requires a particular order.
  2. In human-readable plans, - denotes a planned destruction of a managed resource.
  3. The graph command emits a DOT graph representation of Terraform dependencies, useful for spotting unexpected ordering constraints.
  4. The -json flag emits a structured JSON representation suitable for inspection by automation, with careful handling of sensitive output.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to feed a saved plan to a machine-readable analysis tool, so it produces the behavior described. In contrast, a resource action marked minus serves a different goal: interpret a plan showing a resource that Terraform will destroy, not feed a saved plan to a machine-readable analysis tool.

Incorrect Answers

A:

The description applies to the dependency graph during planning when an engineer needs to explain why two unrelated resources can be planned and applied in parallel; the named terraform show -json on a plan instead handles the requirement to feed a saved plan to a machine-readable analysis tool, so this behavior does not describe terraform show -json on a plan in the situation named.

B:

The description applies to a resource action marked minus when an engineer needs to interpret a plan showing a resource that Terraform will destroy; the named terraform show -json on a plan instead handles the requirement to feed a saved plan to a machine-readable analysis tool, so this behavior does not describe terraform show -json on a plan in the situation named.

C:

The description applies to terraform graph when an engineer needs to display configuration and state dependencies for troubleshooting; the named terraform show -json on a plan instead handles the requirement to feed a saved plan to a machine-readable analysis tool, so this behavior does not describe terraform show -json on a plan in the situation named.

Question 109

During an infrastructure design review about how to connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io, a maintainer asks what “Terraform Enterprise hostname selection” does. Which description is accurate?

  1. The cloud workspaces block supports a project setting for organizing related workspace integration.
  2. The cloud hostname setting and login host identify the relevant service installation for organization operations.
  3. The cloud block's workspaces name attribute identifies one workspace, rather than selecting an arbitrary state path.
  4. Migration requires setting HCP Terraform integration and handling state transfer rather than starting a blank workspace against existing objects.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io, so it produces the behavior described. In contrast, migrating state to HCP Terraform serves a different goal: move an established root configuration from local state into a managed HCP workspace, not connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io.

Incorrect Answers

A:

The description applies to a cloud block project selector when an engineer needs to associate an HCP Terraform workspace with an intended project during configuration; the named Terraform Enterprise hostname selection instead handles the requirement to connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io, so this behavior does not describe Terraform Enterprise hostname selection in the situation named.

C:

The description applies to a cloud workspaces name setting when an engineer needs to target a particular HCP Terraform workspace from a root configuration; the named Terraform Enterprise hostname selection instead handles the requirement to connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io, so this behavior does not describe Terraform Enterprise hostname selection in the situation named.

D:

The description applies to migrating state to HCP Terraform when an engineer needs to move an established root configuration from local state into a managed HCP workspace; the named Terraform Enterprise hostname selection instead handles the requirement to connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io, so this behavior does not describe Terraform Enterprise hostname selection in the situation named.

Question 110

A team compares Terraform mechanisms for the goal to control behavioral changes after moving to a new module release. Which stated consequence belongs specifically to “Reviewing module upgrade changes”?

  1. A module upgrade can change resource definitions and outputs, so the consumer should inspect the new source and resulting Terraform plan.
  2. The upgrade mode reselects module versions subject to constraints instead of automatically keeping the previously installed copy.
  3. Changing a module source or version constraint requires reinitializing to resolve the updated selection.
  4. The module version argument accepts version constraints for registry sources and Terraform resolves compatible published releases during init.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to control behavioral changes after moving to a new module release, so it produces the behavior described. In contrast, init after module version change serves a different goal: install a newly allowed child module release after editing its version requirement, not control behavioral changes after moving to a new module release.

Incorrect Answers

B:

The description applies to init -upgrade for registry modules when an engineer needs to consider newer published module releases already allowed by a version constraint; the named reviewing module upgrade changes instead handles the requirement to control behavioral changes after moving to a new module release, so this behavior does not describe Reviewing module upgrade changes in the situation named.

C:

The description applies to init after module version change when an engineer needs to install a newly allowed child module release after editing its version requirement; the named reviewing module upgrade changes instead handles the requirement to control behavioral changes after moving to a new module release, so this behavior does not describe Reviewing module upgrade changes in the situation named.

D:

The description applies to a registry module version constraint when an engineer needs to select a supported module release range from the registry; the named reviewing module upgrade changes instead handles the requirement to control behavioral changes after moving to a new module release, so this behavior does not describe Reviewing module upgrade changes in the situation named.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests