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

Question 40

During an implementation review, a Terraform team encounters "Local backend configuration". Which purpose is associated with that mechanism?

  1. choose a particular path for a locally stored Terraform state file
  2. retain a prior state snapshot while modifying local state
  3. keep a standalone project's state on its local filesystem
  4. distinguish state of different local Terraform workspaces

Explanation

Correct Answer

A:

The practical result of Local backend configuration, used to choose a particular path for a locally stored Terraform state file, is: The local backend supports a path setting to change where state is written. A qualification for this effect is: A custom local path still resides on the operator's filesystem.

Incorrect Answers

B:

That outcome applies to Local state backup, intended to retain a prior state snapshot while modifying local state, rather than the question's feature Local backend configuration: Local state operations commonly create backup snapshots to aid recovery from mistakes. Unlike Local state backup, Local backend configuration is intended to choose a particular path for a locally stored Terraform state file, not to retain a prior state snapshot while modifying local state.

C:

That outcome applies to Default local state storage, intended to keep a standalone project's state on its local filesystem, rather than the question's feature Local backend configuration: Without a configured remote backend, Terraform ordinarily stores state locally in terraform.tfstate. Unlike Default local state storage, Local backend configuration is intended to choose a particular path for a locally stored Terraform state file, not to keep a standalone project's state on its local filesystem.

D:

That outcome applies to Local workspace state files, intended to distinguish state of different local Terraform workspaces, rather than the question's feature Local backend configuration: Non-default local workspace state snapshots can be kept in a terraform.tfstate.d structure. Unlike Local workspace state files, Local backend configuration is intended to choose a particular path for a locally stored Terraform state file, not to distinguish state of different local Terraform workspaces.

Question 41

A Terraform rollout has two separate requirements: first, represent desired infrastructure in reviewable configuration files; second, describe one managed infrastructure object in a configuration. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Desired configuration; then use Terraform resource declaration.
  2. First use Infrastructure as code definition; then use Idempotent reconciliation.
  3. First use Infrastructure as code definition; then use Terraform resource declaration.
  4. First use Idempotent reconciliation; then use Desired configuration.
  5. First use Terraform resource declaration; then use Infrastructure as code definition.

Explanation

Correct Answer

C:

The first requirement, to represent desired infrastructure in reviewable configuration files, is handled by Infrastructure as code definition: Infrastructure as code describes infrastructure through machine-readable files instead of relying only on manual console operations. The second requirement, to describe one managed infrastructure object in a configuration, is handled by Terraform resource declaration: A resource block represents an object that Terraform will create, update, or destroy through a provider. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to represent desired infrastructure in reviewable configuration files and describe one managed infrastructure object in a configuration, the first candidate Desired configuration addresses record intended infrastructure settings under version control; the second candidate Terraform resource declaration addresses describe one managed infrastructure object in a configuration. This mapping fails because the first mechanism primarily supports the task to record intended infrastructure settings under version control; the actual requirements are represent desired infrastructure in reviewable configuration files first and describe one managed infrastructure object in a configuration second.

B:

For the requested tasks to represent desired infrastructure in reviewable configuration files and describe one managed infrastructure object in a configuration, the first candidate Infrastructure as code definition addresses represent desired infrastructure in reviewable configuration files; the second candidate Idempotent reconciliation addresses repeat an apply without recreating already matching resources. This mapping fails because the second mechanism primarily supports the task to repeat an apply without recreating already matching resources; the actual requirements are represent desired infrastructure in reviewable configuration files first and describe one managed infrastructure object in a configuration second.

D:

For the requested tasks to represent desired infrastructure in reviewable configuration files and describe one managed infrastructure object in a configuration, the first candidate Idempotent reconciliation addresses repeat an apply without recreating already matching resources; the second candidate Desired configuration addresses record intended infrastructure settings under version control. This mapping fails because the first mechanism primarily supports the task to repeat an apply without recreating already matching resources and the second mechanism primarily supports the task to record intended infrastructure settings under version control; the actual requirements are represent desired infrastructure in reviewable configuration files first and describe one managed infrastructure object in a configuration second.

E:

For the requested tasks to represent desired infrastructure in reviewable configuration files and describe one managed infrastructure object in a configuration, the first candidate Terraform resource declaration addresses describe one managed infrastructure object in a configuration; the second candidate Infrastructure as code definition addresses represent desired infrastructure in reviewable configuration files. This mapping fails because the first mechanism primarily supports the task to describe one managed infrastructure object in a configuration and the second mechanism primarily supports the task to represent desired infrastructure in reviewable configuration files; the actual requirements are represent desired infrastructure in reviewable configuration files first and describe one managed infrastructure object in a configuration second.

Question 42

An operator chooses the mechanism "Public registry module source" for a Terraform project. Which outcome should this choice support?

  1. select a Terraform module within a larger repository
  2. load a reusable module from a directory in the same repository
  3. reference a reusable Terraform module from a VCS repository
  4. reuse a published module from the Terraform Registry

Explanation

Correct Answer

D:

The practical result of Public registry module source, used to reuse a published module from the Terraform Registry, is: Registry source addresses identify published module packages by namespace, name, and provider. A qualification for this effect is: Review source quality and pin an appropriate version instead of assuming every module is vetted.

Incorrect Answers

A:

That outcome applies to Module source subdirectory, intended to select a Terraform module within a larger repository, rather than the question's feature Public registry module source: The double-slash syntax in supported remote sources identifies a module subdirectory within the downloaded package. Unlike Module source subdirectory, Public registry module source is intended to reuse a published module from the Terraform Registry, not to select a Terraform module within a larger repository.

B:

That outcome applies to Local child module source, intended to load a reusable module from a directory in the same repository, rather than the question's feature Public registry module source: A source like ./modules/network points a module call at a local filesystem path. Unlike Local child module source, Public registry module source is intended to reuse a published module from the Terraform Registry, not to load a reusable module from a directory in the same repository.

C:

That outcome applies to Git-hosted module source, intended to reference a reusable Terraform module from a VCS repository, rather than the question's feature Public registry module source: A git:: URL can fetch a module from a Git repository using supported source syntax. Unlike Git-hosted module source, Public registry module source is intended to reuse a published module from the Terraform Registry, not to reference a reusable Terraform module from a VCS repository.

Question 43

A colleague recommends the Terraform concept "VCS-driven HCP Terraform workflow". Which use case best matches it?

  1. start remote plans from connected version-control updates
  2. execute Terraform with network access to private environments
  3. review a planned change in the HCP Terraform run interface before apply
  4. queue runs through an API integration instead of only direct Git events

Explanation

Correct Answer

A:

The practical result of VCS-driven HCP Terraform workflow, used to start remote plans from connected version-control updates, is: A VCS-connected workspace can queue runs when matching configuration changes are committed. A qualification for this effect is: Its workspace settings determine whether runs need approval or are automatically applied.

Incorrect Answers

B:

That outcome applies to HCP Terraform agent, intended to execute Terraform with network access to private environments, rather than the question's feature VCS-driven HCP Terraform workflow: An HCP Terraform agent can run work in an operator-controlled environment and connect to private resources. Unlike HCP Terraform agent, VCS-driven HCP Terraform workflow is intended to start remote plans from connected version-control updates, not to execute Terraform with network access to private environments.

C:

That outcome applies to Remote run approval, intended to review a planned change in the HCP Terraform run interface before apply, rather than the question's feature VCS-driven HCP Terraform workflow: An HCP workspace can separate planning and apply confirmation for controlled changes. Unlike Remote run approval, VCS-driven HCP Terraform workflow is intended to start remote plans from connected version-control updates, not to review a planned change in the HCP Terraform run interface before apply.

D:

That outcome applies to HCP Terraform API-driven run, intended to queue runs through an API integration instead of only direct Git events, rather than the question's feature VCS-driven HCP Terraform workflow: The HCP Terraform API can support workflows that upload configuration and trigger managed runs. Unlike HCP Terraform API-driven run, VCS-driven HCP Terraform workflow is intended to start remote plans from connected version-control updates, not to queue runs through an API integration instead of only direct Git events.

Question 44

A Terraform rollout has two separate requirements: first, bring a pre-existing remote object under a resource address in Terraform state; second, map a discovered object to the intended Terraform resource instance address. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Import under aliased provider; then use Import resource address matching.
  2. First use terraform import CLI; then use Import resource address matching.
  3. First use terraform import CLI; then use Import without recreation.
  4. First use Import without recreation; then use Import under aliased provider.
  5. First use Import resource address matching; then use terraform import CLI.

Explanation

Correct Answer

B:

The first requirement, to bring a pre-existing remote object under a resource address in Terraform state, is handled by terraform import CLI: terraform import ADDRESS ID binds the specified remote object to a declared resource instance. The second requirement, to map a discovered object to the intended Terraform resource instance address, is handled by Import resource address matching: Import uses a Terraform resource address that corresponds to the configuration intended to manage the object. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to bring a pre-existing remote object under a resource address in Terraform state and map a discovered object to the intended Terraform resource instance address, the first candidate Import under aliased provider addresses adopt a remote object from the correct account or region; the second candidate Import resource address matching addresses map a discovered object to the intended Terraform resource instance address. This mapping fails because the first mechanism primarily supports the task to adopt a remote object from the correct account or region; the actual requirements are bring a pre-existing remote object under a resource address in Terraform state first and map a discovered object to the intended Terraform resource instance address second.

C:

For the requested tasks to bring a pre-existing remote object under a resource address in Terraform state and map a discovered object to the intended Terraform resource instance address, the first candidate terraform import CLI addresses bring a pre-existing remote object under a resource address in Terraform state; the second candidate Import without recreation addresses adopt an existing object rather than creating a new duplicate. This mapping fails because the second mechanism primarily supports the task to adopt an existing object rather than creating a new duplicate; the actual requirements are bring a pre-existing remote object under a resource address in Terraform state first and map a discovered object to the intended Terraform resource instance address second.

D:

For the requested tasks to bring a pre-existing remote object under a resource address in Terraform state and map a discovered object to the intended Terraform resource instance address, the first candidate Import without recreation addresses adopt an existing object rather than creating a new duplicate; the second candidate Import under aliased provider addresses adopt a remote object from the correct account or region. This mapping fails because the first mechanism primarily supports the task to adopt an existing object rather than creating a new duplicate and the second mechanism primarily supports the task to adopt a remote object from the correct account or region; the actual requirements are bring a pre-existing remote object under a resource address in Terraform state first and map a discovered object to the intended Terraform resource instance address second.

E:

For the requested tasks to bring a pre-existing remote object under a resource address in Terraform state and map a discovered object to the intended Terraform resource instance address, the first candidate Import resource address matching addresses map a discovered object to the intended Terraform resource instance address; the second candidate terraform import CLI addresses bring a pre-existing remote object under a resource address in Terraform state. This mapping fails because the first mechanism primarily supports the task to map a discovered object to the intended Terraform resource instance address and the second mechanism primarily supports the task to bring a pre-existing remote object under a resource address in Terraform state; the actual requirements are bring a pre-existing remote object under a resource address in Terraform state first and map a discovered object to the intended Terraform resource instance address second.

Question 45

An engineer must update an existing Terraform workflow to identify a pre-existing infrastructure object using provider-supported search criteria. Which mechanism most directly meets this particular need?

  1. Resource type and local name
  2. Resource attributes computed by provider
  3. Data source dependency scheduling
  4. Data source lookup filters

Explanation

Correct Answer

D:

The task is to identify a pre-existing infrastructure object using provider-supported search criteria; Data source lookup filters directly supports that requirement: Data source arguments let the provider identify an existing object, often by name or tags. Its relevant boundary is: A lookup that finds no suitable object can fail rather than creating one.

Incorrect Answers

A:

Resource type and local name is designed to distinguish a provider-defined resource kind from its Terraform address label, whereas this task is to identify a pre-existing infrastructure object using provider-supported search criteria: A resource block has both a resource type and local name, forming references like aws_vpc.main. Against Data source lookup filters, its limitation is: Changing the local name can change the state address unless migrated.

B:

Resource attributes computed by provider is designed to consume an assigned ID only after the provider supplies it, whereas this task is to identify a pre-existing infrastructure object using provider-supported search criteria: Computed attributes are often unknown during planning and become available after the provider creates or reads an object. Against Data source lookup filters, its limitation is: They should not be hard-coded when proper references are available.

C:

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 identify a pre-existing infrastructure object using provider-supported search criteria: Terraform tracks references to determine whether a data-source read can run during planning or must wait. Against Data source lookup filters, its limitation is: A data source does not automatically establish ownership over the queried object.

Question 46

A change proposal relies on Collaborative review before apply for the task to separate proposing infrastructure changes from authorizing them. Which limitation specifically applies to it?

  1. A green validation result cannot substitute for plan review.
  2. Destroy and import are maintenance actions rather than steps in every routine run.
  3. Editing a file does not update the cloud before apply.
  4. Concurrency still needs backend locking when several runs target the same state.
  5. Version control approval alone does not guarantee the exact reviewed plan is used.

Explanation

Correct Answer

E:

For Collaborative review before apply in the task to separate proposing infrastructure changes from authorizing them, the important caution is: Version control approval alone does not guarantee the exact reviewed plan is used. The reason this matters is its actual behavior: Teams can share configuration and review a Terraform plan before a privileged apply runs.

Incorrect Answers

A:

The proposed warning belongs to Plan inspection checkpoint, which serves the different goal to review planned deletion before permitting an irreversible action, rather than to Collaborative review before apply: A review of change symbols and affected addresses can reveal unexpected destroy or replacement operations. The question concerns Collaborative review before apply acting to separate proposing infrastructure changes from authorizing them, not a limit of Plan inspection checkpoint.

B:

The proposed warning belongs to Write-plan-apply lifecycle, which serves the different goal to follow the core workflow from configuration to deliberate execution, rather than to Collaborative review before apply: The core workflow involves writing configuration, initializing, planning, then applying intended changes. The question concerns Collaborative review before apply acting to separate proposing infrastructure changes from authorizing them, not a limit of Write-plan-apply lifecycle.

C:

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 Collaborative review before apply: Editing HCL changes intended infrastructure and a new plan reveals proposed differences. The question concerns Collaborative review before apply acting to separate proposing infrastructure changes from authorizing them, not a limit of Configuration change cycle.

D:

The proposed warning belongs to Dependency-aware parallelism, which serves the different goal to allow independent resources to be managed concurrently within one run, rather than to Collaborative review before apply: Terraform uses its dependency graph to schedule actions that have no ordering relationship. The question concerns Collaborative review before apply acting to separate proposing infrastructure changes from authorizing them, not a limit of Dependency-aware parallelism.

Question 47

The deployment owner requests a reliable way to restrict acceptable versions of an infrastructure provider. Which mechanism most directly meets this particular need?

  1. Provider version compatibility operator
  2. terraform providers lock
  3. Provider version constraint
  4. Provider installation during init

Explanation

Correct Answer

C:

The task is to restrict acceptable versions of an infrastructure provider; Provider version constraint directly supports that requirement: The version argument in required_providers expresses allowed provider versions, such as a compatible release series. Its relevant boundary is: The constraint is not the same as Terraform CLI required_version.

Incorrect Answers

A:

Provider version compatibility operator is designed to allow only nonbreaking versions in a specified range, whereas this task is to restrict acceptable versions of an infrastructure provider: A constraint like ~> 5.2 permits compatible versions within that bound while excluding the next incompatible major range. Against Provider version constraint, its limitation is: It is a permitted range, not proof of the installed provider's actual version.

B:

terraform providers lock is designed to populate or update provider checksum selections in the lock file, whereas this task is to restrict acceptable versions of an infrastructure provider: The providers lock command can record provider package checksums for selected target platforms. Against Provider version constraint, its limitation is: It is not the command that downloads and configures all root-module infrastructure.

D:

Provider installation during init is designed to download required plugins into the initialized working environment, whereas this task is to restrict acceptable versions of an infrastructure provider: terraform init resolves provider dependencies and installs or reuses selected plugin packages. Against Provider version constraint, its limitation is: It does not apply infrastructure changes during initialization.

Question 48

The rollout owner asks whether Local backend configuration is sufficient to choose a particular path for a locally stored Terraform state file. Which limitation specifically concerns that mechanism?

  1. A local file does not provide multi-user remote collaboration guarantees.
  2. Separate workspace state does not change the configuration code automatically.
  3. A backup does not make concurrent state modifications safe.
  4. A custom local path still resides on the operator's filesystem.

Explanation

Correct Answer

D:

For Local backend configuration in the task to choose a particular path for a locally stored Terraform state file, the important caution is: A custom local path still resides on the operator's filesystem. The reason this matters is its actual behavior: The local backend supports a path setting to change where state is written.

Incorrect Answers

A:

The proposed warning belongs to Default local state storage, which serves the different goal to keep a standalone project's state on its local filesystem, rather than to Local backend configuration: Without a configured remote backend, Terraform ordinarily stores state locally in terraform.tfstate. The question concerns Local backend configuration acting to choose a particular path for a locally stored Terraform state file, not a limit of Default local state storage.

B:

The proposed warning belongs to Local workspace state files, which serves the different goal to distinguish state of different local Terraform workspaces, rather than to Local backend configuration: Non-default local workspace state snapshots can be kept in a terraform.tfstate.d structure. The question concerns Local backend configuration acting to choose a particular path for a locally stored Terraform state file, not a limit of Local workspace state files.

C:

The proposed warning belongs to Local state backup, which serves the different goal to retain a prior state snapshot while modifying local state, rather than to Local backend configuration: Local state operations commonly create backup snapshots to aid recovery from mistakes. The question concerns Local backend configuration acting to choose a particular path for a locally stored Terraform state file, not a limit of Local state backup.

Question 49

A change proposal relies on Public registry module source for the task to reuse a published module from the Terraform Registry. Which limitation specifically applies to it?

  1. The path suffix does not change provider plugin version selection.
  2. Review source quality and pin an appropriate version instead of assuming every module is vetted.
  3. A Git module is not selected by the registry-only version argument.
  4. Local module paths do not use registry module version arguments.

Explanation

Correct Answer

B:

For Public registry module source in the task to reuse a published module from the Terraform Registry, the important caution is: Review source quality and pin an appropriate version instead of assuming every module is vetted. The reason this matters is its actual behavior: Registry source addresses identify published module packages by namespace, name, and provider.

Incorrect Answers

A:

The proposed warning belongs to Module source subdirectory, which serves the different goal to select a Terraform module within a larger repository, rather than to Public registry module source: The double-slash syntax in supported remote sources identifies a module subdirectory within the downloaded package. The question concerns Public registry module source acting to reuse a published module from the Terraform Registry, not a limit of Module source subdirectory.

C:

The proposed warning belongs to Git-hosted module source, which serves the different goal to reference a reusable Terraform module from a VCS repository, rather than to Public registry module source: A git:: URL can fetch a module from a Git repository using supported source syntax. The question concerns Public registry module source acting to reuse a published module from the Terraform Registry, not a limit of Git-hosted module source.

D:

The proposed warning belongs to Local child module source, which serves the different goal to load a reusable module from a directory in the same repository, rather than to Public registry module source: A source like ./modules/network points a module call at a local filesystem path. The question concerns Public registry module source acting to reuse a published module from the Terraform Registry, not a limit of Local child module source.

Question 50

Before adopting VCS-driven HCP Terraform workflow to start remote plans from connected version-control updates, which statement sets an accurate boundary?

  1. A speculative plan from a pull request is not the same as an authorized apply run.
  2. An API workflow must still authenticate and choose the intended workspace.
  3. It is not identical to a local CLI workspace's implementation.
  4. Its workspace settings determine whether runs need approval or are automatically applied.
  5. An agent requires setup and does not make inaccessible endpoints public.

Explanation

Correct Answer

D:

For VCS-driven HCP Terraform workflow in the task to start remote plans from connected version-control updates, the important caution is: Its workspace settings determine whether runs need approval or are automatically applied. The reason this matters is its actual behavior: A VCS-connected workspace can queue runs when matching configuration changes are committed.

Incorrect Answers

A:

The proposed warning belongs to Remote run approval, which serves the different goal to review a planned change in the HCP Terraform run interface before apply, rather than to VCS-driven HCP Terraform workflow: An HCP workspace can separate planning and apply confirmation for controlled changes. The question concerns VCS-driven HCP Terraform workflow acting to start remote plans from connected version-control updates, not a limit of Remote run approval.

B:

The proposed warning belongs to HCP Terraform API-driven run, which serves the different goal to queue runs through an API integration instead of only direct Git events, rather than to VCS-driven HCP Terraform workflow: The HCP Terraform API can support workflows that upload configuration and trigger managed runs. The question concerns VCS-driven HCP Terraform workflow acting to start remote plans from connected version-control updates, not a limit of HCP Terraform API-driven run.

C:

The proposed warning belongs to HCP Terraform workspace, which serves the different goal to isolate the state, variables, and run history for one managed infrastructure unit, rather than to VCS-driven HCP Terraform workflow: An HCP Terraform workspace organizes a Terraform run context with its own state and configuration connection. The question concerns VCS-driven HCP Terraform workflow acting to start remote plans from connected version-control updates, not a limit of HCP Terraform workspace.

E:

The proposed warning belongs to HCP Terraform agent, which serves the different goal to execute Terraform with network access to private environments, rather than to VCS-driven HCP Terraform workflow: An HCP Terraform agent can run work in an operator-controlled environment and connect to private resources. The question concerns VCS-driven HCP Terraform workflow acting to start remote plans from connected version-control updates, not a limit of HCP Terraform agent.

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