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

Question 870

Reviewers reject “Module-level depends_on” as a way to understand which source files Terraform loads as one module. Which actual behavior explains why the proposal is unsuitable?

  1. All Terraform configuration files in a module directory are combined as one module; filenames do not define separate execution units.
  2. depends_on on a module call affects all resources and data sources inside that module and can constrain concurrency.
  3. The module block's version argument can constrain registry modules and is separate from Terraform CLI and provider version settings.
  4. Parent configurations can pass one child module's outputs into another child's inputs to compose larger infrastructure systems.

Explanation

Correct Answer

B:

Module-level depends_on is used when an operator needs to create an explicit ordering edge for module resources that have a real hidden dependency. Consequently, this choice cannot meet the separate requirement to understand which source files Terraform loads as one module. The intended action would instead require A module root directory.

Incorrect Answers

A:

That outcome belongs to A module root directory, the mechanism that can understand which source files Terraform loads as one module. The question concerns the engineer’s actual proposal, Module-level depends_on; it is directed at create an explicit ordering edge for module resources that have a real hidden dependency, not that result.

C:

This behavior belongs to Using a module registry version, which helps engineers control which published module release a root configuration consumes rather than satisfying the separate requirement to understand which source files Terraform loads as one module. The attempted technique was Module-level depends_on; it would instead be used to create an explicit ordering edge for module resources that have a real hidden dependency, not to produce the effect associated with Using a module registry version.

D:

This behavior belongs to Module composition, which helps engineers combine small modules into a root configuration without producing one giant module rather than satisfying the separate requirement to understand which source files Terraform loads as one module. The attempted technique was Module-level depends_on; it would instead be used to create an explicit ordering edge for module resources that have a real hidden dependency, not to produce the effect associated with Module composition.

Question 871

During a design review, the requirement is to identify which remote object corresponds to a particular configuration resource. Which option should the engineer select?

  1. Terraform refresh during planning
  2. State resource addresses
  3. Separate state per environment
  4. Remote state sharing boundaries

Explanation

Correct Answer

B:

State maps Terraform instance addresses to remote object identifiers and remembered attributes for subsequent comparisons; this directly meets the requirement to identify which remote object corresponds to a particular configuration resource. By comparison, terraform state list is intended to inspect the addresses of instances currently tracked in state, which is a different task from identify which remote object corresponds to a particular configuration resource.

Incorrect Answers

A:

A normal plan attempts to refresh state from providers before comparing objects to the current configuration; this concerns the task to detect actual resource attributes rather than relying only on historical saved values, not the current need to identify which remote object corresponds to a particular configuration resource. A State resource addresses approach is appropriate here; the substituted Terraform refresh during planning option does not supply the specified Terraform capability.

C:

Distinct backends, workspaces or root configurations can isolate state, but the configuration must target the intended instance set; this mechanism is useful when the job is to prevent staging changes from unintentionally sharing the production state mapping, whereas the current scenario requires the engineer to identify which remote object corresponds to a particular configuration resource. These operations have different effects in the stated Terraform workflow.

D:

Reading a remote state output still requires access to the underlying snapshot; exporting data through a narrower interface can reduce exposure; this mechanism is useful when the job is to avoid exposing full state when another stack only needs a published identifier, whereas the current scenario requires the engineer to identify which remote object corresponds to a particular configuration resource. These operations have different effects in the stated Terraform workflow.

Question 872

An engineering checklist calls for separate outcomes: (1) retrieve child modules without running the complete backend and provider setup steps; (2) consider newer published module releases already allowed by a version constraint; (3) make a module input optional when callers do not require customization. Which THREE options implement the requested outcomes? Choose THREE.

  1. terraform get
  2. Provider and module version separation
  3. Parent-to-child argument passing
  4. Init -upgrade for registry modules
  5. A variable default inside a child
  6. Registry module documentation

Explanation

Correct Answers

A:

The terraform get command updates downloaded module sources only; routine workflows generally prefer terraform init; this meets the requirement to retrieve child modules without running the complete backend and provider setup steps, while the other selected techniques address consider newer published module releases already allowed by a version constraint and make a module input optional when callers do not require customization, which require their own distinct Terraform mechanisms.

D:

The upgrade mode reselects module versions subject to constraints instead of automatically keeping the previously installed copy; this meets the requirement to consider newer published module releases already allowed by a version constraint, while the other selected techniques address retrieve child modules without running the complete backend and provider setup steps and make a module input optional when callers do not require customization, which require their own distinct Terraform mechanisms.

E:

A default inside the child variable declaration applies when the caller omits that module argument; this meets the requirement to make a module input optional when callers do not require customization, while the other selected techniques address retrieve child modules without running the complete backend and provider setup steps and consider newer published module releases already allowed by a version constraint, which require their own distinct Terraform mechanisms.

Incorrect Answers

B:

Provider versions are constrained in required_providers and locked in .terraform.lock.hcl; registry modules use their module block version arguments; it addresses avoid confusing provider plugin selection with reusable module source selection, but this delivery instead requires retrieve child modules without running the complete backend and provider setup steps and consider newer published module releases already allowed by a version constraint and make a module input optional when callers do not require customization. The required combination involves terraform get and A variable default inside a child and Init -upgrade for registry modules, not the behavior of Provider and module version separation.

C:

A module block explicitly sets the child's declared input variables using arguments of matching names; it addresses set a reusable module's environment tag from the caller, but this delivery instead requires retrieve child modules without running the complete backend and provider setup steps and consider newer published module releases already allowed by a version constraint and make a module input optional when callers do not require customization. The required combination involves terraform get and A variable default inside a child and Init -upgrade for registry modules, not the behavior of Parent-to-child argument passing.

F:

Published module documentation and metadata describe the module interface and help consumers understand required arguments; it addresses determine a module's declared inputs, outputs, providers and usage examples, but this delivery instead requires retrieve child modules without running the complete backend and provider setup steps and consider newer published module releases already allowed by a version constraint and make a module input optional when callers do not require customization. The required combination involves terraform get and A variable default inside a child and Init -upgrade for registry modules, not the behavior of Registry module documentation.

Question 873

The team evaluates “A workspace variable” for a requirement to supply a configuration input or environment value for HCP Terraform runs. Which observed behavior belongs to that mechanism rather than a different Terraform feature?

  1. Workspace output values come from root module output blocks and can be consumed through supported interfaces.
  2. HCP Terraform workspaces can hold Terraform input variables and environment variables for run-time use.
  3. HCP Terraform can run the apply stage after its configured approval, policy and workflow requirements are satisfied.
  4. HCP Terraform runs have plan stages where proposed infrastructure operations can be inspected and checked.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to supply a configuration input or environment value for HCP Terraform runs, so it produces the behavior described. In contrast, a run apply phase serves a different goal: execute approved resource changes within an HCP Terraform workspace, not supply a configuration input or environment value for HCP Terraform runs.

Incorrect Answers

A:

The description applies to workspace outputs when an engineer needs to publish selected values produced by an HCP Terraform run; the named a workspace variable instead handles the requirement to supply a configuration input or environment value for HCP Terraform runs, so this behavior does not describe A workspace variable in the situation named.

C:

The description applies to a run apply phase when an engineer needs to execute approved resource changes within an HCP Terraform workspace; the named a workspace variable instead handles the requirement to supply a configuration input or environment value for HCP Terraform runs, so this behavior does not describe A workspace variable in the situation named.

D:

The description applies to a run plan phase when an engineer needs to review infrastructure differences before applying a workspace change; the named a workspace variable instead handles the requirement to supply a configuration input or environment value for HCP Terraform runs, so this behavior does not describe A workspace variable in the situation named.

Question 874

An engineer proposes “terraform state mv” to map an existing object's correct remote identifier to a Terraform address. Which outcome does the proposed technique actually provide?

  1. The lifecycle ignore_changes rule suppresses post-creation update plans for selected attributes while leaving other attributes managed.
  2. Import commands require the provider-defined identity format, not an arbitrary local Terraform block label.
  3. The state mv command reassigns a managed resource's address without contacting the provider to destroy the object.
  4. Refresh-only apply can update the recorded state to match observed remote attributes without modifying cloud resources.

Explanation

Correct Answer

C:

terraform state mv is used when an operator needs to change the address of a tracked object directly within state. Consequently, this choice cannot meet the separate requirement to map an existing object's correct remote identifier to a Terraform address. The intended action would instead require Import IDs defined by providers.

Incorrect Answers

A:

This behavior belongs to ignore_changes for shared ownership, which helps engineers stop Terraform from overwriting a field delegated to an external controller rather than satisfying the separate requirement to map an existing object's correct remote identifier to a Terraform address. The attempted technique was terraform state mv; it would instead be used to change the address of a tracked object directly within state, not to produce the effect associated with ignore_changes for shared ownership.

B:

That outcome belongs to Import IDs defined by providers, the mechanism that can map an existing object's correct remote identifier to a Terraform address. The question concerns the engineer’s actual proposal, terraform state mv; it is directed at change the address of a tracked object directly within state, not that result.

D:

This behavior belongs to terraform apply -refresh-only, which helps engineers accept current remote readings into Terraform's state through an apply operation rather than satisfying the separate requirement to map an existing object's correct remote identifier to a Terraform address. The attempted technique was terraform state mv; it would instead be used to change the address of a tracked object directly within state, not to produce the effect associated with terraform apply -refresh-only.

Question 875

An engineer intends to remove nested list layers to obtain a flat sequence and is reviewing “The flatten function”. What consequence follows from using it as intended?

  1. The condition ? value_a : value_b expression chooses a suitable branch without creating duplicate resource blocks.
  2. flatten recursively replaces nested lists with their constituent elements, while preserving ordered traversal.
  3. dynamic constructs blocks required by resource schemas; it does not create standalone Terraform resource declarations.
  4. base64encode applies a reversible encoding and should not be mistaken for encryption of secrets.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to remove nested list layers to obtain a flat sequence, so it produces the behavior described. In contrast, the base64encode function serves a different goal: turn ordinary string content into Base64 text, not remove nested list layers to obtain a flat sequence.

Incorrect Answers

A:

The description applies to the ternary conditional operator when an engineer needs to set a resource argument according to a boolean expression; the named the flatten function instead handles the requirement to remove nested list layers to obtain a flat sequence, so this behavior does not describe The flatten function in the situation named.

C:

The description applies to the dynamic block when an engineer needs to generate repeated nested blocks from a collection; the named the flatten function instead handles the requirement to remove nested list layers to obtain a flat sequence, so this behavior does not describe The flatten function in the situation named.

D:

The description applies to the base64encode function when an engineer needs to turn ordinary string content into Base64 text; the named the flatten function instead handles the requirement to remove nested list layers to obtain a flat sequence, so this behavior does not describe The flatten function in the situation named.

Question 876

An engineer intends to combine maps with later values overriding earlier keys and is reviewing “The merge function”. What consequence follows from using it as intended?

  1. merge overlays object or map arguments and chooses the value from the last argument containing a duplicate key.
  2. formatlist applies its formatting string across list elements to produce a list of formatted strings.
  3. lower converts letters to lowercase and is often used in consistent name expressions.
  4. The condition ? value_a : value_b expression chooses a suitable branch without creating duplicate resource blocks.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to combine maps with later values overriding earlier keys, so it produces the behavior described. In contrast, the ternary conditional operator serves a different goal: set a resource argument according to a boolean expression, not combine maps with later values overriding earlier keys.

Incorrect Answers

B:

The description applies to the formatlist function when an engineer needs to format each element of multiple lists using one common template; the named the merge function instead handles the requirement to combine maps with later values overriding earlier keys, so this behavior does not describe The merge function in the situation named.

C:

The description applies to the lower function when an engineer needs to normalize a string identifier to lowercase; the named the merge function instead handles the requirement to combine maps with later values overriding earlier keys, so this behavior does not describe The merge function in the situation named.

D:

The description applies to the ternary conditional operator when an engineer needs to set a resource argument according to a boolean expression; the named the merge function instead handles the requirement to combine maps with later values overriding earlier keys, so this behavior does not describe The merge function in the situation named.

Question 877

A Terraform change proposal names “State-backed dependency links” to maintain dependencies for resources that have been removed from configuration. Which outcome can reviewers attribute to that particular mechanism?

  1. The state snapshot records managed instance data and metadata needed to plan future actions.
  2. State can retain dependency information needed to correctly destroy objects no longer declared in configuration.
  3. The state list command enumerates Terraform resource addresses without creating or deleting infrastructure.
  4. Distinct backends, workspaces or root configurations can isolate state, but the configuration must target the intended instance set.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to maintain dependencies for resources that have been removed from configuration, so it produces the behavior described. In contrast, separate state per environment serves a different goal: prevent staging changes from unintentionally sharing the production state mapping, not maintain dependencies for resources that have been removed from configuration.

Incorrect Answers

A:

The description applies to state snapshots when an engineer needs to preserve Terraform's knowledge of managed infrastructure between CLI runs; the named state-backed dependency links instead handles the requirement to maintain dependencies for resources that have been removed from configuration, so this behavior does not describe State-backed dependency links in the situation named.

C:

The description applies to terraform state list when an engineer needs to inspect the addresses of instances currently tracked in state; the named state-backed dependency links instead handles the requirement to maintain dependencies for resources that have been removed from configuration, so this behavior does not describe State-backed dependency links in the situation named.

D:

The description applies to separate state per environment when an engineer needs to prevent staging changes from unintentionally sharing the production state mapping; the named state-backed dependency links instead handles the requirement to maintain dependencies for resources that have been removed from configuration, so this behavior does not describe State-backed dependency links in the situation named.

Question 878

During one infrastructure delivery, the team must satisfy all of the following: (1) avoid embedding cloud backend access keys into tracked Terraform source; (2) obtain the current state snapshot for inspection or controlled backup. Select TWO appropriate Terraform approaches. Choose TWO.

  1. An HCP Terraform cloud block
  2. Backend credentials from the environment
  3. terraform state pull
  4. terraform init -migrate-state
  5. ignore_changes for shared ownership

Explanation

Correct Answers

B:

Supported backends can discover authentication from environment settings or identity mechanisms rather than inline key literals; this meets the requirement to avoid embedding cloud backend access keys into tracked Terraform source, while the other selected techniques address obtain the current state snapshot for inspection or controlled backup, which require their own distinct Terraform mechanisms.

C:

The state pull command retrieves state from the configured backend and prints a snapshot that may contain secrets; this meets the requirement to obtain the current state snapshot for inspection or controlled backup, while the other selected techniques address avoid embedding cloud backend access keys into tracked Terraform source, which require their own distinct Terraform mechanisms.

Incorrect Answers

A:

The terraform cloud block connects configuration to HCP Terraform, and cannot coexist with a standard backend block in the same configuration; it addresses integrate Terraform CLI with an HCP organization and workspace, but this delivery instead requires avoid embedding cloud backend access keys into tracked Terraform source and obtain the current state snapshot for inspection or controlled backup. The required combination involves Backend credentials from the environment and terraform state pull, not the behavior of An HCP Terraform cloud block.

D:

After changing backend configuration, migrate-state attempts to transfer existing state instead of starting with an empty one; it addresses copy a known working state's snapshot into a new configured backend, but this delivery instead requires avoid embedding cloud backend access keys into tracked Terraform source and obtain the current state snapshot for inspection or controlled backup. The required combination involves Backend credentials from the environment and terraform state pull, not the behavior of terraform init -migrate-state.

E:

The lifecycle ignore_changes rule suppresses post-creation update plans for selected attributes while leaving other attributes managed; it addresses stop Terraform from overwriting a field delegated to an external controller, but this delivery instead requires avoid embedding cloud backend access keys into tracked Terraform source and obtain the current state snapshot for inspection or controlled backup. The required combination involves Backend credentials from the environment and terraform state pull, not the behavior of ignore_changes for shared ownership.

Question 879

An output block uses the value expression concat(["a", "b"], ["c"]). Assuming only the literal data shown, which result should be expected?

  1. ["a", "b", "c"] (flat three-element list)
  2. ["a", "b"] (nested third element)
  3. ["a", "b", ["c"]]
  4. ["c", "a", "b"]

Explanation

Correct Answer

A:

The expression concat(["a", "b"], ["c"]) evaluates to ["a", "b", "c"] because concat appends the second list's members to the end of the first list. This is Terraform's direct evaluation of the supplied literal arguments in concat(["a", "b"], ["c"]), not an external provider lookup.

Incorrect Answers

B:

The final element from the second list must be included. HCL evaluates concat(["a", "b"], ["c"]) using the supplied arguments: concat appends the second list's members to the end of the first list; the listed result is therefore incorrect.

C:

The nested-list structure would be retained by list nesting, not concat. For concat(["a", "b"], ["c"]), concat appends the second list's members to the end of the first list; consequently this candidate is not the value Terraform computes.

D:

Concat preserves argument order and does not place the second list first. In this specific evaluation, concat appends the second list's members to the end of the first list, which rules out the proposed alternative.

Question 880

A team compares Terraform mechanisms for the goal to instantiate a fixed number of child module copies. Which stated consequence belongs specifically to “A module with count”?

  1. Reusable modules normally declare provider requirements while callers supply provider configurations and credentials.
  2. Parent configurations can pass one child module's outputs into another child's inputs to compose larger infrastructure systems.
  3. The count meta-argument creates numerically indexed module instances such as module.worker[0].
  4. An output-to-input reference establishes a natural dependency and avoids imposing broad depends_on edges unnecessarily.
  5. The module block's source points to child configuration and its other arguments supply input variables and relevant meta-arguments.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to instantiate a fixed number of child module copies, so it produces the behavior described. In contrast, a module call block serves a different goal: instantiate a reusable configuration unit under a distinct local name, not instantiate a fixed number of child module copies.

Incorrect Answers

A:

The description applies to avoiding hard-coded child credentials when an engineer needs to keep authentication and deployment-specific region choices outside a reusable child module; the named a module with count instead handles the requirement to instantiate a fixed number of child module copies, so this behavior does not describe A module with count in the situation named.

B:

The description applies to module composition when an engineer needs to combine small modules into a root configuration without producing one giant module; the named a module with count instead handles the requirement to instantiate a fixed number of child module copies, so this behavior does not describe A module with count in the situation named.

D:

The description applies to a module dependency interface when an engineer needs to connect two modules by declared output and input values; the named a module with count instead handles the requirement to instantiate a fixed number of child module copies, so this behavior does not describe A module with count in the situation named.

E:

The description applies to a module call block when an engineer needs to instantiate a reusable configuration unit under a distinct local name; the named a module with count instead handles the requirement to instantiate a fixed number of child module copies, so this behavior does not describe A module with count in the situation named.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests