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

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.

Question 11

A Terraform runbook describes the mechanism "Default local state storage". Which responsibility should a reviewer associate with it?

  1. avoid using workstation files as the source of truth for team deployments
  2. keep a standalone project's state on its local filesystem
  3. place an isolated sandbox state file away from another lab's state
  4. prevent unauthorized reading of saved infrastructure metadata

Explanation

Correct Answer

B:

The practical result of Default local state storage, used to keep a standalone project's state on its local filesystem, is: Without a configured remote backend, Terraform ordinarily stores state locally in terraform.tfstate. A qualification for this effect is: A local file does not provide multi-user remote collaboration guarantees.

Incorrect Answers

A:

That outcome applies to Local backend and shared CI, intended to avoid using workstation files as the source of truth for team deployments, rather than the question's feature Default local state storage: Local state is best suited to isolated or experimental work rather than competing team runners. Unlike Local backend and shared CI, Default local state storage is intended to keep a standalone project's state on its local filesystem, not to avoid using workstation files as the source of truth for team deployments.

C:

That outcome applies to Custom local state path, intended to place an isolated sandbox state file away from another lab's state, rather than the question's feature Default local state storage: A local backend path can separate state storage from another configuration's snapshot. Unlike Custom local state path, Default local state storage is intended to keep a standalone project's state on its local filesystem, not to place an isolated sandbox state file away from another lab's state.

D:

That outcome applies to Local state access controls, intended to prevent unauthorized reading of saved infrastructure metadata, rather than the question's feature Default local state storage: Filesystem permissions and secure workstation handling matter when state stays local. Unlike Local state access controls, Default local state storage is intended to keep a standalone project's state on its local filesystem, not to prevent unauthorized reading of saved infrastructure metadata.

Question 12

The rollout owner asks whether Managed resource block is sufficient to ask Terraform to create and maintain an infrastructure object. Which limitation specifically concerns that mechanism?

  1. Changing the local name can change the state address unless migrated.
  2. It is not a read-only query against an object managed elsewhere.
  3. A data source does not automatically establish ownership over the queried object.
  4. They should not be hard-coded when proper references are available.

Explanation

Correct Answer

B:

For Managed resource block in the task to ask Terraform to create and maintain an infrastructure object, the important caution is: It is not a read-only query against an object managed elsewhere. The reason this matters is its actual behavior: A resource block declares a managed object whose lifecycle Terraform reconciles through a provider.

Incorrect Answers

A:

The proposed warning belongs to Resource type and local name, which serves the different goal to distinguish a provider-defined resource kind from its Terraform address label, rather than to Managed resource block: A resource block has both a resource type and local name, forming references like aws_vpc.main. The question concerns Managed resource block acting to ask Terraform to create and maintain an infrastructure object, not a limit of Resource type and local name.

C:

The proposed warning belongs to Data source dependency scheduling, which serves the different goal to defer a read when its arguments depend on a resource still being created, rather than to Managed resource block: Terraform tracks references to determine whether a data-source read can run during planning or must wait. The question concerns Managed resource block acting to ask Terraform to create and maintain an infrastructure object, not a limit of Data source dependency scheduling.

D:

The proposed warning belongs to Resource attributes computed by provider, which serves the different goal to consume an assigned ID only after the provider supplies it, rather than to Managed resource block: Computed attributes are often unknown during planning and become available after the provider creates or reads an object. The question concerns Managed resource block acting to ask Terraform to create and maintain an infrastructure object, not a limit of Resource attributes computed by provider.

Question 13

A colleague recommends the Terraform concept "Local child module source". Which use case best matches it?

  1. choose an explicit compatible release of a registry module
  2. use a chosen module branch, tag, or commit from a Git source
  3. find documented reusable modules rather than copying configurations manually
  4. load a reusable module from a directory in the same repository

Explanation

Correct Answer

D:

The practical result of Local child module source, used to load a reusable module from a directory in the same repository, is: A source like ./modules/network points a module call at a local filesystem path. A qualification for this effect is: Local module paths do not use registry module version arguments.

Incorrect Answers

A:

That outcome applies to Registry module version selection, intended to choose an explicit compatible release of a registry module, rather than the question's feature Local child module source: The version argument on a registry module call constrains which published module release is installed. Unlike Registry module version selection, Local child module source is intended to load a reusable module from a directory in the same repository, not to choose an explicit compatible release of a registry module.

B:

That outcome applies to Pinned Git module ref, intended to use a chosen module branch, tag, or commit from a Git source, rather than the question's feature Local child module source: A Git module source can use ?ref=... to select the intended revision. Unlike Pinned Git module ref, Local child module source is intended to load a reusable module from a directory in the same repository, not to use a chosen module branch, tag, or commit from a Git source.

C:

That outcome applies to Module discovery in registry, intended to find documented reusable modules rather than copying configurations manually, rather than the question's feature Local child module source: The Terraform Registry and private module registries can publish modules with inputs and outputs. Unlike Module discovery in registry, Local child module source is intended to load a reusable module from a directory in the same repository, not to find documented reusable modules rather than copying configurations manually.

Question 14

During an implementation review, a Terraform team encounters "HCP Terraform workspace". Which purpose is associated with that mechanism?

  1. store workspace state centrally rather than on a personal machine
  2. execute Terraform operations in a managed remote runtime
  3. isolate the state, variables, and run history for one managed infrastructure unit
  4. start remote plans from connected version-control updates

Explanation

Correct Answer

C:

The practical result of HCP Terraform workspace, used to isolate the state, variables, and run history for one managed infrastructure unit, is: An HCP Terraform workspace organizes a Terraform run context with its own state and configuration connection. A qualification for this effect is: It is not identical to a local CLI workspace's implementation.

Incorrect Answers

A:

That outcome applies to HCP Terraform state storage, intended to store workspace state centrally rather than on a personal machine, rather than the question's feature HCP Terraform workspace: HCP Terraform manages workspace state snapshots with controlled access and history. Unlike HCP Terraform state storage, HCP Terraform workspace is intended to isolate the state, variables, and run history for one managed infrastructure unit, not to store workspace state centrally rather than on a personal machine.

B:

That outcome applies to HCP Terraform remote execution, intended to execute Terraform operations in a managed remote runtime, rather than the question's feature HCP Terraform workspace: HCP Terraform can run plans and applies outside a developer's workstation under workspace controls. Unlike HCP Terraform remote execution, HCP Terraform workspace is intended to isolate the state, variables, and run history for one managed infrastructure unit, not to execute Terraform operations in a managed remote runtime.

D:

That outcome applies to VCS-driven HCP Terraform workflow, intended to start remote plans from connected version-control updates, rather than the question's feature HCP Terraform workspace: A VCS-connected workspace can queue runs when matching configuration changes are committed. Unlike VCS-driven HCP Terraform workflow, HCP Terraform workspace is intended to isolate the state, variables, and run history for one managed infrastructure unit, not to start remote plans from connected version-control updates.

Question 15

During an implementation review, a Terraform team encounters "required_providers source". Which purpose is associated with that mechanism?

  1. keep selected provider versions reproducible between runs
  2. identify the namespace and provider plugin that Terraform should install
  3. ask initialization to reconsider allowed provider selections
  4. restrict acceptable versions of an infrastructure provider

Explanation

Correct Answer

B:

The practical result of required_providers source, used to identify the namespace and provider plugin that Terraform should install, is: The required_providers map supplies a provider source address such as hashicorp/aws for dependency resolution. A qualification for this effect is: A provider block configures an installed provider instance rather than declaring its source.

Incorrect Answers

A:

That outcome applies to Terraform dependency lock file, intended to keep selected provider versions reproducible between runs, rather than the question's feature required_providers source: The .terraform.lock.hcl file records resolved provider versions and checksums for repeatable installation. Unlike Terraform dependency lock file, required_providers source is intended to identify the namespace and provider plugin that Terraform should install, not to keep selected provider versions reproducible between runs.

C:

That outcome applies to terraform init -upgrade, intended to ask initialization to reconsider allowed provider selections, rather than the question's feature required_providers source: Using -upgrade during init allows newer versions satisfying the configured provider constraints to be selected. Unlike terraform init -upgrade, required_providers source is intended to identify the namespace and provider plugin that Terraform should install, not to ask initialization to reconsider allowed provider selections.

D:

That outcome applies to Provider version constraint, intended to restrict acceptable versions of an infrastructure provider, rather than the question's feature required_providers source: The version argument in required_providers expresses allowed provider versions, such as a compatible release series. Unlike Provider version constraint, required_providers source is intended to identify the namespace and provider plugin that Terraform should install, not to restrict acceptable versions of an infrastructure provider.

Question 16

A Terraform rollout has two separate requirements: first, ask Terraform to create and maintain an infrastructure object; second, identify a pre-existing infrastructure object using provider-supported search criteria. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Resource type and local name; then use Data source lookup filters.
  2. First use Data source lookup filters; then use Managed resource block.
  3. First use Read-only cross-account lookup; then use Resource type and local name.
  4. First use Managed resource block; then use Read-only cross-account lookup.
  5. First use Managed resource block; then use Data source lookup filters.

Explanation

Correct Answer

E:

The first requirement, to ask Terraform to create and maintain an infrastructure object, is handled by Managed resource block: A resource block declares a managed object whose lifecycle Terraform reconciles through a provider. The second requirement, to identify a pre-existing infrastructure object using provider-supported search criteria, is handled by Data source lookup filters: Data source arguments let the provider identify an existing object, often by name or tags. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to ask Terraform to create and maintain an infrastructure object and identify a pre-existing infrastructure object using provider-supported search criteria, the first candidate Resource type and local name addresses distinguish a provider-defined resource kind from its Terraform address label; the second candidate Data source lookup filters addresses identify a pre-existing infrastructure object using provider-supported search criteria. This mapping fails because the first mechanism primarily supports the task to distinguish a provider-defined resource kind from its Terraform address label; the actual requirements are ask Terraform to create and maintain an infrastructure object first and identify a pre-existing infrastructure object using provider-supported search criteria second.

B:

For the requested tasks to ask Terraform to create and maintain an infrastructure object and identify a pre-existing infrastructure object using provider-supported search criteria, the first candidate Data source lookup filters addresses identify a pre-existing infrastructure object using provider-supported search criteria; the second candidate Managed resource block addresses ask Terraform to create and maintain an infrastructure object. This mapping fails because the first mechanism primarily supports the task to identify a pre-existing infrastructure object using provider-supported search criteria and the second mechanism primarily supports the task to ask Terraform to create and maintain an infrastructure object; the actual requirements are ask Terraform to create and maintain an infrastructure object first and identify a pre-existing infrastructure object using provider-supported search criteria second.

C:

For the requested tasks to ask Terraform to create and maintain an infrastructure object and identify a pre-existing infrastructure object using provider-supported search criteria, the first candidate Read-only cross-account lookup addresses obtain a shared network identifier owned by a different deployment team; the second candidate Resource type and local name addresses distinguish a provider-defined resource kind from its Terraform address label. This mapping fails because the first mechanism primarily supports the task to obtain a shared network identifier owned by a different deployment team and the second mechanism primarily supports the task to distinguish a provider-defined resource kind from its Terraform address label; the actual requirements are ask Terraform to create and maintain an infrastructure object first and identify a pre-existing infrastructure object using provider-supported search criteria second.

D:

For the requested tasks to ask Terraform to create and maintain an infrastructure object and identify a pre-existing infrastructure object using provider-supported search criteria, the first candidate Managed resource block addresses ask Terraform to create and maintain an infrastructure object; the second candidate Read-only cross-account lookup addresses obtain a shared network identifier owned by a different deployment team. This mapping fails because the second mechanism primarily supports the task to obtain a shared network identifier owned by a different deployment team; the actual requirements are ask Terraform to create and maintain an infrastructure object first and identify a pre-existing infrastructure object using provider-supported search criteria second.

Question 17

A design uses Write-plan-apply lifecycle to follow the core workflow from configuration to deliberate execution. Which qualification applies to the named mechanism?

  1. Saved plans may contain sensitive values and must be protected.
  2. Editing a file does not update the cloud before apply.
  3. Destroy and import are maintenance actions rather than steps in every routine run.
  4. The graph is not simply a sequential list ordered by file line number.
  5. Version control approval alone does not guarantee the exact reviewed plan is used.

Explanation

Correct Answer

C:

For Write-plan-apply lifecycle in the task to follow the core workflow from configuration to deliberate execution, the important caution is: Destroy and import are maintenance actions rather than steps in every routine run. The reason this matters is its actual behavior: The core workflow involves writing configuration, initializing, planning, then applying intended changes.

Incorrect Answers

A:

The proposed warning belongs to Saved plan promotion, which serves the different goal to apply the reviewed plan artifact rather than recomputing from changed inputs, rather than to Write-plan-apply lifecycle: terraform plan -out creates a binary plan that terraform apply can execute by file name. The question concerns Write-plan-apply lifecycle acting to follow the core workflow from configuration to deliberate execution, not a limit of Saved plan promotion.

B:

The proposed warning belongs to Configuration change cycle, which serves the different goal to modify desired resource arguments then inspect the resulting plan, rather than to Write-plan-apply lifecycle: Editing HCL changes intended infrastructure and a new plan reveals proposed differences. The question concerns Write-plan-apply lifecycle acting to follow the core workflow from configuration to deliberate execution, not a limit of Configuration change cycle.

D:

The proposed warning belongs to Plan refresh and graph evaluation, which serves the different goal to reason about dependencies before Terraform proposes remote operations, rather than to Write-plan-apply lifecycle: Terraform evaluates configuration, state, and provider information to construct an action graph. The question concerns Write-plan-apply lifecycle acting to follow the core workflow from configuration to deliberate execution, not a limit of Plan refresh and graph evaluation.

E:

The proposed warning belongs to Collaborative review before apply, which serves the different goal to separate proposing infrastructure changes from authorizing them, rather than to Write-plan-apply lifecycle: Teams can share configuration and review a Terraform plan before a privileged apply runs. The question concerns Write-plan-apply lifecycle acting to follow the core workflow from configuration to deliberate execution, not a limit of Collaborative review before apply.

Question 18

Before adopting Default local state storage to keep a standalone project's state on its local filesystem, which statement sets an accurate boundary?

  1. State location alone does not separate permissions for remote provider resources.
  2. Copying a state file between computers is error-prone and can leak secrets.
  3. A local file does not provide multi-user remote collaboration guarantees.
  4. A local backend cannot by itself provide shared policy controls or central audit.

Explanation

Correct Answer

C:

For Default local state storage in the task to keep a standalone project's state on its local filesystem, the important caution is: A local file does not provide multi-user remote collaboration guarantees. The reason this matters is its actual behavior: Without a configured remote backend, Terraform ordinarily stores state locally in terraform.tfstate.

Incorrect Answers

A:

The proposed warning belongs to Custom local state path, which serves the different goal to place an isolated sandbox state file away from another lab's state, rather than to Default local state storage: A local backend path can separate state storage from another configuration's snapshot. The question concerns Default local state storage acting to keep a standalone project's state on its local filesystem, not a limit of Custom local state path.

B:

The proposed warning belongs to Local backend and shared CI, which serves the different goal to avoid using workstation files as the source of truth for team deployments, rather than to Default local state storage: Local state is best suited to isolated or experimental work rather than competing team runners. The question concerns Default local state storage acting to keep a standalone project's state on its local filesystem, not a limit of Local backend and shared CI.

D:

The proposed warning belongs to Local state access controls, which serves the different goal to prevent unauthorized reading of saved infrastructure metadata, rather than to Default local state storage: Filesystem permissions and secure workstation handling matter when state stays local. The question concerns Default local state storage acting to keep a standalone project's state on its local filesystem, not a limit of Local state access controls.

Question 19

A team reviews the use of Infrastructure as code definition in Terraform 1.12. Which purpose matches its actual behavior?

  1. record intended infrastructure settings under version control
  2. translate declarative resources into operations on a platform
  3. preview the proposed actions before changing real resources
  4. represent desired infrastructure in reviewable configuration files

Explanation

Correct Answer

D:

The practical result of Infrastructure as code definition, used to represent desired infrastructure in reviewable configuration files, is: Infrastructure as code describes infrastructure through machine-readable files instead of relying only on manual console operations. A qualification for this effect is: The configuration still needs a tool and credentials to change actual systems.

Incorrect Answers

A:

That outcome applies to Desired configuration, intended to record intended infrastructure settings under version control, rather than the question's feature Infrastructure as code definition: Configuration expresses the operator's intended infrastructure and is the starting point for planning. Unlike Desired configuration, Infrastructure as code definition is intended to represent desired infrastructure in reviewable configuration files, not to record intended infrastructure settings under version control.

B:

That outcome applies to Infrastructure provider API, intended to translate declarative resources into operations on a platform, rather than the question's feature Infrastructure as code definition: Provider plugins supply resource implementations and call remote APIs when Terraform reconciles infrastructure. Unlike Infrastructure provider API, Infrastructure as code definition is intended to represent desired infrastructure in reviewable configuration files, not to translate declarative resources into operations on a platform.

C:

That outcome applies to Infrastructure execution plan, intended to preview the proposed actions before changing real resources, rather than the question's feature Infrastructure as code definition: A Terraform plan calculates proposed actions from configuration, state, providers, and current observations. Unlike Infrastructure execution plan, Infrastructure as code definition is intended to represent desired infrastructure in reviewable configuration files, not to preview the proposed actions before changing real resources.

Question 20

A design uses Local child module source to load a reusable module from a directory in the same repository. Which qualification applies to the named mechanism?

  1. The version argument is not supported for arbitrary local path modules.
  2. A published module can still depend on provider permissions and external objects.
  3. A floating branch can change over time and weaken reproducibility.
  4. Local module paths do not use registry module version arguments.
  5. Review source quality and pin an appropriate version instead of assuming every module is vetted.

Explanation

Correct Answer

D:

For Local child module source in the task to load a reusable module from a directory in the same repository, the important caution is: Local module paths do not use registry module version arguments. The reason this matters is its actual behavior: A source like ./modules/network points a module call at a local filesystem path.

Incorrect Answers

A:

The proposed warning belongs to Registry module version selection, which serves the different goal to choose an explicit compatible release of a registry module, rather than to Local child module source: The version argument on a registry module call constrains which published module release is installed. The question concerns Local child module source acting to load a reusable module from a directory in the same repository, not a limit of Registry module version selection.

B:

The proposed warning belongs to Module discovery in registry, which serves the different goal to find documented reusable modules rather than copying configurations manually, rather than to Local child module source: The Terraform Registry and private module registries can publish modules with inputs and outputs. The question concerns Local child module source acting to load a reusable module from a directory in the same repository, not a limit of Module discovery in registry.

C:

The proposed warning belongs to Pinned Git module ref, which serves the different goal to use a chosen module branch, tag, or commit from a Git source, rather than to Local child module source: A Git module source can use ?ref=... to select the intended revision. The question concerns Local child module source acting to load a reusable module from a directory in the same repository, not a limit of Pinned Git module ref.

E:

The proposed warning belongs to Public registry module source, which serves the different goal to reuse a published module from the Terraform Registry, rather than to Local child module source: Registry source addresses identify published module packages by namespace, name, and provider. The question concerns Local child module source acting to load a reusable module from a directory in the same repository, not a limit of Public registry module source.

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