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

Question 540

Before adopting Object type to define a fixed schema of named attributes with declared types, which statement sets an accurate boundary?

  1. The resulting collection should not be treated as positionally indexed.
  2. It is distinct from a map requiring the same element type for all values.
  3. An optional attribute is not the same as an entirely optional module input variable.
  4. Its schema is positional, unlike named fields of an object.

Explanation

Correct Answer

B:

For Object type in the task to define a fixed schema of named attributes with declared types, the important caution is: It is distinct from a map requiring the same element type for all values. The reason this matters is its actual behavior: object({...}) gives each named property a type, allowing heterogeneous fields.

Incorrect Answers

A:

The proposed warning belongs to Type conversion function, which serves the different goal to convert a collection into a set before using for_each, rather than to Object type: toset(...) converts suitable values into a set, removing duplicates from a list input. The question concerns Object type acting to define a fixed schema of named attributes with declared types, not a limit of Type conversion function.

C:

The proposed warning belongs to Optional object attribute, which serves the different goal to allow an object input to omit a field with an optional type specification, rather than to Object type: optional(TYPE, DEFAULT) supports an omitted object attribute and can supply a default value. The question concerns Object type acting to define a fixed schema of named attributes with declared types, not a limit of Optional object attribute.

D:

The proposed warning belongs to Tuple type, which serves the different goal to describe a fixed sequence with independently typed positions, rather than to Object type: tuple([...]) declares the expected type at each list position. The question concerns Object type acting to define a fixed schema of named attributes with declared types, not a limit of Tuple type.

Question 541

A colleague recommends the Terraform concept "Module provider passing". Which use case best matches it?

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

Explanation

Correct Answer

D:

The practical result of Module provider passing, used to attach an explicitly selected provider configuration to child module resources, is: The providers map lets a module receive the provider instance the caller intends. A qualification for this effect is: Each child must declare compatible provider requirements in its own module code.

Incorrect Answers

A:

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 provider passing: References such as module.network.vpc_id can supply another module's required variable. Unlike Module output composition, Module provider passing is intended to attach an explicitly selected provider configuration to child module resources, not to wire one module's published result into another module's input.

B:

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 provider passing: Modules promote reuse by letting callers depend on documented variables and outputs rather than every internal block. Unlike Module encapsulation, Module provider passing is intended to attach an explicitly selected provider configuration to child module resources, not to keep implementation resources private while exposing a stable input and output interface.

C:

That outcome applies to Module refactor with moved block, intended to preserve resource identity when a configuration resource is moved into a module, rather than the question's feature Module provider passing: A moved block can map an old resource address to a new module resource address for state-aware refactoring. Unlike Module refactor with moved block, Module provider passing is intended to attach an explicitly selected provider configuration to child module resources, not to preserve resource identity when a configuration resource is moved into a module.

E:

That outcome applies to Module block invocation, intended to compose a reusable infrastructure component into a root configuration, rather than the question's feature Module provider passing: A module block points at a source and supplies declared input arguments to a child module. Unlike Module block invocation, Module provider passing is intended to attach an explicitly selected provider configuration to child module resources, not to compose a reusable infrastructure component into a root configuration.

Question 542

During an implementation review, a Terraform team encounters "HCP Terraform run triggers". Which purpose is associated with that mechanism?

  1. give development and production separate credentials and deployment values
  2. associate one infrastructure workspace with the correct organizational project
  3. queue a downstream workspace run when an upstream workspace completes a successful apply
  4. delegate a set of workspaces without granting broad organization-wide rights
  5. organize related workspaces and manage project-level access controls

Explanation

Correct Answer

C:

The practical result of HCP Terraform run triggers, used to queue a downstream workspace run when an upstream workspace completes a successful apply, is: Run triggers support a controlled dependency workflow between HCP Terraform workspaces. A qualification for this effect is: They are not a substitute for explicitly supplying needed outputs or credentials.

Incorrect Answers

A:

That outcome applies to Workspace variable isolation, intended to give development and production separate credentials and deployment values, rather than the question's feature HCP Terraform run triggers: Distinct workspaces separate their state and input variables even when they use similar configuration. Unlike Workspace variable isolation, HCP Terraform run triggers is intended to queue a downstream workspace run when an upstream workspace completes a successful apply, not to give development and production separate credentials and deployment values.

B:

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 HCP Terraform run triggers: A workspace can be assigned to a project representing its team or platform boundary. Unlike Workspace placement within a project, HCP Terraform run triggers is intended to queue a downstream workspace run when an upstream workspace completes a successful apply, not to associate one infrastructure workspace with the correct organizational project.

D:

That outcome applies to Project-level team access, intended to delegate a set of workspaces without granting broad organization-wide rights, rather than the question's feature HCP Terraform run triggers: Project-scoped team permissions help control who can manage associated workspaces. Unlike Project-level team access, HCP Terraform run triggers is intended to queue a downstream workspace run when an upstream workspace completes a successful apply, not to delegate a set of workspaces without granting broad organization-wide rights.

E:

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 HCP Terraform run triggers: Projects group HCP Terraform workspaces so teams can delegate organization and access by project. Unlike HCP Terraform project grouping, HCP Terraform run triggers is intended to queue a downstream workspace run when an upstream workspace completes a successful apply, not to organize related workspaces and manage project-level access controls.

Question 543

During an implementation review, a Terraform team encounters "Provider selection for resource prefix". Which purpose is associated with that mechanism?

  1. define the supported arguments and attributes for one resource type
  2. supply settings such as region or endpoint for a provider instance
  3. authorize API operations requested by a Terraform provider
  4. translate a Terraform resource operation into remote service API calls
  5. read remote information without declaring ownership of its lifecycle
  6. associate a resource with the default provider for its type prefix

Explanation

Correct Answer

F:

The practical result of Provider selection for resource prefix, used to associate a resource with the default provider for its type prefix, is: Without a provider meta-argument Terraform normally selects the matching local provider configuration. A qualification for this effect is: An alias must be chosen explicitly if the resource needs a nondefault configuration.

Incorrect Answers

A:

That outcome applies to Provider resource schema, intended to define the supported arguments and attributes for one resource type, rather than the question's feature Provider selection for resource prefix: The provider schema specifies which settings users can configure and which values are computed. Unlike Provider resource schema, Provider selection for resource prefix is intended to associate a resource with the default provider for its type prefix, not to define the supported arguments and attributes for one resource type.

B:

That outcome applies to Provider block configuration, intended to supply settings such as region or endpoint for a provider instance, rather than the question's feature Provider selection for resource prefix: A provider block creates a configured provider instance that resources can use. Unlike Provider block configuration, Provider selection for resource prefix is intended to associate a resource with the default provider for its type prefix, not to supply settings such as region or endpoint for a provider instance.

C:

That outcome applies to Provider authentication, intended to authorize API operations requested by a Terraform provider, rather than the question's feature Provider selection for resource prefix: Providers use supported credentials and authentication mechanisms to talk to their services. Unlike Provider authentication, Provider selection for resource prefix is intended to associate a resource with the default provider for its type prefix, not to authorize API operations requested by a Terraform provider.

D:

That outcome applies to Provider plugin responsibility, intended to translate a Terraform resource operation into remote service API calls, rather than the question's feature Provider selection for resource prefix: The provider implements resource types and performs create, read, update, and delete operations when supported. Unlike Provider plugin responsibility, Provider selection for resource prefix is intended to associate a resource with the default provider for its type prefix, not to translate a Terraform resource operation into remote service API calls.

E:

That outcome applies to Provider data sources, intended to read remote information without declaring ownership of its lifecycle, rather than the question's feature Provider selection for resource prefix: A provider data source queries external information that configuration can reference. Unlike Provider data sources, Provider selection for resource prefix is intended to associate a resource with the default provider for its type prefix, not to read remote information without declaring ownership of its lifecycle.

Question 544

A Terraform rollout has two separate requirements: first, define a fixed schema of named attributes with declared types; second, allow an object input to omit a field with an optional type specification. Which assignment of mechanisms correctly handles both responsibilities?

  1. First use Type conversion function; then use List type.
  2. First use Optional object attribute; then use Object type.
  3. First use Object type; then use Type conversion function.
  4. First use Object type; then use Optional object attribute.
  5. First use List type; then use Optional object attribute.

Explanation

Correct Answer

D:

The first requirement, to define a fixed schema of named attributes with declared types, is handled by Object type: object({...}) gives each named property a type, allowing heterogeneous fields. The second requirement, to allow an object input to omit a field with an optional type specification, is handled by Optional object attribute: optional(TYPE, DEFAULT) supports an omitted object attribute and can supply a default value. Each of these mechanisms has a distinct responsibility.

Incorrect Answers

A:

For the requested tasks to define a fixed schema of named attributes with declared types and allow an object input to omit a field with an optional type specification, the first candidate Type conversion function addresses convert a collection into a set before using for_each; the second candidate List type addresses hold ordered values of a single element type. This mapping fails because the first mechanism primarily supports the task to convert a collection into a set before using for_each and the second mechanism primarily supports the task to hold ordered values of a single element type; the actual requirements are define a fixed schema of named attributes with declared types first and allow an object input to omit a field with an optional type specification second.

B:

For the requested tasks to define a fixed schema of named attributes with declared types and allow an object input to omit a field with an optional type specification, the first candidate Optional object attribute addresses allow an object input to omit a field with an optional type specification; the second candidate Object type addresses define a fixed schema of named attributes with declared types. This mapping fails because the first mechanism primarily supports the task to allow an object input to omit a field with an optional type specification and the second mechanism primarily supports the task to define a fixed schema of named attributes with declared types; the actual requirements are define a fixed schema of named attributes with declared types first and allow an object input to omit a field with an optional type specification second.

C:

For the requested tasks to define a fixed schema of named attributes with declared types and allow an object input to omit a field with an optional type specification, the first candidate Object type addresses define a fixed schema of named attributes with declared types; the second candidate Type conversion function addresses convert a collection into a set before using for_each. This mapping fails because the second mechanism primarily supports the task to convert a collection into a set before using for_each; the actual requirements are define a fixed schema of named attributes with declared types first and allow an object input to omit a field with an optional type specification second.

E:

For the requested tasks to define a fixed schema of named attributes with declared types and allow an object input to omit a field with an optional type specification, the first candidate List type addresses hold ordered values of a single element type; the second candidate Optional object attribute addresses allow an object input to omit a field with an optional type specification. This mapping fails because the first mechanism primarily supports the task to hold ordered values of a single element type; the actual requirements are define a fixed schema of named attributes with declared types first and allow an object input to omit a field with an optional type specification second.

Question 545

Before adopting Static checking before a run to add a low-risk validation stage to a pull request workflow, which statement sets an accurate boundary?

  1. It does not verify remote credentials or guarantee an apply succeeds.
  2. Input values can still fail runtime preconditions or provider API constraints later.
  3. It cannot evaluate every computed value that requires a remote read.
  4. Validation does not download missing plugins for itself.

Explanation

Correct Answer

C:

For Static checking before a run in the task to add a low-risk validation stage to a pull request workflow, the important caution is: It cannot evaluate every computed value that requires a remote read. The reason this matters is its actual behavior: Running validate early detects many language and schema problems before planning or applying.

Incorrect Answers

A:

The proposed warning belongs to terraform validate command, which serves the different goal to check configuration syntax and internal consistency without proposing resource changes, rather than to Static checking before a run: terraform validate checks the configuration's structural validity in an initialized directory. The question concerns Static checking before a run acting to add a low-risk validation stage to a pull request workflow, not a limit of terraform validate command.

B:

The proposed warning belongs to Validation of module inputs, which serves the different goal to catch an unsupported or missing required module argument early, rather than to Static checking before a run: terraform validate can report module call errors that violate input or schema requirements. The question concerns Static checking before a run acting to add a low-risk validation stage to a pull request workflow, not a limit of Validation of module inputs.

D:

The proposed warning belongs to Validate after initializing, which serves the different goal to avoid plugin-schema errors when checking a newly cloned configuration, rather than to Static checking before a run: An initialized directory provides modules and provider schemas needed for full configuration validation. The question concerns Static checking before a run acting to add a low-risk validation stage to a pull request workflow, not a limit of Validate after initializing.

Question 546

A change proposal relies on Backend migration workflow for the task to move an existing state history when switching remote storage. Which limitation specifically applies to it?

  1. Child module blocks do not create independent backend state files.
  2. Backend credentials are distinct from provider API credentials.
  3. The migration should be confirmed and tested to avoid splitting state histories.
  4. Access to state metadata may expose more than the specific outputs, so permissions matter.

Explanation

Correct Answer

C:

For Backend migration workflow in the task to move an existing state history when switching remote storage, the important caution is: The migration should be confirmed and tested to avoid splitting state histories. The reason this matters is its actual behavior: terraform init -migrate-state supports moving state during an intentional backend change.

Incorrect Answers

A:

The proposed warning belongs to Backend configuration is root-only, which serves the different goal to set backend storage for a root execution rather than independently in each child module, rather than to Backend migration workflow: The active root module configures the backend used by that Terraform working directory. The question concerns Backend migration workflow acting to move an existing state history when switching remote storage, not a limit of Backend configuration is root-only.

B:

The proposed warning belongs to Backend credential management, which serves the different goal to authenticate backend access without embedding credentials in Terraform source, rather than to Backend migration workflow: Environment-based or supported identity-based backend credentials are generally safer than hardcoded values. The question concerns Backend migration workflow acting to move an existing state history when switching remote storage, not a limit of Backend credential management.

D:

The proposed warning belongs to Data source for remote state outputs, which serves the different goal to consume published output values from another Terraform state where supported, rather than to Backend migration workflow: terraform_remote_state exposes root output values from a compatible existing state snapshot. The question concerns Backend migration workflow acting to move an existing state history when switching remote storage, not a limit of Data source for remote state outputs.

Question 547

A team reviews the use of Change impact preview in Terraform 1.12. Which purpose matches its actual behavior?

  1. identify likely creations, updates, and deletions before execution
  2. make infrastructure dependencies understandable from code
  3. reduce configuration drift across environments using shared modules
  4. recreate equivalent infrastructure patterns from one codebase
  5. replace repetitive click-by-click resource deployment with a pipeline
  6. trace why infrastructure definitions changed

Explanation

Correct Answer

A:

The practical result of Change impact preview, used to identify likely creations, updates, and deletions before execution, is: Terraform planning exposes proposed operations for examination before they take effect. A qualification for this effect is: A plan may include unknown attributes that are resolved only during apply.

Incorrect Answers

B:

That outcome applies to Self-documenting resource relationships, intended to make infrastructure dependencies understandable from code, rather than the question's feature Change impact preview: Resource references and explicit dependencies can express how objects relate without relying on tribal knowledge. Unlike Self-documenting resource relationships, Change impact preview is intended to identify likely creations, updates, and deletions before execution, not to make infrastructure dependencies understandable from code.

C:

That outcome applies to Consistent development and production patterns, intended to reduce configuration drift across environments using shared modules, rather than the question's feature Change impact preview: Reusing modules with explicit inputs aligns infrastructure design while allowing intentional environment differences. Unlike Consistent development and production patterns, Change impact preview is intended to identify likely creations, updates, and deletions before execution, not to reduce configuration drift across environments using shared modules.

D:

That outcome applies to Repeatable environment provisioning, intended to recreate equivalent infrastructure patterns from one codebase, rather than the question's feature Change impact preview: Parameterizing reusable Terraform modules can provision consistent environment patterns repeatedly. Unlike Repeatable environment provisioning, Change impact preview is intended to identify likely creations, updates, and deletions before execution, not to recreate equivalent infrastructure patterns from one codebase.

E:

That outcome applies to Automated provisioning pipeline, intended to replace repetitive click-by-click resource deployment with a pipeline, rather than the question's feature Change impact preview: A CI pipeline can run validation and planning before an authorized apply, reducing procedural inconsistency. Unlike Automated provisioning pipeline, Change impact preview is intended to identify likely creations, updates, and deletions before execution, not to replace repetitive click-by-click resource deployment with a pipeline.

F:

That outcome applies to Version-controlled configuration history, intended to trace why infrastructure definitions changed, rather than the question's feature Change impact preview: Git commits and pull requests make configuration edits auditable before the next Terraform run. Unlike Version-controlled configuration history, Change impact preview is intended to identify likely creations, updates, and deletions before execution, not to trace why infrastructure definitions changed.

Question 548

Before adopting Module provider passing to attach an explicitly selected provider configuration to child module resources, which statement sets an accurate boundary?

  1. Move mappings need compatible resource types and valid source/destination addresses.
  2. Each child must declare compatible provider requirements in its own module code.
  3. Changing a module's public interface still requires managing compatibility for callers.
  4. The parent must connect the modules; Terraform does not expose unexported child internals.

Explanation

Correct Answer

B:

For Module provider passing in the task to attach an explicitly selected provider configuration to child module resources, the important caution is: Each child must declare compatible provider requirements in its own module code. The reason this matters is its actual behavior: The providers map lets a module receive the provider instance the caller intends.

Incorrect Answers

A:

The proposed warning belongs to Module refactor with moved block, which serves the different goal to preserve resource identity when a configuration resource is moved into a module, rather than to Module provider passing: A moved block can map an old resource address to a new module resource address for state-aware refactoring. The question concerns Module provider passing acting to attach an explicitly selected provider configuration to child module resources, not a limit of Module refactor with moved block.

C:

The proposed warning belongs to Module encapsulation, which serves the different goal to keep implementation resources private while exposing a stable input and output interface, rather than to Module provider passing: Modules promote reuse by letting callers depend on documented variables and outputs rather than every internal block. The question concerns Module provider passing acting to attach an explicitly selected provider configuration to child module resources, not a limit of Module encapsulation.

D:

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 Module provider passing: References such as module.network.vpc_id can supply another module's required variable. The question concerns Module provider passing acting to attach an explicitly selected provider configuration to child module resources, not a limit of Module output composition.

Question 549

A design uses HCP Terraform run triggers to queue a downstream workspace run when an upstream workspace completes a successful apply. Which qualification applies to the named mechanism?

  1. Shared variable sets need appropriate scoping to avoid accidental cross-environment access.
  2. They are not a substitute for explicitly supplying needed outputs or credentials.
  3. Project grouping is broadly available, but assigning project-level permissions requires an Essentials, Standard, or Premium plan; each workspace has its own state.
  4. Moving the workspace between projects does not merge its state with neighbors.

Explanation

Correct Answer

B:

For HCP Terraform run triggers in the task to queue a downstream workspace run when an upstream workspace completes a successful apply, the important caution is: They are not a substitute for explicitly supplying needed outputs or credentials. The reason this matters is its actual behavior: Run triggers support a controlled dependency workflow between HCP Terraform workspaces.

Incorrect Answers

A:

The proposed warning belongs to Workspace variable isolation, which serves the different goal to give development and production separate credentials and deployment values, rather than to HCP Terraform run triggers: Distinct workspaces separate their state and input variables even when they use similar configuration. The question concerns HCP Terraform run triggers acting to queue a downstream workspace run when an upstream workspace completes a successful apply, not a limit of Workspace variable isolation.

C:

The proposed warning belongs to HCP Terraform project grouping, which serves the different goal to organize related workspaces and manage project-level access controls, rather than to HCP Terraform run triggers: Projects group HCP Terraform workspaces so teams can delegate organization and access by project. The question concerns HCP Terraform run triggers acting to queue a downstream workspace run when an upstream workspace completes a successful apply, not a limit of HCP Terraform project grouping.

D:

The proposed warning belongs to Workspace placement within a project, which serves the different goal to associate one infrastructure workspace with the correct organizational project, rather than to HCP Terraform run triggers: A workspace can be assigned to a project representing its team or platform boundary. The question concerns HCP Terraform run triggers acting to queue a downstream workspace run when an upstream workspace completes a successful apply, not a limit of Workspace placement within a project.

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.

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