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

Question 550

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

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

Explanation

Correct Answer

D:

The practical result of terraform output, used to display declared root output values from the current state, is: output reads named output values and can provide -json for structured automation. A qualification for this effect is: It does not display arbitrary resource attributes unless exported via outputs.

Incorrect Answers

A:

That outcome applies to terraform state show ADDRESS, intended to inspect stored attributes for one tracked resource instance, rather than the question's feature terraform output: state show presents the state representation of an addressed resource. Unlike terraform state show ADDRESS, terraform output is intended to display declared root output values from the current state, not to inspect stored attributes for one tracked resource instance.

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 terraform output: state list displays managed addresses and can be narrowed with address filters. Unlike terraform state list, terraform output is intended to display declared root output values from the current state, not to enumerate Terraform resource addresses currently tracked in a state snapshot.

C:

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 output: state list accepts optional address patterns to narrow visible resources. Unlike Address filter for state list, terraform output is intended to display declared root output values from the current state, not to locate a relevant module or resource without reading every tracked address.

E:

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 output: state pull reads state from the configured backend for inspection or backup handling. Unlike terraform state pull, terraform output is intended to display declared root output values from the current state, not to retrieve the current backend state snapshot as serialized JSON.

F:

That outcome applies to terraform show -json, intended to export state or saved plan information in machine-readable form, rather than the question's feature terraform output: show -json emits detailed JSON for supported state and plan representations. Unlike terraform show -json, terraform output is intended to display declared root output values from the current state, not to export state or saved plan information in machine-readable form.

Question 551

A deployment design calls for a supported way to describe a fixed sequence with independently typed positions. Which mechanism most directly meets this particular need?

  1. Set type
  2. Map type
  3. List type
  4. Tuple type

Explanation

Correct Answer

D:

The task is to describe a fixed sequence with independently typed positions; Tuple type directly supports that requirement: tuple([...]) declares the expected type at each list position. Its relevant boundary is: Its schema is positional, unlike named fields of an object.

Incorrect Answers

A:

Set type is designed to represent unique elements where ordering does not matter, whereas this task is to describe a fixed sequence with independently typed positions: A set(T) deduplicates members and does not guarantee a stable positional order. Against Tuple type, its limitation is: Do not rely on numeric indexing into a set like a list.

B:

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

C:

List type is designed to hold ordered values of a single element type, whereas this task is to describe a fixed sequence with independently typed positions: A list(T) preserves sequence and permits duplicates, with elements addressable by numeric index. Against Tuple type, its limitation is: It is not the same as a set, where order is not meaningful.

Question 552

A Terraform rollout has two separate requirements: first, add a low-risk validation stage to a pull request workflow; second, reject a proposed change whose behavior is unsafe even when HCL is valid. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Validate after initializing; then use Validation versus plan authorization.
  2. First use Validation versus plan authorization; then use Static checking before a run.
  3. First use terraform validate command; then use Validate after initializing.
  4. First use Static checking before a run; then use terraform validate command.
  5. First use Static checking before a run; then use Validation versus plan authorization.

Explanation

Correct Answer

E:

The first requirement, to add a low-risk validation stage to a pull request workflow, is handled by Static checking before a run: Running validate early detects many language and schema problems before planning or applying. The second requirement, to reject a proposed change whose behavior is unsafe even when HCL is valid, is handled by Validation versus plan authorization: Terraform validation verifies configuration well-formedness, not business policy or risk. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to add a low-risk validation stage to a pull request workflow and reject a proposed change whose behavior is unsafe even when HCL is valid, the first candidate Validate after initializing addresses avoid plugin-schema errors when checking a newly cloned configuration; the second candidate Validation versus plan authorization addresses reject a proposed change whose behavior is unsafe even when HCL is valid. This mapping fails because the first mechanism primarily supports the task to avoid plugin-schema errors when checking a newly cloned configuration; the actual requirements are add a low-risk validation stage to a pull request workflow first and reject a proposed change whose behavior is unsafe even when HCL is valid second.

B:

For the requested tasks to add a low-risk validation stage to a pull request workflow and reject a proposed change whose behavior is unsafe even when HCL is valid, the first candidate Validation versus plan authorization addresses reject a proposed change whose behavior is unsafe even when HCL is valid; the second candidate Static checking before a run addresses add a low-risk validation stage to a pull request workflow. This mapping fails because the first mechanism primarily supports the task to reject a proposed change whose behavior is unsafe even when HCL is valid and the second mechanism primarily supports the task to add a low-risk validation stage to a pull request workflow; the actual requirements are add a low-risk validation stage to a pull request workflow first and reject a proposed change whose behavior is unsafe even when HCL is valid second.

C:

For the requested tasks to add a low-risk validation stage to a pull request workflow and reject a proposed change whose behavior is unsafe even when HCL is valid, the first candidate terraform validate command addresses check configuration syntax and internal consistency without proposing resource changes; the second candidate Validate after initializing addresses avoid plugin-schema errors when checking a newly cloned configuration. This mapping fails because the first mechanism primarily supports the task to check configuration syntax and internal consistency without proposing resource changes and the second mechanism primarily supports the task to avoid plugin-schema errors when checking a newly cloned configuration; the actual requirements are add a low-risk validation stage to a pull request workflow first and reject a proposed change whose behavior is unsafe even when HCL is valid second.

D:

For the requested tasks to add a low-risk validation stage to a pull request workflow and reject a proposed change whose behavior is unsafe even when HCL is valid, the first candidate Static checking before a run addresses add a low-risk validation stage to a pull request workflow; the second candidate terraform validate command addresses check configuration syntax and internal consistency without proposing resource changes. This mapping fails because the second mechanism primarily supports the task to check configuration syntax and internal consistency without proposing resource changes; the actual requirements are add a low-risk validation stage to a pull request workflow first and reject a proposed change whose behavior is unsafe even when HCL is valid second.

Question 553

The rollout owner asks whether Provider selection for resource prefix is sufficient to associate a resource with the default provider for its type prefix. Which limitation specifically concerns that mechanism?

  1. Successful terraform validate does not guarantee those credentials can reach an API.
  2. It does not determine which provider package source gets installed.
  3. Terraform itself does not create a cloud instance without an appropriate provider.
  4. An alias must be chosen explicitly if the resource needs a nondefault configuration.

Explanation

Correct Answer

D:

For Provider selection for resource prefix in the task to associate a resource with the default provider for its type prefix, the important caution is: An alias must be chosen explicitly if the resource needs a nondefault configuration. The reason this matters is its actual behavior: Without a provider meta-argument Terraform normally selects the matching local provider configuration.

Incorrect Answers

A:

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 selection for resource prefix: Providers use supported credentials and authentication mechanisms to talk to their services. The question concerns Provider selection for resource prefix acting to associate a resource with the default provider for its type prefix, not a limit of Provider authentication.

B:

The proposed warning belongs to Provider block configuration, which serves the different goal to supply settings such as region or endpoint for a provider instance, rather than to Provider selection for resource prefix: A provider block creates a configured provider instance that resources can use. The question concerns Provider selection for resource prefix acting to associate a resource with the default provider for its type prefix, not a limit of Provider block configuration.

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 selection for resource prefix: The provider implements resource types and performs create, read, update, and delete operations when supported. The question concerns Provider selection for resource prefix acting to associate a resource with the default provider for its type prefix, not a limit of Provider plugin responsibility.

Question 554

A Terraform rollout has two separate requirements: first, move an existing state history when switching remote storage; second, consume published output values from another Terraform state where supported. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use terraform backend block; then use Remote state centralization.
  2. First use Data source for remote state outputs; then use Backend migration workflow.
  3. First use Remote state centralization; then use Data source for remote state outputs.
  4. First use Backend migration workflow; then use Data source for remote state outputs.
  5. First use Backend migration workflow; then use terraform backend block.

Explanation

Correct Answer

D:

The first requirement, to move an existing state history when switching remote storage, is handled by Backend migration workflow: terraform init -migrate-state supports moving state during an intentional backend change. The second requirement, to consume published output values from another Terraform state where supported, is handled by Data source for remote state outputs: terraform_remote_state exposes root output values from a compatible existing state snapshot. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to move an existing state history when switching remote storage and consume published output values from another Terraform state where supported, the first candidate terraform backend block addresses configure where a root module stores and accesses its state; 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 configure where a root module stores and accesses its state and the second mechanism primarily supports the task to keep a team deployment's current state in a shared backend; the actual requirements are move an existing state history when switching remote storage first and consume published output values from another Terraform state where supported second.

B:

For the requested tasks to move an existing state history when switching remote storage and consume published output values from another Terraform state where supported, the first candidate Data source for remote state outputs addresses consume published output values from another Terraform state where supported; the second candidate Backend migration workflow addresses move an existing state history when switching remote storage. This mapping fails because the first mechanism primarily supports the task to consume published output values from another Terraform state where supported and the second mechanism primarily supports the task to move an existing state history when switching remote storage; the actual requirements are move an existing state history when switching remote storage first and consume published output values from another Terraform state where supported second.

C:

For the requested tasks to move an existing state history when switching remote storage and consume published output values from another Terraform state where supported, the first candidate Remote state centralization addresses keep a team deployment's current state in a shared backend; the second candidate Data source for remote state outputs addresses consume published output values from another Terraform state where supported. This mapping fails because the first mechanism primarily supports the task to keep a team deployment's current state in a shared backend; the actual requirements are move an existing state history when switching remote storage first and consume published output values from another Terraform state where supported second.

E:

For the requested tasks to move an existing state history when switching remote storage and consume published output values from another Terraform state where supported, the first candidate Backend migration workflow addresses move an existing state history when switching remote storage; the second candidate terraform backend block addresses configure where a root module stores and accesses its state. This mapping fails because the second mechanism primarily supports the task to configure where a root module stores and accesses its state; the actual requirements are move an existing state history when switching remote storage first and consume published output values from another Terraform state where supported second.

Question 555

A Terraform rollout has two separate requirements: first, attach an explicitly selected provider configuration to child module resources; second, preserve resource identity when a configuration resource is moved into a module. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Module refactor with moved block; then use Module provider passing.
  2. First use Module provider passing; then use Module block invocation.
  3. First use Module block invocation; then use Multiple instances of one module.
  4. First use Module provider passing; then use Module refactor with moved block.
  5. First use Multiple instances of one module; then use Module refactor with moved block.

Explanation

Correct Answer

D:

The first requirement, to attach an explicitly selected provider configuration to child module resources, is handled by Module provider passing: The providers map lets a module receive the provider instance the caller intends. The second requirement, to preserve resource identity when a configuration resource is moved into a module, is handled by Module refactor with moved block: A moved block can map an old resource address to a new module resource address for state-aware refactoring. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to attach an explicitly selected provider configuration to child module resources and preserve resource identity when a configuration resource is moved into a module, the first candidate Module refactor with moved block addresses preserve resource identity when a configuration resource is moved into a module; the second candidate Module provider passing addresses attach an explicitly selected provider configuration to child module resources. This mapping fails because the first mechanism primarily supports the task to preserve resource identity when a configuration resource is moved into a module and the second mechanism primarily supports the task to attach an explicitly selected provider configuration to child module resources; the actual requirements are attach an explicitly selected provider configuration to child module resources first and preserve resource identity when a configuration resource is moved into a module second.

B:

For the requested tasks to attach an explicitly selected provider configuration to child module resources and preserve resource identity when a configuration resource is moved into a module, the first candidate Module provider passing addresses attach an explicitly selected provider configuration to child module resources; the second candidate Module block invocation addresses compose a reusable infrastructure component into a root configuration. This mapping fails because the second mechanism primarily supports the task to compose a reusable infrastructure component into a root configuration; the actual requirements are attach an explicitly selected provider configuration to child module resources first and preserve resource identity when a configuration resource is moved into a module second.

C:

For the requested tasks to attach an explicitly selected provider configuration to child module resources and preserve resource identity when a configuration resource is moved into a module, the first candidate Module block invocation addresses compose a reusable infrastructure component into a root configuration; the second candidate Multiple instances of one module addresses deploy a common module separately for several named environments. This mapping fails because the first mechanism primarily supports the task to compose a reusable infrastructure component into a root configuration and the second mechanism primarily supports the task to deploy a common module separately for several named environments; the actual requirements are attach an explicitly selected provider configuration to child module resources first and preserve resource identity when a configuration resource is moved into a module second.

E:

For the requested tasks to attach an explicitly selected provider configuration to child module resources and preserve resource identity when a configuration resource is moved into a module, the first candidate Multiple instances of one module addresses deploy a common module separately for several named environments; the second candidate Module refactor with moved block addresses preserve resource identity when a configuration resource is moved into a module. This mapping fails because the first mechanism primarily supports the task to deploy a common module separately for several named environments; the actual requirements are attach an explicitly selected provider configuration to child module resources first and preserve resource identity when a configuration resource is moved into a module second.

Question 556

The implementation must both queue a downstream workspace run when an upstream workspace completes a successful apply and separate administrative grouping from reusable Terraform code. Which TWO mechanisms directly address these two separate requirements? Choose TWO.

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

Explanation

Correct Answers

B:

Among the paired tasks to queue a downstream workspace run when an upstream workspace completes a successful apply and separate administrative grouping from reusable Terraform code, Project organization versus module reuse serves the requirement to separate administrative grouping from reusable Terraform code: Projects group workspaces for access and organization, while modules encapsulate configuration for reuse. The other task must be covered by a separate mechanism.

D:

Among the paired tasks to queue a downstream workspace run when an upstream workspace completes a successful apply and separate administrative grouping from reusable Terraform code, HCP Terraform run triggers serves the requirement to queue a downstream workspace run when an upstream workspace completes a successful apply: Run triggers support a controlled dependency workflow between HCP Terraform workspaces. The other task must be covered by a separate mechanism.

Incorrect Answers

A:

The requirements are queue a downstream workspace run when an upstream workspace completes a successful apply and separate administrative grouping from reusable Terraform code, while Workspace variable isolation supports the different task to give development and production separate credentials and deployment values: Distinct workspaces separate their state and input variables even when they use similar configuration. That capability is outside the two selected responsibilities.

C:

The requirements are queue a downstream workspace run when an upstream workspace completes a successful apply and separate administrative grouping from reusable Terraform code, while HCP Terraform project grouping supports the different task to organize related workspaces and manage project-level access controls: Projects group HCP Terraform workspaces so teams can delegate organization and access by project. That capability is outside the two selected responsibilities.

E:

The requirements are queue a downstream workspace run when an upstream workspace completes a successful apply and separate administrative grouping from reusable Terraform code, while Workspace placement within a project supports the different task to associate one infrastructure workspace with the correct organizational project: A workspace can be assigned to a project representing its team or platform boundary. That capability is outside the two selected responsibilities.

Question 557

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

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

Explanation

Correct Answer

E:

The practical result of Tuple type, used to describe a fixed sequence with independently typed positions, is: tuple([...]) declares the expected type at each list position. A qualification for this effect is: Its schema is positional, unlike named fields of an object.

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 Tuple type: A set(T) deduplicates members and does not guarantee a stable positional order. Unlike Set type, Tuple type is intended to describe a fixed sequence with independently typed positions, not to represent unique elements where ordering does not matter.

B:

That outcome applies to List type, intended to hold ordered values of a single element type, rather than the question's feature Tuple type: A list(T) preserves sequence and permits duplicates, with elements addressable by numeric index. Unlike List type, Tuple type is intended to describe a fixed sequence with independently typed positions, not to hold ordered values of a single element type.

C:

That outcome applies to Map type, intended to associate string keys with values of one element type, rather than the question's feature Tuple type: map(T) supports key-based lookup for values that share a type. Unlike Map type, Tuple type is intended to describe a fixed sequence with independently typed positions, not to associate string keys with values of one element type.

D:

That outcome applies to Object type, intended to define a fixed schema of named attributes with declared types, rather than the question's feature Tuple type: object({...}) gives each named property a type, allowing heterogeneous fields. Unlike Object type, Tuple type is intended to describe a fixed sequence with independently typed positions, not to define a fixed schema of named attributes with declared types.

Question 558

Before adopting Change impact preview to identify likely creations, updates, and deletions before execution, which statement sets an accurate boundary?

  1. A plan may include unknown attributes that are resolved only during apply.
  2. Provider behavior and implicit side effects still need relevant documentation.
  3. Automation must still control credentials and state concurrency.
  4. Sharing a module does not force all environments to use identical values.

Explanation

Correct Answer

A:

For Change impact preview in the task to identify likely creations, updates, and deletions before execution, the important caution is: A plan may include unknown attributes that are resolved only during apply. The reason this matters is its actual behavior: Terraform planning exposes proposed operations for examination before they take effect.

Incorrect Answers

B:

The proposed warning belongs to Self-documenting resource relationships, which serves the different goal to make infrastructure dependencies understandable from code, rather than to Change impact preview: Resource references and explicit dependencies can express how objects relate without relying on tribal knowledge. The question concerns Change impact preview acting to identify likely creations, updates, and deletions before execution, not a limit of Self-documenting resource relationships.

C:

The proposed warning belongs to Automated provisioning pipeline, which serves the different goal to replace repetitive click-by-click resource deployment with a pipeline, rather than to Change impact preview: A CI pipeline can run validation and planning before an authorized apply, reducing procedural inconsistency. The question concerns Change impact preview acting to identify likely creations, updates, and deletions before execution, not a limit of Automated provisioning pipeline.

D:

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 Change impact preview: Reusing modules with explicit inputs aligns infrastructure design while allowing intentional environment differences. The question concerns Change impact preview acting to identify likely creations, updates, and deletions before execution, not a limit of Consistent development and production patterns.

Question 559

Before adopting terraform output to display declared root output values from the current state, which statement sets an accurate boundary?

  1. An address filter does not delete unwanted resource records.
  2. Sensitive values can appear in cleartext and output needs access controls.
  3. It does not enumerate every object in the cloud account.
  4. It does not display arbitrary resource attributes unless exported via outputs.

Explanation

Correct Answer

D:

For terraform output in the task to display declared root output values from the current state, the important caution is: It does not display arbitrary resource attributes unless exported via outputs. The reason this matters is its actual behavior: output reads named output values and can provide -json for structured automation.

Incorrect Answers

A:

The proposed warning belongs to Address filter for state list, which serves the different goal to locate a relevant module or resource without reading every tracked address, rather than to terraform output: state list accepts optional address patterns to narrow visible resources. The question concerns terraform output acting to display declared root output values from the current state, not a limit of Address filter for state list.

B:

The proposed warning belongs to terraform show -json, which serves the different goal to export state or saved plan information in machine-readable form, rather than to terraform output: show -json emits detailed JSON for supported state and plan representations. The question concerns terraform output acting to display declared root output values from the current state, not a limit of terraform show -json.

C:

The listed caution belongs specifically to terraform state list, used to enumerate Terraform resource addresses currently tracked in a state snapshot: state list displays managed addresses and can be narrowed with address filters; the feature under review is instead terraform output, so this answer attaches another feature's qualification to the wrong mechanism.

Question 560

In a reusable deployment, the primary objective is to emit machine-readable diagnostics for CI processing. Which mechanism most directly meets this particular need?

  1. Formatting versus validation
  2. Validation versus plan authorization
  3. terraform validate -json
  4. terraform validate command

Explanation

Correct Answer

C:

The task is to emit machine-readable diagnostics for CI processing; terraform validate -json directly supports that requirement: The -json option provides structured validation results for scripts and automation. Its relevant boundary is: A valid JSON response does not mean remote infrastructure matches HCL.

Incorrect Answers

A:

Formatting versus validation is designed to distinguish syntactically valid code from canonical HCL formatting, whereas this task is to emit machine-readable diagnostics for CI processing: terraform fmt changes layout and spacing; terraform validate checks configuration correctness. Against terraform validate -json, its limitation is: A configuration may validate even when its style differs from fmt output.

B:

Validation versus plan authorization is designed to reject a proposed change whose behavior is unsafe even when HCL is valid, whereas this task is to emit machine-readable diagnostics for CI processing: Terraform validation verifies configuration well-formedness, not business policy or risk. Against terraform validate -json, its limitation is: Reviewing a plan or applying policy checks is a separate control.

D:

terraform validate command addresses the different requirement to check configuration syntax and internal consistency without proposing resource changes: terraform validate checks the configuration's structural validity in an initialized directory; this does not by itself satisfy the requested task to emit machine-readable diagnostics for CI processing. For the stated need, terraform validate -json is the more direct mechanism.

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