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

Question 460

A design uses Multiple instances of one module to deploy a common module separately for several named environments. Which qualification applies to the named mechanism?

  1. Count-based addressing is positional and differs from for_each keys.
  2. The parent must connect the modules; Terraform does not expose unexported child internals.
  3. The child module must be installed before a complete plan can be evaluated.
  4. Each module instance has distinct state addresses and input values.

Explanation

Correct Answer

D:

For Multiple instances of one module in the task to deploy a common module separately for several named environments, the important caution is: Each module instance has distinct state addresses and input values. The reason this matters is its actual behavior: for_each on a module block can create a keyed child module instance per entry.

Incorrect Answers

A:

The proposed warning belongs to Module count meta-argument, which serves the different goal to optionally instantiate a module based on a count expression, rather than to Multiple instances of one module: count on a module block creates zero or more indexed module instances. The question concerns Multiple instances of one module acting to deploy a common module separately for several named environments, not a limit of Module count meta-argument.

B:

The proposed warning belongs to Module output composition, which serves the different goal to wire one module's published result into another module's input, rather than to Multiple instances of one module: References such as module.network.vpc_id can supply another module's required variable. The question concerns Multiple instances of one module acting to deploy a common module separately for several named environments, not a limit of Module output composition.

C:

The proposed warning belongs to Module block invocation, which serves the different goal to compose a reusable infrastructure component into a root configuration, rather than to Multiple instances of one module: A module block points at a source and supplies declared input arguments to a child module. The question concerns Multiple instances of one module acting to deploy a common module separately for several named environments, not a limit of Module block invocation.

Question 461

The team is documenting risks of Workspace placement within a project while planning to associate one infrastructure workspace with the correct organizational project. Which caveat specifically applies to that mechanism?

  1. Putting two workspaces in one project does not cause shared resource state.
  2. Moving the workspace between projects does not merge its state with neighbors.
  3. Creating a workspace per resource is not universally required or optimal.
  4. They are not a substitute for explicitly supplying needed outputs or credentials.

Explanation

Correct Answer

B:

For Workspace placement within a project in the task to associate one infrastructure workspace with the correct organizational project, the important caution is: Moving the workspace between projects does not merge its state with neighbors. The reason this matters is its actual behavior: A workspace can be assigned to a project representing its team or platform boundary.

Incorrect Answers

A:

The proposed warning belongs to Project organization versus module reuse, which serves the different goal to separate administrative grouping from reusable Terraform code, rather than to Workspace placement within a project: Projects group workspaces for access and organization, while modules encapsulate configuration for reuse. The question concerns Workspace placement within a project acting to associate one infrastructure workspace with the correct organizational project, not a limit of Project organization versus module reuse.

C:

The proposed warning belongs to Workspace naming and ownership boundaries, which serves the different goal to align state ownership with a clearly defined infrastructure component, rather than to Workspace placement within a project: Separate workspaces can represent distinct application stacks, environments, or ownership units. The question concerns Workspace placement within a project acting to associate one infrastructure workspace with the correct organizational project, not a limit of Workspace naming and ownership boundaries.

D:

The proposed warning belongs to HCP Terraform run triggers, which serves the different goal to queue a downstream workspace run when an upstream workspace completes a successful apply, rather than to Workspace placement within a project: Run triggers support a controlled dependency workflow between HCP Terraform workspaces. The question concerns Workspace placement within a project acting to associate one infrastructure workspace with the correct organizational project, not a limit of HCP Terraform run triggers.

Question 462

A colleague recommends the Terraform concept "terraform show -json". Which use case best matches it?

  1. retrieve the current backend state snapshot as serialized JSON
  2. export state or saved plan information in machine-readable form
  3. enumerate Terraform resource addresses currently tracked in a state snapshot
  4. display declared root output values from the current state
  5. locate a relevant module or resource without reading every tracked address

Explanation

Correct Answer

B:

The practical result of terraform show -json, used to export state or saved plan information in machine-readable form, is: show -json emits detailed JSON for supported state and plan representations. A qualification for this effect is: Sensitive values can appear in cleartext and output needs access controls.

Incorrect Answers

A:

That outcome applies to terraform state pull, intended to retrieve the current backend state snapshot as serialized JSON, rather than the question's feature terraform show -json: state pull reads state from the configured backend for inspection or backup handling. Unlike terraform state pull, terraform show -json is intended to export state or saved plan information in machine-readable form, not to retrieve the current backend state snapshot as serialized JSON.

C:

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 terraform show -json: state list displays managed addresses and can be narrowed with address filters. Unlike terraform state list, terraform show -json is intended to export state or saved plan information in machine-readable form, not to enumerate Terraform resource addresses currently tracked in a state snapshot.

D:

That outcome applies to terraform output, intended to display declared root output values from the current state, rather than the question's feature terraform show -json: output reads named output values and can provide -json for structured automation. Unlike terraform output, terraform show -json is intended to export state or saved plan information in machine-readable form, not to display declared root output values from the current state.

E:

That outcome applies to Address filter for state list, intended to locate a relevant module or resource without reading every tracked address, rather than the question's feature terraform show -json: state list accepts optional address patterns to narrow visible resources. Unlike Address filter for state list, terraform show -json is intended to export state or saved plan information in machine-readable form, not to locate a relevant module or resource without reading every tracked address.

Question 463

A platform engineering group needs to hold ordered values of a single element type. Which mechanism most directly meets this particular need?

  1. Tuple type
  2. Object type
  3. Optional object attribute
  4. Map type
  5. Set type
  6. List type

Explanation

Correct Answer

F:

The task is to hold ordered values of a single element type; List type directly supports that requirement: A list(T) preserves sequence and permits duplicates, with elements addressable by numeric index. Its relevant boundary is: It is not the same as a set, where order is not meaningful.

Incorrect Answers

A:

Tuple type is designed to describe a fixed sequence with independently typed positions, whereas this task is to hold ordered values of a single element type: tuple([...]) declares the expected type at each list position. Against List type, its limitation is: Its schema is positional, unlike named fields of an object.

B:

Object type is designed to define a fixed schema of named attributes with declared types, whereas this task is to hold ordered values of a single element type: object({...}) gives each named property a type, allowing heterogeneous fields. Against List type, its limitation is: It is distinct from a map requiring the same element type for all values.

C:

Optional object attribute is designed to allow an object input to omit a field with an optional type specification, whereas this task is to hold ordered values of a single element type: optional(TYPE, DEFAULT) supports an omitted object attribute and can supply a default value. Against List type, its limitation is: An optional attribute is not the same as an entirely optional module input variable.

D:

Map type is designed to associate string keys with values of one element type, whereas this task is to hold ordered values of a single element type: map(T) supports key-based lookup for values that share a type. Against List type, its limitation is: A map is not a tuple whose elements have heterogeneous positional types.

E:

Set type is designed to represent unique elements where ordering does not matter, whereas this task is to hold ordered values of a single element type: A set(T) deduplicates members and does not guarantee a stable positional order. Against List type, its limitation is: Do not rely on numeric indexing into a set like a list.

Question 464

The implementation must both avoid plugin-schema errors when checking a newly cloned configuration and distinguish syntactically valid code from canonical HCL formatting. Which TWO mechanisms directly address these two separate requirements? Choose TWO.

  1. Static checking before a run
  2. terraform validate command
  3. Validate after initializing
  4. terraform validate -json
  5. Formatting versus validation

Explanation

Correct Answers

C:

Among the paired tasks to avoid plugin-schema errors when checking a newly cloned configuration and distinguish syntactically valid code from canonical HCL formatting, Validate after initializing serves the requirement to avoid plugin-schema errors when checking a newly cloned configuration: An initialized directory provides modules and provider schemas needed for full configuration validation. The other task must be covered by a separate mechanism.

E:

Among the paired tasks to avoid plugin-schema errors when checking a newly cloned configuration and distinguish syntactically valid code from canonical HCL formatting, Formatting versus validation serves the requirement to distinguish syntactically valid code from canonical HCL formatting: terraform fmt changes layout and spacing; terraform validate checks configuration correctness. The other task must be covered by a separate mechanism.

Incorrect Answers

A:

The requirements are avoid plugin-schema errors when checking a newly cloned configuration and distinguish syntactically valid code from canonical HCL formatting, while Static checking before a run supports the different task to add a low-risk validation stage to a pull request workflow: Running validate early detects many language and schema problems before planning or applying. That capability is outside the two selected responsibilities.

B:

The requirements are avoid plugin-schema errors when checking a newly cloned configuration and distinguish syntactically valid code from canonical HCL formatting, while terraform validate command supports the different task to check configuration syntax and internal consistency without proposing resource changes: terraform validate checks the configuration's structural validity in an initialized directory. That capability is outside the two selected responsibilities.

D:

The requested tasks are to avoid plugin-schema errors when checking a newly cloned configuration; distinguish syntactically valid code from canonical HCL formatting, but terraform validate -json primarily addresses the different goal to emit machine-readable diagnostics for CI processing: The -json option provides structured validation results for scripts and automation; therefore it is not one of the mechanisms selected for the stated requirements.

Question 465

The team is documenting risks of Provider data sources while planning to read remote information without declaring ownership of its lifecycle. Which caveat specifically applies to that mechanism?

  1. It generally does not create or destroy the looked-up object.
  2. Successful terraform validate does not guarantee those credentials can reach an API.
  3. Terraform itself does not create a cloud instance without an appropriate provider.
  4. A generic Terraform language feature cannot invent unsupported provider arguments.

Explanation

Correct Answer

A:

For Provider data sources in the task to read remote information without declaring ownership of its lifecycle, the important caution is: It generally does not create or destroy the looked-up object. The reason this matters is its actual behavior: A provider data source queries external information that configuration can reference.

Incorrect Answers

B:

The proposed warning belongs to Provider authentication, which serves the different goal to authorize API operations requested by a Terraform provider, rather than to Provider data sources: Providers use supported credentials and authentication mechanisms to talk to their services. The question concerns Provider data sources acting to read remote information without declaring ownership of its lifecycle, not a limit of Provider authentication.

C:

The proposed warning belongs to Provider plugin responsibility, which serves the different goal to translate a Terraform resource operation into remote service API calls, rather than to Provider data sources: The provider implements resource types and performs create, read, update, and delete operations when supported. The question concerns Provider data sources acting to read remote information without declaring ownership of its lifecycle, not a limit of Provider plugin responsibility.

D:

The listed caution belongs specifically to Provider resource schema, used to define the supported arguments and attributes for one resource type: The provider schema specifies which settings users can configure and which values are computed; the feature under review is instead Provider data sources, so this answer attaches another feature's qualification to the wrong mechanism.

Question 466

A Terraform rollout has two separate requirements: first, keep a team deployment's current state in a shared backend; second, authenticate backend access without embedding credentials in Terraform source. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Backend migration workflow; then use Backend configuration is root-only.
  2. First use Remote state centralization; then use Backend migration workflow.
  3. First use Remote state centralization; then use Backend credential management.
  4. First use Backend credential management; then use Remote state centralization.
  5. First use Backend configuration is root-only; then use Backend credential management.

Explanation

Correct Answer

C:

The first requirement, to keep a team deployment's current state in a shared backend, is handled by Remote state centralization: Remote state gives authorized runners a common state location rather than separate laptop snapshots. The second requirement, to authenticate backend access without embedding credentials in Terraform source, is handled by Backend credential management: Environment-based or supported identity-based backend credentials are generally safer than hardcoded values. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to keep a team deployment's current state in a shared backend and authenticate backend access without embedding credentials in Terraform source, the first candidate Backend migration workflow addresses move an existing state history when switching remote storage; the second candidate Backend configuration is root-only addresses set backend storage for a root execution rather than independently in each child module. This mapping fails because the first mechanism primarily supports the task to move an existing state history when switching remote storage and the second mechanism primarily supports the task to set backend storage for a root execution rather than independently in each child module; the actual requirements are keep a team deployment's current state in a shared backend first and authenticate backend access without embedding credentials in Terraform source second.

B:

For the requested tasks to keep a team deployment's current state in a shared backend and authenticate backend access without embedding credentials in Terraform source, the first candidate Remote state centralization addresses keep a team deployment's current state in a shared backend; the second candidate Backend migration workflow addresses move an existing state history when switching remote storage. This mapping fails because the second mechanism primarily supports the task to move an existing state history when switching remote storage; the actual requirements are keep a team deployment's current state in a shared backend first and authenticate backend access without embedding credentials in Terraform source second.

D:

For the requested tasks to keep a team deployment's current state in a shared backend and authenticate backend access without embedding credentials in Terraform source, the first candidate Backend credential management addresses authenticate backend access without embedding credentials in Terraform source; the second candidate Remote state centralization addresses keep a team deployment's current state in a shared backend. This mapping fails because the first mechanism primarily supports the task to authenticate backend access without embedding credentials in Terraform source and the second mechanism primarily supports the task to keep a team deployment's current state in a shared backend; the actual requirements are keep a team deployment's current state in a shared backend first and authenticate backend access without embedding credentials in Terraform source second.

E:

For the requested tasks to keep a team deployment's current state in a shared backend and authenticate backend access without embedding credentials in Terraform source, the first candidate Backend configuration is root-only addresses set backend storage for a root execution rather than independently in each child module; the second candidate Backend credential management addresses authenticate backend access without embedding credentials in Terraform source. This mapping fails because the first mechanism primarily supports the task to set backend storage for a root execution rather than independently in each child module; the actual requirements are keep a team deployment's current state in a shared backend first and authenticate backend access without embedding credentials in Terraform source second.

Question 467

The implementation must both deploy a common module separately for several named environments and wire one module's published result into another module's input. Which TWO mechanisms directly address these two separate requirements? Choose TWO.

  1. Multiple instances of one module
  2. Module block invocation
  3. Module provider passing
  4. Module count meta-argument
  5. Module output composition

Explanation

Correct Answers

A:

Among the paired tasks to deploy a common module separately for several named environments and wire one module's published result into another module's input, Multiple instances of one module serves the requirement to deploy a common module separately for several named environments: for_each on a module block can create a keyed child module instance per entry. The other task must be covered by a separate mechanism.

E:

Among the paired tasks to deploy a common module separately for several named environments and wire one module's published result into another module's input, Module output composition serves the requirement to wire one module's published result into another module's input: References such as module.network.vpc_id can supply another module's required variable. The other task must be covered by a separate mechanism.

Incorrect Answers

B:

The requirements are deploy a common module separately for several named environments and wire one module's published result into another module's input, while Module block invocation supports the different task to compose a reusable infrastructure component into a root configuration: A module block points at a source and supplies declared input arguments to a child module. That capability is outside the two selected responsibilities.

C:

The requirements are deploy a common module separately for several named environments and wire one module's published result into another module's input, while Module provider passing supports the different task to attach an explicitly selected provider configuration to child module resources: The providers map lets a module receive the provider instance the caller intends. That capability is outside the two selected responsibilities.

D:

The requirements are deploy a common module separately for several named environments and wire one module's published result into another module's input, while Module count meta-argument supports the different task to optionally instantiate a module based on a count expression: count on a module block creates zero or more indexed module instances. That capability is outside the two selected responsibilities.

Question 468

A technical review has three distinct objectives: associate one infrastructure workspace with the correct organizational project; delegate a set of workspaces without granting broad organization-wide rights; and align state ownership with a clearly defined infrastructure component. Which THREE mechanisms should the team identify for these respective needs? Choose THREE.

  1. Workspace variable isolation
  2. HCP Terraform project grouping
  3. Workspace placement within a project
  4. Workspace naming and ownership boundaries
  5. Project-level team access

Explanation

Correct Answers

C:

In the workflow combining associate one infrastructure workspace with the correct organizational project, delegate a set of workspaces without granting broad organization-wide rights, and align state ownership with a clearly defined infrastructure component, Workspace placement within a project correctly addresses the individual goal to associate one infrastructure workspace with the correct organizational project: A workspace can be assigned to a project representing its team or platform boundary. It is one of three separately required capabilities.

D:

In the workflow combining associate one infrastructure workspace with the correct organizational project, delegate a set of workspaces without granting broad organization-wide rights, and align state ownership with a clearly defined infrastructure component, Workspace naming and ownership boundaries correctly addresses the individual goal to align state ownership with a clearly defined infrastructure component: Separate workspaces can represent distinct application stacks, environments, or ownership units. It is one of three separately required capabilities.

E:

In the workflow combining associate one infrastructure workspace with the correct organizational project, delegate a set of workspaces without granting broad organization-wide rights, and align state ownership with a clearly defined infrastructure component, Project-level team access correctly addresses the individual goal to delegate a set of workspaces without granting broad organization-wide rights: Project-scoped team permissions help control who can manage associated workspaces. It is one of three separately required capabilities.

Incorrect Answers

A:

Compared with the three tasks to associate one infrastructure workspace with the correct organizational project, delegate a set of workspaces without granting broad organization-wide rights, and align state ownership with a clearly defined infrastructure component, Workspace variable isolation primarily supports an unrelated request to give development and production separate credentials and deployment values: Distinct workspaces separate their state and input variables even when they use similar configuration. Therefore this option is not among the three specified mechanisms.

B:

Compared with the three tasks to associate one infrastructure workspace with the correct organizational project, delegate a set of workspaces without granting broad organization-wide rights, and align state ownership with a clearly defined infrastructure component, HCP Terraform project grouping primarily supports an unrelated request to organize related workspaces and manage project-level access controls: Projects group HCP Terraform workspaces so teams can delegate organization and access by project. Therefore this option is not among the three specified mechanisms.

Question 469

An operator chooses the mechanism "List type" for a Terraform project. Which outcome should this choice support?

  1. represent unique elements where ordering does not matter
  2. hold ordered values of a single element type
  3. define a fixed schema of named attributes with declared types
  4. associate string keys with values of one element type

Explanation

Correct Answer

B:

The practical result of List type, used to hold ordered values of a single element type, is: A list(T) preserves sequence and permits duplicates, with elements addressable by numeric index. A qualification for this effect is: It is not the same as a set, where order is not meaningful.

Incorrect Answers

A:

That outcome applies to Set type, intended to represent unique elements where ordering does not matter, rather than the question's feature List type: A set(T) deduplicates members and does not guarantee a stable positional order. Unlike Set type, List type is intended to hold ordered values of a single element type, not to represent unique elements where ordering does not matter.

C:

That outcome applies to Object type, intended to define a fixed schema of named attributes with declared types, rather than the question's feature List type: object({...}) gives each named property a type, allowing heterogeneous fields. Unlike Object type, List type is intended to hold ordered values of a single element type, not to define a fixed schema of named attributes with declared types.

D:

That outcome applies to Map type, intended to associate string keys with values of one element type, rather than the question's feature List type: map(T) supports key-based lookup for values that share a type. Unlike Map type, List type is intended to hold ordered values of a single element type, not to associate string keys with values of one element type.

Question 470

A change proposal relies on Automated provisioning pipeline for the task to replace repetitive click-by-click resource deployment with a pipeline. Which limitation specifically applies to it?

  1. Provider behavior and implicit side effects still need relevant documentation.
  2. A plan may include unknown attributes that are resolved only during apply.
  3. A Git diff tracks source files rather than proving the exact live infrastructure state.
  4. Automation must still control credentials and state concurrency.
  5. Sharing a module does not force all environments to use identical values.

Explanation

Correct Answer

D:

For Automated provisioning pipeline in the task to replace repetitive click-by-click resource deployment with a pipeline, the important caution is: Automation must still control credentials and state concurrency. The reason this matters is its actual behavior: A CI pipeline can run validation and planning before an authorized apply, reducing procedural inconsistency.

Incorrect Answers

A:

The proposed warning belongs to Self-documenting resource relationships, which serves the different goal to make infrastructure dependencies understandable from code, rather than to Automated provisioning pipeline: Resource references and explicit dependencies can express how objects relate without relying on tribal knowledge. The question concerns Automated provisioning pipeline acting to replace repetitive click-by-click resource deployment with a pipeline, not a limit of Self-documenting resource relationships.

B:

The proposed warning belongs to Change impact preview, which serves the different goal to identify likely creations, updates, and deletions before execution, rather than to Automated provisioning pipeline: Terraform planning exposes proposed operations for examination before they take effect. The question concerns Automated provisioning pipeline acting to replace repetitive click-by-click resource deployment with a pipeline, not a limit of Change impact preview.

C:

The proposed warning belongs to Version-controlled configuration history, which serves the different goal to trace why infrastructure definitions changed, rather than to Automated provisioning pipeline: Git commits and pull requests make configuration edits auditable before the next Terraform run. The question concerns Automated provisioning pipeline acting to replace repetitive click-by-click resource deployment with a pipeline, not a limit of Version-controlled configuration history.

E:

The proposed warning belongs to Consistent development and production patterns, which serves the different goal to reduce configuration drift across environments using shared modules, rather than to Automated provisioning pipeline: Reusing modules with explicit inputs aligns infrastructure design while allowing intentional environment differences. The question concerns Automated provisioning pipeline acting to replace repetitive click-by-click resource deployment with a pipeline, not a limit of Consistent development and production patterns.

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