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

Question 860

A change request asks an engineer to prevent incompatible provider upgrades from affecting resource handling. Which choice best implements the requested behavior?

  1. Provider authentication environment variables
  2. Provider version compatibility
  3. The provider registry namespace
  4. Provider-defined data sources

Explanation

Correct Answer

B:

Version constraints and a shared lock file reduce unintended schema and behavior changes between deployments; this directly meets the requirement to prevent incompatible provider upgrades from affecting resource handling. By comparison, the provider registry namespace is intended to identify the publisher when providers share a type name, which is a different task from prevent incompatible provider upgrades from affecting resource handling.

Incorrect Answers

A:

Many provider plugins can read credentials from provider-specific environment variables or identity mechanisms, reducing secret exposure in configuration; this mechanism is useful when the job is to avoid hard-coding a provider's API credential into .tf files, whereas the current scenario requires the engineer to prevent incompatible provider upgrades from affecting resource handling. These operations have different effects in the stated Terraform workflow.

C:

The namespace portion of a source address separates provider publishers in the registry; this mechanism is useful when the job is to identify the publisher when providers share a type name, whereas the current scenario requires the engineer to prevent incompatible provider upgrades from affecting resource handling. These operations have different effects in the stated Terraform workflow.

D:

A provider's data source reads existing data and exposes attributes without creating or destroying the queried object; this mechanism is useful when the job is to read information from an external service without owning its lifecycle, whereas the current scenario requires the engineer to prevent incompatible provider upgrades from affecting resource handling. These operations have different effects in the stated Terraform workflow.

Question 861

An operations team replacing ad-hoc scripts requires a way to manage infrastructure services through a shared declarative workflow. Which Terraform approach most directly fulfills that request?

  1. A resource graph
  2. Declarative resource configuration
  3. Repeatable environment definition
  4. Provider-mediated API operations
  5. Version-controlled infrastructure definition

Explanation

Correct Answer

D:

Terraform Core evaluates configuration while provider plugins implement the provider-specific API operations; this directly meets the requirement to manage infrastructure services through a shared declarative workflow. By comparison, version-controlled infrastructure definition is intended to review a proposed infrastructure change before team members deploy it, which is a different task from manage infrastructure services through a shared declarative workflow.

Incorrect Answers

A:

Terraform derives dependency edges from references, using the graph to order dependent changes and permit safe parallel operations; this mechanism is useful when the job is to determine a safe sequence for creating objects with references between them, whereas the current scenario requires the engineer to manage infrastructure services through a shared declarative workflow. These operations have different effects in the stated Terraform workflow.

B:

Terraform interprets resource declarations, constructs a dependency graph, and asks providers to reconcile real objects with that desired state; this mechanism is useful when the job is to describe the desired infrastructure state instead of scripting every API step, whereas the current scenario requires the engineer to manage infrastructure services through a shared declarative workflow. These operations have different effects in the stated Terraform workflow.

C:

IaC configuration provides repeatable definitions; variables and isolated state allow environments to differ without independently hand-building each object; this mechanism is useful when the job is to recreate the same logical infrastructure design across test and production, whereas the current scenario requires the engineer to manage infrastructure services through a shared declarative workflow. These operations have different effects in the stated Terraform workflow.

E:

Infrastructure configuration can be committed and reviewed in version control so the intended change is traceable before a Terraform run; this mechanism is useful when the job is to review a proposed infrastructure change before team members deploy it, whereas the current scenario requires the engineer to manage infrastructure services through a shared declarative workflow. These operations have different effects in the stated Terraform workflow.

Question 862

During a design review, the requirement is to assign common environment values to a group of workspaces. Which option should the engineer select?

  1. Distinct production and staging workspaces
  2. A tagged cloud workspaces block
  3. Project-level variable sets
  4. One state per independently owned system

Explanation

Correct Answer

C:

Variable sets can be scoped to projects to share configuration while avoiding repetitive per-workspace assignments; this directly meets the requirement to assign common environment values to a group of workspaces. By comparison, one state per independently owned system is intended to avoid coupling different teams' deploys into a single state and blast radius, which is a different task from assign common environment values to a group of workspaces.

Incorrect Answers

A:

Each HCP Terraform workspace has its own state and run configuration so changes in one do not automatically update the other; this mechanism is useful when the job is to isolate state and runs for two deployment environments, whereas the current scenario requires the engineer to assign common environment values to a group of workspaces. These operations have different effects in the stated Terraform workflow.

B:

The cloud block can select a workspace set by supported tags, which differs from specifying one workspace name; this mechanism is useful when the job is to select workspaces using Terraform cloud configuration rather than a single explicit name, whereas the current scenario requires the engineer to assign common environment values to a group of workspaces. These operations have different effects in the stated Terraform workflow.

D:

Separate workspaces allow independent state lifecycles for services that are changed and approved separately; this mechanism is useful when the job is to avoid coupling different teams' deploys into a single state and blast radius, whereas the current scenario requires the engineer to assign common environment values to a group of workspaces. These operations have different effects in the stated Terraform workflow.

Question 863

An engineer preparing an infrastructure rollout needs to move existing state to a newly configured backend. Which feature or operation is the most direct match?

  1. The .terraform.lock.hcl file
  2. terraform init -migrate-state
  3. The .terraform directory
  4. terraform init -get=false

Explanation

Correct Answer

B:

The migrate-state flag attempts to copy prior state into the new backend and can prompt for migration confirmation; this directly meets the requirement to move existing state to a newly configured backend. By comparison, terraform init -get=false is intended to avoid downloading child modules during a narrowly scoped initialization, which is a different task from move existing state to a newly configured backend.

Incorrect Answers

A:

Terraform records provider version and checksum selections in its dependency lock file, which teams normally commit to source control; this mechanism is useful when the job is to identify which file should be checked in to preserve selected provider packages, whereas the current scenario requires the engineer to move existing state to a newly configured backend. These operations have different effects in the stated Terraform workflow.

C:

Terraform creates .terraform for module caches, provider installations and backend/workspace metadata; it is not a substitute for committed configuration; this mechanism is useful when the job is to identify where a working directory keeps installed modules and initialization metadata, whereas the current scenario requires the engineer to move existing state to a newly configured backend. These operations have different effects in the stated Terraform workflow.

D:

The get=false switch skips child module installation, which is generally safe only if module dependencies are already present; this mechanism is useful when the job is to avoid downloading child modules during a narrowly scoped initialization, whereas the current scenario requires the engineer to move existing state to a newly configured backend. These operations have different effects in the stated Terraform workflow.

Question 864

A Terraform state maintenance procedure has a concrete implementation goal: recover from a state change without relying solely on an unversioned primary file. What is the most appropriate Terraform mechanism?

  1. Backend configuration only in a root module
  2. A local state backup file
  3. The terraform.tfstate file
  4. A local backend path setting

Explanation

Correct Answer

B:

Terraform commonly writes backup snapshots for local state updates, but backups require the same confidentiality controls as state; this directly meets the requirement to recover from a state change without relying solely on an unversioned primary file. By comparison, a local backend path setting is intended to save the default workspace state to a nondefault local filename, which is a different task from recover from a state change without relying solely on an unversioned primary file.

Incorrect Answers

A:

Backend configuration is evaluated for the root module; defining backend settings inside reusable child modules does not give them separate state; this mechanism is useful when the job is to choose where a root deployment's state will be stored, whereas the current scenario requires the engineer to recover from a state change without relying solely on an unversioned primary file. These operations have different effects in the stated Terraform workflow.

C:

The default workspace's local state is kept as terraform.tfstate; this file may contain sensitive infrastructure details; this mechanism is useful when the job is to identify Terraform's default local state artifact, whereas the current scenario requires the engineer to recover from a state change without relying solely on an unversioned primary file. These operations have different effects in the stated Terraform workflow.

D:

The local backend supports a path argument for where the state file is stored on disk; this mechanism is useful when the job is to save the default workspace state to a nondefault local filename, whereas the current scenario requires the engineer to recover from a state change without relying solely on an unversioned primary file. These operations have different effects in the stated Terraform workflow.

Question 865

A runbook lists “Multiple calls to one module” for the task to deploy two independently managed stacks from the same module definition. Which technical effect should its description include?

  1. Module outputs provide explicit integration points between modules without relying on child resource addresses.
  2. depends_on on a module call affects all resources and data sources inside that module and can constrain concurrency.
  3. Two module blocks that use the same source create separate module instances and separate resource addresses.
  4. Reusable modules normally declare provider requirements while callers supply provider configurations and credentials.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to deploy two independently managed stacks from the same module definition, so it produces the behavior described. In contrast, a module output reference serves a different goal: use a network module's subnet IDs inside an application module call, not deploy two independently managed stacks from the same module definition.

Incorrect Answers

A:

The description applies to a module output reference when an engineer needs to use a network module's subnet IDs inside an application module call; the named multiple calls to one module instead handles the requirement to deploy two independently managed stacks from the same module definition, so this behavior does not describe Multiple calls to one module in the situation named.

B:

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 multiple calls to one module instead handles the requirement to deploy two independently managed stacks from the same module definition, so this behavior does not describe Multiple calls to one module in the situation named.

D:

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 multiple calls to one module instead handles the requirement to deploy two independently managed stacks from the same module definition, so this behavior does not describe Multiple calls to one module in the situation named.

Question 866

An engineer intends to understand why create_before_destroy can still fail on a uniquely named object and is reviewing “Lifecycle ordering versus API support”. What consequence follows from using it as intended?

  1. The -target option narrows an operation to selected objects and prerequisites; routine selective deployment is not its intended model.
  2. With all attributes ignored during updates, Terraform can still create and destroy the resource but does not reconcile field-level changes.
  3. The depends_on edge can relate the whole counted resource block to an upstream resource, rather than computing one edge by list position.
  4. Terraform can request early replacement creation, but remote API constraints may disallow two objects with the same globally unique name.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to understand why create_before_destroy can still fail on a uniquely named object, so it produces the behavior described. In contrast, count and depends_on together serves a different goal: make multiple resource instances wait for a shared prerequisite, not understand why create_before_destroy can still fail on a uniquely named object.

Incorrect Answers

A:

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 lifecycle ordering versus API support instead handles the requirement to understand why create_before_destroy can still fail on a uniquely named object, so this behavior does not describe Lifecycle ordering versus API support in the situation named.

B:

The description applies to ignore_changes = all when an engineer needs to disable updates to all managed resource attributes after creation; the named lifecycle ordering versus API support instead handles the requirement to understand why create_before_destroy can still fail on a uniquely named object, so this behavior does not describe Lifecycle ordering versus API support in the situation named.

C:

The description applies to count and depends_on together when an engineer needs to make multiple resource instances wait for a shared prerequisite; the named lifecycle ordering versus API support instead handles the requirement to understand why create_before_destroy can still fail on a uniquely named object, so this behavior does not describe Lifecycle ordering versus API support in the situation named.

Question 867

An engineer proposes “Remote backend support for workspaces” to switch backend settings without performing automatic state migration. Which outcome does the proposed technique actually provide?

  1. The reconfigure flag discards cached previous backend settings and does not copy the prior state snapshot.
  2. Workspace support depends on the selected backend, and each workspace tracks its own state snapshot.
  3. Terraform detects changed backend settings and requires initialization with an explicit migration or reconfiguration choice.
  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

B:

Remote backend support for workspaces is used when an operator needs to use multiple logical state namespaces when the backend implementation supports it. Consequently, this choice cannot meet the separate requirement to switch backend settings without performing automatic state migration. The intended action would instead require terraform init -reconfigure.

Incorrect Answers

A:

That outcome belongs to terraform init -reconfigure, the mechanism that can switch backend settings without performing automatic state migration. The question concerns the engineer’s actual proposal, Remote backend support for workspaces; it is directed at use multiple logical state namespaces when the backend implementation supports it, not that result.

C:

This behavior belongs to Init after changing state storage, which helps engineers adopt a new remote state destination after editing configuration rather than satisfying the separate requirement to switch backend settings without performing automatic state migration. The attempted technique was Remote backend support for workspaces; it would instead be used to use multiple logical state namespaces when the backend implementation supports it, not to produce the effect associated with Init after changing state storage.

D:

This behavior belongs to An HCP Terraform cloud block, which helps engineers integrate Terraform CLI with an HCP organization and workspace rather than satisfying the separate requirement to switch backend settings without performing automatic state migration. The attempted technique was Remote backend support for workspaces; it would instead be used to use multiple logical state namespaces when the backend implementation supports it, not to produce the effect associated with An HCP Terraform cloud block.

Question 868

A runbook lists “A list of strings type” for the task to accept an ordered collection of same-type string values. Which technical effect should its description include?

  1. In supported contexts, setting an optional resource argument to null behaves like leaving that argument unset.
  2. Terraform's condition ? true_value : false_value syntax chooses one branch while reconciling compatible result types.
  3. The count meta-argument uses an integer expression and creates zero-based numeric instance addresses.
  4. The type constraint list(string) represents ordered string elements and supports numeric indexing, preserving element order.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to accept an ordered collection of same-type string values, so it produces the behavior described. In contrast, a conditional expression serves a different goal: select between two expression results based on a boolean predicate, not accept an ordered collection of same-type string values.

Incorrect Answers

A:

The description applies to the null value when an engineer needs to represent the absence of an optional argument value; the named a list of strings type instead handles the requirement to accept an ordered collection of same-type string values, so this behavior does not describe A list of strings type in the situation named.

B:

The description applies to a conditional expression when an engineer needs to select between two expression results based on a boolean predicate; the named a list of strings type instead handles the requirement to accept an ordered collection of same-type string values, so this behavior does not describe A list of strings type in the situation named.

C:

The description applies to count with a number when an engineer needs to create a specified number of similarly configured resource instances; the named a list of strings type instead handles the requirement to accept an ordered collection of same-type string values, so this behavior does not describe A list of strings type in the situation named.

Question 869

A Terraform reviewer encounters “A major-series compatible constraint” while assessing how to accept minor and patch updates without crossing the next major version. Which statement correctly describes its actual behavior?

  1. Initialization resolves provider requirements, installs plugins, and prepares modules and backend settings in the working directory.
  2. The .terraform.lock.hcl file records selected provider versions and checksums to constrain subsequent installations.
  3. The pessimistic constraint ~> 5.3 permits version 5.3 and later releases below 6.0.0.
  4. The -upgrade switch permits newer versions that satisfy constraints instead of preserving current installed or locked selections.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to accept minor and patch updates without crossing the next major version, so it produces the behavior described. In contrast, terraform init -upgrade serves a different goal: intentionally reconsider previously locked provider and module selections, not accept minor and patch updates without crossing the next major version.

Incorrect Answers

A:

The description applies to terraform init when an engineer needs to download missing required provider plugins before planning; the named a major-series compatible constraint instead handles the requirement to accept minor and patch updates without crossing the next major version, so this behavior does not describe A major-series compatible constraint in the situation named.

B:

The description applies to the dependency lock file when an engineer needs to reproduce previously selected provider package versions on other machines; the named a major-series compatible constraint instead handles the requirement to accept minor and patch updates without crossing the next major version, so this behavior does not describe A major-series compatible constraint in the situation named.

D:

The description applies to terraform init -upgrade when an engineer needs to intentionally reconsider previously locked provider and module selections; the named a major-series compatible constraint instead handles the requirement to accept minor and patch updates without crossing the next major version, so this behavior does not describe A major-series compatible constraint in the situation named.

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.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests