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

Question 310

A design uses Module download on init to install externally sourced child modules referenced by the root module. Which qualification applies to the named mechanism?

  1. Initialization is not the command for creating managed resources.
  2. It does not automatically move the old state into the new backend.
  3. Downloading a module does not create its infrastructure.
  4. Reinitialization is not a substitute for planning after configuration changes.

Explanation

Correct Answer

C:

For Module download on init in the task to install externally sourced child modules referenced by the root module, the important caution is: Downloading a module does not create its infrastructure. The reason this matters is its actual behavior: terraform init resolves module sources and downloads them to the local module cache.

Incorrect Answers

A:

The proposed warning belongs to Initialize a new working directory, which serves the different goal to prepare backend and plugin dependencies before planning, rather than to Module download on init: terraform init configures backend access and fetches required modules and providers. The question concerns Module download on init acting to install externally sourced child modules referenced by the root module, not a limit of Initialize a new working directory.

B:

The proposed warning belongs to Backend reconfiguration during init, which serves the different goal to accept an intentional backend configuration change without migrating state, rather than to Module download on init: terraform init -reconfigure disregards the existing backend initialization settings and uses new ones. The question concerns Module download on init acting to install externally sourced child modules referenced by the root module, not a limit of Backend reconfiguration during init.

D:

The listed caution belongs specifically to Initialization as safe repeated step, used to rerun initialization after adding a provider or changing module sources: It is normally safe to run terraform init repeatedly to satisfy updated dependencies; the feature under review is instead Module download on init, so this answer attaches another feature's qualification to the wrong mechanism.

Question 311

An engineer must update an existing Terraform workflow to translate a Terraform resource operation into remote service API calls. Which mechanism most directly meets this particular need?

  1. Provider plugin responsibility
  2. Provider block configuration
  3. Provider resource schema
  4. Plugin dependency installation
  5. Provider selection for resource prefix

Explanation

Correct Answer

A:

The task is to translate a Terraform resource operation into remote service API calls; Provider plugin responsibility directly supports that requirement: The provider implements resource types and performs create, read, update, and delete operations when supported. Its relevant boundary is: Terraform itself does not create a cloud instance without an appropriate provider.

Incorrect Answers

B:

Provider block configuration is designed to supply settings such as region or endpoint for a provider instance, whereas this task is to translate a Terraform resource operation into remote service API calls: A provider block creates a configured provider instance that resources can use. Against Provider plugin responsibility, its limitation is: It does not determine which provider package source gets installed.

C:

Provider resource schema is designed to define the supported arguments and attributes for one resource type, whereas this task is to translate a Terraform resource operation into remote service API calls: The provider schema specifies which settings users can configure and which values are computed. Against Provider plugin responsibility, its limitation is: A generic Terraform language feature cannot invent unsupported provider arguments.

D:

Plugin dependency installation is designed to resolve all referenced provider plugins before planning, whereas this task is to translate a Terraform resource operation into remote service API calls: An initialized working directory has the plugins required for its configured resources and data sources. Against Provider plugin responsibility, its limitation is: A provider is not a Terraform module downloaded from a module source.

E:

Provider selection for resource prefix is designed to associate a resource with the default provider for its type prefix, whereas this task is to translate a Terraform resource operation into remote service API calls: Without a provider meta-argument Terraform normally selects the matching local provider configuration. Against Provider plugin responsibility, its limitation is: An alias must be chosen explicitly if the resource needs a nondefault configuration.

Question 312

Before adopting terraform -lock-timeout behavior to let a run wait briefly rather than fail immediately when state is busy, which statement sets an accurate boundary?

  1. It does not itself activate locking on a backend that lacks that feature.
  2. Not every backend supports locking in the same way.
  3. Guessing an ID or acting during an active deployment can corrupt coordination.
  4. -lock=false makes concurrent writers potentially unsafe.
  5. Remote storage and locking are related but distinct capabilities.

Explanation

Correct Answer

A:

For terraform -lock-timeout behavior in the task to let a run wait briefly rather than fail immediately when state is busy, the important caution is: It does not itself activate locking on a backend that lacks that feature. The reason this matters is its actual behavior: The lock-timeout flag controls how long supported operations retry obtaining a lock.

Incorrect Answers

B:

The proposed warning belongs to Terraform state locking, which serves the different goal to prevent two concurrent runs from writing the same state snapshot, rather than to terraform -lock-timeout behavior: A backend with locking support serializes operations that could corrupt shared state. The question concerns terraform -lock-timeout behavior acting to let a run wait briefly rather than fail immediately when state is busy, not a limit of Terraform state locking.

C:

The proposed warning belongs to Lock identifier verification, which serves the different goal to identify the precise stale lock before taking exceptional recovery action, rather than to terraform -lock-timeout behavior: A lock ID should be matched to the blocked state operation before unlocking. The question concerns terraform -lock-timeout behavior acting to let a run wait briefly rather than fail immediately when state is busy, not a limit of Lock identifier verification.

D:

The proposed warning belongs to Avoid disabling state locks, which serves the different goal to protect shared state rather than using -lock=false as a routine workaround, rather than to terraform -lock-timeout behavior: Using a lock-capable backend with normal locking reduces state races. The question concerns terraform -lock-timeout behavior acting to let a run wait briefly rather than fail immediately when state is busy, not a limit of Avoid disabling state locks.

E:

The proposed warning belongs to Remote backend locking capabilities, which serves the different goal to select shared state storage with appropriate concurrency semantics, rather than to terraform -lock-timeout behavior: Supported remote backends can coordinate locking around updates to common state. The question concerns terraform -lock-timeout behavior acting to let a run wait briefly rather than fail immediately when state is busy, not a limit of Remote backend locking capabilities.

Question 313

A design uses Module local values to compute module-specific intermediate values without exporting them. Which qualification applies to the named mechanism?

  1. A default does not override an explicitly passed module argument.
  2. An aliased provider is not automatically inherited as a child alias.
  3. They are not automatically exposed through a module output reference.
  4. A repeated module call is not the same value shape as a single module output object.

Explanation

Correct Answer

C:

For Module local values in the task to compute module-specific intermediate values without exporting them, the important caution is: They are not automatically exposed through a module output reference. The reason this matters is its actual behavior: Local values belong to the defining module and are referenced through local.name in that scope.

Incorrect Answers

A:

The proposed warning belongs to Module input defaults, which serves the different goal to make some child module arguments optional for callers, rather than to Module local values: A child variable with a default can be omitted by the caller, allowing the child to use its fallback. The question concerns Module local values acting to compute module-specific intermediate values without exporting them, not a limit of Module input defaults.

B:

The proposed warning belongs to Provider configuration scope, which serves the different goal to keep provider instances configured in the root and pass them to child modules, rather than to Module local values: A root module can explicitly map provider configurations into child module calls. The question concerns Module local values acting to compute module-specific intermediate values without exporting them, not a limit of Provider configuration scope.

D:

The proposed warning belongs to Module outputs with repeated instances, which serves the different goal to read values from every instance created by a counted or keyed module call, rather than to Module local values: Counted module outputs use numeric indices; for_each module outputs use instance keys. The question concerns Module local values acting to compute module-specific intermediate values without exporting them, not a limit of Module outputs with repeated instances.

Question 314

The team is documenting risks of HCP Terraform variable sets while planning to share reusable variables across selected workspaces. Which caveat specifically applies to that mechanism?

  1. Team permission management requires a supported paid HCP Terraform edition; these roles do not replace cloud-provider permissions.
  2. Policies assess plans or configuration; they are not Terraform resource providers.
  3. HCP Terraform health assessments require Standard or Premium edition and an eligible workspace; detection itself does not automatically correct drift.
  4. Per-workspace values and precedence must be reviewed when there are overlaps.

Explanation

Correct Answer

D:

For HCP Terraform variable sets in the task to share reusable variables across selected workspaces, the important caution is: Per-workspace values and precedence must be reviewed when there are overlaps. The reason this matters is its actual behavior: Variable sets can provide common Terraform or environment variables to applicable workspaces.

Incorrect Answers

A:

The proposed warning belongs to HCP Terraform teams and permissions, which serves the different goal to grant workspace access based on collaboration responsibilities, rather than to HCP Terraform variable sets: Teams can be assigned appropriate workspace permissions for viewing, planning, and applying. The question concerns HCP Terraform variable sets acting to share reusable variables across selected workspaces, not a limit of HCP Terraform teams and permissions.

B:

The proposed warning belongs to HCP Terraform policy sets, which serves the different goal to enforce organizational rules during infrastructure runs, rather than to HCP Terraform variable sets: HCP Terraform can evaluate governance policies such as Sentinel or OPA as part of run controls. The question concerns HCP Terraform variable sets acting to share reusable variables across selected workspaces, not a limit of HCP Terraform policy sets.

C:

The listed caution belongs specifically to HCP Terraform drift detection, used to monitor for resources that have diverged from workspace configuration: Health assessments can identify drift between tracked resources and desired configuration; the feature under review is instead HCP Terraform variable sets, so this answer attaches another feature's qualification to the wrong mechanism.

Question 315

A colleague recommends the Terraform concept "Required input variable". Which use case best matches it?

  1. prompt for or provide a root-module value when no default exists
  2. override environment or tfvars values with an explicit CLI variable flag
  3. load multiple variable assignments from a chosen tfvars file
  4. expose a selected Terraform expression to the caller or CLI

Explanation

Correct Answer

A:

The practical result of Required input variable, used to prompt for or provide a root-module value when no default exists, is: A variable block without a default requires a value supplied through a supported input channel. A qualification for this effect is: Declaring a variable does not itself fetch a remote API value.

Incorrect Answers

B:

That outcome applies to Variable source precedence, intended to override environment or tfvars values with an explicit CLI variable flag, rather than the question's feature Required input variable: Direct -var and -var-file command-line assignments have precedence over automatically loaded values. Unlike Variable source precedence, Required input variable is intended to prompt for or provide a root-module value when no default exists, not to override environment or tfvars values with an explicit CLI variable flag.

C:

That outcome applies to Variable file input, intended to load multiple variable assignments from a chosen tfvars file, rather than the question's feature Required input variable: The -var-file flag passes root-module input values from a named variable definitions file. Unlike Variable file input, Required input variable is intended to prompt for or provide a root-module value when no default exists, not to load multiple variable assignments from a chosen tfvars file.

D:

That outcome applies to Output block, intended to expose a selected Terraform expression to the caller or CLI, rather than the question's feature Required input variable: An output block publishes a value from its module, such as an endpoint or resource identifier. Unlike Output block, Required input variable is intended to prompt for or provide a root-module value when no default exists, not to expose a selected Terraform expression to the caller or CLI.

Question 316

Before continuing an infrastructure rollout, the operator must trace why infrastructure definitions changed. Which mechanism most directly meets this particular need?

  1. Version-controlled configuration history
  2. Repeatable environment provisioning
  3. Automated provisioning pipeline
  4. Peer review for infrastructure
  5. Consistent development and production patterns

Explanation

Correct Answer

A:

The task is to trace why infrastructure definitions changed; Version-controlled configuration history directly supports that requirement: Git commits and pull requests make configuration edits auditable before the next Terraform run. Its relevant boundary is: A Git diff tracks source files rather than proving the exact live infrastructure state.

Incorrect Answers

B:

Repeatable environment provisioning is designed to recreate equivalent infrastructure patterns from one codebase, whereas this task is to trace why infrastructure definitions changed: Parameterizing reusable Terraform modules can provision consistent environment patterns repeatedly. Against Version-controlled configuration history, its limitation is: Differences in inputs and provider versions can still alter actual results.

C:

Automated provisioning pipeline is designed to replace repetitive click-by-click resource deployment with a pipeline, whereas this task is to trace why infrastructure definitions changed: A CI pipeline can run validation and planning before an authorized apply, reducing procedural inconsistency. Against Version-controlled configuration history, its limitation is: Automation must still control credentials and state concurrency.

D:

Peer review for infrastructure is designed to require approval before risky infrastructure changes, whereas this task is to trace why infrastructure definitions changed: Text configuration can be reviewed through a normal code review before an approved apply. Against Version-controlled configuration history, its limitation is: Source approval does not replace inspecting the execution plan.

E:

Consistent development and production patterns is designed to reduce configuration drift across environments using shared modules, whereas this task is to trace why infrastructure definitions changed: Reusing modules with explicit inputs aligns infrastructure design while allowing intentional environment differences. Against Version-controlled configuration history, its limitation is: Sharing a module does not force all environments to use identical values.

Question 317

A reviewer is asked to choose a mechanism to enumerate Terraform resource addresses currently tracked in a state snapshot. Which mechanism most directly meets this particular need?

  1. terraform show
  2. terraform state pull
  3. terraform state list
  4. terraform state show ADDRESS
  5. terraform show -json

Explanation

Correct Answer

C:

The task is to enumerate Terraform resource addresses currently tracked in a state snapshot; terraform state list directly supports that requirement: state list displays managed addresses and can be narrowed with address filters. Its relevant boundary is: It does not enumerate every object in the cloud account.

Incorrect Answers

A:

terraform show is designed to inspect the latest state or a saved execution plan in readable form, whereas this task is to enumerate Terraform resource addresses currently tracked in a state snapshot: terraform show can display an existing state snapshot or a named plan file. Against terraform state list, its limitation is: It is not the same as running a fresh plan against current infrastructure.

B:

terraform state pull is designed to retrieve the current backend state snapshot as serialized JSON, whereas this task is to enumerate Terraform resource addresses currently tracked in a state snapshot: state pull reads state from the configured backend for inspection or backup handling. Against terraform state list, its limitation is: Editing and pushing the JSON should not be treated as a routine management workflow.

D:

terraform state show ADDRESS is designed to inspect stored attributes for one tracked resource instance, whereas this task is to enumerate Terraform resource addresses currently tracked in a state snapshot: state show presents the state representation of an addressed resource. Against terraform state list, its limitation is: It does not perform an infrastructure change or show another resource automatically.

E:

terraform show -json is designed to export state or saved plan information in machine-readable form, whereas this task is to enumerate Terraform resource addresses currently tracked in a state snapshot: show -json emits detailed JSON for supported state and plan representations. Against terraform state list, its limitation is: Sensitive values can appear in cleartext and output needs access controls.

Question 318

The implementation must both install externally sourced child modules referenced by the root module and work on configuration validation while deliberately skipping backend initialization. Which TWO mechanisms directly address these two separate requirements? Choose TWO.

  1. Module download on init
  2. Backend migration during init
  3. Init without backend setup
  4. Initialize a new working directory
  5. Backend reconfiguration during init

Explanation

Correct Answers

A:

Among the paired tasks to install externally sourced child modules referenced by the root module and work on configuration validation while deliberately skipping backend initialization, Module download on init serves the requirement to install externally sourced child modules referenced by the root module: terraform init resolves module sources and downloads them to the local module cache. The other task must be covered by a separate mechanism.

C:

Among the paired tasks to install externally sourced child modules referenced by the root module and work on configuration validation while deliberately skipping backend initialization, Init without backend setup serves the requirement to work on configuration validation while deliberately skipping backend initialization: terraform init -backend=false skips the backend initialization step where appropriate. The other task must be covered by a separate mechanism.

Incorrect Answers

B:

The requirements are install externally sourced child modules referenced by the root module and work on configuration validation while deliberately skipping backend initialization, while Backend migration during init supports the different task to move existing state to a newly selected backend when changing its storage: terraform init -migrate-state offers state migration when a backend configuration changes. That capability is outside the two selected responsibilities.

D:

The requirements are install externally sourced child modules referenced by the root module and work on configuration validation while deliberately skipping backend initialization, while Initialize a new working directory supports the different task to prepare backend and plugin dependencies before planning: terraform init configures backend access and fetches required modules and providers. That capability is outside the two selected responsibilities.

E:

The requirements are install externally sourced child modules referenced by the root module and work on configuration validation while deliberately skipping backend initialization, while Backend reconfiguration during init supports the different task to accept an intentional backend configuration change without migrating state: terraform init -reconfigure disregards the existing backend initialization settings and uses new ones. That capability is outside the two selected responsibilities.

Question 319

A Terraform rollout has two separate requirements: first, let a run wait briefly rather than fail immediately when state is busy; second, identify the precise stale lock before taking exceptional recovery action. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use terraform -lock-timeout behavior; then use Remote backend locking capabilities.
  2. First use terraform -lock-timeout behavior; then use Lock identifier verification.
  3. First use Lock identifier verification; then use terraform -lock-timeout behavior.
  4. First use Terraform state locking; then use Lock identifier verification.
  5. First use Remote backend locking capabilities; then use Terraform state locking.

Explanation

Correct Answer

B:

The first requirement, to let a run wait briefly rather than fail immediately when state is busy, is handled by terraform -lock-timeout behavior: The lock-timeout flag controls how long supported operations retry obtaining a lock. The second requirement, to identify the precise stale lock before taking exceptional recovery action, is handled by Lock identifier verification: A lock ID should be matched to the blocked state operation before unlocking. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to let a run wait briefly rather than fail immediately when state is busy and identify the precise stale lock before taking exceptional recovery action, the first candidate terraform -lock-timeout behavior addresses let a run wait briefly rather than fail immediately when state is busy; the second candidate Remote backend locking capabilities addresses select shared state storage with appropriate concurrency semantics. This mapping fails because the second mechanism primarily supports the task to select shared state storage with appropriate concurrency semantics; the actual requirements are let a run wait briefly rather than fail immediately when state is busy first and identify the precise stale lock before taking exceptional recovery action second.

C:

For the requested tasks to let a run wait briefly rather than fail immediately when state is busy and identify the precise stale lock before taking exceptional recovery action, the first candidate Lock identifier verification addresses identify the precise stale lock before taking exceptional recovery action; the second candidate terraform -lock-timeout behavior addresses let a run wait briefly rather than fail immediately when state is busy. This mapping fails because the first mechanism primarily supports the task to identify the precise stale lock before taking exceptional recovery action and the second mechanism primarily supports the task to let a run wait briefly rather than fail immediately when state is busy; the actual requirements are let a run wait briefly rather than fail immediately when state is busy first and identify the precise stale lock before taking exceptional recovery action second.

D:

For the requested tasks to let a run wait briefly rather than fail immediately when state is busy and identify the precise stale lock before taking exceptional recovery action, the first candidate Terraform state locking addresses prevent two concurrent runs from writing the same state snapshot; the second candidate Lock identifier verification addresses identify the precise stale lock before taking exceptional recovery action. This mapping fails because the first mechanism primarily supports the task to prevent two concurrent runs from writing the same state snapshot; the actual requirements are let a run wait briefly rather than fail immediately when state is busy first and identify the precise stale lock before taking exceptional recovery action second.

E:

For the requested tasks to let a run wait briefly rather than fail immediately when state is busy and identify the precise stale lock before taking exceptional recovery action, the first candidate Remote backend locking capabilities addresses select shared state storage with appropriate concurrency semantics; the second candidate Terraform state locking addresses prevent two concurrent runs from writing the same state snapshot. This mapping fails because the first mechanism primarily supports the task to select shared state storage with appropriate concurrency semantics and the second mechanism primarily supports the task to prevent two concurrent runs from writing the same state snapshot; the actual requirements are let a run wait briefly rather than fail immediately when state is busy first and identify the precise stale lock before taking exceptional recovery action second.

Question 320

Before adopting Required input variable to prompt for or provide a root-module value when no default exists, which statement sets an accurate boundary?

  1. Input precedence does not grant the variable a new scope inside child modules.
  2. Outputs do not automatically create an infrastructure object.
  3. Declaring a variable does not itself fetch a remote API value.
  4. The file supplies values but does not declare variable types.

Explanation

Correct Answer

C:

For Required input variable in the task to prompt for or provide a root-module value when no default exists, the important caution is: Declaring a variable does not itself fetch a remote API value. The reason this matters is its actual behavior: A variable block without a default requires a value supplied through a supported input channel.

Incorrect Answers

A:

The proposed warning belongs to Variable source precedence, which serves the different goal to override environment or tfvars values with an explicit CLI variable flag, rather than to Required input variable: Direct -var and -var-file command-line assignments have precedence over automatically loaded values. The question concerns Required input variable acting to prompt for or provide a root-module value when no default exists, not a limit of Variable source precedence.

B:

The proposed warning belongs to Output block, which serves the different goal to expose a selected Terraform expression to the caller or CLI, rather than to Required input variable: An output block publishes a value from its module, such as an endpoint or resource identifier. The question concerns Required input variable acting to prompt for or provide a root-module value when no default exists, not a limit of Output block.

D:

The proposed warning belongs to Variable file input, which serves the different goal to load multiple variable assignments from a chosen tfvars file, rather than to Required input variable: The -var-file flag passes root-module input values from a named variable definitions file. The question concerns Required input variable acting to prompt for or provide a root-module value when no default exists, not a limit of Variable file input.

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