HashiCorp Terraform Associate 004 Practice Test 70
Question 690
During a clean initialization of a newly composed infrastructure root module, the following condition occurs: A root Terraform stack tries to consume a network ID that the child module computes but does not publish as an output. The team must preserve reproducibility across callers. Which diagnostic check provides the strongest evidence for the underlying problem?
- Check the module source address, allowed version range and current module selections from initialization.
- Inspect the child module's output blocks and root expressions that refer to module.network values.
- 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.
Explanation
Correct Answer
B:Inspect the child module's output blocks and root expressions that refer to module.network values. Output values are the supported way for a module to expose results to its parent; ordinary child locals are not exported. A justified correction is: Add the intended child output declaration and access it through module.network.<output_name> in the caller.
Incorrect Answers
A:Check the module source address, allowed version range and current module selections from initialization. This inspects registry module version pin to avoid breaking releases rather than the reported child output exposure to calling module issue. The decisive investigation is: Inspect the child module's output blocks and root expressions that refer to module.network values.
C:Inspect the module Git source URL and whether it contains a commit, tag or versioned ref rather than an unpinned branch. This inspects git module ref pin rather than floating main branch rather than the reported child output exposure to calling module issue. The decisive investigation is: Inspect the child module's output blocks and root expressions that refer to module.network values.
D: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 child output exposure to calling module issue. The decisive investigation is: Inspect the child module's output blocks and root expressions that refer to module.network values.
Question 691
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. Which proposed remediation solves this failure without masking its cause?
- Use one supported state integration for the root; choose the cloud block when adopting HCP Terraform's integrated workflow.
- Select the intended workspace before planning and check the corresponding workspace-specific state directory.
- Declare a supported backend block with a reviewed storage location, then initialize and migrate state under controlled conditions.
- Configure a suitable remote backend for shared operations or explicitly isolate disposable local state with restricted permissions.
Explanation
Correct Answer
A:Use one supported state integration for the root; choose the cloud block when adopting HCP Terraform's integrated workflow. HCP Terraform's cloud integration and a separate backend declaration are alternative root state configuration modes. Confirm the cause with: Inspect the terraform block for mutually incompatible cloud and backend settings and the intended HCP Terraform workspace. A concrete acceptance test is: Initialization connects to the intended workspace without conflicting backend configurations or unintended state copies. This matters here because as a second engineer rehearses an infrastructure state migration, the following condition occurs: A root Terraform….
Incorrect Answers
B:Select the intended workspace before planning and check the corresponding workspace-specific state directory. This could address local workspace state separation, but it does not correct the indicated hcp cloud integration versus remote backend mechanism. The relevant fix is: Use one supported state integration for the root; choose the cloud block when adopting HCP Terraform's integrated workflow.
C:Declare a supported backend block with a reviewed storage location, then initialize and migrate state under controlled conditions. This could address remote backend block configuration, but it does not correct the indicated hcp cloud integration versus remote backend mechanism. The relevant fix is: Use one supported state integration for the root; choose the cloud block when adopting HCP Terraform's integrated workflow.
D:Configure a suitable remote backend for shared operations or explicitly isolate disposable local state with restricted permissions. This could address local backend path and exposure, but it does not correct the indicated hcp cloud integration versus remote backend mechanism. The relevant fix is: Use one supported state integration for the root; choose the cloud block when adopting HCP Terraform's integrated workflow.
Question 692
While diagnosing a Terraform state or import issue in a staging workspace, the following condition occurs: An organization adopts hundreds of existing resources using ad hoc CLI import commands that are absent from code review and difficult to reproduce. The investigator must avoid unreviewed state writes. What measurable postchange observation would confirm that the correction worked?
- The logs identify the failing initialization or provider interaction and can be disabled after troubleshooting.
- The next plan shows the intended objects being imported rather than created and adoption mappings remain reviewable in source.
- The planned refactor covers every tracked instance and does not omit resources merely because source code is abstract.
- The resource binds to the production object while no unexpected development object is created or modified.
Explanation
Correct Answer
B:The next plan shows the intended objects being imported rather than created and adoption mappings remain reviewable in source. Configuration-driven import blocks can make existing-resource adoption repeatable and part of a reviewed execution plan. It tests the correction: Declare reviewed import blocks for known objects, plan the adoption, and reconcile configuration with the resulting resource state. This matters here because while diagnosing a Terraform state or import issue in a staging workspace, the following condition occurs: An….
Incorrect Answers
A:The logs identify the failing initialization or provider interaction and can be disabled after troubleshooting. This might validate tf_log for troubleshooting provider and cli diagnostics, but it does not prove that import blocks for reproducible adoption workflow was resolved. Confirm instead: The next plan shows the intended objects being imported rather than created and adoption mappings remain reviewable in source.
C:The planned refactor covers every tracked instance and does not omit resources merely because source code is abstract. This might validate state list for tracking managed addresses, but it does not prove that import blocks for reproducible adoption workflow was resolved. Confirm instead: The next plan shows the intended objects being imported rather than created and adoption mappings remain reviewable in source.
D:The resource binds to the production object while no unexpected development object is created or modified. This might validate import source account and provider selection, but it does not prove that import blocks for reproducible adoption workflow was resolved. Confirm instead: The next plan shows the intended objects being imported rather than created and adoption mappings remain reviewable in source. This matters here because while diagnosing a Terraform state or import issue in a staging workspace, the following condition occurs: An….
Question 693
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 TWO options together provide the relevant diagnosis and its targeted remediation? Select TWO.
- Inspect provider alias blocks and the resource's provider selection, including default identity and account-specific configuration.
- Recover the correct protected state snapshot or deliberately import existing objects before applying destructive duplicate provisioning.
- Review the upgrade impact and run terraform init -upgrade intentionally, then commit the updated lock selection after validation.
- Check which resource attributes are computed by the provider and how state records them after successful operations.
- Use resource references and output values so computed identifiers resolve after creation rather than hardcoding an invented ID.
Explanation
Correct Answers
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 forms one element of the required two-step diagnosis and correction. This matters here because in a clean CI runner initializing a Terraform root configuration, the following condition occurs: A root output….
E:Use resource references and output values so computed identifiers resolve after creation rather than hardcoding an invented ID. State stores known provider-returned attributes and supports dependency references; some values remain unknown until apply. Confirm the cause with: Check which resource attributes are computed by the provider and how state records them after successful operations. A concrete acceptance test is: The first plan marks unknown values appropriately and a subsequent apply publishes the actual ID through the tracked state. This forms one element of the required two-step diagnosis and correction. This matters here because in a clean CI runner initializing a Terraform root configuration, the following condition occurs: A root output….
Incorrect Answers
A:Inspect provider alias blocks and the resource's provider selection, including default identity and account-specific configuration. This relates to provider alias for multiple accounts rather than the matching diagnosis-and-remediation pair required here. Check: Check which resource attributes are computed by the provider and how state records them after successful operations. Then change: Use resource references and output values so computed identifiers resolve after creation rather than hardcoding an invented ID.
B:Recover the correct protected state snapshot or deliberately import existing objects before applying destructive duplicate provisioning. This relates to state binding between resource address and remote object rather than the matching diagnosis-and-remediation pair required here. Check: Check which resource attributes are computed by the provider and how state records them after successful operations. Then change: Use resource references and output values so computed identifiers resolve after creation rather than hardcoding an invented ID.
C:Review the upgrade impact and run terraform init -upgrade intentionally, then commit the updated lock selection after validation. This relates to controlled provider upgrade using init upgrade rather than the matching diagnosis-and-remediation pair required here. Check: Check which resource attributes are computed by the provider and how state records them after successful operations. Then change: Use resource references and output values so computed identifiers resolve after creation rather than hardcoding an invented ID.
Question 694
During a controlled module integration test for a production Terraform stack, the following condition occurs: A Terraform module copies a long-lived API token directly into a committed .tf file so an infrastructure deployment can authenticate to an external service. The desired fix must avoid unrelated resource changes. Which TWO options together provide the relevant diagnosis and its targeted remediation? Select TWO.
- Rotate the exposed token and retrieve needed credentials through an approved Vault-based ephemeral or runtime authentication flow.
- Express the necessary dependency explicitly or reference a resource attribute so the lookup can occur when its prerequisite exists.
- Inspect the repository for embedded secrets and review supported Vault provider/ephemeral integration and token access policy.
- Inspect the variable type constraint and the HCL expression used to access its values.
- Supply a supported write-only password argument from an ephemeral value and use the provider's explicit version mechanism when required.
Explanation
Correct Answers
A:Rotate the exposed token and retrieve needed credentials through an approved Vault-based ephemeral or runtime authentication flow. Secrets management separates credential issuance from infrastructure definitions; committed passwords remain exposed even if displayed as sensitive. Confirm the cause with: Inspect the repository for embedded secrets and review supported Vault provider/ephemeral integration and token access policy. A concrete acceptance test is: The module applies under least privilege without retaining the secret in source control or ordinary state output. 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….
C:Inspect the repository for embedded secrets and review supported Vault provider/ephemeral integration and token access policy. Secrets management separates credential issuance from infrastructure definitions; committed passwords remain exposed even if displayed as sensitive. A justified correction is: Rotate the exposed token and retrieve needed credentials through an approved Vault-based ephemeral or runtime authentication flow. 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….
Incorrect Answers
B:Express the necessary dependency explicitly or reference a resource attribute so the lookup can occur when its prerequisite exists. This relates to data source read ordering versus creation rather than the matching diagnosis-and-remediation pair required here. Check: Inspect the repository for embedded secrets and review supported Vault provider/ephemeral integration and token access policy. Then change: Rotate the exposed token and retrieve needed credentials through an approved Vault-based ephemeral or runtime authentication flow.
D:Inspect the variable type constraint and the HCL expression used to access its values. This relates to map versus list addressing for environment inputs rather than the matching diagnosis-and-remediation pair required here. Check: Inspect the repository for embedded secrets and review supported Vault provider/ephemeral integration and token access policy. Then change: Rotate the exposed token and retrieve needed credentials through an approved Vault-based ephemeral or runtime authentication flow.
E:Supply a supported write-only password argument from an ephemeral value and use the provider's explicit version mechanism when required. This relates to write-only provider argument for managed secret rotation rather than the matching diagnosis-and-remediation pair required here. Check: Inspect the repository for embedded secrets and review supported Vault provider/ephemeral integration and token access policy. Then change: Rotate the exposed token and retrieve needed credentials through an approved Vault-based ephemeral or runtime authentication flow.
Question 695
During a separate-region Terraform rollout in an approved staging account, the following condition occurs: Two engineers initialize the same project at different times and unexpectedly use different provider binaries after compatible new releases appear. The configuration should behave consistently without broadening access. What measurable postchange observation would confirm that the correction worked?
- Unauthorized users cannot read the state snapshot while approved Terraform runs continue tracking infrastructure.
- Two clean checkouts select the reviewed compatible provider binaries rather than silently upgrading independently.
- The plan identifies production-account resources under the intended provider configuration while development objects remain separate.
- Terraform resolves the intended plugin source consistently instead of relying on historical default namespace guesses.
Explanation
Correct Answer
B:Two clean checkouts select the reviewed compatible provider binaries rather than silently upgrading independently. Version constraints define acceptable releases; the dependency lock file records concrete chosen provider selections and checksums. It tests the correction: Commit the dependency lock file for a root configuration and use ordinary terraform init to honor its selected provider versions. This matters here because during a separate-region Terraform rollout in an approved staging account, the following condition occurs: Two….
Incorrect Answers
A:Unauthorized users cannot read the state snapshot while approved Terraform runs continue tracking infrastructure. This might validate state as sensitive operational metadata, but it does not prove that dependency lock file reproducible selection was resolved. Confirm instead: Two clean checkouts select the reviewed compatible provider binaries rather than silently upgrading independently.
C:The plan identifies production-account resources under the intended provider configuration while development objects remain separate. This might validate provider alias for multiple accounts, but it does not prove that dependency lock file reproducible selection was resolved. Confirm instead: Two clean checkouts select the reviewed compatible provider binaries rather than silently upgrading independently.
D:Terraform resolves the intended plugin source consistently instead of relying on historical default namespace guesses. This might validate provider source requirement declaration, but it does not prove that dependency lock file reproducible selection was resolved. Confirm instead: Two clean checkouts select the reviewed compatible provider binaries rather than silently upgrading independently.
Question 696
While migrating a manually maintained development environment into reviewed Terraform configuration, the following condition occurs: Three product teams rebuild nearly identical staging networks by copying browser instructions, but naming and access rules diverge by team. The team must establish a reproducible and auditable infrastructure change. 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.
- Configure separate authorized providers and identities for the hybrid environments while retaining a shared desired-state workflow.
- Require reviewed Terraform commits and corresponding plan evidence for production changes rather than console-only alterations.
- Identify which attributes Terraform declares and which external system writes to the same managed object between runs.
- Compare repeated environment requirements against current configuration differences and find parameters that should vary intentionally.
Explanation
Correct Answers
A:Use reusable Terraform modules and explicit environment inputs to encode shared rules while allowing reviewed differences. Shared IaC patterns reduce accidental divergence without requiring every environment to have identical parameters. Confirm the cause with: Compare repeated environment requirements against current configuration differences and find parameters that should vary intentionally. A concrete acceptance test is: New staging environments satisfy common access requirements while explicit input values account for documented environment differences. This forms one element of the required two-step diagnosis and correction.
E:Compare repeated environment requirements against current configuration differences and find parameters that should vary intentionally. Shared IaC patterns reduce accidental divergence without requiring every environment to have identical parameters. A justified correction is: Use reusable Terraform modules and explicit environment inputs to encode shared rules while allowing reviewed differences. This forms one element of the required two-step diagnosis and correction.
Incorrect Answers
B:Configure separate authorized providers and identities for the hybrid environments while retaining a shared desired-state workflow. This relates to hybrid cloud workflow with distinct provider credentials rather than the matching diagnosis-and-remediation pair required here. Check: Compare repeated environment requirements against current configuration differences and find parameters that should vary intentionally. Then change: Use reusable Terraform modules and explicit environment inputs to encode shared rules while allowing reviewed differences.
C:Require reviewed Terraform commits and corresponding plan evidence for production changes rather than console-only alterations. This relates to version-controlled iac change auditing rather than the matching diagnosis-and-remediation pair required here. Check: Compare repeated environment requirements against current configuration differences and find parameters that should vary intentionally. Then change: Use reusable Terraform modules and explicit environment inputs to encode shared rules while allowing reviewed differences.
D:Identify which attributes Terraform declares and which external system writes to the same managed object between runs. This relates to terraform resource ownership boundary rather than the matching diagnosis-and-remediation pair required here. Check: Compare repeated environment requirements against current configuration differences and find parameters that should vary intentionally. Then change: Use reusable Terraform modules and explicit environment inputs to encode shared rules while allowing reviewed differences.
Question 697
As a second engineer rehearses an infrastructure state migration, the following condition occurs: A network rule is modified directly in a cloud console and a subsequent Terraform plan proposes reverting it although the Terraform files are unchanged. The operation must not delete or duplicate existing production objects. Which Terraform configuration or workflow change most directly corrects the described issue?
- Apply a reviewed refresh-only plan when appropriate to synchronize state with current remote objects without an infrastructure change.
- Configure a suitable remote backend for shared operations or explicitly isolate disposable local state with restricted permissions.
- Select the intended workspace before planning and check the corresponding workspace-specific state directory.
- Review whether to restore desired IaC attributes or update configuration deliberately to adopt the observed change.
Explanation
Correct Answer
D:Review whether to restore desired IaC attributes or update configuration deliberately to adopt the observed change. Terraform can detect remote drift during refresh and propose changes back to declared configuration rather than treating console edits as code. Confirm the cause with: Compare the refreshed real object with its prior state and declared configuration to identify an outside change. A concrete acceptance test is: The approved reconciliation returns to a stable plan and makes the handling of the external modification explicit. This matters here because as a second engineer rehearses an infrastructure state migration, the following condition occurs: A network rule is….
Incorrect Answers
A:Apply a reviewed refresh-only plan when appropriate to synchronize state with current remote objects without an infrastructure change. This could address refresh-only state update without infrastructure mutation, but it does not correct the indicated out-of-band drift detection in managed resource mechanism. The relevant fix is: Review whether to restore desired IaC attributes or update configuration deliberately to adopt the observed change.
B:Configure a suitable remote backend for shared operations or explicitly isolate disposable local state with restricted permissions. This could address local backend path and exposure, but it does not correct the indicated out-of-band drift detection in managed resource mechanism. The relevant fix is: Review whether to restore desired IaC attributes or update configuration deliberately to adopt the observed change.
C:Select the intended workspace before planning and check the corresponding workspace-specific state directory. This could address local workspace state separation, but it does not correct the indicated out-of-band drift detection in managed resource mechanism. The relevant fix is: Review whether to restore desired IaC attributes or update configuration deliberately to adopt the observed change. This matters here because as a second engineer rehearses an infrastructure state migration, the following condition occurs: A network rule is….
Question 698
As an infrastructure team integrates an existing repository with HCP Terraform, the following condition occurs: A team runs Terraform independently on laptops while its shared HCP Terraform workspace is intended to control remote plan and apply runs. The workflow must apply least privilege and preserve workspace isolation. What should the engineer inspect FIRST to distinguish this issue from unrelated failures?
- Review organization and workspace team roles, run permissions and audit records for sensitive environments.
- Inspect workspace workflow configuration, VCS repository association, branch selection and recent run triggers.
- Inspect whether the root is connected to the correct HCP workspace and which execution mode is configured.
- Inspect which settings are truly shared and whether variable sets are already assigned at the correct project or workspace scope.
Explanation
Correct Answer
C:Inspect whether the root is connected to the correct HCP workspace and which execution mode is configured. HCP Terraform workspaces can coordinate Terraform runs and state, but a local directory is not automatically connected to one. A justified correction is: Connect the configuration to the appropriate HCP Terraform workspace and select a governed remote execution workflow. This matters here because as an infrastructure team integrates an existing repository with HCP Terraform, the following condition occurs: A….
Incorrect Answers
A:Review organization and workspace team roles, run permissions and audit records for sensitive environments. This inspects hcp terraform team permissions and audit trail rather than the reported hcp terraform remote execution and state hosting issue. The decisive investigation is: Inspect whether the root is connected to the correct HCP workspace and which execution mode is configured.
B: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 remote execution and state hosting issue. The decisive investigation is: Inspect whether the root is connected to the correct HCP workspace and which execution mode is configured. This matters here because as an infrastructure team integrates an existing repository with HCP Terraform, the following condition occurs: A….
D:Inspect which settings are truly shared and whether variable sets are already assigned at the correct project or workspace scope. This inspects hcp workspace variable sets share scoped configuration rather than the reported hcp terraform remote execution and state hosting issue. The decisive investigation is: Inspect whether the root is connected to the correct HCP workspace and which execution mode is configured. This matters here because as an infrastructure team integrates an existing repository with HCP Terraform, the following condition occurs: A….
Question 699
During a controlled module integration test for a production Terraform stack, the following condition occurs: A pipeline needs a temporary provider API token but its input variable is ordinary and the security reviewer wants to avoid persisting the token in plan or state artifacts. The desired fix must avoid unrelated resource changes. What targeted engineering response should the team implement?
- Add a variable validation block with an appropriate condition and useful error_message for unacceptable CIDR input.
- Declare the token input as ephemeral = true and pass it only into compatible runtime contexts such as provider configuration.
- Index the intended instance by key or construct a mapped collection of instance attributes before passing them elsewhere.
- Rotate the exposed token and retrieve needed credentials through an approved Vault-based ephemeral or runtime authentication flow.
Explanation
Correct Answer
B:Declare the token input as ephemeral = true and pass it only into compatible runtime contexts such as provider configuration. This is the targeted response for ephemeral variable for short-lived token in terraform 1.12. Ephemeral values are available during an operation but cannot be referenced in arbitrary normal persisted expressions. Confirm the cause with: Inspect the variable's ephemeral setting and whether downstream use is an allowed ephemeral context such as provider configuration. A concrete acceptance test is: A controlled Terraform operation can authenticate using the short-lived token while its value is omitted from plan and state artifacts. This matters here because during a controlled module integration test for a production Terraform stack, the following condition occurs: A….
Incorrect Answers
A:Add a variable validation block with an appropriate condition and useful error_message for unacceptable CIDR input. This could address input variable custom validation rule, but it does not correct the indicated ephemeral variable for short-lived token in terraform 1.12 mechanism. The relevant fix is: Declare the token input as ephemeral = true and pass it only into compatible runtime contexts such as provider configuration.
C:Index the intended instance by key or construct a mapped collection of instance attributes before passing them elsewhere. This could address collection references for for_each resources, but it does not correct the indicated ephemeral variable for short-lived token in terraform 1.12 mechanism. The relevant fix is: Declare the token input as ephemeral = true and pass it only into compatible runtime contexts such as provider configuration. This matters here because during a controlled module integration test for a production Terraform stack, the following condition occurs: A….
D:Rotate the exposed token and retrieve needed credentials through an approved Vault-based ephemeral or runtime authentication flow. This could address vault credential lookup without hardcoding secret values, but it does not correct the indicated ephemeral variable for short-lived token in terraform 1.12 mechanism. The relevant fix is: Declare the token input as ephemeral = true and pass it only into compatible runtime contexts such as provider configuration.
Question 700
During an isolated staging rehearsal of the Terraform workflow, the following condition occurs: A root module adds a new remote child module source, but terraform validate reports it cannot find the child module in the local working directory. The operator must obtain auditable evidence before touching production resources. Which outcome most directly validates the intended fix?
- The working directory uses the approved remote backend and the existing managed resource bindings remain available without duplicate provisioning.
- A planned change is inspected before approval, then the resulting infrastructure matches the reviewed configuration where supported.
- The module source resolves and validation can analyze the combined configuration without manually copying code into the root directory.
- Validation passes with the declared variable name and no longer reports the nonexistent symbol reference.
Explanation
Correct Answer
C:The module source resolves and validation can analyze the combined configuration without manually copying code into the root directory. Terraform initialization installs external module dependencies while validation assumes required module code is locally available. It tests the correction: Run terraform init to install and configure referenced child modules before attempting configuration validation. This matters here because a root module adds a new remote child module source, but terraform validate reports it cannot find the child module….
Incorrect Answers
A:The working directory uses the approved remote backend and the existing managed resource bindings remain available without duplicate provisioning. This might validate reinitializing after backend configuration change, but it does not prove that module installation during initial setup was resolved. Confirm instead: The module source resolves and validation can analyze the combined configuration without manually copying code into the root directory. This matters here because a root module adds a new remote child module source, but terraform validate reports it cannot find the child module….
B:A planned change is inspected before approval, then the resulting infrastructure matches the reviewed configuration where supported. This might validate core write plan apply workflow order, but it does not prove that module installation during initial setup was resolved. Confirm instead: The module source resolves and validation can analyze the combined configuration without manually copying code into the root directory.
D: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 module installation during initial setup was resolved. Confirm instead: The module source resolves and validation can analyze the combined configuration without manually copying code into the root directory.