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

Question 510

During a deployment checklist, one task is to recognize that filesystem modules follow the current checkout, while another is to make dependency expectations explicit before broad reuse. Select the matching pair of techniques.

  1. Use a release tag as a Git source ref + Use >= 1.2.0, < 2.0.0 for registry modules
  2. Do not assign a version argument to a local path module + Review the plan after a module upgrade
  3. Specify a registry module version in the call + Document compatibility requirements for module consumers
  4. Set version = "= 1.4.2" on a registry module + Document compatibility requirements for module consumers
  5. Do not assign a version argument to a local path module + Document compatibility requirements for module consumers

Explanation

Correct Answer

E:

For the first criterion, 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 recognize that filesystem modules follow the current checkout and make dependency expectations explicit before broad reuse; this directly addresses the need to recognize that filesystem modules follow the current checkout. For the separate second criterion, 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 recognize that filesystem modules follow the current checkout and make dependency expectations explicit before broad reuse; this fulfills the need to make dependency expectations explicit before broad reuse. Together they cover the independent tasks of recognize that filesystem modules follow the current checkout and make dependency expectations explicit before broad reuse without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure is intended to refer to a known Git module milestone: 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 recognize that filesystem modules follow the current checkout and make dependency expectations explicit before broad reuse. The second measure is intended to permit a defined compatible interval of releases: Multiple constraints are intersected when selecting registry module versions; they express an acceptable range, not a request to always use the latest major release; this behavior should be assessed against the concrete need to recognize that filesystem modules follow the current checkout and make dependency expectations explicit before broad reuse. Neither is the directly designated method for the separate goals of recognize that filesystem modules follow the current checkout and make dependency expectations explicit before broad reuse in this review.

B:

The first measure meets the requirement to recognize that filesystem modules follow the current checkout, but its partner serves a different role: 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 recognize that filesystem modules follow the current checkout and make dependency expectations explicit before broad reuse. That second component is designed to spot effects caused by changed child resource definitions, so the still-missing criterion is to make dependency expectations explicit before broad reuse, while the first criterion remains recognize that filesystem modules follow the current checkout.

C:

The second measure does meet the make dependency expectations explicit before broad reuse requirement, but the first is designed for another concern: 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 recognize that filesystem modules follow the current checkout and make dependency expectations explicit before broad reuse. That first component is designed to distinguish registry version selection from source identification, which does not accomplish the requested task to recognize that filesystem modules follow the current checkout, even though the other measure satisfies make dependency expectations explicit before broad reuse.

D:

The second measure does meet the make dependency expectations explicit before broad reuse requirement, but the first is designed for another concern: 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 recognize that filesystem modules follow the current checkout and make dependency expectations explicit before broad reuse. That first component is designed to use one exact published module version for reproducible runs, which does not accomplish the requested task to recognize that filesystem modules follow the current checkout, even though the other measure satisfies make dependency expectations explicit before broad reuse.

Question 511

An infrastructure repository has local and external module sources. The team must both fetch module code directly from a Git repository and select a nested module directory inside a downloaded repository. Which paired choice implements those distinct goals?

  1. Use source = "../shared" + Understand source address is required for a module call
  2. Use git::https://... as the source + Use //subdirectory in an external module source
  3. Avoid confusing a module with a provider + Use //subdirectory in an external module source
  4. Use git::https://... as the source + Use source = "./modules/network"

Explanation

Correct Answer

B:

For the first criterion, 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 fetch module code directly from a Git repository and select a nested module directory inside a downloaded repository; this directly addresses the need to fetch module code directly from a Git repository. For the separate second criterion, 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 fetch module code directly from a Git repository and select a nested module directory inside a downloaded repository; this fulfills the need to select a nested module directory inside a downloaded repository. Together they cover the independent tasks of fetch module code directly from a Git repository and select a nested module directory inside a downloaded repository without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first 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 fetch module code directly from a Git repository and select a nested module directory inside a downloaded repository. The second measure is intended to identify where Terraform should load the child configuration: 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 fetch module code directly from a Git repository and select a nested module directory inside a downloaded repository. Neither is the directly designated method for the separate goals of fetch module code directly from a Git repository and select a nested module directory inside a downloaded repository in this review.

C:

The second measure does meet the select a nested module directory inside a downloaded repository requirement, but the first is designed for another concern: 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 fetch module code directly from a Git repository and select a nested module directory inside a downloaded repository. That first component is designed to recognize reusable Terraform configuration versus an API integration plugin, which does not accomplish the requested task to fetch module code directly from a Git repository, even though the other measure satisfies select a nested module directory inside a downloaded repository.

D:

The first measure meets the requirement to fetch module code directly from a Git repository, but its partner serves a different role: 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 fetch module code directly from a Git repository and select a nested module directory inside a downloaded repository. That second component is designed to load a child module from a path relative to the calling configuration, so the still-missing criterion is to select a nested module directory inside a downloaded repository, while the first criterion remains fetch module code directly from a Git repository.

Question 512

An application team is designing a reusable module interface. The requirement is to preserve encapsulation of implementation-only calculations. Which Terraform mechanism directly meets this requirement?

  1. Expose selected values via output blocks
  2. Avoid referencing child local values from the parent
  3. Declare inputs in a child variable block
  4. Use nullable = false for a non-null module input

Explanation

Correct Answer

B:

Only outputs are exposed for general child-module consumption; callers should not depend on private local names that may change during refactoring; this behavior should be assessed against the concrete need to preserve encapsulation of implementation-only calculations. This directly supports the task to preserve encapsulation of implementation-only calculations during an automated release.

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 preserve encapsulation of implementation-only calculations. The stated requirement is to preserve encapsulation of implementation-only calculations, not to allow a caller to reference child results; this alternative addresses a different control or phase.

C:

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 preserve encapsulation of implementation-only calculations. The distinction matters here: using that mechanism to accept values from the calling module through a documented interface would still leave the objective to preserve encapsulation of implementation-only calculations unmet.

D:

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 preserve encapsulation of implementation-only calculations. It may support a related workflow, but the question specifically requires the mechanism for preserve encapsulation of implementation-only calculations rather than reject a caller's explicit null rather than accidentally passing it onward.

Question 513

A module call requires provider settings and outputs. A reviewer must determine how to meet the child module's variable contract. Which action is the appropriate choice?

  1. Read module.web.endpoint after declaring an output
  2. Supply required module input arguments
  3. Build a root orchestration module
  4. Share provider configurations from the root

Explanation

Correct Answer

B:

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 meet the child module's variable contract. This directly supports the task to meet the child module's variable contract during a staged rollout.

Incorrect Answers

A:

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 meet the child module's variable contract. It may support a related workflow, but the question specifically requires the mechanism for meet the child module's variable contract rather than consume a child module result in the caller.

C:

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 meet the child module's variable contract. That can be useful when the aim is to compose specialized children without embedding infrastructure logic everywhere, but it does not directly deliver the requested ability to meet the child module's variable contract.

D:

A child module should declare provider requirements while receiving provider configurations through inheritance or explicit mapping; this supports flexible reuse; this behavior should be assessed against the concrete need to meet the child module's variable contract. The distinction matters here: using that mechanism to avoid configuring cloud credentials separately in every reusable child would still leave the objective to meet the child module's variable contract unmet.

Question 514

The immediate Terraform task is to choose a specific revision from an external Git repository. Which method handles that task most directly?

  1. Set version = "~> 2.3" on a registry module
  2. Use a release tag as a Git source ref
  3. Use ?ref=COMMIT on a Git module
  4. Use >= 1.2.0, < 2.0.0 for registry modules

Explanation

Correct Answer

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 choose a specific revision from an external Git repository. This directly supports the task to choose a specific revision from an external Git repository during a configuration change.

Incorrect Answers

A:

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 choose a specific revision from an external Git repository. The distinction matters here: using that mechanism to allow compatible registry releases within a bounded series would still leave the objective to choose a specific revision from an external Git repository unmet.

B:

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 choose a specific revision from an external Git repository. It may support a related workflow, but the question specifically requires the mechanism for choose a specific revision from an external Git repository rather than refer to a known Git module milestone.

D:

Multiple constraints are intersected when selecting registry module versions; they express an acceptable range, not a request to always use the latest major release; this behavior should be assessed against the concrete need to choose a specific revision from an external Git repository. That can be useful when the aim is to permit a defined compatible interval of releases, but it does not directly deliver the requested ability to choose a specific revision from an external Git repository.

Question 515

A team is retrieving reusable Terraform modules. The requirement is to load a child module from a path relative to the calling configuration. Which Terraform mechanism directly meets this requirement?

  1. Use source = "./modules/network"
  2. Avoid confusing a module with a provider
  3. Use a local module source for rapid in-repository changes
  4. Use //subdirectory in an external module source

Explanation

Correct Answer

A:

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 load a child module from a path relative to the calling configuration. This directly supports the task to load a child module from a path relative to the calling configuration during an automated release.

Incorrect Answers

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 load a child module from a path relative to the calling configuration. It may support a related workflow, but the question specifically requires the mechanism for load a child module from a path relative to the calling configuration rather than recognize reusable Terraform configuration versus an API integration plugin.

C:

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 load a child module from a path relative to the calling configuration. The stated requirement is to load a child module from a path relative to the calling configuration, not to develop a shared component without publishing a remote module release; this alternative addresses a different control or phase.

D:

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 load a child module from a path relative to the calling configuration. That can be useful when the aim is to select a nested module directory inside a downloaded repository, but it does not directly deliver the requested ability to load a child module from a path relative to the calling configuration.

Question 516

During a deployment checklist, one task is to compute implementation details without exposing extra inputs, while another is to avoid accidentally publishing a secret through the caller's outputs. Select the matching pair of techniques.

  1. Use child locals for internal derivations + Avoid referencing child local values from the parent
  2. Use typed module inputs + Treat module output sensitivity as contagious
  3. Use child locals for internal derivations + Treat module output sensitivity as contagious
  4. Expose selected values via output blocks + Use a default on a child input for optional behavior

Explanation

Correct Answer

C:

For the first criterion, 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 compute implementation details without exposing extra inputs and avoid accidentally publishing a secret through the caller's outputs; this directly addresses the need to compute implementation details without exposing extra inputs. For the separate second criterion, sensitive values can flow across module boundaries; a root output exposing a sensitive value generally needs an explicit sensitive marking; state protection remains necessary; this behavior should be assessed against the concrete need to compute implementation details without exposing extra inputs and avoid accidentally publishing a secret through the caller's outputs; this fulfills the need to avoid accidentally publishing a secret through the caller's outputs. Together they cover the independent tasks of compute implementation details without exposing extra inputs and avoid accidentally publishing a secret through the caller's outputs without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure meets the requirement to compute implementation details without exposing extra inputs, but its partner serves a different role: Only outputs are exposed for general child-module consumption; callers should not depend on private local names that may change during refactoring; this behavior should be assessed against the concrete need to compute implementation details without exposing extra inputs and avoid accidentally publishing a secret through the caller's outputs. That second component is designed to preserve encapsulation of implementation-only calculations, so the still-missing criterion is to avoid accidentally publishing a secret through the caller's outputs, while the first criterion remains compute implementation details without exposing extra inputs.

B:

The second measure does meet the avoid accidentally publishing a secret through the caller's outputs requirement, but the first is designed for another concern: 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 compute implementation details without exposing extra inputs and avoid accidentally publishing a secret through the caller's outputs. That first component is designed to catch incompatible caller values before deployment, which does not accomplish the requested task to compute implementation details without exposing extra inputs, even though the other measure satisfies avoid accidentally publishing a secret through the caller's outputs.

D:

The first measure is intended to allow a caller to reference child results: 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 compute implementation details without exposing extra inputs and avoid accidentally publishing a secret through the caller's outputs. The second measure is intended to allow callers to omit that specific module argument: A variable default supplies the value within the child when no argument is passed; other child inputs without defaults remain required; this behavior should be assessed against the concrete need to compute implementation details without exposing extra inputs and avoid accidentally publishing a secret through the caller's outputs. Neither is the directly designated method for the separate goals of compute implementation details without exposing extra inputs and avoid accidentally publishing a secret through the caller's outputs in this review.

Question 517

A reviewer has to approve a two-part design: create a numbered collection of module instances; additionally, select which root provider configurations the module uses. Which option pairs the correct mechanisms?

  1. Use a local module while iterating on a design + Share provider configurations from the root
  2. Use multiple child modules to separate responsibilities + Pass the providers mapping to a child
  3. Use count on a compatible module call + Keep backend configuration in the root module
  4. Use count on a compatible module call + Pass the providers mapping to a child

Explanation

Correct Answer

D:

For the first criterion, count produces addresses such as module.worker[0]; each instance can receive a different input computed from count.index; this behavior should be assessed against the concrete need to create a numbered collection of module instances and select which root provider configurations the module uses; this directly addresses the need to create a numbered collection of module instances. For the separate second 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 create a numbered collection of module instances and select which root provider configurations the module uses; this fulfills the need to select which root provider configurations the module uses. Together they cover the independent tasks of create a numbered collection of module instances and select which root provider configurations the module uses without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure is intended to test in-repository child changes before publishing a version: A local path loads code directly from the checkout; this differs from upgrading an immutable release in an external module registry; this behavior should be assessed against the concrete need to create a numbered collection of module instances and select which root provider configurations the module uses. The second measure is intended to avoid configuring cloud credentials separately in every reusable child: A child module should declare provider requirements while receiving provider configurations through inheritance or explicit mapping; this supports flexible reuse; this behavior should be assessed against the concrete need to create a numbered collection of module instances and select which root provider configurations the module uses. Neither is the directly designated method for the separate goals of create a numbered collection of module instances and select which root provider configurations the module uses in this review.

B:

The second measure does meet the select which root provider configurations the module uses requirement, but the first is designed for another concern: 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 create a numbered collection of module instances and select which root provider configurations the module uses. That first component is designed to keep reusable components small and interoperable, which does not accomplish the requested task to create a numbered collection of module instances, even though the other measure satisfies select which root provider configurations the module uses.

C:

The first measure meets the requirement to create a numbered collection of module instances, but its partner serves a different role: 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 create a numbered collection of module instances and select which root provider configurations the module uses. That second component is designed to avoid assuming a backend in a child controls the caller's state, so the still-missing criterion is to select which root provider configurations the module uses, while the first criterion remains create a numbered collection of module instances.

Question 518

A Terraform rollout has separate acceptance criteria: distinguish registry version selection from source identification and spot effects caused by changed child resource definitions. Which combined approach directly satisfies the two criteria?

  1. Specify a registry module version in the call + Review the plan after a module upgrade
  2. Use >= 1.2.0, < 2.0.0 for registry modules + Review the plan after a module upgrade
  3. Set version = "= 1.4.2" on a registry module + Document compatibility requirements for module consumers
  4. Specify a registry module version in the call + Set version = "~> 2.3" on a registry module

Explanation

Correct Answer

A:

For the first criterion, 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 and spot effects caused by changed child resource definitions; this directly addresses the need to distinguish registry version selection from source identification. For the separate second criterion, 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 distinguish registry version selection from source identification and spot effects caused by changed child resource definitions; this fulfills the need to spot effects caused by changed child resource definitions. Together they cover the independent tasks of distinguish registry version selection from source identification and spot effects caused by changed child resource definitions without exchanging the responsibilities of these features.

Incorrect Answers

B:

The second measure does meet the spot effects caused by changed child resource definitions requirement, but the first is designed for another concern: Multiple constraints are intersected when selecting registry module versions; they express an acceptable range, not a request to always use the latest major release; this behavior should be assessed against the concrete need to distinguish registry version selection from source identification and spot effects caused by changed child resource definitions. That first component is designed to permit a defined compatible interval of releases, which does not accomplish the requested task to distinguish registry version selection from source identification, even though the other measure satisfies spot effects caused by changed child resource definitions.

C:

The first measure is intended to use one exact published module version for reproducible runs: 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 distinguish registry version selection from source identification and spot effects caused by changed child resource definitions. 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 distinguish registry version selection from source identification and spot effects caused by changed child resource definitions. Neither is the directly designated method for the separate goals of distinguish registry version selection from source identification and spot effects caused by changed child resource definitions in this review.

D:

The first measure meets the requirement to distinguish registry version selection from source identification, but its partner serves a different role: 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 distinguish registry version selection from source identification and spot effects caused by changed child resource definitions. That second component is designed to allow compatible registry releases within a bounded series, so the still-missing criterion is to spot effects caused by changed child resource definitions, while the first criterion remains distinguish registry version selection from source identification.

Question 519

A developer is deciding how to reference shared module code. A reviewer must determine how to develop a shared component without publishing a remote module release. Which action is the appropriate choice?

  1. Avoid confusing a module with a provider
  2. Use a local module source for rapid in-repository changes
  3. Understand source address is required for a module call
  4. Use source = "./modules/network"

Explanation

Correct Answer

B:

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. This directly supports the task to develop a shared component without publishing a remote module release during a staged rollout.

Incorrect Answers

A:

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 develop a shared component without publishing a remote module release. It may support a related workflow, but the question specifically requires the mechanism for develop a shared component without publishing a remote module release rather than recognize reusable Terraform configuration versus an API integration plugin.

C:

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. That can be useful when the aim is to identify where Terraform should load the child configuration, but it does not directly deliver the requested ability to develop a shared component without publishing a remote module release.

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 develop a shared component without publishing a remote module release. 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 develop a shared component without publishing a remote module release unmet.

Question 520

The immediate Terraform task is to allow a caller to reference child results. Which method handles that task most directly?

  1. Avoid referencing child local values from the parent
  2. Use nullable = false for a non-null module input
  3. Expose selected values via output blocks
  4. Pass a root output through a child input explicitly

Explanation

Correct Answer

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 allow a caller to reference child results. This directly supports the task to allow a caller to reference child results during a configuration change.

Incorrect Answers

A:

Only outputs are exposed for general child-module consumption; callers should not depend on private local names that may change during refactoring; this behavior should be assessed against the concrete need to allow a caller to reference child results. The distinction matters here: using that mechanism to preserve encapsulation of implementation-only calculations would still leave the objective to allow a caller to reference child results unmet.

B:

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 allow a caller to reference child results. It may support a related workflow, but the question specifically requires the mechanism for allow a caller to reference child results rather than reject a caller's explicit null rather than accidentally passing it onward.

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 allow a caller to reference child results. That can be useful when the aim is to connect two modules while preserving their separate scopes, but it does not directly deliver the requested ability to allow a caller to reference child results.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests