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

Question 980

A runbook lists “An HCP private registry module source” for the task to consume a module managed by the organization's HCP private registry. Which technical effect should its description include?

  1. Run tasks integrate external systems into workflow checkpoints without changing the Terraform resource graph directly.
  2. A module source can reference a private registry hostname and namespace after the client has appropriate authentication.
  3. The login command stores a CLI API token for the selected service host so CLI-driven workflows can authenticate.
  4. Running init processes the cloud block and configures workspace connectivity before plans or applies.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to consume a module managed by the organization's HCP private registry, so it produces the behavior described. In contrast, terraform login serves a different goal: authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname, not consume a module managed by the organization's HCP private registry.

Incorrect Answers

A:

The description applies to HCP Terraform run tasks integration when an engineer needs to send proposed changes to a third-party quality or security check service; the named an HCP private registry module source instead handles the requirement to consume a module managed by the organization's HCP private registry, so this behavior does not describe An HCP private registry module source in the situation named.

C:

The description applies to terraform login when an engineer needs to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname; the named an HCP private registry module source instead handles the requirement to consume a module managed by the organization's HCP private registry, so this behavior does not describe An HCP private registry module source in the situation named.

D:

The description applies to terraform init after adding cloud integration when an engineer needs to configure the local working directory to connect with the selected HCP workspace; the named an HCP private registry module source instead handles the requirement to consume a module managed by the organization's HCP private registry, so this behavior does not describe An HCP private registry module source in the situation named.

Question 981

An engineer proposes “Version-controlled infrastructure definition” to determine a safe sequence for creating objects with references between them. Which outcome does the proposed technique actually provide?

  1. Terraform derives dependency edges from references, using the graph to order dependent changes and permit safe parallel operations.
  2. Terraform state records mappings and attributes needed to compare future plans without rediscovering every object's identity from scratch.
  3. Infrastructure configuration can be committed and reviewed in version control so the intended change is traceable before a Terraform run.
  4. IaC configuration provides repeatable definitions; variables and isolated state allow environments to differ without independently hand-building each object.

Explanation

Correct Answer

C:

Version-controlled infrastructure definition is used when an operator needs to review a proposed infrastructure change before team members deploy it. Consequently, this choice cannot meet the separate requirement to determine a safe sequence for creating objects with references between them. The intended action would instead require A resource graph.

Incorrect Answers

A:

That outcome belongs to A resource graph, the mechanism that can determine a safe sequence for creating objects with references between them. The question concerns the engineer’s actual proposal, Version-controlled infrastructure definition; it is directed at review a proposed infrastructure change before team members deploy it, not that result.

B:

This behavior belongs to State-backed object tracking, which helps engineers retain the association between a configuration address and its actual managed object rather than satisfying the separate requirement to determine a safe sequence for creating objects with references between them. The attempted technique was Version-controlled infrastructure definition; it would instead be used to review a proposed infrastructure change before team members deploy it, not to produce the effect associated with State-backed object tracking.

D:

This behavior belongs to Repeatable environment definition, which helps engineers recreate the same logical infrastructure design across test and production rather than satisfying the separate requirement to determine a safe sequence for creating objects with references between them. The attempted technique was Version-controlled infrastructure definition; it would instead be used to review a proposed infrastructure change before team members deploy it, not to produce the effect associated with Repeatable environment definition.

Question 982

During a design review, the requirement is to read a field from a configured data source in another expression. Which option should the engineer select?

  1. The resource address format
  2. A data attribute reference
  3. Explicit depends_on
  4. each.key

Explanation

Correct Answer

B:

The syntax data.TYPE.NAME.ATTRIBUTE accesses attributes returned by an existing-object query; this directly meets the requirement to read a field from a configured data source in another expression. By comparison, the resource address format is intended to identify a resource instance by its type and local name, which is a different task from read a field from a configured data source in another expression.

Incorrect Answers

A:

A resource address inside a module ordinarily uses TYPE.NAME, with optional instance indexing when count or for_each is used; this mechanism is useful when the job is to identify a resource instance by its type and local name, whereas the current scenario requires the engineer to read a field from a configured data source in another expression. These operations have different effects in the stated Terraform workflow.

C:

The depends_on meta-argument adds dependency edges for a known relationship that Terraform cannot otherwise infer; this mechanism is useful when the job is to order resources when there is a dependency not expressed by attribute references, whereas the current scenario requires the engineer to read a field from a configured data source in another expression. These operations have different effects in the stated Terraform workflow.

D:

In a for_each resource block, each.key identifies the current map key or set element for that instance; this mechanism is useful when the job is to refer to the stable key of a for_each resource instance, whereas the current scenario requires the engineer to read a field from a configured data source in another expression. These operations have different effects in the stated Terraform workflow.

Question 983

A Terraform change proposal names “terraform apply -auto-approve” to suppress Terraform's normal approval prompt in a controlled pipeline. Which outcome can reviewers attribute to that particular mechanism?

  1. Provider API operations use the provider's configured credentials or supported ambient authentication, not the login name in a commit.
  2. Passing the saved plan file to terraform apply uses its recorded choices; applying a plan file does not start a new interactive replanning step.
  3. Root output blocks expose values Terraform calculates from the applied resource graph; output display is not an access-control boundary.
  4. A partial apply may have changed some resources, so Terraform should refresh and build a new plan rather than blindly assuming a full rollback.
  5. The auto-approve option allows the automatically created plan to proceed without interactive confirmation, so pipeline safeguards matter.

Explanation

Correct Answer

E:

The named mechanism is used when the objective is to suppress Terraform's normal approval prompt in a controlled pipeline, so it produces the behavior described. In contrast, apply failure recovery serves a different goal: inspect state and re-plan when a provider operation fails partway through, not suppress Terraform's normal approval prompt in a controlled pipeline.

Incorrect Answers

A:

The description applies to apply using current credentials when an engineer needs to determine which identity actually performs infrastructure changes; the named terraform apply -auto-approve instead handles the requirement to suppress Terraform's normal approval prompt in a controlled pipeline, so this behavior does not describe terraform apply -auto-approve in the situation named.

B:

The description applies to apply a saved plan when an engineer needs to execute exactly the plan artifact that was reviewed; the named terraform apply -auto-approve instead handles the requirement to suppress Terraform's normal approval prompt in a controlled pipeline, so this behavior does not describe terraform apply -auto-approve in the situation named.

C:

The description applies to post-apply outputs when an engineer needs to retrieve computed identifiers that can be used by deployment automation; the named terraform apply -auto-approve instead handles the requirement to suppress Terraform's normal approval prompt in a controlled pipeline, so this behavior does not describe terraform apply -auto-approve in the situation named.

D:

The description applies to apply failure recovery when an engineer needs to inspect state and re-plan when a provider operation fails partway through; the named terraform apply -auto-approve instead handles the requirement to suppress Terraform's normal approval prompt in a controlled pipeline, so this behavior does not describe terraform apply -auto-approve in the situation named.

Question 984

A team compares Terraform mechanisms for the goal to avoid coupling different teams' deploys into a single state and blast radius. Which stated consequence belongs specifically to “One state per independently owned system”?

  1. VCS connection details identify the source code changes that should trigger a workspace's Terraform run.
  2. Workspace tags help group and select workspaces, including when a CLI cloud block targets tagged workspace sets.
  3. Variable sets can be scoped to projects to share configuration while avoiding repetitive per-workspace assignments.
  4. Separate workspaces allow independent state lifecycles for services that are changed and approved separately.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to avoid coupling different teams' deploys into a single state and blast radius, so it produces the behavior described. In contrast, project-level variable sets serves a different goal: assign common environment values to a group of workspaces, not avoid coupling different teams' deploys into a single state and blast radius.

Incorrect Answers

A:

The description applies to a workspace's VCS repository settings when an engineer needs to define which configuration branch or directory produces automatic runs; the named one state per independently owned system instead handles the requirement to avoid coupling different teams' deploys into a single state and blast radius, so this behavior does not describe One state per independently owned system in the situation named.

B:

The description applies to workspace tags when an engineer needs to categorize HCP Terraform workspaces for filtering or configuration selection; the named one state per independently owned system instead handles the requirement to avoid coupling different teams' deploys into a single state and blast radius, so this behavior does not describe One state per independently owned system in the situation named.

C:

The description applies to project-level variable sets when an engineer needs to assign common environment values to a group of workspaces; the named one state per independently owned system instead handles the requirement to avoid coupling different teams' deploys into a single state and blast radius, so this behavior does not describe One state per independently owned system in the situation named.

Question 985

During a design review, the requirement is to control whether a caller can intentionally pass null to an input variable. Which option should the engineer select?

  1. A sensitive output
  2. A locals block
  3. terraform output -json
  4. A nullable variable setting

Explanation

Correct Answer

D:

The nullable argument on a variable declaration determines whether null is a valid override of its normal value; this directly meets the requirement to control whether a caller can intentionally pass null to an input variable. By comparison, a locals block is intended to compute and reuse a derived expression without asking callers to supply it, which is a different task from control whether a caller can intentionally pass null to an input variable.

Incorrect Answers

A:

Marking an output sensitive redacts ordinary CLI presentation, but does not by itself prevent storage in state; this mechanism is useful when the job is to hide a secret-like output from Terraform's usual human-readable display, whereas the current scenario requires the engineer to control whether a caller can intentionally pass null to an input variable. These operations have different effects in the stated Terraform workflow.

B:

Local values are internal named expressions accessed using local.NAME; they are not module input parameters; this mechanism is useful when the job is to compute and reuse a derived expression without asking callers to supply it, whereas the current scenario requires the engineer to control whether a caller can intentionally pass null to an input variable. These operations have different effects in the stated Terraform workflow.

C:

The JSON output mode serializes output values and metadata for automation; it can expose sensitive values and must be protected; this mechanism is useful when the job is to retrieve root outputs for integration with another program, whereas the current scenario requires the engineer to control whether a caller can intentionally pass null to an input variable. These operations have different effects in the stated Terraform workflow.

Question 986

A Terraform reviewer encounters “An optional object attribute” while assessing how to accept an omitted field in a structured object input. Which statement correctly describes its actual behavior?

  1. tolist converts compatible values to a list, but a source set's original order is not inherently meaningful.
  2. The count meta-argument uses an integer expression and creates zero-based numeric instance addresses.
  3. tomap attempts to convert an input value into a map whose values share a compatible element type.
  4. The optional type modifier inside an object constraint allows the caller to omit a field and optionally sets a default.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to accept an omitted field in a structured object input, so it produces the behavior described. In contrast, count with a number serves a different goal: create a specified number of similarly configured resource instances, not accept an omitted field in a structured object input.

Incorrect Answers

A:

The description applies to tolist conversion when an engineer needs to coerce a suitable collection into a list for ordered operations; the named an optional object attribute instead handles the requirement to accept an omitted field in a structured object input, so this behavior does not describe An optional object attribute in the situation named.

B:

The description applies to count with a number when an engineer needs to create a specified number of similarly configured resource instances; the named an optional object attribute instead handles the requirement to accept an omitted field in a structured object input, so this behavior does not describe An optional object attribute in the situation named.

C:

The description applies to tomap conversion when an engineer needs to turn a compatible collection into a uniform-keyed map; the named an optional object attribute instead handles the requirement to accept an omitted field in a structured object input, so this behavior does not describe An optional object attribute in the situation named.

Question 987

In a Terraform configuration, what value does the HCL expression lookup({dev=2}, "prod", 4) evaluate to?

  1. 4
  2. 0
  3. null
  4. 2

Explanation

Correct Answer

A:

The expression lookup({dev=2}, "prod", 4) evaluates to 4 because prod is not a key in the map, so lookup returns the explicit fallback. This is Terraform's direct evaluation of the supplied literal arguments in lookup({dev=2}, "prod", 4), not an external provider lookup.

Incorrect Answers

B:

Lookup does not invent a zero when its supplied fallback is four. HCL evaluates lookup({dev=2}, "prod", 4) using the supplied arguments: prod is not a key in the map, so lookup returns the explicit fallback; the listed result is therefore incorrect.

C:

A default value is supplied, so this call does not return null for an absent key. In this specific evaluation, prod is not a key in the map, so lookup returns the explicit fallback, which rules out the proposed alternative.

D:

The dev value is not used for the missing prod key. For lookup({dev=2}, "prod", 4), prod is not a key in the map, so lookup returns the explicit fallback; consequently this candidate is not the value Terraform computes.

Question 988

A Terraform reviewer encounters “Sentinel policy enforcement” while assessing how to evaluate organizational infrastructure rules during HCP Terraform runs. Which statement correctly describes its actual behavior?

  1. Sentinel policies can assess planned infrastructure and produce policy check outcomes before a run can apply when enforcement requires it.
  2. HCP Terraform permissions differentiate viewing configuration and runs from authorized apply or administration operations.
  3. Private registry modules can be published, versioned and discovered by authorized HCP Terraform users.
  4. HCP Terraform can use supported dynamic provider credentials that are generated for runs rather than stored as permanent workspace secrets.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to evaluate organizational infrastructure rules during HCP Terraform runs, so it produces the behavior described. In contrast, HCP provider dynamic credentials serves a different goal: replace standing cloud keys with short-lived run identities, not evaluate organizational infrastructure rules during HCP Terraform runs.

Incorrect Answers

B:

The description applies to workspace access separation when an engineer needs to prevent a developer with read access from automatically applying production changes; the named sentinel policy enforcement instead handles the requirement to evaluate organizational infrastructure rules during HCP Terraform runs, so this behavior does not describe Sentinel policy enforcement in the situation named.

C:

The description applies to the HCP private module registry when an engineer needs to share approved modules with organization members without relying on public registry visibility; the named sentinel policy enforcement instead handles the requirement to evaluate organizational infrastructure rules during HCP Terraform runs, so this behavior does not describe Sentinel policy enforcement in the situation named.

D:

The description applies to HCP provider dynamic credentials when an engineer needs to replace standing cloud keys with short-lived run identities; the named sentinel policy enforcement instead handles the requirement to evaluate organizational infrastructure rules during HCP Terraform runs, so this behavior does not describe Sentinel policy enforcement in the situation named.

Question 989

During a design review, the requirement is to read values explicitly declared as root outputs of the configuration. Which option should the engineer select?

  1. terraform state mv
  2. terraform workspace list
  3. terraform state pull
  4. terraform output

Explanation

Correct Answer

D:

The output command reports root output values rather than listing every raw attribute from state; this directly meets the requirement to read values explicitly declared as root outputs of the configuration. By comparison, terraform workspace list is intended to list the workspaces available through the initialized backend, which is a different task from read values explicitly declared as root outputs of the configuration.

Incorrect Answers

A:

State mv updates address mapping within state and does not move the real infrastructure object between regions or accounts; this mechanism is useful when the job is to change a tracked object's resource address after an intentional refactor, whereas the current scenario requires the engineer to read values explicitly declared as root outputs of the configuration. These operations have different effects in the stated Terraform workflow.

B:

Workspace list shows logical Terraform workspaces, which may correspond to separate state instances depending on backend support; this mechanism is useful when the job is to list the workspaces available through the initialized backend, whereas the current scenario requires the engineer to read values explicitly declared as root outputs of the configuration. These operations have different effects in the stated Terraform workflow.

C:

State pull reads the current snapshot to standard output, including potentially sensitive provider attributes; this mechanism is useful when the job is to export a state snapshot from the configured backend for careful examination, whereas the current scenario requires the engineer to read values explicitly declared as root outputs of the configuration. These operations have different effects in the stated Terraform workflow.

Question 990

The team evaluates “depends_on for module calls” for a requirement to wait for prerequisite objects before considering resources in another module. Which observed behavior belongs to that mechanism rather than a different Terraform feature?

  1. A module block can declare depends_on so all managed objects inside it observe the specified dependency relationship.
  2. The -target option narrows an operation to selected objects and prerequisites; routine selective deployment is not its intended model.
  3. The lifecycle ignore_changes list excludes chosen attributes from later update comparisons while creation still considers configured values.
  4. With all attributes ignored during updates, Terraform can still create and destroy the resource but does not reconcile field-level changes.
  5. This lifecycle rule uses planned resource actions as triggers for replacement and is not a general-purpose dependency selector.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to wait for prerequisite objects before considering resources in another module, so it produces the behavior described. In contrast, ignore_changes = all serves a different goal: disable updates to all managed resource attributes after creation, not wait for prerequisite objects before considering resources in another module.

Incorrect Answers

B:

The description applies to resource targeting as an exception when an engineer needs to repair an isolated broken dependency while acknowledging incomplete plan coverage; the named depends_on for module calls instead handles the requirement to wait for prerequisite objects before considering resources in another module, so this behavior does not describe depends_on for module calls in the situation named.

C:

The description applies to ignore_changes on a tag when an engineer needs to allow another system to update selected attributes without Terraform reverting them; the named depends_on for module calls instead handles the requirement to wait for prerequisite objects before considering resources in another module, so this behavior does not describe depends_on for module calls in the situation named.

D:

The description applies to ignore_changes = all when an engineer needs to disable updates to all managed resource attributes after creation; the named depends_on for module calls instead handles the requirement to wait for prerequisite objects before considering resources in another module, so this behavior does not describe depends_on for module calls in the situation named.

E:

The description applies to replace_triggered_by when an engineer needs to replace one managed resource when another managed resource's attribute changes; the named depends_on for module calls instead handles the requirement to wait for prerequisite objects before considering resources in another module, so this behavior does not describe depends_on for module calls in the situation named.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests