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

Question 630

During a design review, the requirement is to focus verbose diagnostics on Terraform Core rather than all plugin activity. Which option should the engineer select?

  1. TF_LOG=DEBUG
  2. TF_LOG=TRACE
  3. TF_LOG_CORE
  4. Redacting shared diagnostic logs
  5. TF_LOG=INFO

Explanation

Correct Answer

C:

The TF_LOG_CORE variable can control log verbosity for Core messages independently of general logging; this directly meets the requirement to focus verbose diagnostics on Terraform Core rather than all plugin activity. By comparison, TF_LOG=TRACE is intended to obtain detailed Terraform core and provider diagnostic output while troubleshooting, which is a different task from focus verbose diagnostics on Terraform Core rather than all plugin activity.

Incorrect Answers

A:

Setting TF_LOG to DEBUG exposes useful troubleshooting messages without the full trace-level volume; this mechanism is useful when the job is to enable diagnostic output with lower verbosity than TRACE, whereas the current scenario requires the engineer to focus verbose diagnostics on Terraform Core rather than all plugin activity. These operations have different effects in the stated Terraform workflow.

B:

Terraform logging set to TRACE emits highly verbose diagnostic detail and may contain sensitive information; this mechanism is useful when the job is to obtain detailed Terraform core and provider diagnostic output while troubleshooting, whereas the current scenario requires the engineer to focus verbose diagnostics on Terraform Core rather than all plugin activity. These operations have different effects in the stated Terraform workflow.

D:

Terraform diagnostic logs can include sensitive data, so access control and careful review are required before sharing them; this mechanism is useful when the job is to prevent troubleshooting output from leaking credentials or resource attributes, whereas the current scenario requires the engineer to focus verbose diagnostics on Terraform Core rather than all plugin activity. These operations have different effects in the stated Terraform workflow.

E:

INFO logging provides operational context with less detail than DEBUG and TRACE; this mechanism is useful when the job is to record higher-level operational messages during troubleshooting, whereas the current scenario requires the engineer to focus verbose diagnostics on Terraform Core rather than all plugin activity. These operations have different effects in the stated Terraform workflow.

Question 631

An engineer proposes “A relative local module source” to determine a module's declared inputs, outputs, providers and usage examples. Which outcome does the proposed technique actually provide?

  1. Published module documentation and metadata describe the module interface and help consumers understand required arguments.
  2. The terraform get command updates downloaded module sources only; routine workflows generally prefer terraform init.
  3. A module source such as ./modules/network points to a local directory and requires no registry download or semantic version selection.
  4. Initialization retrieves module sources and populates .terraform/modules while preparing other required dependencies.

Explanation

Correct Answer

C:

A relative local module source is used when an operator needs to reuse a neighboring module directory in the same repository. Consequently, this choice cannot meet the separate requirement to determine a module's declared inputs, outputs, providers and usage examples. The intended action would instead require Registry module documentation.

Incorrect Answers

A:

That outcome belongs to Registry module documentation, the mechanism that can determine a module's declared inputs, outputs, providers and usage examples. The question concerns the engineer’s actual proposal, A relative local module source; it is directed at reuse a neighboring module directory in the same repository, not that result.

B:

This behavior belongs to terraform get, which helps engineers retrieve child modules without running the complete backend and provider setup steps rather than satisfying the separate requirement to determine a module's declared inputs, outputs, providers and usage examples. The attempted technique was A relative local module source; it would instead be used to reuse a neighboring module directory in the same repository, not to produce the effect associated with terraform get.

D:

This behavior belongs to terraform init for modules, which helps engineers install all referenced remote child modules before planning rather than satisfying the separate requirement to determine a module's declared inputs, outputs, providers and usage examples. The attempted technique was A relative local module source; it would instead be used to reuse a neighboring module directory in the same repository, not to produce the effect associated with terraform init for modules.

Question 632

A module author evaluates the expression substr("terraform", 0, 4) with the literal inputs shown. What is the resulting Terraform value?

  1. "terr"
  2. "t"
  3. "form"
  4. "terra"

Explanation

Correct Answer

A:

The expression substr("terraform", 0, 4) evaluates to "terr" because substr starts at zero and returns exactly four characters from terraform. This is Terraform's direct evaluation of the supplied literal arguments in substr("terraform", 0, 4), not an external provider lookup.

Incorrect Answers

B:

The third argument asks for four characters, not one. HCL evaluates substr("terraform", 0, 4) using the supplied arguments: substr starts at zero and returns exactly four characters from terraform; the listed result is therefore incorrect.

C:

That suffix begins later than offset zero. In this specific evaluation, substr starts at zero and returns exactly four characters from terraform, which rules out the proposed alternative.

D:

This takes five characters instead of the requested four. For substr("terraform", 0, 4), substr starts at zero and returns exactly four characters from terraform; consequently this candidate is not the value Terraform computes.

Question 633

The team evaluates “A variable reference” for a requirement to inject a caller-supplied input into a resource argument. Which observed behavior belongs to that mechanism rather than a different Terraform feature?

  1. Referencing another managed resource's attribute creates an implicit dependency in Terraform's graph.
  2. Resources using count can refer to the current instance number through count.index, a zero-based integer.
  3. var.NAME reads a declared input variable in the module where the variable block is defined.
  4. Count instances have numeric indexes such as aws_instance.web[1] for the second instance.
  5. The depends_on meta-argument adds dependency edges for a known relationship that Terraform cannot otherwise infer.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to inject a caller-supplied input into a resource argument, so it produces the behavior described. In contrast, an instance address with count serves a different goal: refer specifically to the second object of a count-created resource, not inject a caller-supplied input into a resource argument.

Incorrect Answers

A:

The description applies to an implicit attribute dependency when an engineer needs to ensure a dependent resource waits for the object whose ID it needs; the named a variable reference instead handles the requirement to inject a caller-supplied input into a resource argument, so this behavior does not describe A variable reference in the situation named.

B:

The description applies to count.index when an engineer needs to build a numbered name for each instance created using count; the named a variable reference instead handles the requirement to inject a caller-supplied input into a resource argument, so this behavior does not describe A variable reference in the situation named.

D:

The description applies to an instance address with count when an engineer needs to refer specifically to the second object of a count-created resource; the named a variable reference instead handles the requirement to inject a caller-supplied input into a resource argument, so this behavior does not describe A variable reference in the situation named.

E:

The description applies to explicit depends_on when an engineer needs to order resources when there is a dependency not expressed by attribute references; the named a variable reference instead handles the requirement to inject a caller-supplied input into a resource argument, so this behavior does not describe A variable reference in the situation named.

Question 634

A reusable infrastructure definition has a concrete implementation goal: hide a supplied secret from ordinary CLI display without removing it from state. What is the most appropriate Terraform mechanism?

  1. No ephemeral root output
  2. Environment-based provider credentials
  3. sensitive = true on a variable
  4. Vault short-lived credentials

Explanation

Correct Answer

C:

Sensitive marks a value for redaction in UI output, but regular sensitive values can still be persisted in plan and state files; this directly meets the requirement to hide a supplied secret from ordinary CLI display without removing it from state. By comparison, no ephemeral root output is intended to reject a design that tries to publish a runtime-only value through the root output table, which is a different task from hide a supplied secret from ordinary CLI display without removing it from state.

Incorrect Answers

A:

Terraform does not permit ephemeral = true on root-module output blocks, because their ordinary purpose is persistent presentation; this mechanism is useful when the job is to reject a design that tries to publish a runtime-only value through the root output table, whereas the current scenario requires the engineer to hide a supplied secret from ordinary CLI display without removing it from state. These operations have different effects in the stated Terraform workflow.

B:

Providers can often authenticate through environment variables or identity integrations so credentials are absent from checked-in HCL; this mechanism is useful when the job is to avoid putting provider access tokens directly in configuration source, whereas the current scenario requires the engineer to hide a supplied secret from ordinary CLI display without removing it from state. These operations have different effects in the stated Terraform workflow.

D:

Vault's dynamic credentials can provide expiring access with centrally enforced policies instead of permanent embedded keys; this mechanism is useful when the job is to limit the lifetime and scope of identities used by infrastructure automation, whereas the current scenario requires the engineer to hide a supplied secret from ordinary CLI display without removing it from state. These operations have different effects in the stated Terraform workflow.

Question 635

During a design review, the requirement is to connect a root configuration to an HCP Terraform organization and workspace. Which option should the engineer select?

  1. An HCP private registry module source
  2. Mutual exclusivity of cloud and backend
  3. A cloud block in terraform settings
  4. Dynamic provider credential integration

Explanation

Correct Answer

C:

A terraform cloud block declares organization and workspace selection, integrating the local CLI with HCP Terraform workflows; this directly meets the requirement to connect a root configuration to an HCP Terraform organization and workspace. By comparison, an HCP private registry module source is intended to consume a module managed by the organization's HCP private registry, which is a different task from connect a root configuration to an HCP Terraform organization and workspace.

Incorrect Answers

A:

A module source can reference a private registry hostname and namespace after the client has appropriate authentication; this mechanism is useful when the job is to consume a module managed by the organization's HCP private registry, whereas the current scenario requires the engineer to connect a root configuration to an HCP Terraform organization and workspace. These operations have different effects in the stated Terraform workflow.

B:

Terraform does not allow simultaneous cloud and backend blocks because both would compete to control the state and execution connection; this concerns the task to avoid declaring both HCP cloud integration and a standard backend in the same root module, not the current need to connect a root configuration to an HCP Terraform organization and workspace. A A cloud block in terraform settings approach is appropriate here; the substituted Mutual exclusivity of cloud and backend option does not supply the specified Terraform capability.

D:

Dynamic credentials integrate HCP Terraform with supported identity federation to obtain scoped run credentials; this mechanism is useful when the job is to grant HCP runs temporary cloud authorization instead of long-lived static secrets, whereas the current scenario requires the engineer to connect a root configuration to an HCP Terraform organization and workspace. These operations have different effects in the stated Terraform workflow.

Question 636

A Terraform reviewer encounters “HCP continuous validation” while assessing how to monitor whether infrastructure-specific check assertions still pass after deployment. Which statement correctly describes its actual behavior?

  1. Registry access and publishing permissions help centralize reusable module governance across teams.
  2. Continuous validation can evaluate configuration check blocks to identify operational health issues in supported workspaces.
  3. Policy sets organize policy rules and their workspace or project applicability rather than modifying provider schemas directly.
  4. Run history records plan and apply activity to support team review and change tracking.
  5. HCP Terraform approval workflow separates viewing a plan from the permission to proceed with an apply.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to monitor whether infrastructure-specific check assertions still pass after deployment, so it produces the behavior described. In contrast, a restricted private registry serves a different goal: let approved teams discover modules while controlling publication rights, not monitor whether infrastructure-specific check assertions still pass after deployment.

Incorrect Answers

A:

The description applies to a restricted private registry when an engineer needs to let approved teams discover modules while controlling publication rights; the named HCP continuous validation instead handles the requirement to monitor whether infrastructure-specific check assertions still pass after deployment, so this behavior does not describe HCP continuous validation in the situation named.

C:

The description applies to policy sets when an engineer needs to attach a shared governance policy collection to selected workspace scopes; the named HCP continuous validation instead handles the requirement to monitor whether infrastructure-specific check assertions still pass after deployment, so this behavior does not describe HCP continuous validation in the situation named.

D:

The description applies to workspace audit history when an engineer needs to review past runs and changes in a shared HCP organization; the named HCP continuous validation instead handles the requirement to monitor whether infrastructure-specific check assertions still pass after deployment, so this behavior does not describe HCP continuous validation in the situation named.

E:

The description applies to workspace run approvals when an engineer needs to require an authorized person to approve a run before applying changes; the named HCP continuous validation instead handles the requirement to monitor whether infrastructure-specific check assertions still pass after deployment, so this behavior does not describe HCP continuous validation in the situation named.

Question 637

An engineering checklist calls for separate outcomes: (1) present a meaningful explanation when a custom condition evaluates false; (2) look up an already existing object without taking ownership of its lifecycle. Which TWO options implement the requested outcomes? Choose TWO.

  1. A data-source reference
  2. Resource precondition
  3. The error_message field
  4. Preconditions for external assumptions
  5. A data source block

Explanation

Correct Answers

C:

Validation, precondition and postcondition definitions use error_message to tell the operator why a rule failed; this meets the requirement to present a meaningful explanation when a custom condition evaluates false, while the other selected techniques address look up an already existing object without taking ownership of its lifecycle, which require their own distinct Terraform mechanisms.

E:

A data block asks a provider to read information and does not make Terraform create or destroy the referenced remote object; this meets the requirement to look up an already existing object without taking ownership of its lifecycle, while the other selected techniques address present a meaningful explanation when a custom condition evaluates false, which require their own distinct Terraform mechanisms.

Incorrect Answers

A:

References to data.TYPE.NAME.attribute retrieve values supplied by a read-only provider data source; it addresses use attributes read from an existing resource when configuring a new managed object, but this delivery instead requires present a meaningful explanation when a custom condition evaluates false and look up an already existing object without taking ownership of its lifecycle. The required combination involves A data source block and The error_message field, not the behavior of A data-source reference.

B:

A precondition inside lifecycle requires a true predicate before Terraform can continue the relevant resource operation; it addresses fail a plan or apply when a prerequisite property is unacceptable, but this delivery instead requires present a meaningful explanation when a custom condition evaluates false and look up an already existing object without taking ownership of its lifecycle. The required combination involves A data source block and The error_message field, not the behavior of Resource precondition.

D:

A precondition can express a domain requirement such as a selected image having an expected property before using it; it addresses guard a resource against prerequisites outside the provider's basic schema, but this delivery instead requires present a meaningful explanation when a custom condition evaluates false and look up an already existing object without taking ownership of its lifecycle. The required combination involves A data source block and The error_message field, not the behavior of Preconditions for external assumptions.

Question 638

A Terraform module author requires a way to format each element of multiple lists using one common template. Which Terraform approach most directly fulfills that request?

  1. The jsondecode function
  2. The formatlist function
  3. The for expression
  4. The lower function

Explanation

Correct Answer

B:

formatlist applies its formatting string across list elements to produce a list of formatted strings; this directly meets the requirement to format each element of multiple lists using one common template. By comparison, the lower function is intended to normalize a string identifier to lowercase, which is a different task from format each element of multiple lists using one common template.

Incorrect Answers

A:

jsondecode converts JSON input into native maps, objects, lists or primitives used in expressions; this mechanism is useful when the job is to parse a JSON document string into Terraform values, whereas the current scenario requires the engineer to format each element of multiple lists using one common template. These operations have different effects in the stated Terraform workflow.

C:

A for expression builds derived collection values, optionally filtering with an if clause and transforming keys or values; this mechanism is useful when the job is to transform a collection's elements into a new list or map, whereas the current scenario requires the engineer to format each element of multiple lists using one common template. These operations have different effects in the stated Terraform workflow.

D:

lower converts letters to lowercase and is often used in consistent name expressions; this mechanism is useful when the job is to normalize a string identifier to lowercase, whereas the current scenario requires the engineer to format each element of multiple lists using one common template. These operations have different effects in the stated Terraform workflow.

Question 639

An engineer proposes “Nested module output propagation” to expose a chosen internal attribute to the calling parent module. Which outcome does the proposed technique actually provide?

  1. Each call has its own variable assignments and resource instances, even when both calls reference the same module source directory.
  2. A module block explicitly sets the child's declared input variables using arguments of matching names.
  3. The output block defines a published module interface; the parent reads the value as module.NAME.OUTPUT.
  4. Each module boundary needs an output passthrough because the root cannot directly access an arbitrary grandchild's private resources.

Explanation

Correct Answer

D:

Nested module output propagation is used when an operator needs to make a value from a grandchild module visible to the root module. Consequently, this choice cannot meet the separate requirement to expose a chosen internal attribute to the calling parent module. The intended action would instead require A child module output.

Incorrect Answers

A:

This behavior belongs to Different values for two module calls, which helps engineers instantiate the same module with distinct environment inputs rather than satisfying the separate requirement to expose a chosen internal attribute to the calling parent module. The attempted technique was Nested module output propagation; it would instead be used to make a value from a grandchild module visible to the root module, not to produce the effect associated with Different values for two module calls.

B:

This behavior belongs to Parent-to-child argument passing, which helps engineers set a reusable module's environment tag from the caller rather than satisfying the separate requirement to expose a chosen internal attribute to the calling parent module. The attempted technique was Nested module output propagation; it would instead be used to make a value from a grandchild module visible to the root module, not to produce the effect associated with Parent-to-child argument passing.

C:

That outcome belongs to A child module output, the mechanism that can expose a chosen internal attribute to the calling parent module. The question concerns the engineer’s actual proposal, Nested module output propagation; it is directed at make a value from a grandchild module visible to the root module, not that result.

Question 640

During an infrastructure design review about how to call a child module from an explicit filesystem path, a maintainer asks what “An absolute local module source” does. Which description is accurate?

  1. Terraform can load a module from a local filesystem path, though absolute paths make configurations less portable.
  2. Published module documentation and metadata describe the module interface and help consumers understand required arguments.
  3. Initialization retrieves module sources and populates .terraform/modules while preparing other required dependencies.
  4. A source address ending in ?ref=... selects a Git revision; it does not use the registry-specific module version argument.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to call a child module from an explicit filesystem path, so it produces the behavior described. In contrast, a Git ref query parameter serves a different goal: pin a VCS module to a specific Git branch, tag or commit, not call a child module from an explicit filesystem path.

Incorrect Answers

B:

The description applies to registry module documentation when an engineer needs to determine a module's declared inputs, outputs, providers and usage examples; the named an absolute local module source instead handles the requirement to call a child module from an explicit filesystem path, so this behavior does not describe An absolute local module source in the situation named.

C:

The description applies to terraform init for modules when an engineer needs to install all referenced remote child modules before planning; the named an absolute local module source instead handles the requirement to call a child module from an explicit filesystem path, so this behavior does not describe An absolute local module source in the situation named.

D:

The description applies to a Git ref query parameter when an engineer needs to pin a VCS module to a specific Git branch, tag or commit; the named an absolute local module source instead handles the requirement to call a child module from an explicit filesystem path, so this behavior does not describe An absolute local module source in the situation named.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests