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

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.

Question 111

A remote-state operations review requires a way to copy a known working state's snapshot into a new configured backend. Which Terraform approach most directly fulfills that request?

  1. terraform init -migrate-state
  2. Remote backend support for workspaces
  3. No input variable interpolation in a backend block
  4. Remote state encryption at rest

Explanation

Correct Answer

A:

After changing backend configuration, migrate-state attempts to transfer existing state instead of starting with an empty one; this directly meets the requirement to copy a known working state's snapshot into a new configured backend. By comparison, remote backend support for workspaces is intended to use multiple logical state namespaces when the backend implementation supports it, which is a different task from copy a known working state's snapshot into a new configured backend.

Incorrect Answers

B:

Workspace support depends on the selected backend, and each workspace tracks its own state snapshot; this mechanism is useful when the job is to use multiple logical state namespaces when the backend implementation supports it, whereas the current scenario requires the engineer to copy a known working state's snapshot into a new configured backend. These operations have different effects in the stated Terraform workflow.

C:

Backend configuration is processed at initialization, before ordinary input expressions are evaluated, so it cannot use regular variables or locals; this mechanism is useful when the job is to avoid expecting var.region or local.name to populate backend settings, whereas the current scenario requires the engineer to copy a known working state's snapshot into a new configured backend. These operations have different effects in the stated Terraform workflow.

D:

Encryption is controlled by the chosen backend service; Terraform's remote backend abstraction does not supply one universal encryption mechanism; this mechanism is useful when the job is to protect stored state contents from unauthorized storage-layer access, whereas the current scenario requires the engineer to copy a known working state's snapshot into a new configured backend. These operations have different effects in the stated Terraform workflow.

Question 112

An engineer troubleshooting a .tf configuration has a concrete implementation goal: allow another system to update selected attributes without Terraform reverting them. What is the most appropriate Terraform mechanism?

  1. Output-level depends_on
  2. An implicit dependency through an ID
  3. Resource targeting as an exception
  4. ignore_changes on a tag
  5. Lifecycle ordering versus API support

Explanation

Correct Answer

D:

The lifecycle ignore_changes list excludes chosen attributes from later update comparisons while creation still considers configured values; this directly meets the requirement to allow another system to update selected attributes without Terraform reverting them. By comparison, lifecycle ordering versus API support is intended to understand why create_before_destroy can still fail on a uniquely named object, which is a different task from allow another system to update selected attributes without Terraform reverting them.

Incorrect Answers

A:

An output block can express an explicit dependency beyond references contained in its value expression; this mechanism is useful when the job is to prevent a module output from being considered ready before an additional side-effect resource, whereas the current scenario requires the engineer to allow another system to update selected attributes without Terraform reverting them. These operations have different effects in the stated Terraform workflow.

B:

Using the network object's ID in the subnet argument automatically creates a dependency edge in the graph; this mechanism is useful when the job is to make a subnet wait for the network resource it references, whereas the current scenario requires the engineer to allow another system to update selected attributes without Terraform reverting them. These operations have different effects in the stated Terraform workflow.

C:

The -target option narrows an operation to selected objects and prerequisites; routine selective deployment is not its intended model; this mechanism is useful when the job is to repair an isolated broken dependency while acknowledging incomplete plan coverage, whereas the current scenario requires the engineer to allow another system to update selected attributes without Terraform reverting them. These operations have different effects in the stated Terraform workflow.

E:

Terraform can request early replacement creation, but remote API constraints may disallow two objects with the same globally unique name; this mechanism is useful when the job is to understand why create_before_destroy can still fail on a uniquely named object, whereas the current scenario requires the engineer to allow another system to update selected attributes without Terraform reverting them. These operations have different effects in the stated Terraform workflow.

Question 113

A state migration and recovery exercise requires a way to wait for a temporary state lock instead of failing immediately. Which Terraform approach most directly fulfills that request?

  1. HCP Terraform run serialization
  2. terraform plan -lock-timeout
  3. Backend-specific lock support
  4. A backend state lock

Explanation

Correct Answer

B:

The lock-timeout option lets Terraform retry lock acquisition for a specified duration before returning an error; this directly meets the requirement to wait for a temporary state lock instead of failing immediately. By comparison, HCP Terraform run serialization is intended to avoid multiple infrastructure applies targeting the same shared HCP workspace state, which is a different task from wait for a temporary state lock instead of failing immediately.

Incorrect Answers

A:

HCP Terraform coordinates workspace runs and state handling, reducing conflicts among collaborating operators; this mechanism is useful when the job is to avoid multiple infrastructure applies targeting the same shared HCP workspace state, whereas the current scenario requires the engineer to wait for a temporary state lock instead of failing immediately. These operations have different effects in the stated Terraform workflow.

C:

Backend state locking behavior depends on the backend implementation; remote storage alone does not guarantee safe locking; this mechanism is useful when the job is to check whether a chosen remote backend actually offers state locking, whereas the current scenario requires the engineer to wait for a temporary state lock instead of failing immediately. These operations have different effects in the stated Terraform workflow.

D:

Supported backends acquire a state lock so simultaneous writers cannot corrupt or overwrite each other's state changes; this mechanism is useful when the job is to serialize operations that write the same Terraform state, whereas the current scenario requires the engineer to wait for a temporary state lock instead of failing immediately. These operations have different effects in the stated Terraform workflow.

Question 114

A platform team separating infrastructure deployments has a concrete implementation goal: integrate external checks into a run before applying infrastructure changes. What is the most appropriate Terraform mechanism?

  1. The HCP private module registry
  2. OPA policy enforcement
  3. Sentinel policy enforcement
  4. Organization variable sets
  5. HCP Terraform run tasks
  6. Policy sets

Explanation

Correct Answer

E:

Run tasks send run context to integrated systems and can participate in checks or approval workflows, depending on configuration; this directly meets the requirement to integrate external checks into a run before applying infrastructure changes. By comparison, sentinel policy enforcement is intended to evaluate organizational infrastructure rules during HCP Terraform runs, which is a different task from integrate external checks into a run before applying infrastructure changes.

Incorrect Answers

A:

Private registry modules can be published, versioned and discovered by authorized HCP Terraform users; this mechanism is useful when the job is to share approved modules with organization members without relying on public registry visibility, whereas the current scenario requires the engineer to integrate external checks into a run before applying infrastructure changes. These operations have different effects in the stated Terraform workflow.

B:

HCP Terraform supports OPA-based policy sets for automated governance on applicable runs; this mechanism is useful when the job is to check proposed infrastructure against rules expressed in Open Policy Agent policies, whereas the current scenario requires the engineer to integrate external checks into a run before applying infrastructure changes. These operations have different effects in the stated Terraform workflow.

C:

Sentinel policies can assess planned infrastructure and produce policy check outcomes before a run can apply when enforcement requires it; this mechanism is useful when the job is to evaluate organizational infrastructure rules during HCP Terraform runs, whereas the current scenario requires the engineer to integrate external checks into a run before applying infrastructure changes. These operations have different effects in the stated Terraform workflow.

D:

Variable sets let administrators manage common workspace variables centrally and scope them to intended workspaces or projects; this mechanism is useful when the job is to supply shared environment or Terraform input values across several workspaces, whereas the current scenario requires the engineer to integrate external checks into a run before applying infrastructure changes. These operations have different effects in the stated Terraform workflow.

F:

Policy sets organize policy rules and their workspace or project applicability rather than modifying provider schemas directly; this mechanism is useful when the job is to attach a shared governance policy collection to selected workspace scopes, whereas the current scenario requires the engineer to integrate external checks into a run before applying infrastructure changes. These operations have different effects in the stated Terraform workflow.

Question 115

A Terraform change proposal names “An HCP Terraform project” to group related workspaces under one organizational and permissions boundary. Which outcome can reviewers attribute to that particular mechanism?

  1. Project-level access scopes workspace capabilities for teams based on organizational boundaries.
  2. VCS connection details identify the source code changes that should trigger a workspace's Terraform run.
  3. Workspace settings store variables for that workspace's execution; global sets should not replace environment-specific data blindly.
  4. Projects organize workspaces by application, team or environment, simplifying scope and access administration.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to group related workspaces under one organizational and permissions boundary, so it produces the behavior described. In contrast, project-scoped team access serves a different goal: delegate administration of one team's project without granting universal organization access, not group related workspaces under one organizational and permissions boundary.

Incorrect Answers

A:

The description applies to project-scoped team access when an engineer needs to delegate administration of one team's project without granting universal organization access; the named an HCP Terraform project instead handles the requirement to group related workspaces under one organizational and permissions boundary, so this behavior does not describe An HCP Terraform project in the situation named.

B:

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 an HCP Terraform project instead handles the requirement to group related workspaces under one organizational and permissions boundary, so this behavior does not describe An HCP Terraform project in the situation named.

C:

The description applies to workspace-specific variables when an engineer needs to override or tailor values used by one particular stack; the named an HCP Terraform project instead handles the requirement to group related workspaces under one organizational and permissions boundary, so this behavior does not describe An HCP Terraform project in the situation named.

Question 116

During an infrastructure design review about how to create one child module instance for each stable application key, a maintainer asks what “A module with for_each” does. Which description is accurate?

  1. Reusable modules normally declare provider requirements while callers supply provider configurations and credentials.
  2. The for_each meta-argument instantiates keyed module instances addressable as module.NAME["key"].
  3. depends_on on a module call affects all resources and data sources inside that module and can constrain concurrency.
  4. The module block's version argument can constrain registry modules and is separate from Terraform CLI and provider version settings.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to create one child module instance for each stable application key, so it produces the behavior described. In contrast, avoiding hard-coded child credentials serves a different goal: keep authentication and deployment-specific region choices outside a reusable child module, not create one child module instance for each stable application key.

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 for_each instead handles the requirement to create one child module instance for each stable application key, so this behavior does not describe A module with for_each in the situation named.

C:

The description applies to module-level depends_on when an engineer needs to create an explicit ordering edge for module resources that have a real hidden dependency; the named a module with for_each instead handles the requirement to create one child module instance for each stable application key, so this behavior does not describe A module with for_each in the situation named.

D:

The description applies to using a module registry version when an engineer needs to control which published module release a root configuration consumes; the named a module with for_each instead handles the requirement to create one child module instance for each stable application key, so this behavior does not describe A module with for_each in the situation named.

Question 117

During one infrastructure delivery, the team must satisfy all of the following: (1) save the default workspace state to a nondefault local filename; (2) stop Terraform from overwriting a field delegated to an external controller. Select TWO appropriate Terraform approaches. Choose TWO.

  1. The local backend's lack of team collaboration features
  2. terraform state rm
  3. A local backend path setting
  4. A state import workflow
  5. ignore_changes for shared ownership

Explanation

Correct Answers

C:

The local backend supports a path argument for where the state file is stored on disk; this meets the requirement to save the default workspace state to a nondefault local filename, while the other selected techniques address stop Terraform from overwriting a field delegated to an external controller, which require their own distinct Terraform mechanisms.

E:

The lifecycle ignore_changes rule suppresses post-creation update plans for selected attributes while leaving other attributes managed; this meets the requirement to stop Terraform from overwriting a field delegated to an external controller, while the other selected techniques address save the default workspace state to a nondefault local filename, which require their own distinct Terraform mechanisms.

Incorrect Answers

A:

Local files do not provide an organization-wide shared state or distributed locking comparable to an appropriately configured remote backend; it addresses avoid concurrent writes from multiple operators on different machines, but this delivery instead requires save the default workspace state to a nondefault local filename and stop Terraform from overwriting a field delegated to an external controller. The required combination involves A local backend path setting and ignore_changes for shared ownership, not the behavior of The local backend's lack of team collaboration features.

B:

The state rm command removes the association so the remote object remains but is no longer tracked by that state; it addresses forget a managed object without destroying the corresponding real infrastructure, but this delivery instead requires save the default workspace state to a nondefault local filename and stop Terraform from overwriting a field delegated to an external controller. The required combination involves A local backend path setting and ignore_changes for shared ownership, not the behavior of terraform state rm.

D:

Importing attaches the remote object's identity to state; compatible configuration is still needed to avoid unwanted changes afterward; it addresses associate existing infrastructure with a newly declared Terraform resource address, but this delivery instead requires save the default workspace state to a nondefault local filename and stop Terraform from overwriting a field delegated to an external controller. The required combination involves A local backend path setting and ignore_changes for shared ownership, not the behavior of A state import workflow.

Question 118

A Terraform module author requires a way to parse a JSON document string into Terraform values. Which Terraform approach most directly fulfills that request?

  1. The dynamic block
  2. The jsondecode function
  3. The file function
  4. The formatlist function

Explanation

Correct Answer

B:

jsondecode converts JSON input into native maps, objects, lists or primitives used in expressions; this directly meets the requirement to parse a JSON document string into Terraform values. By comparison, the dynamic block is intended to generate repeated nested blocks from a collection, which is a different task from parse a JSON document string into Terraform values.

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 parse a JSON document string into Terraform values. 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 parse a JSON document string into Terraform values. These operations have different effects in the stated Terraform workflow.

D:

formatlist applies its formatting string across list elements to produce a list of formatted strings; this mechanism is useful when the job is to format each element of multiple lists using one common template, whereas the current scenario requires the engineer to parse a JSON document string into Terraform values. These operations have different effects in the stated Terraform workflow.

Question 119

The team evaluates “An HCP Terraform cloud block” for a requirement to integrate Terraform CLI with an HCP organization and workspace. Which observed behavior belongs to that mechanism rather than a different Terraform feature?

  1. Using distinct backend keys or workspaces creates separate state namespaces instead of letting unrelated root configurations share one snapshot.
  2. Backend config arguments supplied at init time fill required values, but sensitive content can still be cached in local metadata or plans.
  3. The S3 backend uses configured bucket and key settings, plus suitable authentication and optional locking support.
  4. The terraform cloud block connects configuration to HCP Terraform, and cannot coexist with a standard backend block in the same configuration.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to integrate Terraform CLI with an HCP organization and workspace, so it produces the behavior described. In contrast, partial backend configuration serves a different goal: provide environment-specific backend details at initialization rather than hard-coding them, not integrate Terraform CLI with an HCP organization and workspace.

Incorrect Answers

A:

The description applies to backend state key separation when an engineer needs to store different applications' state snapshots at distinct object paths; the named an HCP Terraform cloud block instead handles the requirement to integrate Terraform CLI with an HCP organization and workspace, so this behavior does not describe An HCP Terraform cloud block in the situation named.

B:

The description applies to partial backend configuration when an engineer needs to provide environment-specific backend details at initialization rather than hard-coding them; the named an HCP Terraform cloud block instead handles the requirement to integrate Terraform CLI with an HCP organization and workspace, so this behavior does not describe An HCP Terraform cloud block in the situation named.

C:

The description applies to the S3 backend when an engineer needs to store Terraform state as an object in an S3 bucket; the named an HCP Terraform cloud block instead handles the requirement to integrate Terraform CLI with an HCP organization and workspace, so this behavior does not describe An HCP Terraform cloud block in the situation named.

Question 120

An engineer intends to avoid assuming a local calculation is automatically visible in a parent module and is reviewing “A local value confined to its module”. What consequence follows from using it as intended?

  1. Locals live within the module where defined and cannot be referenced from another module without passing or exposing a value.
  2. An object type lets a module enforce named configuration fields instead of accepting many untyped values.
  3. A child module may validate its input variables using conditions and errors independent of the parent's variable definitions.
  4. A child output can be marked sensitive, but its underlying value may still reside in state unless it uses permitted ephemeral handling.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to avoid assuming a local calculation is automatically visible in a parent module, so it produces the behavior described. In contrast, variable validation inside a module serves a different goal: enforce a reusable module's own input contract, not avoid assuming a local calculation is automatically visible in a parent module.

Incorrect Answers

B:

The description applies to input object variables when an engineer needs to pass a structured settings bundle into a reusable module; the named a local value confined to its module instead handles the requirement to avoid assuming a local calculation is automatically visible in a parent module, so this behavior does not describe A local value confined to its module in the situation named.

C:

The description applies to variable validation inside a module when an engineer needs to enforce a reusable module's own input contract; the named a local value confined to its module instead handles the requirement to avoid assuming a local calculation is automatically visible in a parent module, so this behavior does not describe A local value confined to its module in the situation named.

D:

The description applies to child module outputs and sensitivity when an engineer needs to limit ordinary display of a sensitive result exported from a reusable module; the named a local value confined to its module instead handles the requirement to avoid assuming a local calculation is automatically visible in a parent module, so this behavior does not describe A local value confined to its module in the situation named.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests