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

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.

Question 21

The team is documenting risks of HCP Terraform workspace while planning to isolate the state, variables, and run history for one managed infrastructure unit. Which caveat specifically applies to that mechanism?

  1. Central state storage does not guarantee infrastructure can be reached from every execution mode.
  2. It is not identical to a local CLI workspace's implementation.
  3. Remote execution still needs provider credentials and connectivity.
  4. A speculative plan from a pull request is not the same as an authorized apply run.
  5. Its workspace settings determine whether runs need approval or are automatically applied.

Explanation

Correct Answer

B:

For HCP Terraform workspace in the task to isolate the state, variables, and run history for one managed infrastructure unit, the important caution is: It is not identical to a local CLI workspace's implementation. The reason this matters is its actual behavior: An HCP Terraform workspace organizes a Terraform run context with its own state and configuration connection.

Incorrect Answers

A:

The proposed warning belongs to HCP Terraform state storage, which serves the different goal to store workspace state centrally rather than on a personal machine, rather than to HCP Terraform workspace: HCP Terraform manages workspace state snapshots with controlled access and history. The question concerns HCP Terraform workspace acting to isolate the state, variables, and run history for one managed infrastructure unit, not a limit of HCP Terraform state storage.

C:

The proposed warning belongs to HCP Terraform remote execution, which serves the different goal to execute Terraform operations in a managed remote runtime, rather than to HCP Terraform workspace: HCP Terraform can run plans and applies outside a developer's workstation under workspace controls. The question concerns HCP Terraform workspace acting to isolate the state, variables, and run history for one managed infrastructure unit, not a limit of HCP Terraform remote execution.

D:

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 HCP Terraform workspace: An HCP workspace can separate planning and apply confirmation for controlled changes. The question concerns HCP Terraform workspace acting to isolate the state, variables, and run history for one managed infrastructure unit, not a limit of Remote run approval.

E:

The proposed warning belongs to VCS-driven HCP Terraform workflow, which serves the different goal to start remote plans from connected version-control updates, rather than to HCP Terraform workspace: A VCS-connected workspace can queue runs when matching configuration changes are committed. The question concerns HCP Terraform workspace acting to isolate the state, variables, and run history for one managed infrastructure unit, not a limit of VCS-driven HCP Terraform workflow.

Question 22

A team reviews the use of terraform import CLI in Terraform 1.12. Which purpose matches its actual behavior?

  1. adopt a remote object from the correct account or region
  2. run a plan after importing an object to check unexpected updates
  3. use import planning support to help write resource HCL for an existing object
  4. bring a pre-existing remote object under a resource address in Terraform state

Explanation

Correct Answer

D:

The practical result of terraform import CLI, used to bring a pre-existing remote object under a resource address in Terraform state, is: terraform import ADDRESS ID binds the specified remote object to a declared resource instance. A qualification for this effect is: The import command alone does not generate a complete root configuration.

Incorrect Answers

A:

That outcome applies to Import under aliased provider, intended to adopt a remote object from the correct account or region, rather than the question's feature terraform import CLI: The target resource's selected provider configuration determines how Terraform locates and reads the imported object. Unlike Import under aliased provider, terraform import CLI is intended to bring a pre-existing remote object under a resource address in Terraform state, not to adopt a remote object from the correct account or region.

B:

That outcome applies to Import validation follow-up, intended to run a plan after importing an object to check unexpected updates, rather than the question's feature terraform import CLI: A post-import plan reveals whether declared settings match the newly adopted remote object. Unlike Import validation follow-up, terraform import CLI is intended to bring a pre-existing remote object under a resource address in Terraform state, not to run a plan after importing an object to check unexpected updates.

C:

That outcome applies to Generate import configuration where supported, intended to use import planning support to help write resource HCL for an existing object, rather than the question's feature terraform import CLI: Terraform supports generating configuration with appropriate import workflows for certain imported resources. Unlike Generate import configuration where supported, terraform import CLI is intended to bring a pre-existing remote object under a resource address in Terraform state, not to use import planning support to help write resource HCL for an existing object.

Question 23

A deployment design calls for a supported way to look up an existing object to use its attributes without managing its lifecycle. Which mechanism most directly meets this particular need?

  1. Data source block
  2. Read-only cross-account lookup
  3. Data source lookup filters
  4. Managed resource block

Explanation

Correct Answer

A:

The task is to look up an existing object to use its attributes without managing its lifecycle; Data source block directly supports that requirement: A data block asks its provider to read information; its attributes can feed other expressions. Its relevant boundary is: The data block does not claim responsibility for creating the referenced object.

Incorrect Answers

B:

Read-only cross-account lookup is designed to obtain a shared network identifier owned by a different deployment team, whereas this task is to look up an existing object to use its attributes without managing its lifecycle: A data source reads a shared object if the provider configuration has permission to access it. Against Data source block, its limitation is: Reading does not transfer ownership to the consuming root module.

C:

Data source lookup filters is designed to identify a pre-existing infrastructure object using provider-supported search criteria, whereas this task is to look up an existing object to use its attributes without managing its lifecycle: Data source arguments let the provider identify an existing object, often by name or tags. Against Data source block, its limitation is: A lookup that finds no suitable object can fail rather than creating one.

D:

Managed resource block is designed to ask Terraform to create and maintain an infrastructure object, whereas this task is to look up an existing object to use its attributes without managing its lifecycle: A resource block declares a managed object whose lifecycle Terraform reconciles through a provider. Against Data source block, its limitation is: It is not a read-only query against an object managed elsewhere.

Question 24

The implementation must both follow the core workflow from configuration to deliberate execution and reason about dependencies before Terraform proposes remote operations. Which TWO mechanisms directly address these two separate requirements? Choose TWO.

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

Explanation

Correct Answers

A:

Among the paired tasks to follow the core workflow from configuration to deliberate execution and reason about dependencies before Terraform proposes remote operations, Plan refresh and graph evaluation serves the requirement to reason about dependencies before Terraform proposes remote operations: Terraform evaluates configuration, state, and provider information to construct an action graph. The other task must be covered by a separate mechanism.

E:

Among the paired tasks to follow the core workflow from configuration to deliberate execution and reason about dependencies before Terraform proposes remote operations, Write-plan-apply lifecycle serves the requirement to follow the core workflow from configuration to deliberate execution: The core workflow involves writing configuration, initializing, planning, then applying intended changes. The other task must be covered by a separate mechanism.

Incorrect Answers

B:

The requirements are follow the core workflow from configuration to deliberate execution and reason about dependencies before Terraform proposes remote operations, while Collaborative review before apply supports the different task to separate proposing infrastructure changes from authorizing them: Teams can share configuration and review a Terraform plan before a privileged apply runs. That capability is outside the two selected responsibilities.

C:

The requirements are follow the core workflow from configuration to deliberate execution and reason about dependencies before Terraform proposes remote operations, while Configuration change cycle supports the different task to modify desired resource arguments then inspect the resulting plan: Editing HCL changes intended infrastructure and a new plan reveals proposed differences. That capability is outside the two selected responsibilities.

D:

The requirements are follow the core workflow from configuration to deliberate execution and reason about dependencies before Terraform proposes remote operations, while Saved plan promotion supports the different task to apply the reviewed plan artifact rather than recomputing from changed inputs: terraform plan -out creates a binary plan that terraform apply can execute by file name. That capability is outside the two selected responsibilities.

Question 25

The team is documenting risks of required_providers source while planning to identify the namespace and provider plugin that Terraform should install. Which caveat specifically applies to that mechanism?

  1. It cannot override a required_providers constraint that excludes a release.
  2. It does not lock child module versions or Terraform Core versions.
  3. The constraint is not the same as Terraform CLI required_version.
  4. A provider block configures an installed provider instance rather than declaring its source.

Explanation

Correct Answer

D:

For required_providers source in the task to identify the namespace and provider plugin that Terraform should install, the important caution is: A provider block configures an installed provider instance rather than declaring its source. The reason this matters is its actual behavior: The required_providers map supplies a provider source address such as hashicorp/aws for dependency resolution.

Incorrect Answers

A:

The proposed warning belongs to terraform init -upgrade, which serves the different goal to ask initialization to reconsider allowed provider selections, rather than to required_providers source: Using -upgrade during init allows newer versions satisfying the configured provider constraints to be selected. The question concerns required_providers source acting to identify the namespace and provider plugin that Terraform should install, not a limit of terraform init -upgrade.

B:

The proposed warning belongs to Terraform dependency lock file, which serves the different goal to keep selected provider versions reproducible between runs, rather than to required_providers source: The .terraform.lock.hcl file records resolved provider versions and checksums for repeatable installation. The question concerns required_providers source acting to identify the namespace and provider plugin that Terraform should install, not a limit of Terraform dependency lock file.

C:

The proposed warning belongs to Provider version constraint, which serves the different goal to restrict acceptable versions of an infrastructure provider, rather than to required_providers source: The version argument in required_providers expresses allowed provider versions, such as a compatible release series. The question concerns required_providers source acting to identify the namespace and provider plugin that Terraform should install, not a limit of Provider version constraint.

Question 26

A Terraform rollout has two separate requirements: first, keep a standalone project's state on its local filesystem; second, distinguish state of different local Terraform workspaces. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Local workspace state files; then use Default local state storage.
  2. First use Local state access controls; then use Local workspace state files.
  3. First use Default local state storage; then use Local workspace state files.
  4. First use Default local state storage; then use Local state backup.
  5. First use Local state backup; then use Local state access controls.

Explanation

Correct Answer

C:

The first requirement, to keep a standalone project's state on its local filesystem, is handled by Default local state storage: Without a configured remote backend, Terraform ordinarily stores state locally in terraform.tfstate. The second requirement, to distinguish state of different local Terraform workspaces, is handled by Local workspace state files: Non-default local workspace state snapshots can be kept in a terraform.tfstate.d structure. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to keep a standalone project's state on its local filesystem and distinguish state of different local Terraform workspaces, the first candidate Local workspace state files addresses distinguish state of different local Terraform workspaces; the second candidate Default local state storage addresses keep a standalone project's state on its local filesystem. This mapping fails because the first mechanism primarily supports the task to distinguish state of different local Terraform workspaces and the second mechanism primarily supports the task to keep a standalone project's state on its local filesystem; the actual requirements are keep a standalone project's state on its local filesystem first and distinguish state of different local Terraform workspaces second.

B:

For the requested tasks to keep a standalone project's state on its local filesystem and distinguish state of different local Terraform workspaces, the first candidate Local state access controls addresses prevent unauthorized reading of saved infrastructure metadata; the second candidate Local workspace state files addresses distinguish state of different local Terraform workspaces. This mapping fails because the first mechanism primarily supports the task to prevent unauthorized reading of saved infrastructure metadata; the actual requirements are keep a standalone project's state on its local filesystem first and distinguish state of different local Terraform workspaces second.

D:

For the requested tasks to keep a standalone project's state on its local filesystem and distinguish state of different local Terraform workspaces, the first candidate Default local state storage addresses keep a standalone project's state on its local filesystem; the second candidate Local state backup addresses retain a prior state snapshot while modifying local state. This mapping fails because the second mechanism primarily supports the task to retain a prior state snapshot while modifying local state; the actual requirements are keep a standalone project's state on its local filesystem first and distinguish state of different local Terraform workspaces second.

E:

For the requested tasks to keep a standalone project's state on its local filesystem and distinguish state of different local Terraform workspaces, the first candidate Local state backup addresses retain a prior state snapshot while modifying local state; the second candidate Local state access controls addresses prevent unauthorized reading of saved infrastructure metadata. This mapping fails because the first mechanism primarily supports the task to retain a prior state snapshot while modifying local state and the second mechanism primarily supports the task to prevent unauthorized reading of saved infrastructure metadata; the actual requirements are keep a standalone project's state on its local filesystem first and distinguish state of different local Terraform workspaces second.

Question 27

The implementation must both load a reusable module from a directory in the same repository and reference a reusable Terraform module from a VCS repository. Which TWO mechanisms directly address these two separate requirements? Choose TWO.

  1. Pinned Git module ref
  2. Public registry module source
  3. Local child module source
  4. Module source subdirectory
  5. Git-hosted module source

Explanation

Correct Answers

C:

Among the paired tasks to load a reusable module from a directory in the same repository and reference a reusable Terraform module from a VCS repository, Local child module source serves the requirement to load a reusable module from a directory in the same repository: A source like ./modules/network points a module call at a local filesystem path. The other task must be covered by a separate mechanism.

E:

Among the paired tasks to load a reusable module from a directory in the same repository and reference a reusable Terraform module from a VCS repository, Git-hosted module source serves the requirement to reference a reusable Terraform module from a VCS repository: A git:: URL can fetch a module from a Git repository using supported source syntax. The other task must be covered by a separate mechanism.

Incorrect Answers

A:

The requirements are load a reusable module from a directory in the same repository and reference a reusable Terraform module from a VCS repository, while Pinned Git module ref supports the different task to use a chosen module branch, tag, or commit from a Git source: A Git module source can use ?ref=... to select the intended revision. That capability is outside the two selected responsibilities.

B:

The requirements are load a reusable module from a directory in the same repository and reference a reusable Terraform module from a VCS repository, while Public registry module source supports the different task to reuse a published module from the Terraform Registry: Registry source addresses identify published module packages by namespace, name, and provider. That capability is outside the two selected responsibilities.

D:

The requirements are load a reusable module from a directory in the same repository and reference a reusable Terraform module from a VCS repository, while Module source subdirectory supports the different task to select a Terraform module within a larger repository: The double-slash syntax in supported remote sources identifies a module subdirectory within the downloaded package. That capability is outside the two selected responsibilities.

Question 28

A Terraform rollout has two separate requirements: first, isolate the state, variables, and run history for one managed infrastructure unit; second, execute Terraform operations in a managed remote runtime. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use HCP Terraform workspace; then use HCP Terraform state storage.
  2. First use HCP Terraform state storage; then use Remote run approval.
  3. First use HCP Terraform remote execution; then use HCP Terraform workspace.
  4. First use Remote run approval; then use HCP Terraform remote execution.
  5. First use HCP Terraform workspace; then use HCP Terraform remote execution.

Explanation

Correct Answer

E:

The first requirement, to isolate the state, variables, and run history for one managed infrastructure unit, is handled by HCP Terraform workspace: An HCP Terraform workspace organizes a Terraform run context with its own state and configuration connection. The second requirement, to execute Terraform operations in a managed remote runtime, is handled by HCP Terraform remote execution: HCP Terraform can run plans and applies outside a developer's workstation under workspace controls. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to isolate the state, variables, and run history for one managed infrastructure unit and execute Terraform operations in a managed remote runtime, the first candidate HCP Terraform workspace addresses isolate the state, variables, and run history for one managed infrastructure unit; the second candidate HCP Terraform state storage addresses store workspace state centrally rather than on a personal machine. This mapping fails because the second mechanism primarily supports the task to store workspace state centrally rather than on a personal machine; the actual requirements are isolate the state, variables, and run history for one managed infrastructure unit first and execute Terraform operations in a managed remote runtime second.

B:

For the requested tasks to isolate the state, variables, and run history for one managed infrastructure unit and execute Terraform operations in a managed remote runtime, the first candidate HCP Terraform state storage addresses store workspace state centrally rather than on a personal machine; the second candidate Remote run approval addresses review a planned change in the HCP Terraform run interface before apply. This mapping fails because the first mechanism primarily supports the task to store workspace state centrally rather than on a personal machine and the second mechanism primarily supports the task to review a planned change in the HCP Terraform run interface before apply; the actual requirements are isolate the state, variables, and run history for one managed infrastructure unit first and execute Terraform operations in a managed remote runtime second.

C:

For the requested tasks to isolate the state, variables, and run history for one managed infrastructure unit and execute Terraform operations in a managed remote runtime, the first candidate HCP Terraform remote execution addresses execute Terraform operations in a managed remote runtime; the second candidate HCP Terraform workspace addresses isolate the state, variables, and run history for one managed infrastructure unit. This mapping fails because the first mechanism primarily supports the task to execute Terraform operations in a managed remote runtime and the second mechanism primarily supports the task to isolate the state, variables, and run history for one managed infrastructure unit; the actual requirements are isolate the state, variables, and run history for one managed infrastructure unit first and execute Terraform operations in a managed remote runtime second.

D:

For the requested tasks to isolate the state, variables, and run history for one managed infrastructure unit and execute Terraform operations in a managed remote runtime, the first candidate Remote run approval addresses review a planned change in the HCP Terraform run interface before apply; the second candidate HCP Terraform remote execution addresses execute Terraform operations in a managed remote runtime. This mapping fails because the first mechanism primarily supports the task to review a planned change in the HCP Terraform run interface before apply; the actual requirements are isolate the state, variables, and run history for one managed infrastructure unit first and execute Terraform operations in a managed remote runtime second.

Question 29

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

  1. obtain a shared network identifier owned by a different deployment team
  2. look up an existing object to use its attributes without managing its lifecycle
  3. identify a pre-existing infrastructure object using provider-supported search criteria
  4. ask Terraform to create and maintain an infrastructure object

Explanation

Correct Answer

B:

The practical result of Data source block, used to look up an existing object to use its attributes without managing its lifecycle, is: A data block asks its provider to read information; its attributes can feed other expressions. A qualification for this effect is: The data block does not claim responsibility for creating the referenced object.

Incorrect Answers

A:

That outcome applies to Read-only cross-account lookup, intended to obtain a shared network identifier owned by a different deployment team, rather than the question's feature Data source block: A data source reads a shared object if the provider configuration has permission to access it. Unlike Read-only cross-account lookup, Data source block is intended to look up an existing object to use its attributes without managing its lifecycle, not to obtain a shared network identifier owned by a different deployment team.

C:

That outcome applies to Data source lookup filters, intended to identify a pre-existing infrastructure object using provider-supported search criteria, rather than the question's feature Data source block: Data source arguments let the provider identify an existing object, often by name or tags. Unlike Data source lookup filters, Data source block is intended to look up an existing object to use its attributes without managing its lifecycle, not to identify a pre-existing infrastructure object using provider-supported search criteria.

D:

That outcome applies to Managed resource block, intended to ask Terraform to create and maintain an infrastructure object, rather than the question's feature Data source block: A resource block declares a managed object whose lifecycle Terraform reconciles through a provider. Unlike Managed resource block, Data source block is intended to look up an existing object to use its attributes without managing its lifecycle, not to ask Terraform to create and maintain an infrastructure object.

Question 30

A change proposal relies on Infrastructure as code definition for the task to represent desired infrastructure in reviewable configuration files. Which limitation specifically applies to it?

  1. Reviewing a plan is different from committing its effects to the remote system.
  2. Terraform Core does not hard-code each cloud service API.
  3. The configuration still needs a tool and credentials to change actual systems.
  4. The file alone does not reveal every live change made outside Terraform.

Explanation

Correct Answer

C:

For Infrastructure as code definition in the task to represent desired infrastructure in reviewable configuration files, the important caution is: The configuration still needs a tool and credentials to change actual systems. The reason this matters is its actual behavior: Infrastructure as code describes infrastructure through machine-readable files instead of relying only on manual console operations.

Incorrect Answers

A:

The proposed warning belongs to Infrastructure execution plan, which serves the different goal to preview the proposed actions before changing real resources, rather than to Infrastructure as code definition: A Terraform plan calculates proposed actions from configuration, state, providers, and current observations. The question concerns Infrastructure as code definition acting to represent desired infrastructure in reviewable configuration files, not a limit of Infrastructure execution plan.

B:

The proposed warning belongs to Infrastructure provider API, which serves the different goal to translate declarative resources into operations on a platform, rather than to Infrastructure as code definition: Provider plugins supply resource implementations and call remote APIs when Terraform reconciles infrastructure. The question concerns Infrastructure as code definition acting to represent desired infrastructure in reviewable configuration files, not a limit of Infrastructure provider API.

D:

The proposed warning belongs to Desired configuration, which serves the different goal to record intended infrastructure settings under version control, rather than to Infrastructure as code definition: Configuration expresses the operator's intended infrastructure and is the starting point for planning. The question concerns Infrastructure as code definition acting to represent desired infrastructure in reviewable configuration files, not a limit of Desired configuration.

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