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

Question 100

In a planned migration, the requested result is to ensure dependencies are installed during initialization. What should the engineer select?

  1. Avoid assuming providers install automatically at apply
  2. Recognize provider source addresses
  3. Review provider documentation for sensitive attributes
  4. Handle provider-specific constraints

Explanation

Correct Answer

A:

Terraform initialization installs provider dependencies before normal plan/apply runs; missing plugin setup cannot be solved solely by granting more cloud permissions; this behavior should be assessed against the concrete need to ensure dependencies are installed during initialization. This directly supports the task to ensure dependencies are installed during initialization during a deployment checklist.

Incorrect Answers

B:

The source includes registry host, namespace, and type when fully qualified; local names let modules refer to that provider without repeating its entire address; this behavior should be assessed against the concrete need to ensure dependencies are installed during initialization. It may support a related workflow, but the question specifically requires the mechanism for ensure dependencies are installed during initialization rather than distinguish a local provider name from its registry namespace.

C:

Providers decide which schema values are stored, sensitive in display, or write-only; hiding a value in output is not equivalent to omitting it from state; this behavior should be assessed against the concrete need to ensure dependencies are installed during initialization. The stated requirement is to ensure dependencies are installed during initialization, not to avoid assuming ordinary resource arguments hide secrets from state; this alternative addresses a different control or phase.

D:

Each service API determines supported operations, defaults, quotas, and replacement rules; the shared HCL syntax does not standardize these platform behaviors; this behavior should be assessed against the concrete need to ensure dependencies are installed during initialization. That can be useful when the aim is to avoid assuming one cloud plugin exposes the same resource semantics as another, but it does not directly deliver the requested ability to ensure dependencies are installed during initialization.

Question 101

An engineer needs to create a second named configuration of the same provider as part of a planned migration. Which option is the best fit?

  1. Use different local provider names for distinct plugin sources
  2. Avoid provider blocks inside reusable child modules
  3. Inherit the default provider configuration into a child module
  4. Define an aliased provider block

Explanation

Correct Answer

D:

An alias identifies an alternate configuration such as another region; it does not register a different plugin source or version by itself; this behavior should be assessed against the concrete need to create a second named configuration of the same provider. This directly supports the task to create a second named configuration of the same provider during a maintenance request.

Incorrect Answers

A:

The local name maps a provider source to an identifier in a module; two sources require distinct local names even if their human-facing functions overlap; this behavior should be assessed against the concrete need to create a second named configuration of the same provider. That can be useful when the aim is to avoid confusing multiple plugins with the same type suffix, but it does not directly deliver the requested ability to create a second named configuration of the same provider.

B:

Child modules designed for reuse should receive provider configurations from callers; embedded provider blocks conflict with some module meta-arguments, including for_each; this behavior should be assessed against the concrete need to create a second named configuration of the same provider. The distinction matters here: using that mechanism to keep configurations controlled by the root for compatible module reuse would still leave the objective to create a second named configuration of the same provider unmet.

C:

Child modules generally inherit default provider configurations when not overridden; aliased configurations are not inherited automatically; this behavior should be assessed against the concrete need to create a second named configuration of the same provider. It may support a related workflow, but the question specifically requires the mechanism for create a second named configuration of the same provider rather than use the parent's ordinary provider settings without manual remapping.

Question 102

An administrator needs to understand a plan that touches existing objects. The requirement is to recognize that a state entry is not a request to keep an object forever. Which Terraform mechanism directly meets this requirement?

  1. Use state for dependency information
  2. Separate state from the desired configuration
  3. Distinguish a managed object from a data-source read
  4. Understand one state per workspace boundary

Explanation

Correct Answer

B:

Configuration declares intended resources while state records what Terraform tracks; removing a block can plan destruction unless a supported removal mechanism changes that intent; this behavior should be assessed against the concrete need to recognize that a state entry is not a request to keep an object forever. This directly supports the task to recognize that a state entry is not a request to keep an object forever during an automated release.

Incorrect Answers

A:

State helps Terraform track relationships and objects that may no longer be present in configuration; its purpose extends beyond saving a copy of HCL source code; this behavior should be assessed against the concrete need to recognize that a state entry is not a request to keep an object forever. The stated requirement is to recognize that a state entry is not a request to keep an object forever, not to retain references needed to reconcile previously created resources; this alternative addresses a different control or phase.

C:

Managed resources have lifecycle operations tracked through state; data sources obtain information without taking ownership of the looked-up remote resource; this behavior should be assessed against the concrete need to recognize that a state entry is not a request to keep an object forever. The distinction matters here: using that mechanism to understand what Terraform considers its responsibility to change would still leave the objective to recognize that a state entry is not a request to keep an object forever unmet.

D:

Different Terraform states maintain separate bindings and resource addresses; a shared configuration can therefore manage multiple environments if each has isolated state and inputs; this behavior should be assessed against the concrete need to recognize that a state entry is not a request to keep an object forever. It may support a related workflow, but the question specifically requires the mechanism for recognize that a state entry is not a request to keep an object forever rather than avoid mixing independent deployments unintentionally.

Question 103

In a planned migration, the requested result is to avoid repeatedly downloading the same provider binaries on a build host. What should the engineer select?

  1. Use TF_PLUGIN_CACHE_DIR for shared package caching
  2. Declare provider source under required_providers
  3. Commit .terraform.lock.hcl for reproducibility
  4. Run terraform init -upgrade deliberately

Explanation

Correct Answer

A:

A plugin cache can reduce download work across directories; it does not replace the dependency lock file's selections and package-verification responsibilities; this behavior should be assessed against the concrete need to avoid repeatedly downloading the same provider binaries on a build host. This directly supports the task to avoid repeatedly downloading the same provider binaries on a build host during a deployment checklist.

Incorrect Answers

B:

The source address identifies the plugin distribution; a local short name in HCL is only an alias within that module; terraform must resolve provider requirements during initialization; this behavior should be assessed against the concrete need to avoid repeatedly downloading the same provider binaries on a build host. That can be useful when the aim is to identify the registry namespace and provider type to install, but it does not directly deliver the requested ability to avoid repeatedly downloading the same provider binaries on a build host.

C:

The dependency lock file constrains selection in later runs and verifies packages; it is not a lock for module releases or a storage location for state; this behavior should be assessed against the concrete need to avoid repeatedly downloading the same provider binaries on a build host. The distinction matters here: using that mechanism to record selected provider releases and package checksums across machines would still leave the objective to avoid repeatedly downloading the same provider binaries on a build host unmet.

D:

Upgrade mode asks Terraform to reconsider provider and module selections instead of preserving the existing lockfile choice; it still respects configured version requirements; this behavior should be assessed against the concrete need to avoid repeatedly downloading the same provider binaries on a build host. It may support a related workflow, but the question specifically requires the mechanism for avoid repeatedly downloading the same provider binaries on a build host rather than reselect newer eligible provider releases within declared constraints.

Question 104

A provider integration encounters an API permission problem. The team must both supply credentials and settings needed for remote API requests and understand why different resource types accept different attributes. Which paired choice implements those distinct goals?

  1. Recognize provider source addresses + Use resource schemas as the authority on arguments
  2. Recognize a provider as an API plugin + Select a provider using the resource type prefix
  3. Configure a provider's authentication + Use resource schemas as the authority on arguments
  4. Configure a provider's authentication + Handle provider-specific constraints

Explanation

Correct Answer

C:

For the first criterion, provider configuration determines how the plugin connects to its service; defining the plugin requirement alone is not sufficient for authenticated resource operations; this behavior should be assessed against the concrete need to supply credentials and settings needed for remote API requests and understand why different resource types accept different attributes; this directly addresses the need to supply credentials and settings needed for remote API requests. For the separate second criterion, each provider publishes expected types, optional fields, and computed fields; terraform validation can reject unsupported arguments even if their names look reasonable; this behavior should be assessed against the concrete need to supply credentials and settings needed for remote API requests and understand why different resource types accept different attributes; this fulfills the need to understand why different resource types accept different attributes. Together they cover the independent tasks of supply credentials and settings needed for remote API requests and understand why different resource types accept different attributes without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the understand why different resource types accept different attributes requirement, but the first is designed for another concern: The source includes registry host, namespace, and type when fully qualified; local names let modules refer to that provider without repeating its entire address; this behavior should be assessed against the concrete need to supply credentials and settings needed for remote API requests and understand why different resource types accept different attributes. That first component is designed to distinguish a local provider name from its registry namespace, which does not accomplish the requested task to supply credentials and settings needed for remote API requests, even though the other measure satisfies understand why different resource types accept different attributes.

B:

The first measure is intended to map Terraform resource operations to a platform's API: Provider binaries translate resource and data-source lifecycle requests into service-specific API calls; terraform Core builds plans and tracks dependencies, rather than implementing every cloud API directly; this behavior should be assessed against the concrete need to supply credentials and settings needed for remote API requests and understand why different resource types accept different attributes. The second measure is intended to understand how an unqualified resource chooses its default provider: A type such as aws_instance typically maps to the default local provider name aws; an explicit provider meta-argument can override that default configuration; this behavior should be assessed against the concrete need to supply credentials and settings needed for remote API requests and understand why different resource types accept different attributes. Neither is the directly designated method for the separate goals of supply credentials and settings needed for remote API requests and understand why different resource types accept different attributes in this review.

D:

The first measure meets the requirement to supply credentials and settings needed for remote API requests, but its partner serves a different role: Each service API determines supported operations, defaults, quotas, and replacement rules; the shared HCL syntax does not standardize these platform behaviors; this behavior should be assessed against the concrete need to supply credentials and settings needed for remote API requests and understand why different resource types accept different attributes. That second component is designed to avoid assuming one cloud plugin exposes the same resource semantics as another, so the still-missing criterion is to understand why different resource types accept different attributes, while the first criterion remains supply credentials and settings needed for remote API requests.

Question 105

A cloud deployment must route each resource to the correct account. The requirement is to diagnose failures when only aliases are configured. Which Terraform mechanism directly meets this requirement?

  1. Understand the implied empty default provider configuration
  2. Reference a provider alias without quotation marks
  3. Avoid provider blocks inside reusable child modules
  4. Map multiple aliases for a cross-region child module

Explanation

Correct Answer

A:

If all provider blocks use aliases, resources without an explicit provider may fall back to an implied empty default; required settings then may be missing; this behavior should be assessed against the concrete need to diagnose failures when only aliases are configured. This directly supports the task to diagnose failures when only aliases are configured during an automated release.

Incorrect Answers

B:

Syntax such as provider = aws.west names the configuration; putting the reference in a string changes it from a provider reference and is not valid usage; this behavior should be assessed against the concrete need to diagnose failures when only aliases are configured. It may support a related workflow, but the question specifically requires the mechanism for diagnose failures when only aliases are configured rather than write the meta-argument as a provider configuration reference.

C:

Child modules designed for reuse should receive provider configurations from callers; embedded provider blocks conflict with some module meta-arguments, including for_each; this behavior should be assessed against the concrete need to diagnose failures when only aliases are configured. The stated requirement is to diagnose failures when only aliases are configured, not to keep configurations controlled by the root for compatible module reuse; this alternative addresses a different control or phase.

D:

A child can declare distinct alias names and the caller can bind each one to a separate root configuration; passing a single default is insufficient for a two-context design; this behavior should be assessed against the concrete need to diagnose failures when only aliases are configured. That can be useful when the aim is to support a module that must address source and destination environments, but it does not directly deliver the requested ability to diagnose failures when only aliases are configured.

Question 106

A team is investigating why Terraform recognizes remote objects. A reviewer must determine how to avoid mixing independent deployments unintentionally. Which action is the appropriate choice?

  1. Distinguish a managed object from a data-source read
  2. Understand one state per workspace boundary
  3. Avoid manual state-file editing
  4. Separate state from the desired configuration

Explanation

Correct Answer

B:

Different Terraform states maintain separate bindings and resource addresses; a shared configuration can therefore manage multiple environments if each has isolated state and inputs; this behavior should be assessed against the concrete need to avoid mixing independent deployments unintentionally. This directly supports the task to avoid mixing independent deployments unintentionally during a staged rollout.

Incorrect Answers

A:

Managed resources have lifecycle operations tracked through state; data sources obtain information without taking ownership of the looked-up remote resource; this behavior should be assessed against the concrete need to avoid mixing independent deployments unintentionally. That can be useful when the aim is to understand what Terraform considers its responsibility to change, but it does not directly deliver the requested ability to avoid mixing independent deployments unintentionally.

C:

terraform state operations and declarative moved/removed blocks are safer tools for intended transitions; hand-editing state can corrupt identifiers or dependencies; this behavior should be assessed against the concrete need to avoid mixing independent deployments unintentionally. It may support a related workflow, but the question specifically requires the mechanism for avoid mixing independent deployments unintentionally rather than preserve internal consistency of resource instance mappings.

D:

Configuration declares intended resources while state records what Terraform tracks; removing a block can plan destruction unless a supported removal mechanism changes that intent; this behavior should be assessed against the concrete need to avoid mixing independent deployments unintentionally. The stated requirement is to avoid mixing independent deployments unintentionally, not to recognize that a state entry is not a request to keep an object forever; this alternative addresses a different control or phase.

Question 107

A CI runner is reproducing dependency installations. The team must both download and initialize missing required providers and reselect newer eligible provider releases within declared constraints. Which paired choice implements those distinct goals?

  1. Distinguish provider requirements from provider configurations + Understand checksums in the lock file
  2. Run terraform init to install plugins + Constrain required_version for Terraform Core
  3. Set a provider version constraint + Run terraform init -upgrade deliberately
  4. Run terraform init to install plugins + Run terraform init -upgrade deliberately

Explanation

Correct Answer

D:

For the first criterion, initialization resolves provider requirements and places plugin packages into the local cache or working data directory. plan assumes required initialization has occurred; this behavior should be assessed against the concrete need to download and initialize missing required providers and reselect newer eligible provider releases within declared constraints; this directly addresses the need to download and initialize missing required providers. For the separate second criterion, upgrade mode asks Terraform to reconsider provider and module selections instead of preserving the existing lockfile choice; it still respects configured version requirements; this behavior should be assessed against the concrete need to download and initialize missing required providers and reselect newer eligible provider releases within declared constraints; this fulfills the need to reselect newer eligible provider releases within declared constraints. Together they cover the independent tasks of download and initialize missing required providers and reselect newer eligible provider releases within declared constraints without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure is intended to separate which plugin to install from how it authenticates and connects: required_providers selects a plugin identity and versions; provider blocks hold instance settings such as region, endpoint, or authentication; this behavior should be assessed against the concrete need to download and initialize missing required providers and reselect newer eligible provider releases within declared constraints. The second measure is intended to verify installed provider packages against trusted recorded hashes: Hashes help detect unexpected package changes; they do not validate that a plugin's credentials have sufficient rights at a remote API; this behavior should be assessed against the concrete need to download and initialize missing required providers and reselect newer eligible provider releases within declared constraints. Neither is the directly designated method for the separate goals of download and initialize missing required providers and reselect newer eligible provider releases within declared constraints in this review.

B:

The first measure meets the requirement to download and initialize missing required providers, but its partner serves a different role: The top-level Terraform version constraint concerns the CLI executable, not a provider plugin; provider requirements belong in required_providers; this behavior should be assessed against the concrete need to download and initialize missing required providers and reselect newer eligible provider releases within declared constraints. That second component is designed to specify which Terraform CLI versions may interpret this configuration, so the still-missing criterion is to reselect newer eligible provider releases within declared constraints, while the first criterion remains download and initialize missing required providers.

C:

The second measure does meet the reselect newer eligible provider releases within declared constraints requirement, but the first is designed for another concern: A constraint such as ~> 5.0 filters available versions by compatibility; it is not a request to install any arbitrarily newer major version; this behavior should be assessed against the concrete need to download and initialize missing required providers and reselect newer eligible provider releases within declared constraints. That first component is designed to restrict which plugin releases are eligible for installation, which does not accomplish the requested task to download and initialize missing required providers, even though the other measure satisfies reselect newer eligible provider releases within declared constraints.

Question 108

A workspace is evaluating resource types and provider configuration. Two independent changes are requested: first, map Terraform resource operations to a platform's API; second, supply credentials and settings needed for remote API requests. Which pair of measures fulfills both?

  1. Distinguish Terraform Core from provider plugins + Handle provider-specific constraints
  2. Understand a provider plugin's version independence + Configure a provider's authentication
  3. Recognize a provider as an API plugin + Read provider-computed attributes
  4. Recognize a provider as an API plugin + Configure a provider's authentication

Explanation

Correct Answer

D:

For the first criterion, provider binaries translate resource and data-source lifecycle requests into service-specific API calls; terraform Core builds plans and tracks dependencies, rather than implementing every cloud API directly; this behavior should be assessed against the concrete need to map Terraform resource operations to a platform's API and supply credentials and settings needed for remote API requests; this directly addresses the need to map Terraform resource operations to a platform's API. For the separate second criterion, provider configuration determines how the plugin connects to its service; defining the plugin requirement alone is not sufficient for authenticated resource operations; this behavior should be assessed against the concrete need to map Terraform resource operations to a platform's API and supply credentials and settings needed for remote API requests; this fulfills the need to supply credentials and settings needed for remote API requests. Together they cover the independent tasks of map Terraform resource operations to a platform's API and supply credentials and settings needed for remote API requests without exchanging the responsibilities of these features.

Incorrect Answers

A:

The first measure is intended to locate graph, evaluation, state, and orchestration responsibilities: Core evaluates configuration and plans operations; a provider talks to its specific API to create, read, update, or delete objects; an API authorization error therefore usually needs provider-side credential review; this behavior should be assessed against the concrete need to map Terraform resource operations to a platform's API and supply credentials and settings needed for remote API requests. The second measure is intended to avoid assuming one cloud plugin exposes the same resource semantics as another: Each service API determines supported operations, defaults, quotas, and replacement rules; the shared HCL syntax does not standardize these platform behaviors; this behavior should be assessed against the concrete need to map Terraform resource operations to a platform's API and supply credentials and settings needed for remote API requests. Neither is the directly designated method for the separate goals of map Terraform resource operations to a platform's API and supply credentials and settings needed for remote API requests in this review.

B:

The second measure does meet the supply credentials and settings needed for remote API requests requirement, but the first is designed for another concern: A provider is distributed and versioned independently of Terraform Core; compatibility constraints may restrict usable combinations; this behavior should be assessed against the concrete need to map Terraform resource operations to a platform's API and supply credentials and settings needed for remote API requests. That first component is designed to separate provider release changes from upgrading Terraform CLI, which does not accomplish the requested task to map Terraform resource operations to a platform's API, even though the other measure satisfies supply credentials and settings needed for remote API requests.

C:

The first measure meets the requirement to map Terraform resource operations to a platform's API, but its partner serves a different role: A provider may return IDs or addresses that were unknown during initial planning; terraform can propagate unknown values through references until the apply produces them; this behavior should be assessed against the concrete need to map Terraform resource operations to a platform's API and supply credentials and settings needed for remote API requests. That second component is designed to use values learned only after resource creation or refresh, so the still-missing criterion is to supply credentials and settings needed for remote API requests, while the first criterion remains map Terraform resource operations to a platform's API.

Question 109

An IaC repository is targeting several accounts or regions. A reviewer must determine how to ensure reads occur in the intended service account or region. Which action is the appropriate choice?

  1. Bind a data source to the appropriate provider alias
  2. Use different local provider names for distinct plugin sources
  3. Map multiple aliases for a cross-region child module
  4. Set provider = aws.west on a resource

Explanation

Correct Answer

A:

Data sources accept provider selection as managed resources do; a lookup against the wrong default configuration may return the wrong object or no object; this behavior should be assessed against the concrete need to ensure reads occur in the intended service account or region. This directly supports the task to ensure reads occur in the intended service account or region during a staged rollout.

Incorrect Answers

B:

The local name maps a provider source to an identifier in a module; two sources require distinct local names even if their human-facing functions overlap; this behavior should be assessed against the concrete need to ensure reads occur in the intended service account or region. The stated requirement is to ensure reads occur in the intended service account or region, not to avoid confusing multiple plugins with the same type suffix; this alternative addresses a different control or phase.

C:

A child can declare distinct alias names and the caller can bind each one to a separate root configuration; passing a single default is insufficient for a two-context design; this behavior should be assessed against the concrete need to ensure reads occur in the intended service account or region. That can be useful when the aim is to support a module that must address source and destination environments, but it does not directly deliver the requested ability to ensure reads occur in the intended service account or region.

D:

The provider meta-argument is a reference to a configured provider instance; without it, a resource normally selects its type's default provider; this behavior should be assessed against the concrete need to ensure reads occur in the intended service account or region. The distinction matters here: using that mechanism to bind an individual resource to a nondefault provider configuration would still leave the objective to ensure reads occur in the intended service account or region unmet.

Question 110

The immediate Terraform task is to identify which remote object Terraform currently manages for a resource block. Which method handles that task most directly?

  1. Distinguish a managed object from a data-source read
  2. Treat state as the resource-address-to-object mapping
  3. Understand refresh during planning
  4. Treat state snapshots as recoverable but hazardous

Explanation

Correct Answer

B:

State binds addresses in configuration to provider-specific remote IDs and recorded attributes; without that mapping Terraform cannot reliably correlate every declared block with an existing object; this behavior should be assessed against the concrete need to identify which remote object Terraform currently manages for a resource block. This directly supports the task to identify which remote object Terraform currently manages for a resource block during a configuration change.

Incorrect Answers

A:

Managed resources have lifecycle operations tracked through state; data sources obtain information without taking ownership of the looked-up remote resource; this behavior should be assessed against the concrete need to identify which remote object Terraform currently manages for a resource block. The distinction matters here: using that mechanism to understand what Terraform considers its responsibility to change would still leave the objective to identify which remote object Terraform currently manages for a resource block unmet.

C:

Terraform typically reads managed remote objects to update its knowledge before making a normal plan; the refresh may reveal drift introduced outside Terraform; this behavior should be assessed against the concrete need to identify which remote object Terraform currently manages for a resource block. The stated requirement is to identify which remote object Terraform currently manages for a resource block, not to compare tracked objects against current provider-reported attributes; this alternative addresses a different control or phase.

D:

An invalid or outdated state snapshot can confuse planned operations; recovery needs controlled version handling, not arbitrary deletion of an active backend; this behavior should be assessed against the concrete need to identify which remote object Terraform currently manages for a resource block. That can be useful when the aim is to plan how to protect, back up, and restore state deliberately, but it does not directly deliver the requested ability to identify which remote object Terraform currently manages for a resource block.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests