HashiCorp Terraform Associate (HashiCorp Certified: Terraform Associate) Practice Test 54

Question 530

A reusable module is receiving controlled releases. A reviewer must determine how to distinguish registry version selection from source identification. Which action is the appropriate choice?

  1. Run terraform init -upgrade after changing a version range
  2. Specify a registry module version in the call
  3. Use ?ref=COMMIT on a Git module
  4. Use a release tag as a Git source ref

Explanation

Correct Answer

B:

The source says which module to fetch, while version constrains published versions; both are important for predictable registry consumption; this behavior should be assessed against the concrete need to distinguish registry version selection from source identification. This directly supports the task to distinguish registry version selection from source identification during a cross-team handoff.

Incorrect Answers

A:

Upgrade mode re-fetches and reevaluates eligible dependencies; existing infrastructure does not change until a subsequent plan/apply; this behavior should be assessed against the concrete need to distinguish registry version selection from source identification. The distinction matters here: using that mechanism to refresh external module and provider selections to newly permitted releases would still leave the objective to distinguish registry version selection from source identification unmet.

C:

A commit hash identifies precise source content; module version arguments are not interpreted for raw Git sources; this behavior should be assessed against the concrete need to distinguish registry version selection from source identification. The stated requirement is to distinguish registry version selection from source identification, not to choose a specific revision from an external Git repository; this alternative addresses a different control or phase.

D:

A Git tag can name a release, but mutable tags remain a repository-governance risk; this version control is separate from registry module version constraints; this behavior should be assessed against the concrete need to distinguish registry version selection from source identification. That can be useful when the aim is to refer to a known Git module milestone, but it does not directly deliver the requested ability to distinguish registry version selection from source identification.

Question 531

A developer is deciding how to reference shared module code. The team must both develop a shared component without publishing a remote module release and identify where Terraform should load the child configuration. Which paired choice implements those distinct goals?

  1. Use a local module source for rapid in-repository changes + Understand source address is required for a module call
  2. Use ?ref=v1.4.0 with a Git source + Use source = "../shared"
  3. Use git::https://... as the source + Understand source address is required for a module call
  4. Use a local module source for rapid in-repository changes + Use //subdirectory in an external module source

Explanation

Correct Answer

A:

For the first criterion, a local module is loaded from the current filesystem tree; changes are visible with the current checkout instead of awaiting a registry release; this behavior should be assessed against the concrete need to develop a shared component without publishing a remote module release and identify where Terraform should load the child configuration; this directly addresses the need to develop a shared component without publishing a remote module release. For the separate second criterion, the source argument resolves module code; a module block with no valid source cannot simply invent the child's resources; this behavior should be assessed against the concrete need to develop a shared component without publishing a remote module release and identify where Terraform should load the child configuration; this fulfills the need to identify where Terraform should load the child configuration. Together they cover the independent tasks of develop a shared component without publishing a remote module release and identify where Terraform should load the child configuration without exchanging the responsibilities of these features.

Incorrect Answers

B:

The first measure is intended to pin a Git-sourced module to a named tag, commit, or branch reference: A Git ref selects code from the repository; for reproducibility a commit or immutable release tag is safer than a moving branch; this behavior should be assessed against the concrete need to develop a shared component without publishing a remote module release and identify where Terraform should load the child configuration. The second measure is intended to reuse a module from a sibling directory: Parent-relative local paths allow neighboring configurations to share code; the directory must be present on the machine or in the checked-out repository; this behavior should be assessed against the concrete need to develop a shared component without publishing a remote module release and identify where Terraform should load the child configuration. Neither is the directly designated method for the separate goals of develop a shared component without publishing a remote module release and identify where Terraform should load the child configuration in this review.

C:

The second measure does meet the identify where Terraform should load the child configuration requirement, but the first is designed for another concern: Terraform supports a Git URL source and can use a reference query parameter; the registry version argument is not used to version raw Git sources; this behavior should be assessed against the concrete need to develop a shared component without publishing a remote module release and identify where Terraform should load the child configuration. That first component is designed to fetch module code directly from a Git repository, which does not accomplish the requested task to develop a shared component without publishing a remote module release, even though the other measure satisfies identify where Terraform should load the child configuration.

D:

The first measure meets the requirement to develop a shared component without publishing a remote module release, but its partner serves a different role: The double-slash delimiter distinguishes the subdirectory from the package URL; terraform retrieves the containing package before entering the path; this behavior should be assessed against the concrete need to develop a shared component without publishing a remote module release and identify where Terraform should load the child configuration. That second component is designed to select a nested module directory inside a downloaded repository, so the still-missing criterion is to identify where Terraform should load the child configuration, while the first criterion remains develop a shared component without publishing a remote module release.

Question 532

A root module passes environment-specific settings into child modules. The requirement is to reduce sprawling module argument lists while preserving type checking. Which Terraform mechanism directly meets this requirement?

  1. Use object inputs to bundle related options
  2. Declare inputs in a child variable block
  3. Expose selected values via output blocks
  4. Pass a root output through a child input explicitly

Explanation

Correct Answer

A:

A typed object can describe several coherent settings at one interface boundary; nested data is still validated against the child's declared input contract; this behavior should be assessed against the concrete need to reduce sprawling module argument lists while preserving type checking. This directly supports the task to reduce sprawling module argument lists while preserving type checking during a planned migration.

Incorrect Answers

B:

Each module declares its own variable names and constraints; a child does not automatically inherit all root input variables; this behavior should be assessed against the concrete need to reduce sprawling module argument lists while preserving type checking. The distinction matters here: using that mechanism to accept values from the calling module through a documented interface would still leave the objective to reduce sprawling module argument lists while preserving type checking unmet.

C:

A child output becomes accessible as module.instance.output_name; callers cannot directly reach arbitrary unexported resources inside the child module; this behavior should be assessed against the concrete need to reduce sprawling module argument lists while preserving type checking. It may support a related workflow, but the question specifically requires the mechanism for reduce sprawling module argument lists while preserving type checking rather than allow a caller to reference child results.

D:

A caller can use module.upstream.value as an argument to module.downstream; this also creates a dependency through the reference; this behavior should be assessed against the concrete need to reduce sprawling module argument lists while preserving type checking. The stated requirement is to reduce sprawling module argument lists while preserving type checking, not to connect two modules while preserving their separate scopes; this alternative addresses a different control or phase.

Question 533

During a module implementation, one task is to instantiate a reusable child configuration from a known location, while another is to avoid assuming a backend in a child controls the caller's state. Select the matching pair of techniques.

  1. Use multiple child modules to separate responsibilities + Supply required module input arguments
  2. Read module.web.endpoint after declaring an output + Keep backend configuration in the root module
  3. Define a module block with source + Pass the providers mapping to a child
  4. Define a module block with source + Keep backend configuration in the root module

Explanation

Correct Answer

D:

For the first criterion, a module call loads the child configuration and supplies its arguments; the caller's root remains responsible for backend setup; this behavior should be assessed against the concrete need to instantiate a reusable child configuration from a known location and avoid assuming a backend in a child controls the caller's state; this directly addresses the need to instantiate a reusable child configuration from a known location. For the separate second criterion, the backend applies to the top-level working configuration; child modules cannot independently select state storage during a normal shared module call; this behavior should be assessed against the concrete need to instantiate a reusable child configuration from a known location and avoid assuming a backend in a child controls the caller's state; this fulfills the need to avoid assuming a backend in a child controls the caller's state. Together they cover the independent tasks of instantiate a reusable child configuration from a known location and avoid assuming a backend in a child controls the caller's state without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure is intended to keep reusable components small and interoperable: Well-defined module outputs connect independent components without cloning all resource blocks; the overall run still uses one state for that root configuration; this behavior should be assessed against the concrete need to instantiate a reusable child configuration from a known location and avoid assuming a backend in a child controls the caller's state. The second measure is intended to meet the child module's variable contract: Terraform maps arguments by name to variables declared inside the child; missing required values prevent a valid plan; this behavior should be assessed against the concrete need to instantiate a reusable child configuration from a known location and avoid assuming a backend in a child controls the caller's state. Neither is the directly designated method for the separate goals of instantiate a reusable child configuration from a known location and avoid assuming a backend in a child controls the caller's state in this review.

B:

The second measure does meet the avoid assuming a backend in a child controls the caller's state requirement, but the first is designed for another concern: Only named output values are exposed by the module reference; the caller cannot assume internal resource addresses are directly visible; this behavior should be assessed against the concrete need to instantiate a reusable child configuration from a known location and avoid assuming a backend in a child controls the caller's state. That first component is designed to consume a child module result in the caller, which does not accomplish the requested task to instantiate a reusable child configuration from a known location, even though the other measure satisfies avoid assuming a backend in a child controls the caller's state.

C:

The first measure meets the requirement to instantiate a reusable child configuration from a known location, but its partner serves a different role: A module provider map binds the child's expected names to configured parent provider instances; it does not install providers independently; this behavior should be assessed against the concrete need to instantiate a reusable child configuration from a known location and avoid assuming a backend in a child controls the caller's state. That second component is designed to select which root provider configurations the module uses, so the still-missing criterion is to avoid assuming a backend in a child controls the caller's state, while the first criterion remains instantiate a reusable child configuration from a known location.

Question 534

A reviewer has to approve a two-part design: use one exact published module version for reproducible runs; additionally, review module inputs, outputs, and resource movements before upgrading. Which option pairs the correct mechanisms?

  1. Set version = "= 1.4.2" on a registry module + Use a release tag as a Git source ref
  2. Set version = "= 1.4.2" on a registry module + Treat major version changes as interface changes
  3. Specify a registry module version in the call + Document compatibility requirements for module consumers
  4. Do not assign a version argument to a local path module + Treat major version changes as interface changes

Explanation

Correct Answer

B:

For the first criterion, an equality constraint selects a specific registry release; it avoids accidental upgrades until the configuration is changed; this behavior should be assessed against the concrete need to use one exact published module version for reproducible runs and review module inputs, outputs, and resource movements before upgrading; this directly addresses the need to use one exact published module version for reproducible runs. For the separate second criterion, a new release can change the child module's contract or resource addresses; a valid installation does not guarantee a safe infrastructure plan; this behavior should be assessed against the concrete need to use one exact published module version for reproducible runs and review module inputs, outputs, and resource movements before upgrading; this fulfills the need to review module inputs, outputs, and resource movements before upgrading. Together they cover the independent tasks of use one exact published module version for reproducible runs and review module inputs, outputs, and resource movements before upgrading without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure meets the requirement to use one exact published module version for reproducible runs, but its partner serves a different role: A Git tag can name a release, but mutable tags remain a repository-governance risk; this version control is separate from registry module version constraints; this behavior should be assessed against the concrete need to use one exact published module version for reproducible runs and review module inputs, outputs, and resource movements before upgrading. That second component is designed to refer to a known Git module milestone, so the still-missing criterion is to review module inputs, outputs, and resource movements before upgrading, while the first criterion remains use one exact published module version for reproducible runs.

C:

The first measure is intended to distinguish registry version selection from source identification: The source says which module to fetch, while version constrains published versions; both are important for predictable registry consumption; this behavior should be assessed against the concrete need to use one exact published module version for reproducible runs and review module inputs, outputs, and resource movements before upgrading. The second measure is intended to make dependency expectations explicit before broad reuse: A reusable module can state minimum provider versions and tested Terraform versions; this keeps consumers from resolving unsupported combinations; this behavior should be assessed against the concrete need to use one exact published module version for reproducible runs and review module inputs, outputs, and resource movements before upgrading. Neither is the directly designated method for the separate goals of use one exact published module version for reproducible runs and review module inputs, outputs, and resource movements before upgrading in this review.

D:

The second measure does meet the review module inputs, outputs, and resource movements before upgrading requirement, but the first is designed for another concern: Local source content is taken directly from disk; versioning needs repository practices rather than Terraform's registry-module version selector; this behavior should be assessed against the concrete need to use one exact published module version for reproducible runs and review module inputs, outputs, and resource movements before upgrading. That first component is designed to recognize that filesystem modules follow the current checkout, which does not accomplish the requested task to use one exact published module version for reproducible runs, even though the other measure satisfies review module inputs, outputs, and resource movements before upgrading.

Question 535

An infrastructure repository has local and external module sources. The requirement is to recognize reusable Terraform configuration versus an API integration plugin. Which Terraform mechanism directly meets this requirement?

  1. Use a public registry source namespace/name/provider
  2. Avoid confusing a module with a provider
  3. Use the module registry's documented inputs and outputs
  4. Use source = "./modules/network"

Explanation

Correct Answer

B:

A module contains HCL blocks; a provider implements external API operations; an external module may use providers but is not itself a provider binary; this behavior should be assessed against the concrete need to recognize reusable Terraform configuration versus an API integration plugin. This directly supports the task to recognize reusable Terraform configuration versus an API integration plugin during a planned migration.

Incorrect Answers

A:

The shorthand identifies a Terraform Registry module and its provider category; version constraints can apply to registry-sourced modules; this behavior should be assessed against the concrete need to recognize reusable Terraform configuration versus an API integration plugin. It may support a related workflow, but the question specifically requires the mechanism for recognize reusable Terraform configuration versus an API integration plugin rather than retrieve a published module from its registry address.

C:

Published modules define an intended interface; callers supply declared variables and consume declared outputs; internal resources are implementation details; this behavior should be assessed against the concrete need to recognize reusable Terraform configuration versus an API integration plugin. That can be useful when the aim is to integrate the module without assuming internal resource names are its API, but it does not directly deliver the requested ability to recognize reusable Terraform configuration versus an API integration plugin.

D:

Local sources refer to code on disk, and ./ makes the relative location explicit; they do not select a published registry version; this behavior should be assessed against the concrete need to recognize reusable Terraform configuration versus an API integration plugin. The distinction matters here: using that mechanism to load a child module from a path relative to the calling configuration would still leave the objective to recognize reusable Terraform configuration versus an API integration plugin unmet.

Question 536

An application team is designing a reusable module interface. A reviewer must determine how to accept values from the calling module through a documented interface. Which action is the appropriate choice?

  1. Expose selected values via output blocks
  2. Use object inputs to bundle related options
  3. Use nullable = false for a non-null module input
  4. Declare inputs in a child variable block

Explanation

Correct Answer

D:

Each module declares its own variable names and constraints; a child does not automatically inherit all root input variables; this behavior should be assessed against the concrete need to accept values from the calling module through a documented interface. This directly supports the task to accept values from the calling module through a documented interface during a cross-team handoff.

Incorrect Answers

A:

A child output becomes accessible as module.instance.output_name; callers cannot directly reach arbitrary unexported resources inside the child module; this behavior should be assessed against the concrete need to accept values from the calling module through a documented interface. The distinction matters here: using that mechanism to allow a caller to reference child results would still leave the objective to accept values from the calling module through a documented interface unmet.

B:

A typed object can describe several coherent settings at one interface boundary; nested data is still validated against the child's declared input contract; this behavior should be assessed against the concrete need to accept values from the calling module through a documented interface. It may support a related workflow, but the question specifically requires the mechanism for accept values from the calling module through a documented interface rather than reduce sprawling module argument lists while preserving type checking.

C:

The variable setting controls whether null is permitted; it does not imply that the child can choose a cloud credential automatically; this behavior should be assessed against the concrete need to accept values from the calling module through a documented interface. The stated requirement is to accept values from the calling module through a documented interface, not to reject a caller's explicit null rather than accidentally passing it onward; this alternative addresses a different control or phase.

Question 537

A reviewer has to approve a two-part design: select which root provider configurations the module uses; additionally, compose specialized children without embedding infrastructure logic everywhere. Which option pairs the correct mechanisms?

  1. Use for_each on a compatible module call + Keep backend configuration in the root module
  2. Pass the providers mapping to a child + Use multiple child modules to separate responsibilities
  3. Pass the providers mapping to a child + Build a root orchestration module
  4. Use depends_on on a module when necessary + Build a root orchestration module

Explanation

Correct Answer

C:

For the first criterion, a module provider map binds the child's expected names to configured parent provider instances; it does not install providers independently; this behavior should be assessed against the concrete need to select which root provider configurations the module uses and compose specialized children without embedding infrastructure logic everywhere; this directly addresses the need to select which root provider configurations the module uses. For the separate second criterion, the root module can connect network, compute, and monitoring children through inputs and outputs; each child's encapsulation reduces repeated configuration; this behavior should be assessed against the concrete need to select which root provider configurations the module uses and compose specialized children without embedding infrastructure logic everywhere; this fulfills the need to compose specialized children without embedding infrastructure logic everywhere. Together they cover the independent tasks of select which root provider configurations the module uses and compose specialized children without embedding infrastructure logic everywhere without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure is intended to instantiate a module per stable map or set key: For-each instance addresses include keys and are often easier to maintain through membership changes than positional count indices; this behavior should be assessed against the concrete need to select which root provider configurations the module uses and compose specialized children without embedding infrastructure logic everywhere. The second measure is intended to avoid assuming a backend in a child controls the caller's state: The backend applies to the top-level working configuration; child modules cannot independently select state storage during a normal shared module call; this behavior should be assessed against the concrete need to select which root provider configurations the module uses and compose specialized children without embedding infrastructure logic everywhere. Neither is the directly designated method for the separate goals of select which root provider configurations the module uses and compose specialized children without embedding infrastructure logic everywhere in this review.

B:

The first measure meets the requirement to select which root provider configurations the module uses, but its partner serves a different role: Well-defined module outputs connect independent components without cloning all resource blocks; the overall run still uses one state for that root configuration; this behavior should be assessed against the concrete need to select which root provider configurations the module uses and compose specialized children without embedding infrastructure logic everywhere. That second component is designed to keep reusable components small and interoperable, so the still-missing criterion is to compose specialized children without embedding infrastructure logic everywhere, while the first criterion remains select which root provider configurations the module uses.

D:

The second measure does meet the compose specialized children without embedding infrastructure logic everywhere requirement, but the first is designed for another concern: An explicit module dependency orders its operations after the listed object; prefer output references when they can express the dependency more narrowly; this behavior should be assessed against the concrete need to select which root provider configurations the module uses and compose specialized children without embedding infrastructure logic everywhere. That first component is designed to enforce a hidden prerequisite for an entire child module, which does not accomplish the requested task to select which root provider configurations the module uses, even though the other measure satisfies compose specialized children without embedding infrastructure logic everywhere.

Question 538

In a planned migration, the requested result is to allow compatible registry releases within a bounded series. What should the engineer select?

  1. Do not assign a version argument to a local path module
  2. Set version = "~> 2.3" on a registry module
  3. Review the plan after a module upgrade
  4. Set version = "= 1.4.2" on a registry module

Explanation

Correct Answer

B:

The pessimistic version constraint selects an eligible published release; it cannot pin raw Git URLs because that source uses its own reference mechanism; this behavior should be assessed against the concrete need to allow compatible registry releases within a bounded series. This directly supports the task to allow compatible registry releases within a bounded series during a deployment checklist.

Incorrect Answers

A:

Local source content is taken directly from disk; versioning needs repository practices rather than Terraform's registry-module version selector; this behavior should be assessed against the concrete need to allow compatible registry releases within a bounded series. The stated requirement is to allow compatible registry releases within a bounded series, not to recognize that filesystem modules follow the current checkout; this alternative addresses a different control or phase.

C:

A new module may replace resources or alter defaults; initialization only fetches code; the plan reveals its likely infrastructure impact; this behavior should be assessed against the concrete need to allow compatible registry releases within a bounded series. The distinction matters here: using that mechanism to spot effects caused by changed child resource definitions would still leave the objective to allow compatible registry releases within a bounded series unmet.

D:

An equality constraint selects a specific registry release; it avoids accidental upgrades until the configuration is changed; this behavior should be assessed against the concrete need to allow compatible registry releases within a bounded series. It may support a related workflow, but the question specifically requires the mechanism for allow compatible registry releases within a bounded series rather than use one exact published module version for reproducible runs.

Question 539

A team is retrieving reusable Terraform modules. A reviewer must determine how to consume an organization-controlled module with published releases. Which action is the appropriate choice?

  1. Use a private registry module source
  2. Use source = "./modules/network"
  3. Use a public registry source namespace/name/provider
  4. Use a local module source for rapid in-repository changes

Explanation

Correct Answer

A:

Private module registries support reusable approved patterns with access controls; consumers still specify the correct source and supported version selection; this behavior should be assessed against the concrete need to consume an organization-controlled module with published releases. This directly supports the task to consume an organization-controlled module with published releases during a cross-team handoff.

Incorrect Answers

B:

Local sources refer to code on disk, and ./ makes the relative location explicit; they do not select a published registry version; this behavior should be assessed against the concrete need to consume an organization-controlled module with published releases. That can be useful when the aim is to load a child module from a path relative to the calling configuration, but it does not directly deliver the requested ability to consume an organization-controlled module with published releases.

C:

The shorthand identifies a Terraform Registry module and its provider category; version constraints can apply to registry-sourced modules; this behavior should be assessed against the concrete need to consume an organization-controlled module with published releases. The distinction matters here: using that mechanism to retrieve a published module from its registry address would still leave the objective to consume an organization-controlled module with published releases unmet.

D:

A local module is loaded from the current filesystem tree; changes are visible with the current checkout instead of awaiting a registry release; this behavior should be assessed against the concrete need to consume an organization-controlled module with published releases. It may support a related workflow, but the question specifically requires the mechanism for consume an organization-controlled module with published releases rather than develop a shared component without publishing a remote module release.

Question 540

A reviewer has to approve a two-part design: assign the caller's value to the child's required variable; additionally, assign different values to identically named inputs in two distinct module instances. Which option pairs the correct mechanisms?

  1. Pass a child input in the module block + Keep same-named child inputs separate across module calls
  2. Expose selected values via output blocks + Keep same-named child inputs separate across module calls
  3. Use child locals for internal derivations + Pass a root output through a child input explicitly
  4. Pass a child input in the module block + Use typed module inputs

Explanation

Correct Answer

A:

For the first criterion, arguments in a module call map into variables declared by that child; an undeclared argument is not a magic global variable; this behavior should be assessed against the concrete need to assign the caller's value to the child's required variable and assign different values to identically named inputs in two distinct module instances; this directly addresses the need to assign the caller's value to the child's required variable. For the separate second criterion, each call has its own variable namespace and argument values; passing region = "east" in one module call does not alter var.region inside another instance; this behavior should be assessed against the concrete need to assign the caller's value to the child's required variable and assign different values to identically named inputs in two distinct module instances; this fulfills the need to assign different values to identically named inputs in two distinct module instances. Together they cover the independent tasks of assign the caller's value to the child's required variable and assign different values to identically named inputs in two distinct module instances without exchanging the responsibilities of these features.

Incorrect Answers

B:

The second measure does meet the assign different values to identically named inputs in two distinct module instances requirement, but the first is designed for another concern: A child output becomes accessible as module.instance.output_name; callers cannot directly reach arbitrary unexported resources inside the child module; this behavior should be assessed against the concrete need to assign the caller's value to the child's required variable and assign different values to identically named inputs in two distinct module instances. That first component is designed to allow a caller to reference child results, which does not accomplish the requested task to assign the caller's value to the child's required variable, even though the other measure satisfies assign different values to identically named inputs in two distinct module instances.

C:

The first measure is intended to compute implementation details without exposing extra inputs: Local values are not parameters the caller can set directly; they provide readable internal names for expressions derived from variables and resources; this behavior should be assessed against the concrete need to assign the caller's value to the child's required variable and assign different values to identically named inputs in two distinct module instances. The second measure is intended to connect two modules while preserving their separate scopes: A caller can use module.upstream.value as an argument to module.downstream; this also creates a dependency through the reference; this behavior should be assessed against the concrete need to assign the caller's value to the child's required variable and assign different values to identically named inputs in two distinct module instances. Neither is the directly designated method for the separate goals of assign the caller's value to the child's required variable and assign different values to identically named inputs in two distinct module instances in this review.

D:

The first measure meets the requirement to assign the caller's value to the child's required variable, but its partner serves a different role: Type constraints describe accepted strings, collections, or nested objects; they make the child-module contract more predictable than undocumented any values; this behavior should be assessed against the concrete need to assign the caller's value to the child's required variable and assign different values to identically named inputs in two distinct module instances. That second component is designed to catch incompatible caller values before deployment, so the still-missing criterion is to assign different values to identically named inputs in two distinct module instances, while the first criterion remains assign the caller's value to the child's required variable.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests