HashiCorp Terraform Associate 004 Practice Test 67
Question 660
During a clean initialization of a newly composed infrastructure root module, 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 team must preserve reproducibility across callers. Which Terraform configuration or workflow change most directly corrects the described issue?
- Pass module.network.subnet_id as an input into the web module rather than duplicating resource creation or guessed values.
- Use the supported Git module source form with the correct double-slash subdirectory and pinned revision ref.
- Update the module version together with dependent output references and validate the full root configuration before applying.
- Pin the Git module source to a reviewed immutable commit or controlled tag and update it through an explicit change review.
Explanation
Correct Answer
C:Update the module version together with dependent output references and validate the full root configuration before applying. Module version changes can alter interfaces; compatibility is assessed across callers, not by module installation success alone. Confirm the cause with: Compare the upgraded module's documented input/output contract to root references before approving the module version change. A concrete acceptance test is: The root plan resolves the new module output names with no dangling references or unintended replacements. This matters here because during a clean initialization of a newly composed infrastructure root module, the following condition occurs: A….
Incorrect Answers
A:Pass module.network.subnet_id as an input into the web module rather than duplicating resource creation or guessed values. This could address module outputs coordinate dependencies instead of duplicate data, but it does not correct the indicated module upgrade plan review with changed outputs mechanism. The relevant fix is: Update the module version together with dependent output references and validate the full root configuration before applying.
B: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 upgrade plan review with changed outputs mechanism. The relevant fix is: Update the module version together with dependent output references and validate the full root configuration before applying.
D:Pin the Git module source to a reviewed immutable commit or controlled tag and update it through an explicit change review. This could address git module ref pin rather than floating main branch, but it does not correct the indicated module upgrade plan review with changed outputs mechanism. The relevant fix is: Update the module version together with dependent output references and validate the full root configuration before applying.
Question 661
While migrating a manually maintained development environment into reviewed Terraform configuration, the following condition occurs: Developers assume a Terraform virtual machine resource from cloud A can be copied unchanged into cloud B just because the configuration language is the same. The team must establish a reproducible and auditable infrastructure change. Which investigation would most directly establish the reported Terraform failure?
- Inspect whether infrastructure choices and dependencies exist as tracked Terraform files or only as undocumented console modifications.
- Compare the runbook's procedural steps with a version-controlled declarative inventory of desired resources and their attributes.
- Check whether each API integration has a Terraform provider and how dependencies pass resource attributes between configurations.
- Compare provider-specific resource schemas, instance properties, network dependencies, and modules' input interfaces.
Explanation
Correct Answer
D:Compare provider-specific resource schemas, instance properties, network dependencies, and modules' input interfaces. Terraform's common workflow does not make different cloud vendor APIs or resource type attributes interchangeable. A justified correction is: Create separate provider-aware modules behind a shared application interface rather than treating resource type names as portable across platforms. This matters here because while migrating a manually maintained development environment into reviewed Terraform configuration, the following….
Incorrect Answers
A: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 provider-neutral infrastructure pattern without identical resource types issue. The decisive investigation is: Compare provider-specific resource schemas, instance properties, network dependencies, and modules' input interfaces.
B:Compare the runbook's procedural steps with a version-controlled declarative inventory of desired resources and their attributes. This inspects declarative desired state versus imperative console runbook rather than the reported provider-neutral infrastructure pattern without identical resource types issue. The decisive investigation is: Compare provider-specific resource schemas, instance properties, network dependencies, and modules' input interfaces. This matters here because while migrating a manually maintained development environment into reviewed Terraform configuration, the following….
C:Check whether each API integration has a Terraform provider and how dependencies pass resource attributes between configurations. This inspects multi-cloud providers under one terraform workflow rather than the reported provider-neutral infrastructure pattern without identical resource types issue. The decisive investigation is: Compare provider-specific resource schemas, instance properties, network dependencies, and modules' input interfaces.
Question 662
During a clean initialization of a newly composed infrastructure root module, the following condition occurs: A Git-sourced security module pulls the latest default branch on every clean initialization, producing inconsistent firewall rules across deployment dates. The team must preserve reproducibility across callers. Which diagnostic check provides the strongest evidence for the underlying problem?
- Inspect the module Git source URL and whether it contains a commit, tag or versioned ref rather than an unpinned branch.
- Trace the token through module input/output declarations and identify any output that exposes secret data.
- Compare the upgraded module's documented input/output contract to root references before approving the module version change.
- Inspect which module arguments vary and whether stable application keys can drive repeated module instances.
Explanation
Correct Answer
A:Inspect the module Git source URL and whether it contains a commit, tag or versioned ref rather than an unpinned branch. VCS module source versions are controlled by source refs rather than by Terraform registry module version constraints. A justified correction is: Pin the Git module source to a reviewed immutable commit or controlled tag and update it through an explicit change review. This matters here because during a clean initialization of a newly composed infrastructure root module, the following condition occurs: A….
Incorrect Answers
B:Trace the token through module input/output declarations and identify any output that exposes secret data. This inspects sensitive input forwarding between nested modules rather than the reported git module ref pin rather than floating main branch issue. The decisive investigation is: Inspect the module Git source URL and whether it contains a commit, tag or versioned ref rather than an unpinned branch. This matters here because during a clean initialization of a newly composed infrastructure root module, the following condition occurs: A….
C:Compare the upgraded module's documented input/output contract to root references before approving the module version change. This inspects module upgrade plan review with changed outputs rather than the reported git module ref pin rather than floating main branch issue. The decisive investigation is: Inspect the module Git source URL and whether it contains a commit, tag or versioned ref rather than an unpinned branch. This matters here because during a clean initialization of a newly composed infrastructure root module, the following condition occurs: A….
D:Inspect which module arguments vary and whether stable application keys can drive repeated module instances. This inspects for_each at module call for multiple environments rather than the reported git module ref pin rather than floating main branch issue. The decisive investigation is: Inspect the module Git source URL and whether it contains a commit, tag or versioned ref rather than an unpinned branch.
Question 663
During a controlled module integration test for a production Terraform stack, 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 desired fix must avoid unrelated resource changes. Which diagnostic check provides the strongest evidence for the underlying problem?
- Inspect variable blocks for type/default arguments and the module call for an explicitly supplied input value.
- Inspect the variable type constraint and the HCL expression used to access its values.
- Inspect the module's input type constraint and the shape of the supplied nested values.
- Inspect the graph references and whether the data source must wait for a managed resource's creation.
Explanation
Correct Answer
C:Inspect the module's input type constraint and the shape of the supplied nested values. Structured object types validate named attribute contracts; a plain string cannot substitute for an object with multiple typed fields. A justified correction is: Declare a suitable object type such as object({ cidr = string, enabled = bool }) and supply matching attribute values. This matters here because during a controlled module integration test for a production Terraform stack, the following condition occurs: A….
Incorrect Answers
A:Inspect variable blocks for type/default arguments and the module call for an explicitly supplied input value. This inspects variable default versus required input rather than the reported object type contract with nested attributes issue. The decisive investigation is: Inspect the module's input type constraint and the shape of the supplied nested values.
B:Inspect the variable type constraint and the HCL expression used to access its values. This inspects map versus list addressing for environment inputs rather than the reported object type contract with nested attributes issue. The decisive investigation is: Inspect the module's input type constraint and the shape of the supplied nested values. This matters here because during a controlled module integration test for a production Terraform stack, the following condition occurs: A….
D:Inspect the graph references and whether the data source must wait for a managed resource's creation. This inspects data source read ordering versus creation rather than the reported object type contract with nested attributes issue. The decisive investigation is: Inspect the module's input type constraint and the shape of the supplied nested values.
Question 664
During a controlled module integration test for a production Terraform stack, the following condition occurs: A team wants additional backup retention only in production but duplicates the entire Terraform module for each environment and the copies diverge. The desired fix must avoid unrelated resource changes. Select TWO: the decisive first check and the change that directly addresses the problem.
- Inspect the shared attributes and whether one expression can derive a value from the environment input.
- Use suitable Terraform string functions such as lower, trimspace, and format to normalize the intended names consistently.
- Inspect the graph references and whether the data source must wait for a managed resource's creation.
- Use an appropriate conditional expression to set the backup retention while keeping common configuration in one reviewed module.
- Expose the required network identifier with an output in the child module and reference module.network.<output_name> from the root.
Explanation
Correct Answers
A:Inspect the shared attributes and whether one expression can derive a value from the environment input. Terraform expressions can choose values based on explicit conditions without duplicating full resource definitions. A justified correction is: Use an appropriate conditional expression to set the backup retention while keeping common configuration in one reviewed module. This forms one element of the required two-step diagnosis and correction. This matters here because during a controlled module integration test for a production Terraform stack, the following condition occurs: A team….
D:Use an appropriate conditional expression to set the backup retention while keeping common configuration in one reviewed module. Terraform expressions can choose values based on explicit conditions without duplicating full resource definitions. Confirm the cause with: Inspect the shared attributes and whether one expression can derive a value from the environment input. A concrete acceptance test is: Development and production plan different approved retention settings with otherwise shared definitions and no copied modules. This forms one element of the required two-step diagnosis and correction. This matters here because during a controlled module integration test for a production Terraform stack, the following condition occurs: A team….
Incorrect Answers
B:Use suitable Terraform string functions such as lower, trimspace, and format to normalize the intended names consistently. This relates to built-in functions for deterministic naming rather than the matching diagnosis-and-remediation pair required here. Check: Inspect the shared attributes and whether one expression can derive a value from the environment input. Then change: Use an appropriate conditional expression to set the backup retention while keeping common configuration in one reviewed module.
C:Inspect the graph references and whether the data source must wait for a managed resource's creation. This relates to data source read ordering versus creation rather than the matching diagnosis-and-remediation pair required here. Check: Inspect the shared attributes and whether one expression can derive a value from the environment input. Then change: Use an appropriate conditional expression to set the backup retention while keeping common configuration in one reviewed module.
E:Expose the required network identifier with an output in the child module and reference module.network.<output_name> from the root. This relates to module output references across composition rather than the matching diagnosis-and-remediation pair required here. Check: Inspect the shared attributes and whether one expression can derive a value from the environment input. Then change: Use an appropriate conditional expression to set the backup retention while keeping common configuration in one reviewed module.
Question 665
As the deployment team prepares a reviewed Terraform CLI change, the following condition occurs: A novice team runs terraform apply in a directory containing unreviewed edits and cannot explain the difference between proposed and actual resource changes. The change must preserve the distinction between previewing and modifying infrastructure. What acceptance evidence best establishes that the Terraform issue has been resolved?
- The apply finishes after explicit approval and writes the updated resource bindings to the configured backend.
- Validation passes with the declared variable name and no longer reports the nonexistent symbol reference.
- A planned change is inspected before approval, then the resulting infrastructure matches the reviewed configuration where supported.
- A reviewed apply changes only the intended managed attribute and the subsequent plan shows no unexpected pending action.
Explanation
Correct Answer
C:A planned change is inspected before approval, then the resulting infrastructure matches the reviewed configuration where supported. Terraform's normal lifecycle separates desired-state authoring and plan evaluation from the operation that changes managed infrastructure. It tests the correction: Use the write, init, plan, and apply sequence with a deliberate review checkpoint before changing the remote environment. This matters here because as the deployment team prepares a reviewed Terraform CLI change, the following condition occurs: A novice team runs….
Incorrect Answers
A:The apply finishes after explicit approval and writes the updated resource bindings to the configured backend. This might validate apply requires approval unless automated, but it does not prove that core write plan apply workflow order was resolved. Confirm instead: A planned change is inspected before approval, then the resulting infrastructure matches the reviewed configuration where supported.
B:Validation passes with the declared variable name and no longer reports the nonexistent symbol reference. This might validate terraform validate catches undeclared reference, but it does not prove that core write plan apply workflow order was resolved. Confirm instead: A planned change is inspected before approval, then the resulting infrastructure matches the reviewed configuration where supported.
D:A reviewed apply changes only the intended managed attribute and the subsequent plan shows no unexpected pending action. This might validate workflow repeatability after configuration change, but it does not prove that core write plan apply workflow order was resolved. Confirm instead: A planned change is inspected before approval, then the resulting infrastructure matches the reviewed configuration where supported. This matters here because as the deployment team prepares a reviewed Terraform CLI change, the following condition occurs: A novice team runs….
Question 666
During a governed HCP Terraform workspace rollout, the following condition occurs: A developer has valid cloud-provider credentials but terraform plan cannot access a private HCP Terraform workspace because the Terraform CLI is unauthenticated to the HCP organization. The organization must retain auditable authorization for runs and state. What should the engineer inspect FIRST to distinguish this issue from unrelated failures?
- Inspect current HCP project assignments, workspace ownership patterns, and project/team permission boundaries.
- Distinguish HCP Terraform API authentication from the separate credentials used by Terraform providers for cloud resources.
- Inspect the terraform cloud block, organization name, workspace selector, and current initialization integration.
- Inspect workspace workflow configuration, VCS repository association, branch selection and recent run triggers.
Explanation
Correct Answer
B:Distinguish HCP Terraform API authentication from the separate credentials used by Terraform providers for cloud resources. HCP workspace authentication and cloud provider authentication protect different services and cannot substitute for each other. A justified correction is: Authenticate to HCP Terraform using a supported CLI login or secure token workflow and retain least-privilege provider credentials independently. This matters here because a developer has valid cloud-provider credentials but terraform plan cannot access a private HCP Terraform workspace….
Incorrect Answers
A:Inspect current HCP project assignments, workspace ownership patterns, and project/team permission boundaries. This inspects hcp projects group workspaces by ownership rather than the reported hcp terraform cli login and execution credentials issue. The decisive investigation is: Distinguish HCP Terraform API authentication from the separate credentials used by Terraform providers for cloud resources.
C:Inspect the terraform cloud block, organization name, workspace selector, and current initialization integration. This inspects terraform cloud block hcp workspace integration rather than the reported hcp terraform cli login and execution credentials issue. The decisive investigation is: Distinguish HCP Terraform API authentication from the separate credentials used by Terraform providers for cloud resources. This matters here because a developer has valid cloud-provider credentials but terraform plan cannot access a private HCP Terraform workspace….
D:Inspect workspace workflow configuration, VCS repository association, branch selection and recent run triggers. This inspects vcs-driven hcp terraform run on approved changes rather than the reported hcp terraform cli login and execution credentials issue. The decisive investigation is: Distinguish HCP Terraform API authentication from the separate credentials used by Terraform providers for cloud resources. This matters here because a developer has valid cloud-provider credentials but terraform plan cannot access a private HCP Terraform workspace….
Question 667
During a cross-platform infrastructure standardization exercise, the following condition occurs: A team cannot explain who enlarged production compute capacity because engineers edit cloud resources without changes to an auditable repository. The decision must preserve ownership and minimize undocumented changes. Which TWO complementary choices identify the cause and implement the appropriate fix? Select TWO.
- Use reusable Terraform modules and explicit environment inputs to encode shared rules while allowing reviewed differences.
- Inspect whether infrastructure choices and dependencies exist as tracked Terraform files or only as undocumented console modifications.
- Use the relevant approved providers in Terraform and define cross-service references through managed configuration outputs or values.
- Inspect infrastructure change logs, commit reviews, and whether the active resources map to revision-controlled Terraform configuration.
- Require reviewed Terraform commits and corresponding plan evidence for production changes rather than console-only alterations.
Explanation
Correct Answers
D:Inspect infrastructure change logs, commit reviews, and whether the active resources map to revision-controlled Terraform configuration. IaC enables reproducible review and history when configuration is versioned and the apply workflow is controlled. A justified correction is: Require reviewed Terraform commits and corresponding plan evidence for production changes rather than console-only alterations. This forms one element of the required two-step diagnosis and correction. This matters here because a team cannot explain who enlarged production compute capacity because engineers edit cloud resources without….
E:Require reviewed Terraform commits and corresponding plan evidence for production changes rather than console-only alterations. IaC enables reproducible review and history when configuration is versioned and the apply workflow is controlled. Confirm the cause with: Inspect infrastructure change logs, commit reviews, and whether the active resources map to revision-controlled Terraform configuration. A concrete acceptance test is: An auditor can identify the approved commit and plan that caused a deliberate infrastructure capacity change. This forms one element of the required two-step diagnosis and correction. This matters here because a team cannot explain who enlarged production compute capacity because engineers edit cloud resources without….
Incorrect Answers
A:Use reusable Terraform modules and explicit environment inputs to encode shared rules while allowing reviewed differences. This relates to reusable environment definitions and reduced configuration drift rather than the matching diagnosis-and-remediation pair required here. Check: Inspect infrastructure change logs, commit reviews, and whether the active resources map to revision-controlled Terraform configuration. Then change: Require reviewed Terraform commits and corresponding plan evidence for production changes rather than console-only alterations.
B:Inspect whether infrastructure choices and dependencies exist as tracked Terraform files or only as undocumented console modifications. This relates to terraform configuration as reviewable infrastructure specification rather than the matching diagnosis-and-remediation pair required here. Check: Inspect infrastructure change logs, commit reviews, and whether the active resources map to revision-controlled Terraform configuration. Then change: Require reviewed Terraform commits and corresponding plan evidence for production changes rather than console-only alterations.
C:Use the relevant approved providers in Terraform and define cross-service references through managed configuration outputs or values. This relates to multi-cloud providers under one terraform workflow rather than the matching diagnosis-and-remediation pair required here. Check: Inspect infrastructure change logs, commit reviews, and whether the active resources map to revision-controlled Terraform configuration. Then change: Require reviewed Terraform commits and corresponding plan evidence for production changes rather than console-only alterations.
Question 668
When reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: A Terraform configuration changes a resource to for_each and a team still refers to the unkeyed address, causing an invalid reference or planned replacement. The engineer must respect declared resource contracts and data security boundaries. Which outcome most directly validates the intended fix?
- The replacement can come online and pass health checks before the former endpoint is destroyed when provider constraints permit.
- The plan resolves the intended instance and avoids accidental replacement caused solely by a configuration address rename.
- Removing one application plans its own deletion without shifting unrelated resource instances to new indexes.
- Terraform reads the existing DNS zone information and plans no duplicate zone creation from the lookup alone.
Explanation
Correct Answer
B:The plan resolves the intended instance and avoids accidental replacement caused solely by a configuration address rename. Repeated resources have instance addresses that include their keys or indexes, rather than a single unqualified instance address. It tests the correction: Reference the correct keyed resource instance or use a reviewed moved block to preserve its existing state identity during refactoring. This matters here because when reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: A Terraform….
Incorrect Answers
A:The replacement can come online and pass health checks before the former endpoint is destroyed when provider constraints permit. This might validate create_before_destroy lifecycle for availability, but it does not prove that resource addressing with repeated instances was resolved. Confirm instead: The plan resolves the intended instance and avoids accidental replacement caused solely by a configuration address rename.
C:Removing one application plans its own deletion without shifting unrelated resource instances to new indexes. This might validate for_each stable identity instead of count index, but it does not prove that resource addressing with repeated instances was resolved. Confirm instead: The plan resolves the intended instance and avoids accidental replacement caused solely by a configuration address rename.
D: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 resource addressing with repeated instances was resolved. Confirm instead: The plan resolves the intended instance and avoids accidental replacement caused solely by a configuration address rename. This matters here because when reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: A Terraform….
Question 669
In a clean CI runner initializing a Terraform root configuration, the following condition occurs: A root output refers to the ID of a resource just created, yet another workflow assumes the string is known before the apply finishes. The engineers must keep provider choices and identities reproducible. Which investigation would most directly establish the reported Terraform failure?
- Separate plugin resolution logs from runtime API authorization errors and inspect the provider's active identity and scoped permissions.
- Compare state resource addresses to actual remote objects and the active backend's selected state snapshot.
- Examine required_providers version constraints and the selected version recorded in the dependency lock file.
- Check which resource attributes are computed by the provider and how state records them after successful operations.
Explanation
Correct Answer
D:Check which resource attributes are computed by the provider and how state records them after successful operations. State stores known provider-returned attributes and supports dependency references; some values remain unknown until apply. A justified correction is: Use resource references and output values so computed identifiers resolve after creation rather than hardcoding an invented ID. This matters here because in a clean CI runner initializing a Terraform root configuration, the following condition occurs: A root output….
Incorrect Answers
A:Separate plugin resolution logs from runtime API authorization errors and inspect the provider's active identity and scoped permissions. This inspects provider authorization versus installation failure rather than the reported resource attribute outputs supplied by state issue. The decisive investigation is: Check which resource attributes are computed by the provider and how state records them after successful operations.
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 resource attribute outputs supplied by state issue. The decisive investigation is: Check which resource attributes are computed by the provider and how state records them after successful operations.
C:Examine required_providers version constraints and the selected version recorded in the dependency lock file. This inspects provider version range semantics rather than the reported resource attribute outputs supplied by state issue. The decisive investigation is: Check which resource attributes are computed by the provider and how state records them after successful operations.
Question 670
During a clean initialization of a newly composed infrastructure root module, the following condition occurs: An engineer references a public registry module using a Git URL but also supplies a registry version argument and expects Terraform to resolve it as a registry source. The team must preserve reproducibility across callers. Which proposed remediation solves this failure without masking its cause?
- Use for_each on the module block with a stable keyed collection and pass each.key or each.value to the child input contract.
- Use a valid registry module address when controlling versions with the module version argument, or pin an appropriate Git ref in a VCS source URL.
- Update the module version together with dependent output references and validate the full root configuration before applying.
- Use the supported Git module source form with the correct double-slash subdirectory and pinned revision ref.
Explanation
Correct Answer
B:Use a valid registry module address when controlling versions with the module version argument, or pin an appropriate Git ref in a VCS source URL. Registry sources support the version argument; a Git source generally selects its revision through its source query ref. Confirm the cause with: Inspect the module source syntax and whether the source is a registry address or a generic VCS URL. A concrete acceptance test is: Terraform fetches the intended module revision without mixing registry-only and Git source selection semantics. This matters here because during a clean initialization of a newly composed infrastructure root module, the following condition occurs: An….
Incorrect Answers
A: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 registry module source naming contract mechanism. The relevant fix is: Use a valid registry module address when controlling versions with the module version argument, or pin an appropriate Git ref in a VCS source URL.
C:Update the module version together with dependent output references and validate the full root configuration before applying. This could address module upgrade plan review with changed outputs, but it does not correct the indicated registry module source naming contract mechanism. The relevant fix is: Use a valid registry module address when controlling versions with the module version argument, or pin an appropriate Git ref in a VCS source URL.
D: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 registry module source naming contract mechanism. The relevant fix is: Use a valid registry module address when controlling versions with the module version argument, or pin an appropriate Git ref in a VCS source URL.