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

Question 590

The deployment owner requests a reliable way to consume published output values from another Terraform state where supported. Which mechanism most directly meets this particular need?

  1. Data source for remote state outputs
  2. Backend credential management
  3. Backend migration workflow
  4. terraform backend block

Explanation

Correct Answer

A:

The task is to consume published output values from another Terraform state where supported; Data source for remote state outputs directly supports that requirement: terraform_remote_state exposes root output values from a compatible existing state snapshot. Its relevant boundary is: Access to state metadata may expose more than the specific outputs, so permissions matter.

Incorrect Answers

B:

Backend credential management is designed to authenticate backend access without embedding credentials in Terraform source, whereas this task is to consume published output values from another Terraform state where supported: Environment-based or supported identity-based backend credentials are generally safer than hardcoded values. Against Data source for remote state outputs, its limitation is: Backend credentials are distinct from provider API credentials.

C:

Backend migration workflow is designed to move an existing state history when switching remote storage, whereas this task is to consume published output values from another Terraform state where supported: terraform init -migrate-state supports moving state during an intentional backend change. Against Data source for remote state outputs, its limitation is: The migration should be confirmed and tested to avoid splitting state histories.

D:

terraform backend block addresses the different requirement to configure where a root module stores and accesses its state: A backend block inside terraform settings specifies a supported state storage backend and its arguments; this does not by itself satisfy the requested task to consume published output values from another Terraform state where supported. For the stated need, Data source for remote state outputs is the more direct mechanism.

Question 591

A configuration walkthrough identifies "Self-documenting resource relationships". Which task is it principally intended to support?

  1. make infrastructure dependencies understandable from code
  2. trace why infrastructure definitions changed
  3. recreate equivalent infrastructure patterns from one codebase
  4. require approval before risky infrastructure changes

Explanation

Correct Answer

A:

The practical result of Self-documenting resource relationships, used to make infrastructure dependencies understandable from code, is: Resource references and explicit dependencies can express how objects relate without relying on tribal knowledge. A qualification for this effect is: Provider behavior and implicit side effects still need relevant documentation.

Incorrect Answers

B:

That outcome applies to Version-controlled configuration history, intended to trace why infrastructure definitions changed, rather than the question's feature Self-documenting resource relationships: Git commits and pull requests make configuration edits auditable before the next Terraform run. Unlike Version-controlled configuration history, Self-documenting resource relationships is intended to make infrastructure dependencies understandable from code, not to trace why infrastructure definitions changed.

C:

That outcome applies to Repeatable environment provisioning, intended to recreate equivalent infrastructure patterns from one codebase, rather than the question's feature Self-documenting resource relationships: Parameterizing reusable Terraform modules can provision consistent environment patterns repeatedly. Unlike Repeatable environment provisioning, Self-documenting resource relationships is intended to make infrastructure dependencies understandable from code, not to recreate equivalent infrastructure patterns from one codebase.

D:

That outcome applies to Peer review for infrastructure, intended to require approval before risky infrastructure changes, rather than the question's feature Self-documenting resource relationships: Text configuration can be reviewed through a normal code review before an approved apply. Unlike Peer review for infrastructure, Self-documenting resource relationships is intended to make infrastructure dependencies understandable from code, not to require approval before risky infrastructure changes.

Question 592

A configuration review identifies the need to preserve resource identity when a configuration resource is moved into a module. Which mechanism most directly meets this particular need?

  1. Module encapsulation
  2. Module provider passing
  3. Module block invocation
  4. Multiple instances of one module
  5. Module refactor with moved block
  6. Module output composition

Explanation

Correct Answer

E:

The task is to preserve resource identity when a configuration resource is moved into a module; Module refactor with moved block directly supports that requirement: A moved block can map an old resource address to a new module resource address for state-aware refactoring. Its relevant boundary is: Move mappings need compatible resource types and valid source/destination addresses.

Incorrect Answers

A:

Module encapsulation is designed to keep implementation resources private while exposing a stable input and output interface, whereas this task is to preserve resource identity when a configuration resource is moved into a module: Modules promote reuse by letting callers depend on documented variables and outputs rather than every internal block. Against Module refactor with moved block, its limitation is: Changing a module's public interface still requires managing compatibility for callers.

B:

Module provider passing is designed to attach an explicitly selected provider configuration to child module resources, whereas this task is to preserve resource identity when a configuration resource is moved into a module: The providers map lets a module receive the provider instance the caller intends. Against Module refactor with moved block, its limitation is: Each child must declare compatible provider requirements in its own module code.

C:

Module block invocation is designed to compose a reusable infrastructure component into a root configuration, whereas this task is to preserve resource identity when a configuration resource is moved into a module: A module block points at a source and supplies declared input arguments to a child module. Against Module refactor with moved block, its limitation is: The child module must be installed before a complete plan can be evaluated.

D:

Multiple instances of one module is designed to deploy a common module separately for several named environments, whereas this task is to preserve resource identity when a configuration resource is moved into a module: for_each on a module block can create a keyed child module instance per entry. Against Module refactor with moved block, its limitation is: Each module instance has distinct state addresses and input values.

F:

Module output composition is designed to wire one module's published result into another module's input, whereas this task is to preserve resource identity when a configuration resource is moved into a module: References such as module.network.vpc_id can supply another module's required variable. Against Module refactor with moved block, its limitation is: The parent must connect the modules; Terraform does not expose unexported child internals.

Question 593

A platform engineering group needs to separate administrative grouping from reusable Terraform code. Which mechanism most directly meets this particular need?

  1. Workspace placement within a project
  2. Workspace variable isolation
  3. Project organization versus module reuse
  4. HCP Terraform project grouping
  5. HCP Terraform run triggers
  6. Project-level team access

Explanation

Correct Answer

C:

The task is to separate administrative grouping from reusable Terraform code; Project organization versus module reuse directly supports that requirement: Projects group workspaces for access and organization, while modules encapsulate configuration for reuse. Its relevant boundary is: Putting two workspaces in one project does not cause shared resource state.

Incorrect Answers

A:

Workspace placement within a project is designed to associate one infrastructure workspace with the correct organizational project, whereas this task is to separate administrative grouping from reusable Terraform code: A workspace can be assigned to a project representing its team or platform boundary. Against Project organization versus module reuse, its limitation is: Moving the workspace between projects does not merge its state with neighbors.

B:

Workspace variable isolation is designed to give development and production separate credentials and deployment values, whereas this task is to separate administrative grouping from reusable Terraform code: Distinct workspaces separate their state and input variables even when they use similar configuration. Against Project organization versus module reuse, its limitation is: Shared variable sets need appropriate scoping to avoid accidental cross-environment access.

D:

HCP Terraform project grouping is designed to organize related workspaces and manage project-level access controls, whereas this task is to separate administrative grouping from reusable Terraform code: Projects group HCP Terraform workspaces so teams can delegate organization and access by project. Against Project organization versus module reuse, its limitation is: Project grouping is broadly available, but assigning project-level permissions requires an Essentials, Standard, or Premium plan; each workspace has its own state.

E:

HCP Terraform run triggers is designed to queue a downstream workspace run when an upstream workspace completes a successful apply, whereas this task is to separate administrative grouping from reusable Terraform code: Run triggers support a controlled dependency workflow between HCP Terraform workspaces. Against Project organization versus module reuse, its limitation is: They are not a substitute for explicitly supplying needed outputs or credentials.

F:

Project-level team access is designed to delegate a set of workspaces without granting broad organization-wide rights, whereas this task is to separate administrative grouping from reusable Terraform code: Project-scoped team permissions help control who can manage associated workspaces. Against Project organization versus module reuse, its limitation is: Project permission management needs Essentials, Standard, or Premium; provider cloud permissions remain independent of HCP roles.

Question 594

A configuration walkthrough identifies "Address filter for state list". Which task is it principally intended to support?

  1. inspect the latest state or a saved execution plan in readable form
  2. enumerate Terraform resource addresses currently tracked in a state snapshot
  3. inspect stored attributes for one tracked resource instance
  4. locate a relevant module or resource without reading every tracked address

Explanation

Correct Answer

D:

The practical result of Address filter for state list, used to locate a relevant module or resource without reading every tracked address, is: state list accepts optional address patterns to narrow visible resources. A qualification for this effect is: An address filter does not delete unwanted resource records.

Incorrect Answers

A:

That outcome applies to terraform show, intended to inspect the latest state or a saved execution plan in readable form, rather than the question's feature Address filter for state list: terraform show can display an existing state snapshot or a named plan file. Unlike terraform show, Address filter for state list is intended to locate a relevant module or resource without reading every tracked address, not to inspect the latest state or a saved execution plan in readable form.

B:

That outcome applies to terraform state list, intended to enumerate Terraform resource addresses currently tracked in a state snapshot, rather than the question's feature Address filter for state list: state list displays managed addresses and can be narrowed with address filters. Unlike terraform state list, Address filter for state list is intended to locate a relevant module or resource without reading every tracked address, not to enumerate Terraform resource addresses currently tracked in a state snapshot.

C:

That outcome applies to terraform state show ADDRESS, intended to inspect stored attributes for one tracked resource instance, rather than the question's feature Address filter for state list: state show presents the state representation of an addressed resource. Unlike terraform state show ADDRESS, Address filter for state list is intended to locate a relevant module or resource without reading every tracked address, not to inspect stored attributes for one tracked resource instance.

Question 595

For a new infrastructure repository, the team wants to convert a collection into a set before using for_each. Which mechanism most directly meets this particular need?

  1. List type
  2. Type conversion function
  3. Set type
  4. Map type

Explanation

Correct Answer

B:

The task is to convert a collection into a set before using for_each; Type conversion function directly supports that requirement: toset(...) converts suitable values into a set, removing duplicates from a list input. Its relevant boundary is: The resulting collection should not be treated as positionally indexed.

Incorrect Answers

A:

List type is designed to hold ordered values of a single element type, whereas this task is to convert a collection into a set before using for_each: A list(T) preserves sequence and permits duplicates, with elements addressable by numeric index. Against Type conversion function, its limitation is: It is not the same as a set, where order is not meaningful.

C:

Set type is designed to represent unique elements where ordering does not matter, whereas this task is to convert a collection into a set before using for_each: A set(T) deduplicates members and does not guarantee a stable positional order. Against Type conversion function, its limitation is: Do not rely on numeric indexing into a set like a list.

D:

Map type is designed to associate string keys with values of one element type, whereas this task is to convert a collection into a set before using for_each: map(T) supports key-based lookup for values that share a type. Against Type conversion function, its limitation is: A map is not a tuple whose elements have heterogeneous positional types.

Question 596

During an implementation review, a Terraform team encounters "Validation versus plan authorization". Which purpose is associated with that mechanism?

  1. catch an unsupported or missing required module argument early
  2. check configuration syntax and internal consistency without proposing resource changes
  3. avoid plugin-schema errors when checking a newly cloned configuration
  4. reject a proposed change whose behavior is unsafe even when HCL is valid

Explanation

Correct Answer

D:

The practical result of Validation versus plan authorization, used to reject a proposed change whose behavior is unsafe even when HCL is valid, is: Terraform validation verifies configuration well-formedness, not business policy or risk. A qualification for this effect is: Reviewing a plan or applying policy checks is a separate control.

Incorrect Answers

A:

That outcome applies to Validation of module inputs, intended to catch an unsupported or missing required module argument early, rather than the question's feature Validation versus plan authorization: terraform validate can report module call errors that violate input or schema requirements. Unlike Validation of module inputs, Validation versus plan authorization is intended to reject a proposed change whose behavior is unsafe even when HCL is valid, not to catch an unsupported or missing required module argument early.

B:

That outcome applies to terraform validate command, intended to check configuration syntax and internal consistency without proposing resource changes, rather than the question's feature Validation versus plan authorization: terraform validate checks the configuration's structural validity in an initialized directory. Unlike terraform validate command, Validation versus plan authorization is intended to reject a proposed change whose behavior is unsafe even when HCL is valid, not to check configuration syntax and internal consistency without proposing resource changes.

C:

That outcome applies to Validate after initializing, intended to avoid plugin-schema errors when checking a newly cloned configuration, rather than the question's feature Validation versus plan authorization: An initialized directory provides modules and provider schemas needed for full configuration validation. Unlike Validate after initializing, Validation versus plan authorization is intended to reject a proposed change whose behavior is unsafe even when HCL is valid, not to avoid plugin-schema errors when checking a newly cloned configuration.

Question 597

A design uses Plugin dependency installation to resolve all referenced provider plugins before planning. Which qualification applies to the named mechanism?

  1. It generally does not create or destroy the looked-up object.
  2. A provider is not a Terraform module downloaded from a module source.
  3. An alias must be chosen explicitly if the resource needs a nondefault configuration.
  4. Terraform itself does not create a cloud instance without an appropriate provider.

Explanation

Correct Answer

B:

For Plugin dependency installation in the task to resolve all referenced provider plugins before planning, the important caution is: A provider is not a Terraform module downloaded from a module source. The reason this matters is its actual behavior: An initialized working directory has the plugins required for its configured resources and data sources.

Incorrect Answers

A:

The proposed warning belongs to Provider data sources, which serves the different goal to read remote information without declaring ownership of its lifecycle, rather than to Plugin dependency installation: A provider data source queries external information that configuration can reference. The question concerns Plugin dependency installation acting to resolve all referenced provider plugins before planning, not a limit of Provider data sources.

C:

The proposed warning belongs to Provider selection for resource prefix, which serves the different goal to associate a resource with the default provider for its type prefix, rather than to Plugin dependency installation: Without a provider meta-argument Terraform normally selects the matching local provider configuration. The question concerns Plugin dependency installation acting to resolve all referenced provider plugins before planning, not a limit of Provider selection for resource prefix.

D:

The listed caution belongs specifically to Provider plugin responsibility, used to translate a Terraform resource operation into remote service API calls: The provider implements resource types and performs create, read, update, and delete operations when supported; the feature under review is instead Plugin dependency installation, so this answer attaches another feature's qualification to the wrong mechanism.

Question 598

A colleague recommends the Terraform concept "Data source for remote state outputs". Which use case best matches it?

  1. move an existing state history when switching remote storage
  2. authenticate backend access without embedding credentials in Terraform source
  3. set backend storage for a root execution rather than independently in each child module
  4. consume published output values from another Terraform state where supported

Explanation

Correct Answer

D:

The practical result of Data source for remote state outputs, used to consume published output values from another Terraform state where supported, is: terraform_remote_state exposes root output values from a compatible existing state snapshot. A qualification for this effect is: Access to state metadata may expose more than the specific outputs, so permissions matter.

Incorrect Answers

A:

That outcome applies to Backend migration workflow, intended to move an existing state history when switching remote storage, rather than the question's feature Data source for remote state outputs: terraform init -migrate-state supports moving state during an intentional backend change. Unlike Backend migration workflow, Data source for remote state outputs is intended to consume published output values from another Terraform state where supported, not to move an existing state history when switching remote storage.

B:

That outcome applies to Backend credential management, intended to authenticate backend access without embedding credentials in Terraform source, rather than the question's feature Data source for remote state outputs: Environment-based or supported identity-based backend credentials are generally safer than hardcoded values. Unlike Backend credential management, Data source for remote state outputs is intended to consume published output values from another Terraform state where supported, not to authenticate backend access without embedding credentials in Terraform source.

C:

That outcome applies to Backend configuration is root-only, intended to set backend storage for a root execution rather than independently in each child module, rather than the question's feature Data source for remote state outputs: The active root module configures the backend used by that Terraform working directory. Unlike Backend configuration is root-only, Data source for remote state outputs is intended to consume published output values from another Terraform state where supported, not to set backend storage for a root execution rather than independently in each child module.

Question 599

A team reviews the use of Module refactor with moved block in Terraform 1.12. Which purpose matches its actual behavior?

  1. attach an explicitly selected provider configuration to child module resources
  2. wire one module's published result into another module's input
  3. preserve resource identity when a configuration resource is moved into a module
  4. keep implementation resources private while exposing a stable input and output interface

Explanation

Correct Answer

C:

The practical result of Module refactor with moved block, used to preserve resource identity when a configuration resource is moved into a module, is: A moved block can map an old resource address to a new module resource address for state-aware refactoring. A qualification for this effect is: Move mappings need compatible resource types and valid source/destination addresses.

Incorrect Answers

A:

That outcome applies to Module provider passing, intended to attach an explicitly selected provider configuration to child module resources, rather than the question's feature Module refactor with moved block: The providers map lets a module receive the provider instance the caller intends. Unlike Module provider passing, Module refactor with moved block is intended to preserve resource identity when a configuration resource is moved into a module, not to attach an explicitly selected provider configuration to child module resources.

B:

That outcome applies to Module output composition, intended to wire one module's published result into another module's input, rather than the question's feature Module refactor with moved block: References such as module.network.vpc_id can supply another module's required variable. Unlike Module output composition, Module refactor with moved block is intended to preserve resource identity when a configuration resource is moved into a module, not to wire one module's published result into another module's input.

D:

That outcome applies to Module encapsulation, intended to keep implementation resources private while exposing a stable input and output interface, rather than the question's feature Module refactor with moved block: Modules promote reuse by letting callers depend on documented variables and outputs rather than every internal block. Unlike Module encapsulation, Module refactor with moved block is intended to preserve resource identity when a configuration resource is moved into a module, not to keep implementation resources private while exposing a stable input and output interface.

Question 600

An operator chooses the mechanism "Project organization versus module reuse" for a Terraform project. Which outcome should this choice support?

  1. organize related workspaces and manage project-level access controls
  2. give development and production separate credentials and deployment values
  3. separate administrative grouping from reusable Terraform code
  4. associate one infrastructure workspace with the correct organizational project

Explanation

Correct Answer

C:

The practical result of Project organization versus module reuse, used to separate administrative grouping from reusable Terraform code, is: Projects group workspaces for access and organization, while modules encapsulate configuration for reuse. A qualification for this effect is: Putting two workspaces in one project does not cause shared resource state.

Incorrect Answers

A:

That outcome applies to HCP Terraform project grouping, intended to organize related workspaces and manage project-level access controls, rather than the question's feature Project organization versus module reuse: Projects group HCP Terraform workspaces so teams can delegate organization and access by project. Unlike HCP Terraform project grouping, Project organization versus module reuse is intended to separate administrative grouping from reusable Terraform code, not to organize related workspaces and manage project-level access controls.

B:

That outcome applies to Workspace variable isolation, intended to give development and production separate credentials and deployment values, rather than the question's feature Project organization versus module reuse: Distinct workspaces separate their state and input variables even when they use similar configuration. Unlike Workspace variable isolation, Project organization versus module reuse is intended to separate administrative grouping from reusable Terraform code, not to give development and production separate credentials and deployment values.

D:

That outcome applies to Workspace placement within a project, intended to associate one infrastructure workspace with the correct organizational project, rather than the question's feature Project organization versus module reuse: A workspace can be assigned to a project representing its team or platform boundary. Unlike Workspace placement within a project, Project organization versus module reuse is intended to separate administrative grouping from reusable Terraform code, not to associate one infrastructure workspace with the correct organizational project.

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