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

Question 1

A team is adjusting its declarative infrastructure process to ask Terraform to create and maintain an infrastructure object. Which mechanism most directly meets this particular need?

  1. Resource attributes computed by provider
  2. Managed resource block
  3. Resource type and local name
  4. Data source dependency scheduling

Explanation

Correct Answer

B:

The task is to ask Terraform to create and maintain an infrastructure object; Managed resource block directly supports that requirement: A resource block declares a managed object whose lifecycle Terraform reconciles through a provider. Its relevant boundary is: It is not a read-only query against an object managed elsewhere.

Incorrect Answers

A:

Resource attributes computed by provider is designed to consume an assigned ID only after the provider supplies it, whereas this task is to ask Terraform to create and maintain an infrastructure object: Computed attributes are often unknown during planning and become available after the provider creates or reads an object. Against Managed resource block, its limitation is: They should not be hard-coded when proper references are available.

C:

Resource type and local name is designed to distinguish a provider-defined resource kind from its Terraform address label, whereas this task is to ask Terraform to create and maintain an infrastructure object: A resource block has both a resource type and local name, forming references like aws_vpc.main. Against Managed resource block, its limitation is: Changing the local name can change the state address unless migrated.

D:

Data source dependency scheduling is designed to defer a read when its arguments depend on a resource still being created, whereas this task is to ask Terraform to create and maintain an infrastructure object: Terraform tracks references to determine whether a data-source read can run during planning or must wait. Against Managed resource block, its limitation is: A data source does not automatically establish ownership over the queried object.

Question 2

A reviewer is asked to choose a mechanism to follow the core workflow from configuration to deliberate execution. Which mechanism most directly meets this particular need?

  1. Plan refresh and graph evaluation
  2. Write-plan-apply lifecycle
  3. Collaborative review before apply
  4. Saved plan promotion

Explanation

Correct Answer

B:

The task is to follow the core workflow from configuration to deliberate execution; Write-plan-apply lifecycle directly supports that requirement: The core workflow involves writing configuration, initializing, planning, then applying intended changes. Its relevant boundary is: Destroy and import are maintenance actions rather than steps in every routine run.

Incorrect Answers

A:

Plan refresh and graph evaluation is designed to reason about dependencies before Terraform proposes remote operations, whereas this task is to follow the core workflow from configuration to deliberate execution: Terraform evaluates configuration, state, and provider information to construct an action graph. Against Write-plan-apply lifecycle, its limitation is: The graph is not simply a sequential list ordered by file line number.

C:

Collaborative review before apply is designed to separate proposing infrastructure changes from authorizing them, whereas this task is to follow the core workflow from configuration to deliberate execution: Teams can share configuration and review a Terraform plan before a privileged apply runs. Against Write-plan-apply lifecycle, its limitation is: Version control approval alone does not guarantee the exact reviewed plan is used.

D:

Saved plan promotion is designed to apply the reviewed plan artifact rather than recomputing from changed inputs, whereas this task is to follow the core workflow from configuration to deliberate execution: terraform plan -out creates a binary plan that terraform apply can execute by file name. Against Write-plan-apply lifecycle, its limitation is: Saved plans may contain sensitive values and must be protected.

Question 3

A Terraform operator is specifically tasked to identify the namespace and provider plugin that Terraform should install. Which mechanism most directly meets this particular need?

  1. required_providers source
  2. Terraform dependency lock file
  3. Provider version constraint
  4. terraform init -upgrade

Explanation

Correct Answer

A:

The task is to identify the namespace and provider plugin that Terraform should install; required_providers source directly supports that requirement: The required_providers map supplies a provider source address such as hashicorp/aws for dependency resolution. Its relevant boundary is: A provider block configures an installed provider instance rather than declaring its source.

Incorrect Answers

B:

Terraform dependency lock file is designed to keep selected provider versions reproducible between runs, whereas this task is to identify the namespace and provider plugin that Terraform should install: The .terraform.lock.hcl file records resolved provider versions and checksums for repeatable installation. Against required_providers source, its limitation is: It does not lock child module versions or Terraform Core versions.

C:

Provider version constraint is designed to restrict acceptable versions of an infrastructure provider, whereas this task is to identify the namespace and provider plugin that Terraform should install: The version argument in required_providers expresses allowed provider versions, such as a compatible release series. Against required_providers source, its limitation is: The constraint is not the same as Terraform CLI required_version.

D:

terraform init -upgrade is designed to ask initialization to reconsider allowed provider selections, whereas this task is to identify the namespace and provider plugin that Terraform should install: Using -upgrade during init allows newer versions satisfying the configured provider constraints to be selected. Against required_providers source, its limitation is: It cannot override a required_providers constraint that excludes a release.

Question 4

A team is adjusting its declarative infrastructure process to keep a standalone project's state on its local filesystem. Which mechanism most directly meets this particular need?

  1. Local state access controls
  2. Default local state storage
  3. Custom local state path
  4. Local backend and shared CI
  5. Local backend configuration

Explanation

Correct Answer

B:

The task is to keep a standalone project's state on its local filesystem; Default local state storage directly supports that requirement: Without a configured remote backend, Terraform ordinarily stores state locally in terraform.tfstate. Its relevant boundary is: A local file does not provide multi-user remote collaboration guarantees.

Incorrect Answers

A:

Local state access controls is designed to prevent unauthorized reading of saved infrastructure metadata, whereas this task is to keep a standalone project's state on its local filesystem: Filesystem permissions and secure workstation handling matter when state stays local. Against Default local state storage, its limitation is: A local backend cannot by itself provide shared policy controls or central audit.

C:

Custom local state path is designed to place an isolated sandbox state file away from another lab's state, whereas this task is to keep a standalone project's state on its local filesystem: A local backend path can separate state storage from another configuration's snapshot. Against Default local state storage, its limitation is: State location alone does not separate permissions for remote provider resources.

D:

Local backend and shared CI is designed to avoid using workstation files as the source of truth for team deployments, whereas this task is to keep a standalone project's state on its local filesystem: Local state is best suited to isolated or experimental work rather than competing team runners. Against Default local state storage, its limitation is: Copying a state file between computers is error-prone and can leak secrets.

E:

Local backend configuration is designed to choose a particular path for a locally stored Terraform state file, whereas this task is to keep a standalone project's state on its local filesystem: The local backend supports a path setting to change where state is written. Against Default local state storage, its limitation is: A custom local path still resides on the operator's filesystem.

Question 5

The deployment owner requests a reliable way to load a reusable module from a directory in the same repository. Which mechanism most directly meets this particular need?

  1. Pinned Git module ref
  2. Module discovery in registry
  3. Local child module source
  4. Registry module version selection

Explanation

Correct Answer

C:

The task is to load a reusable module from a directory in the same repository; Local child module source directly supports that requirement: A source like ./modules/network points a module call at a local filesystem path. Its relevant boundary is: Local module paths do not use registry module version arguments.

Incorrect Answers

A:

Pinned Git module ref is designed to use a chosen module branch, tag, or commit from a Git source, whereas this task is to load a reusable module from a directory in the same repository: A Git module source can use ?ref=... to select the intended revision. Against Local child module source, its limitation is: A floating branch can change over time and weaken reproducibility.

B:

Module discovery in registry is designed to find documented reusable modules rather than copying configurations manually, whereas this task is to load a reusable module from a directory in the same repository: The Terraform Registry and private module registries can publish modules with inputs and outputs. Against Local child module source, its limitation is: A published module can still depend on provider permissions and external objects.

D:

Registry module version selection is designed to choose an explicit compatible release of a registry module, whereas this task is to load a reusable module from a directory in the same repository: The version argument on a registry module call constrains which published module release is installed. Against Local child module source, its limitation is: The version argument is not supported for arbitrary local path modules.

Question 6

A deployment design calls for a supported way to isolate the state, variables, and run history for one managed infrastructure unit. Which mechanism most directly meets this particular need?

  1. VCS-driven HCP Terraform workflow
  2. HCP Terraform workspace
  3. HCP Terraform state storage
  4. HCP Terraform remote execution

Explanation

Correct Answer

B:

The task is to isolate the state, variables, and run history for one managed infrastructure unit; HCP Terraform workspace directly supports that requirement: An HCP Terraform workspace organizes a Terraform run context with its own state and configuration connection. Its relevant boundary is: It is not identical to a local CLI workspace's implementation.

Incorrect Answers

A:

VCS-driven HCP Terraform workflow is designed to start remote plans from connected version-control updates, whereas this task is to isolate the state, variables, and run history for one managed infrastructure unit: A VCS-connected workspace can queue runs when matching configuration changes are committed. Against HCP Terraform workspace, its limitation is: Its workspace settings determine whether runs need approval or are automatically applied.

C:

HCP Terraform state storage is designed to store workspace state centrally rather than on a personal machine, whereas this task is to isolate the state, variables, and run history for one managed infrastructure unit: HCP Terraform manages workspace state snapshots with controlled access and history. Against HCP Terraform workspace, its limitation is: Central state storage does not guarantee infrastructure can be reached from every execution mode.

D:

HCP Terraform remote execution is designed to execute Terraform operations in a managed remote runtime, whereas this task is to isolate the state, variables, and run history for one managed infrastructure unit: HCP Terraform can run plans and applies outside a developer's workstation under workspace controls. Against HCP Terraform workspace, its limitation is: Remote execution still needs provider credentials and connectivity.

Question 7

A Terraform runbook describes the mechanism "Managed resource block". Which responsibility should a reviewer associate with it?

  1. ask Terraform to create and maintain an infrastructure object
  2. distinguish a provider-defined resource kind from its Terraform address label
  3. consume an assigned ID only after the provider supplies it
  4. defer a read when its arguments depend on a resource still being created

Explanation

Correct Answer

A:

The practical result of Managed resource block, used to ask Terraform to create and maintain an infrastructure object, is: A resource block declares a managed object whose lifecycle Terraform reconciles through a provider. A qualification for this effect is: It is not a read-only query against an object managed elsewhere.

Incorrect Answers

B:

That outcome applies to Resource type and local name, intended to distinguish a provider-defined resource kind from its Terraform address label, rather than the question's feature Managed resource block: A resource block has both a resource type and local name, forming references like aws_vpc.main. Unlike Resource type and local name, Managed resource block is intended to ask Terraform to create and maintain an infrastructure object, not to distinguish a provider-defined resource kind from its Terraform address label.

C:

That outcome applies to Resource attributes computed by provider, intended to consume an assigned ID only after the provider supplies it, rather than the question's feature Managed resource block: Computed attributes are often unknown during planning and become available after the provider creates or reads an object. Unlike Resource attributes computed by provider, Managed resource block is intended to ask Terraform to create and maintain an infrastructure object, not to consume an assigned ID only after the provider supplies it.

D:

That outcome applies to Data source dependency scheduling, intended to defer a read when its arguments depend on a resource still being created, rather than the question's feature Managed resource block: Terraform tracks references to determine whether a data-source read can run during planning or must wait. Unlike Data source dependency scheduling, Managed resource block is intended to ask Terraform to create and maintain an infrastructure object, not to defer a read when its arguments depend on a resource still being created.

Question 8

During a Terraform 1.12 implementation, the immediate requirement is to represent desired infrastructure in reviewable configuration files. Which mechanism most directly meets this particular need?

  1. Infrastructure provider API
  2. Desired configuration
  3. Infrastructure as code definition
  4. Infrastructure execution plan

Explanation

Correct Answer

C:

The task is to represent desired infrastructure in reviewable configuration files; Infrastructure as code definition directly supports that requirement: Infrastructure as code describes infrastructure through machine-readable files instead of relying only on manual console operations. Its relevant boundary is: The configuration still needs a tool and credentials to change actual systems.

Incorrect Answers

A:

Infrastructure provider API is designed to translate declarative resources into operations on a platform, whereas this task is to represent desired infrastructure in reviewable configuration files: Provider plugins supply resource implementations and call remote APIs when Terraform reconciles infrastructure. Against Infrastructure as code definition, its limitation is: Terraform Core does not hard-code each cloud service API.

B:

Desired configuration is designed to record intended infrastructure settings under version control, whereas this task is to represent desired infrastructure in reviewable configuration files: Configuration expresses the operator's intended infrastructure and is the starting point for planning. Against Infrastructure as code definition, its limitation is: The file alone does not reveal every live change made outside Terraform.

D:

Infrastructure execution plan is designed to preview the proposed actions before changing real resources, whereas this task is to represent desired infrastructure in reviewable configuration files: A Terraform plan calculates proposed actions from configuration, state, providers, and current observations. Against Infrastructure as code definition, its limitation is: Reviewing a plan is different from committing its effects to the remote system.

Question 9

A configuration review identifies the need to bring a pre-existing remote object under a resource address in Terraform state. Which mechanism most directly meets this particular need?

  1. Import validation follow-up
  2. Generate import configuration where supported
  3. Import under aliased provider
  4. terraform import CLI

Explanation

Correct Answer

D:

The task is to bring a pre-existing remote object under a resource address in Terraform state; terraform import CLI directly supports that requirement: terraform import ADDRESS ID binds the specified remote object to a declared resource instance. Its relevant boundary is: The import command alone does not generate a complete root configuration.

Incorrect Answers

A:

Import validation follow-up is designed to run a plan after importing an object to check unexpected updates, whereas this task is to bring a pre-existing remote object under a resource address in Terraform state: A post-import plan reveals whether declared settings match the newly adopted remote object. Against terraform import CLI, its limitation is: Import success alone does not prove the next apply is a no-op.

B:

Generate import configuration where supported is designed to use import planning support to help write resource HCL for an existing object, whereas this task is to bring a pre-existing remote object under a resource address in Terraform state: Terraform supports generating configuration with appropriate import workflows for certain imported resources. Against terraform import CLI, its limitation is: Generated HCL requires review and may include attributes needing cleanup.

C:

Import under aliased provider is designed to adopt a remote object from the correct account or region, whereas this task is to bring a pre-existing remote object under a resource address in Terraform state: The target resource's selected provider configuration determines how Terraform locates and reads the imported object. Against terraform import CLI, its limitation is: The wrong account's credentials may fail even if an ID format looks valid.

Question 10

A configuration walkthrough identifies "Write-plan-apply lifecycle". Which task is it principally intended to support?

  1. apply the reviewed plan artifact rather than recomputing from changed inputs
  2. separate proposing infrastructure changes from authorizing them
  3. reason about dependencies before Terraform proposes remote operations
  4. follow the core workflow from configuration to deliberate execution

Explanation

Correct Answer

D:

The practical result of Write-plan-apply lifecycle, used to follow the core workflow from configuration to deliberate execution, is: The core workflow involves writing configuration, initializing, planning, then applying intended changes. A qualification for this effect is: Destroy and import are maintenance actions rather than steps in every routine run.

Incorrect Answers

A:

That outcome applies to Saved plan promotion, intended to apply the reviewed plan artifact rather than recomputing from changed inputs, rather than the question's feature Write-plan-apply lifecycle: terraform plan -out creates a binary plan that terraform apply can execute by file name. Unlike Saved plan promotion, Write-plan-apply lifecycle is intended to follow the core workflow from configuration to deliberate execution, not to apply the reviewed plan artifact rather than recomputing from changed inputs.

B:

That outcome applies to Collaborative review before apply, intended to separate proposing infrastructure changes from authorizing them, rather than the question's feature Write-plan-apply lifecycle: Teams can share configuration and review a Terraform plan before a privileged apply runs. Unlike Collaborative review before apply, Write-plan-apply lifecycle is intended to follow the core workflow from configuration to deliberate execution, not to separate proposing infrastructure changes from authorizing them.

C:

That outcome applies to Plan refresh and graph evaluation, intended to reason about dependencies before Terraform proposes remote operations, rather than the question's feature Write-plan-apply lifecycle: Terraform evaluates configuration, state, and provider information to construct an action graph. Unlike Plan refresh and graph evaluation, Write-plan-apply lifecycle is intended to follow the core workflow from configuration to deliberate execution, not to reason about dependencies before Terraform proposes remote operations.

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