HashiCorp Terraform Associate 004 Practice Test 12
Question 110
When maintaining Terraform modules used by several application teams, the following condition occurs: A network module is upgraded and renames a child output, but dependent modules still read the old output and planning fails. The module interface must remain stable and reviewable. What acceptance evidence best establishes that the Terraform issue has been resolved?
- Terraform fetches the intended module revision without mixing registry-only and Git source selection semantics.
- Normal CI initialization selects the reviewed compatible module version and unsupported major releases are not adopted silently.
- The child module files are located consistently by local and CI runs without copying the same definitions into the root.
- The root plan resolves the new module output names with no dangling references or unintended replacements.
Explanation
Correct Answer
D:The root plan resolves the new module output names with no dangling references or unintended replacements. Module version changes can alter interfaces; compatibility is assessed across callers, not by module installation success alone. It tests the correction: Update the module version together with dependent output references and validate the full root configuration before applying.
Incorrect Answers
A:Terraform fetches the intended module revision without mixing registry-only and Git source selection semantics. This might validate registry module source naming contract, but it does not prove that module upgrade plan review with changed outputs was resolved. Confirm instead: The root plan resolves the new module output names with no dangling references or unintended replacements.
B:Normal CI initialization selects the reviewed compatible module version and unsupported major releases are not adopted silently. This might validate registry module version pin to avoid breaking releases, but it does not prove that module upgrade plan review with changed outputs was resolved. Confirm instead: The root plan resolves the new module output names with no dangling references or unintended replacements.
C:The child module files are located consistently by local and CI runs without copying the same definitions into the root. This might validate local child module source path resolution, but it does not prove that module upgrade plan review with changed outputs was resolved. Confirm instead: The root plan resolves the new module output names with no dangling references or unintended replacements.
Question 111
When reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: An operator adds a Terraform check asserting that an HTTP service is healthy and expects a failed check to halt the same apply as a mandatory precondition. The engineer must respect declared resource contracts and data security boundaries. What should the engineer inspect FIRST to distinguish this issue from unrelated failures?
- Inspect the input values and expressions used to construct resource names and tags.
- Inspect whether the zone should be managed or merely read, and compare the resource block with the provider's data source schema.
- Inspect variable input expectations and whether an explicit validation condition can reject invalid strings early.
- Inspect the chosen custom condition mechanism and whether its failure is advisory or blocking for the intended Terraform version.
Explanation
Correct Answer
D:Inspect the chosen custom condition mechanism and whether its failure is advisory or blocking for the intended Terraform version. Check blocks generally issue warnings rather than blocking applies; lifecycle conditions enforce resource pre/post invariants. A justified correction is: Use a resource precondition or postcondition for a hard lifecycle invariant and reserve check blocks for non-blocking validation reports. This matters here because when reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: An operator….
Incorrect Answers
A:Inspect the input values and expressions used to construct resource names and tags. This inspects built-in functions for deterministic naming rather than the reported check block observability versus hard failure issue. The decisive investigation is: Inspect the chosen custom condition mechanism and whether its failure is advisory or blocking for the intended Terraform version.
B:Inspect whether the zone should be managed or merely read, and compare the resource block with the provider's data source schema. This inspects data source versus managed resource definition rather than the reported check block observability versus hard failure issue. The decisive investigation is: Inspect the chosen custom condition mechanism and whether its failure is advisory or blocking for the intended Terraform version.
C:Inspect variable input expectations and whether an explicit validation condition can reject invalid strings early. This inspects input variable custom validation rule rather than the reported check block observability versus hard failure issue. The decisive investigation is: Inspect the chosen custom condition mechanism and whether its failure is advisory or blocking for the intended Terraform version. This matters here because when reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: An operator….
Question 112
When maintaining Terraform modules used by several application teams, the following condition occurs: A web module hardcodes the subnet ID produced by a separate network module and fails when an environment provisions a different subnet. The module interface must remain stable and reviewable. What targeted engineering response should the team implement?
- Use the supported Git module source form with the correct double-slash subdirectory and pinned revision ref.
- Use for_each on the module block with a stable keyed collection and pass each.key or each.value to the child input contract.
- Pass module.network.subnet_id as an input into the web module rather than duplicating resource creation or guessed values.
- Declare an input variable in the child module and pass the parent's value explicitly as a module argument.
Explanation
Correct Answer
C:Pass module.network.subnet_id as an input into the web module rather than duplicating resource creation or guessed values. Composed modules communicate through explicit outputs and inputs, permitting dependency-aware infrastructure assembly. Confirm the cause with: Inspect the parent composition and whether the network child provides an output representing the created subnet. A concrete acceptance test is: Web resources use the subnet created in the same reviewed configuration and maintain a graph dependency on it.
Incorrect Answers
A:Use the supported Git module source form with the correct double-slash subdirectory and pinned revision ref. This could address git module source with explicit subdirectory, but it does not correct the indicated module outputs coordinate dependencies instead of duplicate data mechanism. The relevant fix is: Pass module.network.subnet_id as an input into the web module rather than duplicating resource creation or guessed values.
B:Use for_each on the module block with a stable keyed collection and pass each.key or each.value to the child input contract. This could address for_each at module call for multiple environments, but it does not correct the indicated module outputs coordinate dependencies instead of duplicate data mechanism. The relevant fix is: Pass module.network.subnet_id as an input into the web module rather than duplicating resource creation or guessed values.
D:Declare an input variable in the child module and pass the parent's value explicitly as a module argument. This could address root and child variable scope isolation, but it does not correct the indicated module outputs coordinate dependencies instead of duplicate data mechanism. The relevant fix is: Pass module.network.subnet_id as an input into the web module rather than duplicating resource creation or guessed values.
Question 113
During a cross-platform infrastructure standardization exercise, the following condition occurs: A team needs to coordinate a local virtualization cluster with hosted cloud DNS and attempts to reuse a cloud API token for both providers. The decision must preserve ownership and minimize undocumented changes. Which investigation would most directly establish the reported Terraform failure?
- Compare provider-specific resource schemas, instance properties, network dependencies, and modules' input interfaces.
- Inspect whether infrastructure choices and dependencies exist as tracked Terraform files or only as undocumented console modifications.
- Inspect infrastructure change logs, commit reviews, and whether the active resources map to revision-controlled Terraform configuration.
- Inspect provider source requirements, authentication scopes, and whether the on-premises and hosted platforms expose different APIs.
Explanation
Correct Answer
D:Inspect provider source requirements, authentication scopes, and whether the on-premises and hosted platforms expose different APIs. Hybrid Terraform management uses different provider plugins and credentials; one universal cloud credential is neither expected nor safe. A justified correction is: Configure separate authorized providers and identities for the hybrid environments while retaining a shared desired-state workflow.
Incorrect Answers
A:Compare provider-specific resource schemas, instance properties, network dependencies, and modules' input interfaces. This inspects provider-neutral infrastructure pattern without identical resource types rather than the reported hybrid cloud workflow with distinct provider credentials issue. The decisive investigation is: Inspect provider source requirements, authentication scopes, and whether the on-premises and hosted platforms expose different APIs.
B:Inspect whether infrastructure choices and dependencies exist as tracked Terraform files or only as undocumented console modifications. This inspects terraform configuration as reviewable infrastructure specification rather than the reported hybrid cloud workflow with distinct provider credentials issue. The decisive investigation is: Inspect provider source requirements, authentication scopes, and whether the on-premises and hosted platforms expose different APIs.
C:Inspect infrastructure change logs, commit reviews, and whether the active resources map to revision-controlled Terraform configuration. This inspects version-controlled iac change auditing rather than the reported hybrid cloud workflow with distinct provider credentials issue. The decisive investigation is: Inspect provider source requirements, authentication scopes, and whether the on-premises and hosted platforms expose different APIs.
Question 114
In a clean CI runner initializing a Terraform root configuration, the following condition occurs: An inherited Terraform configuration references a provider without declaring its registry source, so a team cannot reliably establish which plugin will manage resources. The engineers must keep provider choices and identities reproducible. What targeted engineering response should the team implement?
- Use a justified upper-bound or compatible-release constraint such as ~> 5.0 and test upgrades before committing them.
- Declare the provider's correct registry source and compatible version constraint in required_providers, then initialize again.
- Recover the correct protected state snapshot or deliberately import existing objects before applying destructive duplicate provisioning.
- Install and configure the appropriate provider through terraform init so Terraform can use its resource and data source implementations.
Explanation
Correct Answer
B:Declare the provider's correct registry source and compatible version constraint in required_providers, then initialize again. The required_providers mapping identifies the plugin source and compatibility constraint, separate from provider authentication settings. Confirm the cause with: Review required_providers declarations, provider source addresses, existing lock entries, and initialization output. A concrete acceptance test is: Terraform resolves the intended plugin source consistently instead of relying on historical default namespace guesses.
Incorrect Answers
A:Use a justified upper-bound or compatible-release constraint such as ~> 5.0 and test upgrades before committing them. This could address provider version range semantics, but it does not correct the indicated provider source requirement declaration mechanism. The relevant fix is: Declare the provider's correct registry source and compatible version constraint in required_providers, then initialize again.
C:Recover the correct protected state snapshot or deliberately import existing objects before applying destructive duplicate provisioning. This could address state binding between resource address and remote object, but it does not correct the indicated provider source requirement declaration mechanism. The relevant fix is: Declare the provider's correct registry source and compatible version constraint in required_providers, then initialize again.
D:Install and configure the appropriate provider through terraform init so Terraform can use its resource and data source implementations. This could address provider plugin manages api resources and data reads, but it does not correct the indicated provider source requirement declaration mechanism. The relevant fix is: Declare the provider's correct registry source and compatible version constraint in required_providers, then initialize again.
Question 115
When reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: A reusable subnet module expects each entry to contain a CIDR and an enable flag, but callers submit unstructured strings and fail validation. The engineer must respect declared resource contracts and data security boundaries. Which outcome most directly validates the intended fix?
- Invalid caller objects fail early, while well-typed nested values reach their intended configuration expressions.
- The plan selects the correct per-environment instance size without relying on arbitrary key ordering.
- Terraform reads the existing DNS zone information and plans no duplicate zone creation from the lookup alone.
- The provider receives the approved new secret without persisting its plaintext in Terraform's plan or state snapshots.
Explanation
Correct Answer
A:Invalid caller objects fail early, while well-typed nested values reach their intended configuration expressions. Structured object types validate named attribute contracts; a plain string cannot substitute for an object with multiple typed fields. It tests the correction: Declare a suitable object type such as object({ cidr = string, enabled = bool }) and supply matching attribute values. This matters here because when reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: A reusable….
Incorrect Answers
B:The plan selects the correct per-environment instance size without relying on arbitrary key ordering. This might validate map versus list addressing for environment inputs, but it does not prove that object type contract with nested attributes was resolved. Confirm instead: Invalid caller objects fail early, while well-typed nested values reach their intended configuration expressions. This matters here because when reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: A reusable….
C:Terraform reads the existing DNS zone information and plans no duplicate zone creation from the lookup alone. This might validate data source versus managed resource definition, but it does not prove that object type contract with nested attributes was resolved. Confirm instead: Invalid caller objects fail early, while well-typed nested values reach their intended configuration expressions.
D:The provider receives the approved new secret without persisting its plaintext in Terraform's plan or state snapshots. This might validate write-only provider argument for managed secret rotation, but it does not prove that object type contract with nested attributes was resolved. Confirm instead: Invalid caller objects fail early, while well-typed nested values reach their intended configuration expressions.
Question 116
In a clean CI runner initializing a Terraform root configuration, the following condition occurs: An engineer embeds cloud credentials inside required_providers and expects Terraform to authenticate because the source and version were specified there. The engineers must keep provider choices and identities reproducible. Which diagnostic check provides the strongest evidence for the underlying problem?
- Inspect the resource type prefixes and required_providers source mappings before running terraform init.
- Compare state resource addresses to actual remote objects and the active backend's selected state snapshot.
- Review the child module provider requirements and root module providers mapping for the child call.
- Review provider requirement declarations, provider configuration blocks, and the platform's supported authentication mechanisms.
Explanation
Correct Answer
D:Review provider requirement declarations, provider configuration blocks, and the platform's supported authentication mechanisms. Plugin installation requirements and runtime provider configuration are different parts of Terraform's execution model. A justified correction is: Keep provider source and version in required_providers and configure authentication via supported provider settings or short-lived environment credentials.
Incorrect Answers
A:Inspect the resource type prefixes and required_providers source mappings before running terraform init. This inspects provider plugin manages api resources and data reads rather than the reported provider block credentials versus required_providers issue. The decisive investigation is: Review provider requirement declarations, provider configuration blocks, and the platform's supported authentication mechanisms.
B:Compare state resource addresses to actual remote objects and the active backend's selected state snapshot. This inspects state binding between resource address and remote object rather than the reported provider block credentials versus required_providers issue. The decisive investigation is: Review provider requirement declarations, provider configuration blocks, and the platform's supported authentication mechanisms.
C:Review the child module provider requirements and root module providers mapping for the child call. This inspects module provider mapping for aliased configurations rather than the reported provider block credentials versus required_providers issue. The decisive investigation is: Review provider requirement declarations, provider configuration blocks, and the platform's supported authentication mechanisms.
Question 117
As the deployment team prepares a reviewed Terraform CLI change, the following condition occurs: A CI job rejects valid HCL files because their alignment differs from canonical formatting, while engineers mistakenly change provider versions to fix it. The change must preserve the distinction between previewing and modifying infrastructure. Which diagnostic check provides the strongest evidence for the underlying problem?
- Differentiate static schema/reference checks in validation from provider API checks and actual permissions during plan and apply.
- Inspect the terraform fmt -check -diff output and separate style failures from terraform validate diagnostics.
- Inspect whether the approved artifact was produced by terraform plan -out and whether apply consumes exactly that plan artifact.
- Inspect the current HCL formatting and whether a standard terraform fmt check flags style-only differences.
Explanation
Correct Answer
B:Inspect the terraform fmt -check -diff output and separate style failures from terraform validate diagnostics. A formatting check tests canonical HCL presentation, whereas provider version resolution and configuration validity are separate concerns. A justified correction is: Reformat the affected.tf files using terraform fmt and rerun both style checking and validation independently.
Incorrect Answers
A:Differentiate static schema/reference checks in validation from provider API checks and actual permissions during plan and apply. This inspects terraform validate versus cloud permission testing rather than the reported ci terraform fmt check distinguishes style from validity issue. The decisive investigation is: Inspect the terraform fmt -check -diff output and separate style failures from terraform validate diagnostics.
C:Inspect whether the approved artifact was produced by terraform plan -out and whether apply consumes exactly that plan artifact. This inspects saved execution plan for controlled deployment rather than the reported ci terraform fmt check distinguishes style from validity issue. The decisive investigation is: Inspect the terraform fmt -check -diff output and separate style failures from terraform validate diagnostics.
D:Inspect the current HCL formatting and whether a standard terraform fmt check flags style-only differences. This inspects terraform fmt normalizes hcl style rather than the reported ci terraform fmt check distinguishes style from validity issue. The decisive investigation is: Inspect the terraform fmt -check -diff output and separate style failures from terraform validate diagnostics.
Question 118
As the deployment team prepares a reviewed Terraform CLI change, the following condition occurs: A team wants Terraform to stop managing a legacy storage bucket but must retain the real bucket and its contents for a migration. The change must preserve the distinction between previewing and modifying infrastructure. Which investigation would most directly establish the reported Terraform failure?
- Inspect the bucket's resource address and distinguish removing state ownership from destroying remote infrastructure.
- Inspect the current HCL formatting and whether a standard terraform fmt check flags style-only differences.
- Inspect all resource addresses present in the selected workspace state and the destroy plan's complete deletion scope.
- Inspect the old backend metadata, new backend block, and whether a state migration has been explicitly reviewed.
Explanation
Correct Answer
A:Inspect the bucket's resource address and distinguish removing state ownership from destroying remote infrastructure. Destroying a resource and removing a state binding are different operations with different effects on physical infrastructure. A justified correction is: Use an appropriate removed block with destroy = false or a controlled state rm workflow while preserving the remote object.
Incorrect Answers
B:Inspect the current HCL formatting and whether a standard terraform fmt check flags style-only differences. This inspects terraform fmt normalizes hcl style rather than the reported selective cleanup without destroying retained object issue. The decisive investigation is: Inspect the bucket's resource address and distinguish removing state ownership from destroying remote infrastructure.
C:Inspect all resource addresses present in the selected workspace state and the destroy plan's complete deletion scope. This inspects terraform destroy is managed-scope deletion rather than the reported selective cleanup without destroying retained object issue. The decisive investigation is: Inspect the bucket's resource address and distinguish removing state ownership from destroying remote infrastructure.
D:Inspect the old backend metadata, new backend block, and whether a state migration has been explicitly reviewed. This inspects reinitializing after backend configuration change rather than the reported selective cleanup without destroying retained object issue. The decisive investigation is: Inspect the bucket's resource address and distinguish removing state ownership from destroying remote infrastructure.
Question 119
As a second engineer rehearses an infrastructure state migration, the following condition occurs: A root Terraform configuration configures both cloud integration and a separate backend block, leading to a configuration error or ambiguous remote operation target. The operation must not delete or duplicate existing production objects. What acceptance evidence best establishes that the Terraform issue has been resolved?
- Initialization connects to the intended workspace without conflicting backend configurations or unintended state copies.
- A plan in staging reads staging bindings while a default workspace plan remains independent.
- Remote state access succeeds without exposing persistent access keys in the repository, saved plan, or shared logs.
- A stale lock is removed without interrupting an active state-writing operation or corrupting run coordination.
Explanation
Correct Answer
A:Initialization connects to the intended workspace without conflicting backend configurations or unintended state copies. HCP Terraform's cloud integration and a separate backend declaration are alternative root state configuration modes. It tests the correction: Use one supported state integration for the root; choose the cloud block when adopting HCP Terraform's integrated workflow.
Incorrect Answers
B:A plan in staging reads staging bindings while a default workspace plan remains independent. This might validate local workspace state separation, but it does not prove that hcp cloud integration versus remote backend was resolved. Confirm instead: Initialization connects to the intended workspace without conflicting backend configurations or unintended state copies.
C:Remote state access succeeds without exposing persistent access keys in the repository, saved plan, or shared logs. This might validate backend credentials kept out of plan artifacts, but it does not prove that hcp cloud integration versus remote backend was resolved. Confirm instead: Initialization connects to the intended workspace without conflicting backend configurations or unintended state copies.
D:A stale lock is removed without interrupting an active state-writing operation or corrupting run coordination. This might validate force unlock requires stale-lock verification, but it does not prove that hcp cloud integration versus remote backend was resolved. Confirm instead: Initialization connects to the intended workspace without conflicting backend configurations or unintended state copies.
Question 120
During an isolated staging rehearsal of the Terraform workflow, the following condition occurs: A Terraform configuration refers to var.enviroment with a typo although only variable environment was declared, and teammates hope formatting will catch it. The operator must obtain auditable evidence before touching production resources. Which Terraform configuration or workflow change most directly corrects the described issue?
- Decide whether to restore declared configuration or intentionally adopt the outside value, then plan under the chosen ownership policy.
- Run terraform init with an appropriate migration or reconfiguration option after ensuring correct target state and backups.
- Use terraform validate to identify the invalid reference, correct the spelling, and rerun validation before planning.
- Use terraform validate to catch configuration errors and separately run plan or controlled provider checks to assess remote feasibility.
Explanation
Correct Answer
C:Use terraform validate to identify the invalid reference, correct the spelling, and rerun validation before planning. Formatting changes whitespace and indentation; static validation identifies invalid references and configuration structure. Confirm the cause with: Inspect Terraform diagnostic output for undeclared input references and compare declared variable names to expressions. A concrete acceptance test is: Validation passes with the declared variable name and no longer reports the nonexistent symbol reference. This matters here because a Terraform configuration refers to var.enviroment with a typo although only variable environment was declared, and….
Incorrect Answers
A:Decide whether to restore declared configuration or intentionally adopt the outside value, then plan under the chosen ownership policy. This could address plan versus real infrastructure drift, but it does not correct the indicated terraform validate catches undeclared reference mechanism. The relevant fix is: Use terraform validate to identify the invalid reference, correct the spelling, and rerun validation before planning. This matters here because a Terraform configuration refers to var.enviroment with a typo although only variable environment was declared, and….
B:Run terraform init with an appropriate migration or reconfiguration option after ensuring correct target state and backups. This could address reinitializing after backend configuration change, but it does not correct the indicated terraform validate catches undeclared reference mechanism. The relevant fix is: Use terraform validate to identify the invalid reference, correct the spelling, and rerun validation before planning.
D:Use terraform validate to catch configuration errors and separately run plan or controlled provider checks to assess remote feasibility. This could address terraform validate versus cloud permission testing, but it does not correct the indicated terraform validate catches undeclared reference mechanism. The relevant fix is: Use terraform validate to identify the invalid reference, correct the spelling, and rerun validation before planning. This matters here because a Terraform configuration refers to var.enviroment with a typo although only variable environment was declared, and….