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

Question 130

The immediate Terraform task is to compare tracked objects against current provider-reported attributes. Which method handles that task most directly?

  1. Treat state snapshots as recoverable but hazardous
  2. Use state for dependency information
  3. Recognize state does not equal a cloud inventory
  4. Understand refresh during planning

Explanation

Correct Answer

D:

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 compare tracked objects against current provider-reported attributes. This directly supports the task to compare tracked objects against current provider-reported attributes during a platform review.

Incorrect Answers

A:

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 compare tracked objects against current provider-reported attributes. It may support a related workflow, but the question specifically requires the mechanism for compare tracked objects against current provider-reported attributes rather than plan how to protect, back up, and restore state deliberately.

B:

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 compare tracked objects against current provider-reported attributes. The stated requirement is to compare tracked objects against current provider-reported attributes, not to retain references needed to reconcile previously created resources; this alternative addresses a different control or phase.

C:

Terraform tracks objects that were created or imported into that workspace; it does not discover and adopt every service object merely because credentials permit seeing it; this behavior should be assessed against the concrete need to compare tracked objects against current provider-reported attributes. That can be useful when the aim is to understand why unmanaged existing objects do not appear automatically, but it does not directly deliver the requested ability to compare tracked objects against current provider-reported attributes.

Question 131

A CI runner is reproducing dependency installations. The requirement is to verify installed provider packages against trusted recorded hashes. Which Terraform mechanism directly meets this requirement?

  1. Set a provider version constraint
  2. Run terraform init -upgrade deliberately
  3. Run terraform init to install plugins
  4. Understand checksums in the lock file

Explanation

Correct Answer

D:

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 verify installed provider packages against trusted recorded hashes. This directly supports the task to verify installed provider packages against trusted recorded hashes during a planned migration.

Incorrect Answers

A:

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 verify installed provider packages against trusted recorded hashes. It may support a related workflow, but the question specifically requires the mechanism for verify installed provider packages against trusted recorded hashes rather than restrict which plugin releases are eligible for installation.

B:

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 verify installed provider packages against trusted recorded hashes. The stated requirement is to verify installed provider packages against trusted recorded hashes, not to reselect newer eligible provider releases within declared constraints; this alternative addresses a different control or phase.

C:

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 verify installed provider packages against trusted recorded hashes. That can be useful when the aim is to download and initialize missing required providers, but it does not directly deliver the requested ability to verify installed provider packages against trusted recorded hashes.

Question 132

A Terraform review separates 3 requirements: (1) avoid assuming one cloud plugin exposes the same resource semantics as another; (2) understand why different resource types accept different attributes; (3) distinguish a local provider name from its registry namespace. Identify the three features that each directly handle one of those requirements. Choose THREE.

  1. Handle provider-specific constraints
  2. Distinguish Terraform Core from provider plugins
  3. Use resource schemas as the authority on arguments
  4. Recognize provider source addresses
  5. Configure a provider's authentication
  6. Select a provider using the resource type prefix

Explanation

Correct Answers

A:

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 avoid assuming one cloud plugin exposes the same resource semantics as another and understand why different resource types accept different attributes and distinguish a local provider name from its registry namespace. This matches the distinct objective to avoid assuming one cloud plugin exposes the same resource semantics as another; the remaining chosen features address understand why different resource types accept different attributes and distinguish a local provider name from its registry namespace.

C:

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 avoid assuming one cloud plugin exposes the same resource semantics as another and understand why different resource types accept different attributes and distinguish a local provider name from its registry namespace. This matches the distinct objective to understand why different resource types accept different attributes; the remaining chosen features address avoid assuming one cloud plugin exposes the same resource semantics as another and distinguish a local provider name from its registry namespace.

D:

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 avoid assuming one cloud plugin exposes the same resource semantics as another and understand why different resource types accept different attributes and distinguish a local provider name from its registry namespace. This matches the distinct objective to distinguish a local provider name from its registry namespace; the remaining chosen features address avoid assuming one cloud plugin exposes the same resource semantics as another and understand why different resource types accept different attributes.

Incorrect Answers

B:

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 avoid assuming one cloud plugin exposes the same resource semantics as another and understand why different resource types accept different attributes and distinguish a local provider name from its registry namespace. Its main application is to locate graph, evaluation, state, and orchestration responsibilities; the checklist instead asks for avoid assuming one cloud plugin exposes the same resource semantics as another; and understand why different resource types accept different attributes; and distinguish a local provider name from its registry namespace. None of those distinct criteria specifically calls for this alternative.

E:

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 avoid assuming one cloud plugin exposes the same resource semantics as another and understand why different resource types accept different attributes and distinguish a local provider name from its registry namespace. Its main application is to supply credentials and settings needed for remote API requests; the checklist instead asks for avoid assuming one cloud plugin exposes the same resource semantics as another; and understand why different resource types accept different attributes; and distinguish a local provider name from its registry namespace. None of those distinct criteria specifically calls for this alternative.

F:

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 avoid assuming one cloud plugin exposes the same resource semantics as another and understand why different resource types accept different attributes and distinguish a local provider name from its registry namespace. Its main application is to understand how an unqualified resource chooses its default provider; the checklist instead asks for avoid assuming one cloud plugin exposes the same resource semantics as another; and understand why different resource types accept different attributes; and distinguish a local provider name from its registry namespace. None of those distinct criteria specifically calls for this alternative.

Question 133

A reviewer has to approve a two-part design: bind an individual resource to a nondefault provider configuration; additionally, make additional provider configuration names available to child resources. Which option pairs the correct mechanisms?

  1. Pass a providers map in a module call + Declare configuration_aliases in a child module
  2. Set provider = aws.west on a resource + Declare configuration_aliases in a child module
  3. Inherit the default provider configuration into a child module + Declare required_providers separately in a child module
  4. Set provider = aws.west on a resource + Define an aliased provider block

Explanation

Correct Answer

B:

For the first criterion, 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 bind an individual resource to a nondefault provider configuration and make additional provider configuration names available to child resources; this directly addresses the need to bind an individual resource to a nondefault provider configuration. For the separate second criterion, a reusable module must declare aliases it expects in provider requirements; the caller can then pass those configurations through its module block; this behavior should be assessed against the concrete need to bind an individual resource to a nondefault provider configuration and make additional provider configuration names available to child resources; this fulfills the need to make additional provider configuration names available to child resources. Together they cover the independent tasks of bind an individual resource to a nondefault provider configuration and make additional provider configuration names available to child resources without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the make additional provider configuration names available to child resources requirement, but the first is designed for another concern: Module provider mappings decide which configurations each child resource receives; the entries reference provider instances, not plain strings of region names; this behavior should be assessed against the concrete need to bind an individual resource to a nondefault provider configuration and make additional provider configuration names available to child resources. That first component is designed to map a child module's expected provider names to root configurations, which does not accomplish the requested task to bind an individual resource to a nondefault provider configuration, even though the other measure satisfies make additional provider configuration names available to child resources.

C:

The first measure is intended to use the parent's ordinary provider settings without manual remapping: 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 bind an individual resource to a nondefault provider configuration and make additional provider configuration names available to child resources. The second measure is intended to document the plugin source and compatibility constraints inside each module: Provider configurations may be passed across modules, but source and version requirements are local to each module; explicit requirements prevent incorrect provider-source inference; this behavior should be assessed against the concrete need to bind an individual resource to a nondefault provider configuration and make additional provider configuration names available to child resources. Neither is the directly designated method for the separate goals of bind an individual resource to a nondefault provider configuration and make additional provider configuration names available to child resources in this review.

D:

The first measure meets the requirement to bind an individual resource to a nondefault provider configuration, but its partner serves a different role: 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 bind an individual resource to a nondefault provider configuration and make additional provider configuration names available to child resources. That second component is designed to create a second named configuration of the same provider, so the still-missing criterion is to make additional provider configuration names available to child resources, while the first criterion remains bind an individual resource to a nondefault provider configuration.

Question 134

A developer is comparing configuration, state, and current infrastructure. The checklist contains independent tasks: (1) understand why unmanaged existing objects do not appear automatically; (2) identify which remote object Terraform currently manages for a resource block; (3) avoid mixing independent deployments unintentionally. Which three options directly correspond to the respective tasks? Choose THREE.

  1. Use state for dependency information
  2. Understand one state per workspace boundary
  3. Recognize state does not equal a cloud inventory
  4. Treat state as the resource-address-to-object mapping
  5. Avoid manual state-file editing
  6. Understand refresh during planning

Explanation

Correct Answers

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 understand why unmanaged existing objects do not appear automatically and identify which remote object Terraform currently manages for a resource block and avoid mixing independent deployments unintentionally. This matches the distinct objective to avoid mixing independent deployments unintentionally; the remaining chosen features address understand why unmanaged existing objects do not appear automatically and identify which remote object Terraform currently manages for a resource block.

C:

Terraform tracks objects that were created or imported into that workspace; it does not discover and adopt every service object merely because credentials permit seeing it; this behavior should be assessed against the concrete need to understand why unmanaged existing objects do not appear automatically and identify which remote object Terraform currently manages for a resource block and avoid mixing independent deployments unintentionally. This matches the distinct objective to understand why unmanaged existing objects do not appear automatically; the remaining chosen features address identify which remote object Terraform currently manages for a resource block and avoid mixing independent deployments unintentionally.

D:

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 understand why unmanaged existing objects do not appear automatically and identify which remote object Terraform currently manages for a resource block and avoid mixing independent deployments unintentionally. This matches the distinct objective to identify which remote object Terraform currently manages for a resource block; the remaining chosen features address understand why unmanaged existing objects do not appear automatically and avoid mixing independent deployments unintentionally.

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 understand why unmanaged existing objects do not appear automatically and identify which remote object Terraform currently manages for a resource block and avoid mixing independent deployments unintentionally. Its main application is to retain references needed to reconcile previously created resources; the checklist instead asks for understand why unmanaged existing objects do not appear automatically; and identify which remote object Terraform currently manages for a resource block; and avoid mixing independent deployments unintentionally. None of those distinct criteria specifically calls for this alternative.

E:

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 understand why unmanaged existing objects do not appear automatically and identify which remote object Terraform currently manages for a resource block and avoid mixing independent deployments unintentionally. Its main application is to preserve internal consistency of resource instance mappings; the checklist instead asks for understand why unmanaged existing objects do not appear automatically; and identify which remote object Terraform currently manages for a resource block; and avoid mixing independent deployments unintentionally. None of those distinct criteria specifically calls for this alternative.

F:

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 understand why unmanaged existing objects do not appear automatically and identify which remote object Terraform currently manages for a resource block and avoid mixing independent deployments unintentionally. Its main application is to compare tracked objects against current provider-reported attributes; the checklist instead asks for understand why unmanaged existing objects do not appear automatically; and identify which remote object Terraform currently manages for a resource block; and avoid mixing independent deployments unintentionally. None of those distinct criteria specifically calls for this alternative.

Question 135

A developer is troubleshooting plugin selection after a version change. A reviewer must determine how to recognize why two modules can prevent provider resolution. Which action is the appropriate choice?

  1. Inspect selected providers with terraform providers
  2. Diagnose an incompatible version constraint intersection
  3. Commit .terraform.lock.hcl for reproducibility
  4. Run terraform init -upgrade deliberately

Explanation

Correct Answer

B:

Terraform must choose a provider version satisfying all relevant module requirements; contradictory ranges cause initialization failure rather than silent dual-version installation of the same source; this behavior should be assessed against the concrete need to recognize why two modules can prevent provider resolution. This directly supports the task to recognize why two modules can prevent provider resolution during a cross-team handoff.

Incorrect Answers

A:

The command reports the provider dependency tree and can aid source/version troubleshooting; it does not rewrite constraints or upgrade plugin packages; this behavior should be assessed against the concrete need to recognize why two modules can prevent provider resolution. The stated requirement is to recognize why two modules can prevent provider resolution, not to see the provider requirements for the root and child modules; this alternative addresses a different control or phase.

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 recognize why two modules can prevent provider resolution. The distinction matters here: using that mechanism to record selected provider releases and package checksums across machines would still leave the objective to recognize why two modules can prevent provider resolution 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 recognize why two modules can prevent provider resolution. It may support a related workflow, but the question specifically requires the mechanism for recognize why two modules can prevent provider resolution rather than reselect newer eligible provider releases within declared constraints.

Question 136

A reviewer has to approve a two-part design: separate which plugin to install from how it authenticates and connects; additionally, see the provider requirements for the root and child modules. Which option pairs the correct mechanisms?

  1. Understand checksums in the lock file + Inspect selected providers with terraform providers
  2. Run terraform init to install plugins + Diagnose an incompatible version constraint intersection
  3. Distinguish provider requirements from provider configurations + Commit .terraform.lock.hcl for reproducibility
  4. Distinguish provider requirements from provider configurations + Inspect selected providers with terraform providers
  5. Distinguish provider requirements from provider configurations + Use terraform init -lockfile=readonly in CI
  6. Constrain required_version for Terraform Core + Inspect selected providers with terraform providers

Explanation

Correct Answer

D:

For the first criterion, 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 separate which plugin to install from how it authenticates and connects and see the provider requirements for the root and child modules; this directly addresses the need to separate which plugin to install from how it authenticates and connects. For the separate second criterion, the command reports the provider dependency tree and can aid source/version troubleshooting; it does not rewrite constraints or upgrade plugin packages; this behavior should be assessed against the concrete need to separate which plugin to install from how it authenticates and connects and see the provider requirements for the root and child modules; this fulfills the need to see the provider requirements for the root and child modules. Together they cover the independent tasks of separate which plugin to install from how it authenticates and connects and see the provider requirements for the root and child modules without exchanging the responsibilities of these features.

Incorrect Answers

A:

The second measure does meet the see the provider requirements for the root and child modules requirement, but the first is designed for another concern: 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 separate which plugin to install from how it authenticates and connects and see the provider requirements for the root and child modules. That first component is designed to verify installed provider packages against trusted recorded hashes, which does not accomplish the requested task to separate which plugin to install from how it authenticates and connects, even though the other measure satisfies see the provider requirements for the root and child modules.

B:

The first measure is intended to download and initialize missing required providers: 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 separate which plugin to install from how it authenticates and connects and see the provider requirements for the root and child modules. The second measure is intended to recognize why two modules can prevent provider resolution: Terraform must choose a provider version satisfying all relevant module requirements; contradictory ranges cause initialization failure rather than silent dual-version installation of the same source; this behavior should be assessed against the concrete need to separate which plugin to install from how it authenticates and connects and see the provider requirements for the root and child modules. Neither is the directly designated method for the separate goals of separate which plugin to install from how it authenticates and connects and see the provider requirements for the root and child modules in this review.

C:

The first measure meets the requirement to separate which plugin to install from how it authenticates and connects, but its partner serves a different role: 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 separate which plugin to install from how it authenticates and connects and see the provider requirements for the root and child modules. That second component is designed to record selected provider releases and package checksums across machines, so the still-missing criterion is to see the provider requirements for the root and child modules, while the first criterion remains separate which plugin to install from how it authenticates and connects.

E:

The first measure meets the requirement to separate which plugin to install from how it authenticates and connects, but its partner serves a different role: Read-only mode checks the selections already committed and fails if changes are needed; it is useful for strict repeatable pipelines, not for upgrading providers; this behavior should be assessed against the concrete need to separate which plugin to install from how it authenticates and connects and see the provider requirements for the root and child modules. That second component is designed to prevent dependency initialization from changing the committed lock file, so the still-missing criterion is to see the provider requirements for the root and child modules, while the first criterion remains separate which plugin to install from how it authenticates and connects.

F:

The second measure does meet the see the provider requirements for the root and child modules requirement, but the first is designed for another concern: 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 separate which plugin to install from how it authenticates and connects and see the provider requirements for the root and child modules. That first component is designed to specify which Terraform CLI versions may interpret this configuration, which does not accomplish the requested task to separate which plugin to install from how it authenticates and connects, even though the other measure satisfies see the provider requirements for the root and child modules.

Question 137

In a planned migration, the requested result is to specify which Terraform CLI versions may interpret this configuration. What should the engineer select?

  1. Constrain required_version for Terraform Core
  2. Declare provider source under required_providers
  3. Use terraform init -lockfile=readonly in CI
  4. Run terraform init to install plugins
  5. Use TF_PLUGIN_CACHE_DIR for shared package caching

Explanation

Correct Answer

A:

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 specify which Terraform CLI versions may interpret this configuration. This directly supports the task to specify which Terraform CLI versions may interpret this configuration 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 specify which Terraform CLI versions may interpret this configuration. It may support a related workflow, but the question specifically requires the mechanism for specify which Terraform CLI versions may interpret this configuration rather than identify the registry namespace and provider type to install.

C:

Read-only mode checks the selections already committed and fails if changes are needed; it is useful for strict repeatable pipelines, not for upgrading providers; this behavior should be assessed against the concrete need to specify which Terraform CLI versions may interpret this configuration. The stated requirement is to specify which Terraform CLI versions may interpret this configuration, not to prevent dependency initialization from changing the committed lock file; this alternative addresses a different control or phase.

D:

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 specify which Terraform CLI versions may interpret this configuration. That can be useful when the aim is to download and initialize missing required providers, but it does not directly deliver the requested ability to specify which Terraform CLI versions may interpret this configuration.

E:

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 specify which Terraform CLI versions may interpret this configuration. The distinction matters here: using that mechanism to avoid repeatedly downloading the same provider binaries on a build host would still leave the objective to specify which Terraform CLI versions may interpret this configuration unmet.

Question 138

The immediate Terraform task is to inspect intended create, change, and delete actions before execution. Which method handles that task most directly?

  1. Write the desired configuration first
  2. Validate configuration before requesting a plan
  3. Preview changes with terraform plan
  4. Use version control alongside the workflow

Explanation

Correct Answer

C:

Planning compares desired configuration with current state and provider observations; no planned infrastructure actions are applied by the plan command; this behavior should be assessed against the concrete need to inspect intended create, change, and delete actions before execution. This directly supports the task to inspect intended create, change, and delete actions before execution during a platform review.

Incorrect Answers

A:

Resource blocks, variables, and modules define the target arrangement; running the CLI without an intended configuration cannot infer a team's architecture goals; this behavior should be assessed against the concrete need to inspect intended create, change, and delete actions before execution. That can be useful when the aim is to establish the intended infrastructure before Terraform evaluates changes, but it does not directly deliver the requested ability to inspect intended create, change, and delete actions before execution.

B:

Validation checks the HCL configuration against available schemas; it is useful in CI but cannot replace a plan based on actual state and provider data; this behavior should be assessed against the concrete need to inspect intended create, change, and delete actions before execution. The distinction matters here: using that mechanism to identify structural issues early in a workflow would still leave the objective to inspect intended create, change, and delete actions before execution unmet.

D:

Git captures code changes and supports peer review; Terraform state and provider API results remain separate operational concerns; this behavior should be assessed against the concrete need to inspect intended create, change, and delete actions before execution. The stated requirement is to inspect intended create, change, and delete actions before execution, not to make infrastructure edits traceable and reviewable; this alternative addresses a different control or phase.

Question 139

In a planned migration, the requested result is to skip backend initialization for a specific preparation task. What should the engineer select?

  1. Use terraform init -backend=false cautiously
  2. Use terraform init -backend-config=FILE
  3. Inspect .terraform/ as generated local metadata
  4. Reinitialize after changing provider requirements

Explanation

Correct Answer

A:

Disabling backend setup avoids configuring remote state, but some later operations require an initialized backend; it does not create a temporary safe state automatically; this behavior should be assessed against the concrete need to skip backend initialization for a specific preparation task. This directly supports the task to skip backend initialization for a specific preparation task during a deployment checklist.

Incorrect Answers

B:

Partial backend configuration can be completed from a separate file; values supplied this way may still be recorded in local Terraform metadata or saved plans; this behavior should be assessed against the concrete need to skip backend initialization for a specific preparation task. That can be useful when the aim is to supply missing backend settings during initialization, but it does not directly deliver the requested ability to skip backend initialization for a specific preparation task.

C:

The directory can hold installed modules, provider metadata, and backend configuration; it should normally be excluded from Git and may contain sensitive settings; this behavior should be assessed against the concrete need to skip backend initialization for a specific preparation task. The distinction matters here: using that mechanism to recognize initialization artifacts rather than versioned source would still leave the objective to skip backend initialization for a specific preparation task unmet.

D:

Init reconciles the plugin installation and lock selections after changes in required_providers; running only fmt cannot install a newly required plugin; this behavior should be assessed against the concrete need to skip backend initialization for a specific preparation task. It may support a related workflow, but the question specifically requires the mechanism for skip backend initialization for a specific preparation task rather than pick up new dependencies and version constraints.

Question 140

An engineer needs to enforce environment-specific prerequisites that static validation cannot prove as part of a planned migration. Which option is the best fit?

  1. Check expression references for validity
  2. Use preconditions for runtime assumptions
  3. Use variable validation for input contracts
  4. Interpret a clean validate as limited assurance

Explanation

Correct Answer

B:

A lifecycle precondition can validate context-dependent values before acting on a resource; a general syntax check alone cannot confirm runtime facts; this behavior should be assessed against the concrete need to enforce environment-specific prerequisites that static validation cannot prove. This directly supports the task to enforce environment-specific prerequisites that static validation cannot prove during a maintenance request.

Incorrect Answers

A:

Terraform validates the structure of expressions against known configuration objects; values only resolved by providers may remain unknown until later phases; this behavior should be assessed against the concrete need to enforce environment-specific prerequisites that static validation cannot prove. It may support a related workflow, but the question specifically requires the mechanism for enforce environment-specific prerequisites that static validation cannot prove rather than catch references to undeclared blocks and invalid attributes where detectable.

C:

The validation rule belongs to the variable declaration and returns a Boolean; it is distinct from the CLI's whole-configuration validation subcommand; this behavior should be assessed against the concrete need to enforce environment-specific prerequisites that static validation cannot prove. That can be useful when the aim is to reject invalid user-supplied values with a targeted message, but it does not directly deliver the requested ability to enforce environment-specific prerequisites that static validation cannot prove.

D:

Provider API authorization, remote conflicts, and real infrastructure drift can still produce failures; validation checks supported configuration structure rather than deployment success; this behavior should be assessed against the concrete need to enforce environment-specific prerequisites that static validation cannot prove. The distinction matters here: using that mechanism to avoid inferring a successful future apply from successful static checks would still leave the objective to enforce environment-specific prerequisites that static validation cannot prove unmet.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests