HashiCorp Terraform Associate 004 (HashiCorp Certified: Terraform Associate (004)) Practice Test 21

Question 200

A Terraform rollout has two separate requirements: first, review planned deletion before permitting an irreversible action; second, separate proposing infrastructure changes from authorizing them. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Collaborative review before apply; then use Plan inspection checkpoint.
  2. First use Saved plan promotion; then use Collaborative review before apply.
  3. First use Plan inspection checkpoint; then use Plan refresh and graph evaluation.
  4. First use Plan refresh and graph evaluation; then use Saved plan promotion.
  5. First use Plan inspection checkpoint; then use Collaborative review before apply.

Explanation

Correct Answer

E:

The first requirement, to review planned deletion before permitting an irreversible action, is handled by Plan inspection checkpoint: A review of change symbols and affected addresses can reveal unexpected destroy or replacement operations. The second requirement, to separate proposing infrastructure changes from authorizing them, is handled by Collaborative review before apply: Teams can share configuration and review a Terraform plan before a privileged apply runs. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to review planned deletion before permitting an irreversible action and separate proposing infrastructure changes from authorizing them, the first candidate Collaborative review before apply addresses separate proposing infrastructure changes from authorizing them; the second candidate Plan inspection checkpoint addresses review planned deletion before permitting an irreversible action. This mapping fails because the first mechanism primarily supports the task to separate proposing infrastructure changes from authorizing them and the second mechanism primarily supports the task to review planned deletion before permitting an irreversible action; the actual requirements are review planned deletion before permitting an irreversible action first and separate proposing infrastructure changes from authorizing them second.

B:

For the requested tasks to review planned deletion before permitting an irreversible action and separate proposing infrastructure changes from authorizing them, the first candidate Saved plan promotion addresses apply the reviewed plan artifact rather than recomputing from changed inputs; the second candidate Collaborative review before apply addresses separate proposing infrastructure changes from authorizing them. This mapping fails because the first mechanism primarily supports the task to apply the reviewed plan artifact rather than recomputing from changed inputs; the actual requirements are review planned deletion before permitting an irreversible action first and separate proposing infrastructure changes from authorizing them second.

C:

For the requested tasks to review planned deletion before permitting an irreversible action and separate proposing infrastructure changes from authorizing them, the first candidate Plan inspection checkpoint addresses review planned deletion before permitting an irreversible action; the second candidate Plan refresh and graph evaluation addresses reason about dependencies before Terraform proposes remote operations. This mapping fails because the second mechanism primarily supports the task to reason about dependencies before Terraform proposes remote operations; the actual requirements are review planned deletion before permitting an irreversible action first and separate proposing infrastructure changes from authorizing them second.

D:

For the requested tasks to review planned deletion before permitting an irreversible action and separate proposing infrastructure changes from authorizing them, the first candidate Plan refresh and graph evaluation addresses reason about dependencies before Terraform proposes remote operations; the second candidate Saved plan promotion addresses apply the reviewed plan artifact rather than recomputing from changed inputs. This mapping fails because the first mechanism primarily supports the task to reason about dependencies before Terraform proposes remote operations and the second mechanism primarily supports the task to apply the reviewed plan artifact rather than recomputing from changed inputs; the actual requirements are review planned deletion before permitting an irreversible action first and separate proposing infrastructure changes from authorizing them second.

Question 201

A change proposal relies on terraform providers lock for the task to populate or update provider checksum selections in the lock file. Which limitation specifically applies to it?

  1. It does not lock child module versions or Terraform Core versions.
  2. The constraint is not the same as Terraform CLI required_version.
  3. A provider block configures an installed provider instance rather than declaring its source.
  4. It is not the command that downloads and configures all root-module infrastructure.

Explanation

Correct Answer

D:

For terraform providers lock in the task to populate or update provider checksum selections in the lock file, the important caution is: It is not the command that downloads and configures all root-module infrastructure. The reason this matters is its actual behavior: The providers lock command can record provider package checksums for selected target platforms.

Incorrect Answers

A:

The proposed warning belongs to Terraform dependency lock file, which serves the different goal to keep selected provider versions reproducible between runs, rather than to terraform providers lock: The .terraform.lock.hcl file records resolved provider versions and checksums for repeatable installation. The question concerns terraform providers lock acting to populate or update provider checksum selections in the lock file, not a limit of Terraform dependency lock file.

B:

The proposed warning belongs to Provider version constraint, which serves the different goal to restrict acceptable versions of an infrastructure provider, rather than to terraform providers lock: The version argument in required_providers expresses allowed provider versions, such as a compatible release series. The question concerns terraform providers lock acting to populate or update provider checksum selections in the lock file, not a limit of Provider version constraint.

C:

The proposed warning belongs to required_providers source, which serves the different goal to identify the namespace and provider plugin that Terraform should install, rather than to terraform providers lock: The required_providers map supplies a provider source address such as hashicorp/aws for dependency resolution. The question concerns terraform providers lock acting to populate or update provider checksum selections in the lock file, not a limit of required_providers source.

Question 202

A Terraform rollout has two separate requirements: first, place an isolated sandbox state file away from another lab's state; second, choose a particular path for a locally stored Terraform state file. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Local state backup; then use Local backend configuration.
  2. First use Local workspace state files; then use Local state backup.
  3. First use Custom local state path; then use Local workspace state files.
  4. First use Custom local state path; then use Local backend configuration.
  5. First use Local backend configuration; then use Custom local state path.

Explanation

Correct Answer

D:

The first requirement, to place an isolated sandbox state file away from another lab's state, is handled by Custom local state path: A local backend path can separate state storage from another configuration's snapshot. The second requirement, to choose a particular path for a locally stored Terraform state file, is handled by Local backend configuration: The local backend supports a path setting to change where state is written. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to place an isolated sandbox state file away from another lab's state and choose a particular path for a locally stored Terraform state file, the first candidate Local state backup addresses retain a prior state snapshot while modifying local state; the second candidate Local backend configuration addresses choose a particular path for a locally stored Terraform state file. This mapping fails because the first mechanism primarily supports the task to retain a prior state snapshot while modifying local state; the actual requirements are place an isolated sandbox state file away from another lab's state first and choose a particular path for a locally stored Terraform state file second.

B:

For the requested tasks to place an isolated sandbox state file away from another lab's state and choose a particular path for a locally stored Terraform state file, the first candidate Local workspace state files addresses distinguish state of different local Terraform workspaces; the second candidate Local state backup addresses retain a prior state snapshot while modifying local state. This mapping fails because the first mechanism primarily supports the task to distinguish state of different local Terraform workspaces and the second mechanism primarily supports the task to retain a prior state snapshot while modifying local state; the actual requirements are place an isolated sandbox state file away from another lab's state first and choose a particular path for a locally stored Terraform state file second.

C:

For the requested tasks to place an isolated sandbox state file away from another lab's state and choose a particular path for a locally stored Terraform state file, the first candidate Custom local state path addresses place an isolated sandbox state file away from another lab's state; the second candidate Local workspace state files addresses distinguish state of different local Terraform workspaces. This mapping fails because the second mechanism primarily supports the task to distinguish state of different local Terraform workspaces; the actual requirements are place an isolated sandbox state file away from another lab's state first and choose a particular path for a locally stored Terraform state file second.

E:

For the requested tasks to place an isolated sandbox state file away from another lab's state and choose a particular path for a locally stored Terraform state file, the first candidate Local backend configuration addresses choose a particular path for a locally stored Terraform state file; the second candidate Custom local state path addresses place an isolated sandbox state file away from another lab's state. This mapping fails because the first mechanism primarily supports the task to choose a particular path for a locally stored Terraform state file and the second mechanism primarily supports the task to place an isolated sandbox state file away from another lab's state; the actual requirements are place an isolated sandbox state file away from another lab's state first and choose a particular path for a locally stored Terraform state file second.

Question 203

A Terraform rollout has two separate requirements: first, find documented reusable modules rather than copying configurations manually; second, reuse a published module from the Terraform Registry. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Module discovery in registry; then use Git-hosted module source.
  2. First use Module source subdirectory; then use Public registry module source.
  3. First use Git-hosted module source; then use Module source subdirectory.
  4. First use Public registry module source; then use Module discovery in registry.
  5. First use Module discovery in registry; then use Public registry module source.

Explanation

Correct Answer

E:

The first requirement, to find documented reusable modules rather than copying configurations manually, is handled by Module discovery in registry: The Terraform Registry and private module registries can publish modules with inputs and outputs. The second requirement, to reuse a published module from the Terraform Registry, is handled by Public registry module source: Registry source addresses identify published module packages by namespace, name, and provider. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to find documented reusable modules rather than copying configurations manually and reuse a published module from the Terraform Registry, the first candidate Module discovery in registry addresses find documented reusable modules rather than copying configurations manually; the second candidate Git-hosted module source addresses reference a reusable Terraform module from a VCS repository. This mapping fails because the second mechanism primarily supports the task to reference a reusable Terraform module from a VCS repository; the actual requirements are find documented reusable modules rather than copying configurations manually first and reuse a published module from the Terraform Registry second.

B:

For the requested tasks to find documented reusable modules rather than copying configurations manually and reuse a published module from the Terraform Registry, the first candidate Module source subdirectory addresses select a Terraform module within a larger repository; the second candidate Public registry module source addresses reuse a published module from the Terraform Registry. This mapping fails because the first mechanism primarily supports the task to select a Terraform module within a larger repository; the actual requirements are find documented reusable modules rather than copying configurations manually first and reuse a published module from the Terraform Registry second.

C:

For the requested tasks to find documented reusable modules rather than copying configurations manually and reuse a published module from the Terraform Registry, the first candidate Git-hosted module source addresses reference a reusable Terraform module from a VCS repository; the second candidate Module source subdirectory addresses select a Terraform module within a larger repository. This mapping fails because the first mechanism primarily supports the task to reference a reusable Terraform module from a VCS repository and the second mechanism primarily supports the task to select a Terraform module within a larger repository; the actual requirements are find documented reusable modules rather than copying configurations manually first and reuse a published module from the Terraform Registry second.

D:

For the requested tasks to find documented reusable modules rather than copying configurations manually and reuse a published module from the Terraform Registry, the first candidate Public registry module source addresses reuse a published module from the Terraform Registry; the second candidate Module discovery in registry addresses find documented reusable modules rather than copying configurations manually. This mapping fails because the first mechanism primarily supports the task to reuse a published module from the Terraform Registry and the second mechanism primarily supports the task to find documented reusable modules rather than copying configurations manually; the actual requirements are find documented reusable modules rather than copying configurations manually first and reuse a published module from the Terraform Registry second.

Question 204

A Terraform rollout has two separate requirements: first, execute Terraform with network access to private environments; second, start remote plans from connected version-control updates. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use HCP Terraform agent; then use HCP Terraform remote execution.
  2. First use HCP Terraform state storage; then use VCS-driven HCP Terraform workflow.
  3. First use HCP Terraform agent; then use VCS-driven HCP Terraform workflow.
  4. First use HCP Terraform remote execution; then use HCP Terraform state storage.
  5. First use VCS-driven HCP Terraform workflow; then use HCP Terraform agent.

Explanation

Correct Answer

C:

The first requirement, to execute Terraform with network access to private environments, is handled by HCP Terraform agent: An HCP Terraform agent can run work in an operator-controlled environment and connect to private resources. The second requirement, to start remote plans from connected version-control updates, is handled by VCS-driven HCP Terraform workflow: A VCS-connected workspace can queue runs when matching configuration changes are committed. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to execute Terraform with network access to private environments and start remote plans from connected version-control updates, the first candidate HCP Terraform agent addresses execute Terraform with network access to private environments; the second candidate HCP Terraform remote execution addresses execute Terraform operations in a managed remote runtime. This mapping fails because the second mechanism primarily supports the task to execute Terraform operations in a managed remote runtime; the actual requirements are execute Terraform with network access to private environments first and start remote plans from connected version-control updates second.

B:

For the requested tasks to execute Terraform with network access to private environments and start remote plans from connected version-control updates, the first candidate HCP Terraform state storage addresses store workspace state centrally rather than on a personal machine; the second candidate VCS-driven HCP Terraform workflow addresses start remote plans from connected version-control updates. This mapping fails because the first mechanism primarily supports the task to store workspace state centrally rather than on a personal machine; the actual requirements are execute Terraform with network access to private environments first and start remote plans from connected version-control updates second.

D:

For the requested tasks to execute Terraform with network access to private environments and start remote plans from connected version-control updates, the first candidate HCP Terraform remote execution addresses execute Terraform operations in a managed remote runtime; the second candidate HCP Terraform state storage addresses store workspace state centrally rather than on a personal machine. This mapping fails because the first mechanism primarily supports the task to execute Terraform operations in a managed remote runtime and the second mechanism primarily supports the task to store workspace state centrally rather than on a personal machine; the actual requirements are execute Terraform with network access to private environments first and start remote plans from connected version-control updates second.

E:

For the requested tasks to execute Terraform with network access to private environments and start remote plans from connected version-control updates, the first candidate VCS-driven HCP Terraform workflow addresses start remote plans from connected version-control updates; the second candidate HCP Terraform agent addresses execute Terraform with network access to private environments. This mapping fails because the first mechanism primarily supports the task to start remote plans from connected version-control updates and the second mechanism primarily supports the task to execute Terraform with network access to private environments; the actual requirements are execute Terraform with network access to private environments first and start remote plans from connected version-control updates second.

Question 205

An operator chooses the mechanism "Resource address for count instance" for a Terraform project. Which outcome should this choice support?

  1. refer to an instance selected by its map or set key
  2. ensure a dependent resource waits for a referenced upstream attribute
  3. select the exact indexed instance from count-created resources
  4. use a value explicitly exported by a child module

Explanation

Correct Answer

C:

The practical result of Resource address for count instance, used to select the exact indexed instance from count-created resources, is: Count-created instances use numeric indices in expressions and state addresses, such as example[1]. A qualification for this effect is: The index is not a stable semantic key if list ordering changes.

Incorrect Answers

A:

That outcome applies to Resource address for for_each instance, intended to refer to an instance selected by its map or set key, rather than the question's feature Resource address for count instance: A for_each resource uses keyed addressing such as example["prod"] and exposes a key-specific object. Unlike Resource address for for_each instance, Resource address for count instance is intended to select the exact indexed instance from count-created resources, not to refer to an instance selected by its map or set key.

B:

That outcome applies to Implicit resource dependency, intended to ensure a dependent resource waits for a referenced upstream attribute, rather than the question's feature Resource address for count instance: Terraform infers dependencies when expressions reference other resources. Unlike Implicit resource dependency, Resource address for count instance is intended to select the exact indexed instance from count-created resources, not to ensure a dependent resource waits for a referenced upstream attribute.

D:

The outcome in this option belongs to Module output reference: The parent reads a child output through module.name.output_name rather than reaching into child internals; by contrast, the feature actually named in the stem, Resource address for count instance, has a distinct purpose: to select the exact indexed instance from count-created resources.

Question 206

A design uses Desired configuration to record intended infrastructure settings under version control. Which qualification applies to the named mechanism?

  1. An external drift or changed input can still cause a nonempty plan.
  2. The file alone does not reveal every live change made outside Terraform.
  3. Reviewing a plan is different from committing its effects to the remote system.
  4. Terraform Core does not hard-code each cloud service API.

Explanation

Correct Answer

B:

For Desired configuration in the task to record intended infrastructure settings under version control, the important caution is: The file alone does not reveal every live change made outside Terraform. The reason this matters is its actual behavior: Configuration expresses the operator's intended infrastructure and is the starting point for planning.

Incorrect Answers

A:

The proposed warning belongs to Idempotent reconciliation, which serves the different goal to repeat an apply without recreating already matching resources, rather than to Desired configuration: Terraform compares desired configuration with prior state and refreshed remote information and normally plans no change when they agree. The question concerns Desired configuration acting to record intended infrastructure settings under version control, not a limit of Idempotent reconciliation.

C:

The proposed warning belongs to Infrastructure execution plan, which serves the different goal to preview the proposed actions before changing real resources, rather than to Desired configuration: A Terraform plan calculates proposed actions from configuration, state, providers, and current observations. The question concerns Desired configuration acting to record intended infrastructure settings under version control, not a limit of Infrastructure execution plan.

D:

The proposed warning belongs to Infrastructure provider API, which serves the different goal to translate declarative resources into operations on a platform, rather than to Desired configuration: Provider plugins supply resource implementations and call remote APIs when Terraform reconciles infrastructure. The question concerns Desired configuration acting to record intended infrastructure settings under version control, not a limit of Infrastructure provider API.

Question 207

A design uses Import under aliased provider to adopt a remote object from the correct account or region. Which qualification applies to the named mechanism?

  1. Import success alone does not prove the next apply is a no-op.
  2. A post-import plan must still be checked for configuration differences.
  3. The wrong account's credentials may fail even if an ID format looks valid.
  4. Generated HCL requires review and may include attributes needing cleanup.

Explanation

Correct Answer

C:

For Import under aliased provider in the task to adopt a remote object from the correct account or region, the important caution is: The wrong account's credentials may fail even if an ID format looks valid. The reason this matters is its actual behavior: The target resource's selected provider configuration determines how Terraform locates and reads the imported object.

Incorrect Answers

A:

The proposed warning belongs to Import validation follow-up, which serves the different goal to run a plan after importing an object to check unexpected updates, rather than to Import under aliased provider: A post-import plan reveals whether declared settings match the newly adopted remote object. The question concerns Import under aliased provider acting to adopt a remote object from the correct account or region, not a limit of Import validation follow-up.

B:

The proposed warning belongs to Import without recreation, which serves the different goal to adopt an existing object rather than creating a new duplicate, rather than to Import under aliased provider: Import connects an existing provider object to the Terraform state mapping. The question concerns Import under aliased provider acting to adopt a remote object from the correct account or region, not a limit of Import without recreation.

D:

The proposed warning belongs to Generate import configuration where supported, which serves the different goal to use import planning support to help write resource HCL for an existing object, rather than to Import under aliased provider: Terraform supports generating configuration with appropriate import workflows for certain imported resources. The question concerns Import under aliased provider acting to adopt a remote object from the correct account or region, not a limit of Generate import configuration where supported.

Question 208

In a reusable deployment, the primary objective is to prepare backend and plugin dependencies before planning. Which mechanism most directly meets this particular need?

  1. Initialize a new working directory
  2. Init provider plugin upgrade control
  3. Initialization as safe repeated step
  4. Init without backend setup

Explanation

Correct Answer

A:

The task is to prepare backend and plugin dependencies before planning; Initialize a new working directory directly supports that requirement: terraform init configures backend access and fetches required modules and providers. Its relevant boundary is: Initialization is not the command for creating managed resources.

Incorrect Answers

B:

Init provider plugin upgrade control is designed to preserve locked provider selections in routine CI initialization, whereas this task is to prepare backend and plugin dependencies before planning: A normal terraform init honors the existing dependency lock selections unless update is requested. Against Initialize a new working directory, its limitation is: A changed constraint can require an explicit upgrade or other resolution.

C:

Initialization as safe repeated step is designed to rerun initialization after adding a provider or changing module sources, whereas this task is to prepare backend and plugin dependencies before planning: It is normally safe to run terraform init repeatedly to satisfy updated dependencies. Against Initialize a new working directory, its limitation is: Reinitialization is not a substitute for planning after configuration changes.

D:

Init without backend setup is designed to work on configuration validation while deliberately skipping backend initialization, whereas this task is to prepare backend and plugin dependencies before planning: terraform init -backend=false skips the backend initialization step where appropriate. Against Initialize a new working directory, its limitation is: Commands needing live state might not work without a configured backend.

Question 209

A Terraform operator is specifically tasked to prevent two concurrent runs from writing the same state snapshot. Which mechanism most directly meets this particular need?

  1. Lock acquisition before writes
  2. terraform -lock-timeout behavior
  3. terraform force-unlock
  4. Terraform state locking

Explanation

Correct Answer

D:

The task is to prevent two concurrent runs from writing the same state snapshot; Terraform state locking directly supports that requirement: A backend with locking support serializes operations that could corrupt shared state. Its relevant boundary is: Not every backend supports locking in the same way.

Incorrect Answers

A:

Lock acquisition before writes is designed to avoid racing state mutations when several operators run Terraform, whereas this task is to prevent two concurrent runs from writing the same state snapshot: Terraform tries to obtain a state lock when the chosen backend supports it. Against Terraform state locking, its limitation is: A configuration-only validation step typically does not need to change state.

B:

terraform -lock-timeout behavior is designed to let a run wait briefly rather than fail immediately when state is busy, whereas this task is to prevent two concurrent runs from writing the same state snapshot: The lock-timeout flag controls how long supported operations retry obtaining a lock. Against Terraform state locking, its limitation is: It does not itself activate locking on a backend that lacks that feature.

C:

terraform force-unlock is designed to remove a stale lock only after confirming that no valid run owns it, whereas this task is to prevent two concurrent runs from writing the same state snapshot: force-unlock accepts a lock ID and bypasses normal waiting for an abandoned lock. Against Terraform state locking, its limitation is: Incorrectly breaking an active lock risks competing state modifications.

Question 210

Before adopting Resource address for count instance to select the exact indexed instance from count-created resources, which statement sets an accurate boundary?

  1. Using a plain string ID loses that implicit graph dependency.
  2. The index is not a stable semantic key if list ordering changes.
  3. A numeric count index is not interchangeable with a for_each string key.
  4. Unexported child resource attributes are not directly available to the caller.

Explanation

Correct Answer

B:

For Resource address for count instance in the task to select the exact indexed instance from count-created resources, the important caution is: The index is not a stable semantic key if list ordering changes. The reason this matters is its actual behavior: Count-created instances use numeric indices in expressions and state addresses, such as example[1].

Incorrect Answers

A:

The proposed warning belongs to Direct attribute reference, which serves the different goal to pass the generated ID of one resource into a dependent resource, rather than to Resource address for count instance: An expression such as aws_vpc.main.id links a consuming argument to an upstream resource attribute. The question concerns Resource address for count instance acting to select the exact indexed instance from count-created resources, not a limit of Direct attribute reference.

C:

The proposed warning belongs to Resource address for for_each instance, which serves the different goal to refer to an instance selected by its map or set key, rather than to Resource address for count instance: A for_each resource uses keyed addressing such as example["prod"] and exposes a key-specific object. The question concerns Resource address for count instance acting to select the exact indexed instance from count-created resources, not a limit of Resource address for for_each instance.

D:

The listed caution belongs specifically to Module output reference, used to use a value explicitly exported by a child module: The parent reads a child output through module.name.output_name rather than reaching into child internals; the feature under review is instead Resource address for count instance, so this answer attaches another feature's qualification to the wrong mechanism.

HashiCorp Certified: Terraform Associate (004) (Terraform Associate 004) Practice Tests