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

Question 840

A team proposes “A strict registry module pin” to allow compatible patch updates within a module's minor release series. If they proceed with that technique, which result should they anticipate instead?

  1. Changing a module source or version constraint requires reinitializing to resolve the updated selection.
  2. A module version constraint such as = 2.1.3 selects only that published version until the requirement changes.
  3. A module upgrade can change resource definitions and outputs, so the consumer should inspect the new source and resulting Terraform plan.
  4. Provider versions are constrained in required_providers and locked in .terraform.lock.hcl; registry modules use their module block version arguments.

Explanation

Correct Answer

B:

A strict registry module pin is used when an operator needs to reproduce a vetted module release without automatically selecting a newer one. Consequently, this choice cannot meet the separate requirement to allow compatible patch updates within a module's minor release series. The intended action would instead require A pessimistic module version constraint.

Incorrect Answers

A:

This behavior belongs to Init after module version change, which helps engineers install a newly allowed child module release after editing its version requirement rather than satisfying the separate requirement to allow compatible patch updates within a module's minor release series. The attempted technique was A strict registry module pin; it would instead be used to reproduce a vetted module release without automatically selecting a newer one, not to produce the effect associated with Init after module version change.

C:

This behavior belongs to Reviewing module upgrade changes, which helps engineers control behavioral changes after moving to a new module release rather than satisfying the separate requirement to allow compatible patch updates within a module's minor release series. The attempted technique was A strict registry module pin; it would instead be used to reproduce a vetted module release without automatically selecting a newer one, not to produce the effect associated with Reviewing module upgrade changes.

D:

That result belongs to Provider and module version separation, which is designed to avoid confusing provider plugin selection with reusable module source selection; the proposed technique in this failed implementation is A strict registry module pin. Its actual effect cannot be substituted for this unrelated result.

Question 841

A Terraform state maintenance procedure requires a way to store different applications' state snapshots at distinct object paths. Which Terraform approach most directly fulfills that request?

  1. No input variable interpolation in a backend block
  2. Remote state encryption at rest
  3. Backend state key separation
  4. terraform init -migrate-state

Explanation

Correct Answer

C:

Using distinct backend keys or workspaces creates separate state namespaces instead of letting unrelated root configurations share one snapshot; this directly meets the requirement to store different applications' state snapshots at distinct object paths. By comparison, no input variable interpolation in a backend block is intended to avoid expecting var.region or local.name to populate backend settings, which is a different task from store different applications' state snapshots at distinct object paths.

Incorrect Answers

A:

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 store different applications' state snapshots at distinct object paths. These operations have different effects in the stated Terraform workflow.

B:

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 store different applications' state snapshots at distinct object paths. These operations have different effects in the stated Terraform workflow.

D:

After changing backend configuration, migrate-state attempts to transfer existing state instead of starting with an empty one; this mechanism is useful when the job is to copy a known working state's snapshot into a new configured backend, whereas the current scenario requires the engineer to store different applications' state snapshots at distinct object paths. These operations have different effects in the stated Terraform workflow.

Question 842

During a design review, the requirement is to build a numbered name for each instance created using count. Which option should the engineer select?

  1. An implicit attribute dependency
  2. A variable reference
  3. count.index
  4. each.value
  5. A module output reference

Explanation

Correct Answer

C:

Resources using count can refer to the current instance number through count.index, a zero-based integer; this directly meets the requirement to build a numbered name for each instance created using count. By comparison, each.value is intended to read the per-instance map value when iterating with for_each, which is a different task from build a numbered name for each instance created using count.

Incorrect Answers

A:

Referencing another managed resource's attribute creates an implicit dependency in Terraform's graph; this mechanism is useful when the job is to ensure a dependent resource waits for the object whose ID it needs, whereas the current scenario requires the engineer to build a numbered name for each instance created using count. These operations have different effects in the stated Terraform workflow.

B:

var.NAME reads a declared input variable in the module where the variable block is defined; this mechanism is useful when the job is to inject a caller-supplied input into a resource argument, whereas the current scenario requires the engineer to build a numbered name for each instance created using count. These operations have different effects in the stated Terraform workflow.

D:

For a map-based for_each collection, each.value exposes the value associated with the current each.key; this mechanism is useful when the job is to read the per-instance map value when iterating with for_each, whereas the current scenario requires the engineer to build a numbered name for each instance created using count. These operations have different effects in the stated Terraform workflow.

E:

Parent configurations access child outputs using module.CHILD.OUTPUT; private child resource addresses are not automatically exported; this mechanism is useful when the job is to use a child module's published value in a parent resource, whereas the current scenario requires the engineer to build a numbered name for each instance created using count. These operations have different effects in the stated Terraform workflow.

Question 843

A runbook lists “Workspace-specific variables” for the task to override or tailor values used by one particular stack. Which technical effect should its description include?

  1. Workspaces can reference separate branches or release controls while retaining isolated state for each environment.
  2. Workspace settings store variables for that workspace's execution; global sets should not replace environment-specific data blindly.
  3. Separate workspaces allow independent state lifecycles for services that are changed and approved separately.
  4. A project is a grouping and access construct; changing project assignment does not turn two workspaces into one state.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to override or tailor values used by one particular stack, so it produces the behavior described. In contrast, project membership changes serves a different goal: move a workspace to a different organizational group without merging infrastructure state, not override or tailor values used by one particular stack.

Incorrect Answers

A:

The description applies to environment promotion via workspaces when an engineer needs to use a reviewed configuration revision across separate testing and production states; the named workspace-specific variables instead handles the requirement to override or tailor values used by one particular stack, so this behavior does not describe Workspace-specific variables in the situation named.

C:

The description applies to one state per independently owned system when an engineer needs to avoid coupling different teams' deploys into a single state and blast radius; the named workspace-specific variables instead handles the requirement to override or tailor values used by one particular stack, so this behavior does not describe Workspace-specific variables in the situation named.

D:

The description applies to project membership changes when an engineer needs to move a workspace to a different organizational group without merging infrastructure state; the named workspace-specific variables instead handles the requirement to override or tailor values used by one particular stack, so this behavior does not describe Workspace-specific variables in the situation named.

Question 844

During an infrastructure design review about how to verify an invariant about a resource after reading or managing it, a maintainer asks what “Resource postcondition” does. Which description is accurate?

  1. Variable validation rejects unacceptable values, whereas failed check assertions are intended for diagnostic warnings.
  2. Check assertions evaluate health expectations and normally report warning diagnostics rather than blocking deployment on a false condition.
  3. A postcondition evaluates a condition concerning resource results and blocks downstream use when its assertion fails.
  4. Static validate checks structural correctness, while condition expressions may depend on inputs or provider readings evaluated during plan or apply.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to verify an invariant about a resource after reading or managing it, so it produces the behavior described. In contrast, terraform validate versus runtime assertions serves a different goal: distinguish static configuration checks from conditions requiring actual resource values, not verify an invariant about a resource after reading or managing it.

Incorrect Answers

A:

The description applies to input validation versus check blocks when an engineer needs to choose a blocking input constraint rather than a monitoring-style assertion; the named resource postcondition instead handles the requirement to verify an invariant about a resource after reading or managing it, so this behavior does not describe Resource postcondition in the situation named.

B:

The description applies to the check block when an engineer needs to report a failed ongoing infrastructure assertion without ordinarily blocking the apply; the named resource postcondition instead handles the requirement to verify an invariant about a resource after reading or managing it, so this behavior does not describe Resource postcondition in the situation named.

D:

The description applies to terraform validate versus runtime assertions when an engineer needs to distinguish static configuration checks from conditions requiring actual resource values; the named resource postcondition instead handles the requirement to verify an invariant about a resource after reading or managing it, so this behavior does not describe Resource postcondition in the situation named.

Question 845

A change request asks an engineer to choose where a root deployment's state will be stored. Which choice best implements the requested behavior?

  1. Backend configuration only in a root module
  2. Local workspace state directories
  3. State migration from local storage
  4. A local backend path setting

Explanation

Correct Answer

A:

Backend configuration is evaluated for the root module; defining backend settings inside reusable child modules does not give them separate state; this directly meets the requirement to choose where a root deployment's state will be stored. By comparison, state migration from local storage is intended to move an established project to remote state without abandoning resource identity, which is a different task from choose where a root deployment's state will be stored.

Incorrect Answers

B:

When local workspaces are used, nondefault state snapshots are placed under a terraform.tfstate.d directory structure; this mechanism is useful when the job is to identify how the local backend stores nondefault workspaces, whereas the current scenario requires the engineer to choose where a root deployment's state will be stored. These operations have different effects in the stated Terraform workflow.

C:

Changing the root backend and running init -migrate-state can transfer the existing snapshot to the newly configured destination; this mechanism is useful when the job is to move an established project to remote state without abandoning resource identity, whereas the current scenario requires the engineer to choose where a root deployment's state will be stored. 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 choose where a root deployment's state will be stored. These operations have different effects in the stated Terraform workflow.

Question 846

A Terraform module author requires a way to understand why create_before_destroy can still fail on a uniquely named object. Which Terraform approach most directly fulfills that request?

  1. count and depends_on together
  2. Resource targeting as an exception
  3. ignore_changes = all
  4. Lifecycle ordering versus API support

Explanation

Correct Answer

D:

Terraform can request early replacement creation, but remote API constraints may disallow two objects with the same globally unique name; this directly meets the requirement to understand why create_before_destroy can still fail on a uniquely named object. By comparison, count and depends_on together is intended to make multiple resource instances wait for a shared prerequisite, which is a different task from understand why create_before_destroy can still fail on a uniquely named object.

Incorrect Answers

A:

The depends_on edge can relate the whole counted resource block to an upstream resource, rather than computing one edge by list position; this mechanism is useful when the job is to make multiple resource instances wait for a shared prerequisite, whereas the current scenario requires the engineer to understand why create_before_destroy can still fail on a uniquely named object. These operations have different effects in the stated Terraform workflow.

B:

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 understand why create_before_destroy can still fail on a uniquely named object. These operations have different effects in the stated Terraform workflow.

C:

With all attributes ignored during updates, Terraform can still create and destroy the resource but does not reconcile field-level changes; this mechanism is useful when the job is to disable updates to all managed resource attributes after creation, whereas the current scenario requires the engineer to understand why create_before_destroy can still fail on a uniquely named object. These operations have different effects in the stated Terraform workflow.

Question 847

A change-control meeting for a root module requires a way to catch an argument whose expression does not match the provider schema. Which Terraform approach most directly fulfills that request?

  1. A type mismatch diagnosis
  2. terraform validate
  3. terraform fmt -check
  4. Validate after init

Explanation

Correct Answer

A:

Provider schemas and Terraform's type checking can make validate fail before an apply is attempted; this directly meets the requirement to catch an argument whose expression does not match the provider schema. By comparison, terraform fmt -check is intended to verify formatting without rewriting the files in a CI job, which is a different task from catch an argument whose expression does not match the provider schema.

Incorrect Answers

B:

The validate command checks syntax and schema consistency in an initialized configuration without obtaining a full execution plan; this mechanism is useful when the job is to check that Terraform configuration is structurally valid without planning resource changes, whereas the current scenario requires the engineer to catch an argument whose expression does not match the provider schema. These operations have different effects in the stated Terraform workflow.

C:

The fmt -check option exits with a failure status when source files would need formatting changes rather than altering them; this mechanism is useful when the job is to verify formatting without rewriting the files in a CI job, whereas the current scenario requires the engineer to catch an argument whose expression does not match the provider schema. These operations have different effects in the stated Terraform workflow.

D:

Because validate consults provider and module definitions, run init first to install referenced dependencies; this mechanism is useful when the job is to resolve missing provider schemas before checking configuration, whereas the current scenario requires the engineer to catch an argument whose expression does not match the provider schema. These operations have different effects in the stated Terraform workflow.

Question 848

A Terraform runbook prescribes “A lock identifier” to keep two pipelines from changing the same infrastructure state simultaneously, but it does not meet the requirement. What does that step actually accomplish?

  1. The -lock=false option bypasses locking safeguards and increases the risk of two runs writing inconsistent state.
  2. Terraform uses lock information to distinguish a specific operation's lock from unrelated lock holders.
  3. Supported backends acquire a state lock so simultaneous writers cannot corrupt or overwrite each other's state changes.
  4. A state backend with locking helps serialize competing changes, complemented by pipeline approval and run coordination.

Explanation

Correct Answer

B:

A lock identifier is used when an operator needs to ensure a force-unlock targets the correct held state lock. Consequently, this choice cannot meet the separate requirement to keep two pipelines from changing the same infrastructure state simultaneously. The intended action would instead require State consistency during CI.

Incorrect Answers

A:

This behavior belongs to Not disabling locking for speed, which helps engineers avoid conflicting state updates during concurrent deployments rather than satisfying the separate requirement to keep two pipelines from changing the same infrastructure state simultaneously. The attempted technique was A lock identifier; it would instead be used to ensure a force-unlock targets the correct held state lock, not to produce the effect associated with Not disabling locking for speed.

C:

This behavior belongs to A backend state lock, which helps engineers serialize operations that write the same Terraform state rather than satisfying the separate requirement to keep two pipelines from changing the same infrastructure state simultaneously. The attempted technique was A lock identifier; it would instead be used to ensure a force-unlock targets the correct held state lock, not to produce the effect associated with A backend state lock.

D:

That outcome belongs to State consistency during CI, the mechanism that can keep two pipelines from changing the same infrastructure state simultaneously. The question concerns the engineer’s actual proposal, A lock identifier; it is directed at ensure a force-unlock targets the correct held state lock, not that result.

Question 849

A Terraform change proposal names “Reusing modules” to standardize a reusable network pattern across multiple applications. Which outcome can reviewers attribute to that particular mechanism?

  1. Terraform can refresh managed objects during planning and flag differences between the observed infrastructure and configuration.
  2. A policy or governance stage can inspect proposed infrastructure changes before allowing an apply to proceed.
  3. A backend supporting remote storage and locking can centralize state and prevent conflicting concurrent changes.
  4. A module packages input variables, resources and outputs so callers can reuse a consistent infrastructure design.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to standardize a reusable network pattern across multiple applications, so it produces the behavior described. In contrast, collaboration through remote state serves a different goal: allow authorized operators to use one shared source of Terraform state, not standardize a reusable network pattern across multiple applications.

Incorrect Answers

A:

The description applies to drift detection during planning when an engineer needs to notice remote infrastructure changes made outside Terraform; the named reusing modules instead handles the requirement to standardize a reusable network pattern across multiple applications, so this behavior does not describe Reusing modules in the situation named.

B:

The description applies to policy checks before provisioning when an engineer needs to enforce organizational infrastructure constraints consistently; the named reusing modules instead handles the requirement to standardize a reusable network pattern across multiple applications, so this behavior does not describe Reusing modules in the situation named.

C:

The description applies to collaboration through remote state when an engineer needs to allow authorized operators to use one shared source of Terraform state; the named reusing modules instead handles the requirement to standardize a reusable network pattern across multiple applications, so this behavior does not describe Reusing modules in the situation named.

Question 850

A runbook lists “Environment parametrization” for the task to deploy similarly structured stacks with environment-specific settings. Which technical effect should its description include?

  1. With no configuration or remote drift requiring action, a new plan normally proposes no infrastructure changes.
  2. A module packages input variables, resources and outputs so callers can reuse a consistent infrastructure design.
  3. Terraform input variables permit different values for capacity, names and endpoints without copying the entire resource definition.
  4. Terraform can refresh managed objects during planning and flag differences between the observed infrastructure and configuration.
  5. A backend supporting remote storage and locking can centralize state and prevent conflicting concurrent changes.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to deploy similarly structured stacks with environment-specific settings, so it produces the behavior described. In contrast, collaboration through remote state serves a different goal: allow authorized operators to use one shared source of Terraform state, not deploy similarly structured stacks with environment-specific settings.

Incorrect Answers

A:

The description applies to idempotent convergence when an engineer needs to run unchanged configuration repeatedly without inventing new infrastructure updates; the named environment parametrization instead handles the requirement to deploy similarly structured stacks with environment-specific settings, so this behavior does not describe Environment parametrization in the situation named.

B:

The description applies to reusing modules when an engineer needs to standardize a reusable network pattern across multiple applications; the named environment parametrization instead handles the requirement to deploy similarly structured stacks with environment-specific settings, so this behavior does not describe Environment parametrization in the situation named.

D:

The description applies to drift detection during planning when an engineer needs to notice remote infrastructure changes made outside Terraform; the named environment parametrization instead handles the requirement to deploy similarly structured stacks with environment-specific settings, so this behavior does not describe Environment parametrization in the situation named.

E:

The description applies to collaboration through remote state when an engineer needs to allow authorized operators to use one shared source of Terraform state; the named environment parametrization instead handles the requirement to deploy similarly structured stacks with environment-specific settings, so this behavior does not describe Environment parametrization in the situation named.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests