HashiCorp Terraform Associate 004 Practice Test 20
Question 190
When reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: A database provider supports a write-only password argument, but an engineer uses a normal stored password argument and checks the plan artifact into an unsecured archive. The engineer must respect declared resource contracts and data security boundaries. Select TWO: the decisive first check and the change that directly addresses the problem.
- Inspect the graph references and whether the data source must wait for a managed resource's creation.
- Inspect the provider resource schema for supported write-only arguments and associated rotation or version requirements.
- Supply a supported write-only password argument from an ephemeral value and use the provider's explicit version mechanism when required.
- Add an explicit depends_on reference to the necessary policy attachment where an ordinary attribute reference cannot express the relationship.
- Protect the backend and use supported ephemeral/write-only pathways when the provider exposes them rather than relying on sensitive alone.
Explanation
Correct Answers
B:Inspect the provider resource schema for supported write-only arguments and associated rotation or version requirements. Write-only resource arguments accept values during an operation without saving those values into Terraform's managed state. A justified correction is: Supply a supported write-only password argument from an ephemeral value and use the provider's explicit version mechanism when required. This forms one element of the required two-step diagnosis and correction.
C:Supply a supported write-only password argument from an ephemeral value and use the provider's explicit version mechanism when required. Write-only resource arguments accept values during an operation without saving those values into Terraform's managed state. Confirm the cause with: Inspect the provider resource schema for supported write-only arguments and associated rotation or version requirements. A concrete acceptance test is: The provider receives the approved new secret without persisting its plaintext in Terraform's plan or state snapshots. This forms one element of the required two-step diagnosis and correction.
Incorrect Answers
A: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 provider resource schema for supported write-only arguments and associated rotation or version requirements. Then change: Supply a supported write-only password argument from an ephemeral value and use the provider's explicit version mechanism when required.
D:Add an explicit depends_on reference to the necessary policy attachment where an ordinary attribute reference cannot express the relationship. This relates to explicit depends_on for behavior-only dependencies rather than the matching diagnosis-and-remediation pair required here. Check: Inspect the provider resource schema for supported write-only arguments and associated rotation or version requirements. Then change: Supply a supported write-only password argument from an ephemeral value and use the provider's explicit version mechanism when required.
E:Protect the backend and use supported ephemeral/write-only pathways when the provider exposes them rather than relying on sensitive alone. This relates to sensitive variable does not erase state secrets rather than the matching diagnosis-and-remediation pair required here. Check: Inspect the provider resource schema for supported write-only arguments and associated rotation or version requirements. Then change: Supply a supported write-only password argument from an ephemeral value and use the provider's explicit version mechanism when required.
Question 191
While migrating a manually maintained development environment into reviewed Terraform configuration, the following condition occurs: A deployment ticket says to create a network and firewall by hand, leaving no reliable code change for peers to inspect before access is opened. The team must establish a reproducible and auditable infrastructure change. Which proposed remediation solves this failure without masking its cause?
- Encode the network and firewall resources in version-controlled Terraform and require a reviewed plan in the change process.
- Configure separate authorized providers and identities for the hybrid environments while retaining a shared desired-state workflow.
- Run a reviewed Terraform plan before application, investigate unexpected replacements, and require appropriate authorization.
- Assign authoritative ownership to one control plane or explicitly divide attribute responsibility using supported lifecycle practices.
Explanation
Correct Answer
A:Encode the network and firewall resources in version-controlled Terraform and require a reviewed plan in the change process. Terraform configurations are executable specifications that enable peer review, not screenshots of already completed manual changes. Confirm the cause with: Inspect whether infrastructure choices and dependencies exist as tracked Terraform files or only as undocumented console modifications. A concrete acceptance test is: Reviewers can trace a proposed firewall change to an audited configuration diff and plan before any infrastructure changes.
Incorrect Answers
B:Configure separate authorized providers and identities for the hybrid environments while retaining a shared desired-state workflow. This could address hybrid cloud workflow with distinct provider credentials, but it does not correct the indicated terraform configuration as reviewable infrastructure specification mechanism. The relevant fix is: Encode the network and firewall resources in version-controlled Terraform and require a reviewed plan in the change process.
C:Run a reviewed Terraform plan before application, investigate unexpected replacements, and require appropriate authorization. This could address terraform plan review as change safety barrier, but it does not correct the indicated terraform configuration as reviewable infrastructure specification mechanism. The relevant fix is: Encode the network and firewall resources in version-controlled Terraform and require a reviewed plan in the change process.
D:Assign authoritative ownership to one control plane or explicitly divide attribute responsibility using supported lifecycle practices. This could address terraform resource ownership boundary, but it does not correct the indicated terraform configuration as reviewable infrastructure specification mechanism. The relevant fix is: Encode the network and firewall resources in version-controlled Terraform and require a reviewed plan in the change process.
Question 192
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 investigation would most directly establish the reported Terraform failure?
- Differentiate static schema/reference checks in validation from provider API checks and actual permissions during plan and apply.
- Inspect Terraform diagnostic output for undeclared input references and compare declared variable names to expressions.
- Inspect the terraform fmt -check -diff output and separate style failures from terraform validate diagnostics.
- Read the terraform plan action symbols and provider explanation for forces replacement before scheduling apply.
Explanation
Correct Answer
B:Inspect Terraform diagnostic output for undeclared input references and compare declared variable names to expressions. Formatting changes whitespace and indentation; static validation identifies invalid references and configuration structure. A justified correction is: Use terraform validate to identify the invalid reference, correct the spelling, and rerun validation before planning.
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 terraform validate catches undeclared reference issue. The decisive investigation is: Inspect Terraform diagnostic output for undeclared input references and compare declared variable names to expressions.
C:Inspect the terraform fmt -check -diff output and separate style failures from terraform validate diagnostics. This inspects ci terraform fmt check distinguishes style from validity rather than the reported terraform validate catches undeclared reference issue. The decisive investigation is: Inspect Terraform diagnostic output for undeclared input references and compare declared variable names to expressions.
D:Read the terraform plan action symbols and provider explanation for forces replacement before scheduling apply. This inspects plan distinguishes replacement from in-place update rather than the reported terraform validate catches undeclared reference issue. The decisive investigation is: Inspect Terraform diagnostic output for undeclared input references and compare declared variable names to expressions.
Question 193
As the deployment team prepares a reviewed Terraform CLI change, the following condition occurs: A team runs terraform plan against a long-lived environment and unexpectedly sees an outside-of-Terraform network tag change in the refreshed state. The change must preserve the distinction between previewing and modifying infrastructure. Which diagnostic check provides the strongest evidence for the underlying problem?
- Read the terraform plan action symbols and provider explanation for forces replacement before scheduling apply.
- Inspect the .terraform working directory and initialization output for missing backend, module, and provider setup.
- Inspect refresh findings and compare remote attributes with the declared tag values before accepting a proposed remediation.
- Inspect the bucket's resource address and distinguish removing state ownership from destroying remote infrastructure.
Explanation
Correct Answer
C:Inspect refresh findings and compare remote attributes with the declared tag values before accepting a proposed remediation. Normal planning refreshes remote state by default and can reveal differences between real objects and tracked configuration. A justified correction is: Decide whether to restore declared configuration or intentionally adopt the outside value, then plan under the chosen ownership policy. This matters here because as the deployment team prepares a reviewed Terraform CLI change, the following condition occurs: A team runs….
Incorrect Answers
A:Read the terraform plan action symbols and provider explanation for forces replacement before scheduling apply. This inspects plan distinguishes replacement from in-place update rather than the reported plan versus real infrastructure drift issue. The decisive investigation is: Inspect refresh findings and compare remote attributes with the declared tag values before accepting a proposed remediation.
B:Inspect the.terraform working directory and initialization output for missing backend, module, and provider setup. This inspects terraform init backend and provider preparation rather than the reported plan versus real infrastructure drift issue. The decisive investigation is: Inspect refresh findings and compare remote attributes with the declared tag values before accepting a proposed remediation.
D:Inspect the bucket's resource address and distinguish removing state ownership from destroying remote infrastructure. This inspects selective cleanup without destroying retained object rather than the reported plan versus real infrastructure drift issue. The decisive investigation is: Inspect refresh findings and compare remote attributes with the declared tag values before accepting a proposed remediation.
Question 194
When reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: A database connection output includes a password but the author marks only the input variable as sensitive and expects every derived output to be safely hidden in command output. 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 whether the zone should be managed or merely read, and compare the resource block with the provider's data source schema.
- Inspect variable blocks for type/default arguments and the module call for an explicitly supplied input value.
- Review input and output sensitivity declarations and inspect what the plan or output commands will display.
- Inspect the graph references and whether the data source must wait for a managed resource's creation.
Explanation
Correct Answer
C:Review input and output sensitivity declarations and inspect what the plan or output commands will display. Sensitivity metadata affects presentation, not a guarantee that secret bytes have been removed from state or all other surfaces. A justified correction is: Mark secret-bearing outputs sensitive when appropriate, restrict state access, and avoid exposing secret material through ordinary output values.
Incorrect Answers
A: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 sensitive output display behavior issue. The decisive investigation is: Review input and output sensitivity declarations and inspect what the plan or output commands will display.
B: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 sensitive output display behavior issue. The decisive investigation is: Review input and output sensitivity declarations and inspect what the plan or output commands will display.
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 sensitive output display behavior issue. The decisive investigation is: Review input and output sensitivity declarations and inspect what the plan or output commands will display.
Question 195
As an infrastructure team integrates an existing repository with HCP Terraform, the following condition occurs: A company creates production and staging workspaces for dozens of product teams in one flat list, and support staff cannot manage their permissions cleanly. The workflow must apply least privilege and preserve workspace isolation. Which TWO complementary choices identify the cause and implement the appropriate fix? Select TWO.
- Connect the configuration to the appropriate HCP Terraform workspace and select a governed remote execution workflow.
- Inspect existing HCP policy sets, enforcement levels, workspace assignments and prior policy evaluation results.
- Inspect current HCP project assignments, workspace ownership patterns, and project/team permission boundaries.
- Create a controlled HCP Terraform variable set scoped to the intended workspaces and remove conflicting duplicated values.
- Organize related workspaces into appropriate HCP projects and apply reviewed permissions and conventions for each group.
Explanation
Correct Answers
C:Inspect current HCP project assignments, workspace ownership patterns, and project/team permission boundaries. HCP projects organize related workspaces and can simplify team governance without merging their independent state snapshots. A justified correction is: Organize related workspaces into appropriate HCP projects and apply reviewed permissions and conventions for each group. This forms one element of the required two-step diagnosis and correction.
E:Organize related workspaces into appropriate HCP projects and apply reviewed permissions and conventions for each group. HCP projects organize related workspaces and can simplify team governance without merging their independent state snapshots. Confirm the cause with: Inspect current HCP project assignments, workspace ownership patterns, and project/team permission boundaries. A concrete acceptance test is: Teams locate and administer their approved workspaces without accidentally gaining access to unrelated project state. This forms one element of the required two-step diagnosis and correction.
Incorrect Answers
A:Connect the configuration to the appropriate HCP Terraform workspace and select a governed remote execution workflow. This relates to hcp terraform remote execution and state hosting rather than the matching diagnosis-and-remediation pair required here. Check: Inspect current HCP project assignments, workspace ownership patterns, and project/team permission boundaries. Then change: Organize related workspaces into appropriate HCP projects and apply reviewed permissions and conventions for each group.
B:Inspect existing HCP policy sets, enforcement levels, workspace assignments and prior policy evaluation results. This relates to hcp terraform policy enforcement governance rather than the matching diagnosis-and-remediation pair required here. Check: Inspect current HCP project assignments, workspace ownership patterns, and project/team permission boundaries. Then change: Organize related workspaces into appropriate HCP projects and apply reviewed permissions and conventions for each group.
D:Create a controlled HCP Terraform variable set scoped to the intended workspaces and remove conflicting duplicated values. This relates to hcp workspace variable sets share scoped configuration rather than the matching diagnosis-and-remediation pair required here. Check: Inspect current HCP project assignments, workspace ownership patterns, and project/team permission boundaries. Then change: Organize related workspaces into appropriate HCP projects and apply reviewed permissions and conventions for each group.
Question 196
When reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: A root configuration needs a child module's generated network ID but accesses an internal child resource name directly and fails to resolve it. The engineer must respect declared resource contracts and data security boundaries. Which outcome most directly validates the intended fix?
- Each application environment receives the correct key-specific resource ID without ambiguous or invalid collection access.
- The root plan resolves the supported module output without attempting to address private child resource internals.
- The plan selects the correct per-environment instance size without relying on arbitrary key ordering.
- Removing one application plans its own deletion without shifting unrelated resource instances to new indexes.
Explanation
Correct Answer
B:The root plan resolves the supported module output without attempting to address private child resource internals. Modules expose values to callers through output declarations, creating an explicit interface between implementation and consumers. It tests the correction: Expose the required network identifier with an output in the child module and reference module.network.<output_name> from the root. This matters here because when reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: A root….
Incorrect Answers
A:Each application environment receives the correct key-specific resource ID without ambiguous or invalid collection access. This might validate collection references for for_each resources, but it does not prove that module output references across composition was resolved. Confirm instead: The root plan resolves the supported module output without attempting to address private child resource internals.
C: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 module output references across composition was resolved. Confirm instead: The root plan resolves the supported module output without attempting to address private child resource internals.
D: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 module output references across composition was resolved. Confirm instead: The root plan resolves the supported module output without attempting to address private child resource internals.
Question 197
When reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: A reusable module expects a region input but has no default, and a new caller assumes Terraform will infer a region from the module source. The engineer must respect declared resource contracts and data security boundaries. What measurable postchange observation would confirm that the correction worked?
- Routine Terraform output suppresses the marked secret while protected state access remains restricted.
- Identical approved inputs yield consistent resource names and tags without operator-specific manual spelling fixes.
- The module plans with a deliberate region value rather than failing for a missing required input.
- The root plan resolves the supported module output without attempting to address private child resource internals.
Explanation
Correct Answer
C:The module plans with a deliberate region value rather than failing for a missing required input. Input variables lacking defaults are required at the module boundary; module source addresses do not implicitly supply their values. It tests the correction: Provide the required region input through the module call or a supported root variable assignment mechanism.
Incorrect Answers
A:Routine Terraform output suppresses the marked secret while protected state access remains restricted. This might validate sensitive output display behavior, but it does not prove that variable default versus required input was resolved. Confirm instead: The module plans with a deliberate region value rather than failing for a missing required input.
B:Identical approved inputs yield consistent resource names and tags without operator-specific manual spelling fixes. This might validate built-in functions for deterministic naming, but it does not prove that variable default versus required input was resolved. Confirm instead: The module plans with a deliberate region value rather than failing for a missing required input.
D:The root plan resolves the supported module output without attempting to address private child resource internals. This might validate module output references across composition, but it does not prove that variable default versus required input was resolved. Confirm instead: The module plans with a deliberate region value rather than failing for a missing required input.
Question 198
During a cross-platform infrastructure standardization exercise, the following condition occurs: A deployment ticket says to create a network and firewall by hand, leaving no reliable code change for peers to inspect before access is opened. The decision must preserve ownership and minimize undocumented changes. What measurable postchange observation would confirm that the correction worked?
- Reviewers can trace a proposed firewall change to an audited configuration diff and plan before any infrastructure changes.
- An auditor can identify the approved commit and plan that caused a deliberate infrastructure capacity change.
- A series of Terraform plans remains stable after independent automation without oscillating policy settings between tools.
- Both platform implementations satisfy agreed application outputs using their own valid resource schemas and API constraints.
Explanation
Correct Answer
A:Reviewers can trace a proposed firewall change to an audited configuration diff and plan before any infrastructure changes. Terraform configurations are executable specifications that enable peer review, not screenshots of already completed manual changes. It tests the correction: Encode the network and firewall resources in version-controlled Terraform and require a reviewed plan in the change process.
Incorrect Answers
B:An auditor can identify the approved commit and plan that caused a deliberate infrastructure capacity change. This might validate version-controlled iac change auditing, but it does not prove that terraform configuration as reviewable infrastructure specification was resolved. Confirm instead: Reviewers can trace a proposed firewall change to an audited configuration diff and plan before any infrastructure changes.
C:A series of Terraform plans remains stable after independent automation without oscillating policy settings between tools. This might validate terraform resource ownership boundary, but it does not prove that terraform configuration as reviewable infrastructure specification was resolved. Confirm instead: Reviewers can trace a proposed firewall change to an audited configuration diff and plan before any infrastructure changes.
D:Both platform implementations satisfy agreed application outputs using their own valid resource schemas and API constraints. This might validate provider-neutral infrastructure pattern without identical resource types, but it does not prove that terraform configuration as reviewable infrastructure specification was resolved. Confirm instead: Reviewers can trace a proposed firewall change to an audited configuration diff and plan before any infrastructure changes.
Question 199
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. Which outcome most directly validates the intended fix?
- Plans and applies execute in the intended HCP run environment with centralized state and auditable run outcomes.
- Teams locate and administer their approved workspaces without accidentally gaining access to unrelated project state.
- A noncompliant plan is rejected at policy evaluation while a compliant plan continues through its required approvals.
- An approved commit creates the intended Terraform plan run under the selected workspace without laptop-only execution.
Explanation
Correct Answer
A:Plans and applies execute in the intended HCP run environment with centralized state and auditable run outcomes. HCP Terraform workspaces can coordinate Terraform runs and state, but a local directory is not automatically connected to one. It tests the correction: Connect the configuration to the appropriate HCP Terraform workspace and select a governed remote execution workflow.
Incorrect Answers
B:Teams locate and administer their approved workspaces without accidentally gaining access to unrelated project state. This might validate hcp projects group workspaces by ownership, but it does not prove that hcp terraform remote execution and state hosting was resolved. Confirm instead: Plans and applies execute in the intended HCP run environment with centralized state and auditable run outcomes.
C:A noncompliant plan is rejected at policy evaluation while a compliant plan continues through its required approvals. This might validate hcp terraform policy enforcement governance, but it does not prove that hcp terraform remote execution and state hosting was resolved. Confirm instead: Plans and applies execute in the intended HCP run environment with centralized state and auditable run outcomes.
D:An approved commit creates the intended Terraform plan run under the selected workspace without laptop-only execution. This might validate vcs-driven hcp terraform run on approved changes, but it does not prove that hcp terraform remote execution and state hosting was resolved. Confirm instead: Plans and applies execute in the intended HCP run environment with centralized state and auditable run outcomes.
Question 200
When maintaining Terraform modules used by several application teams, 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 module interface must remain stable and reviewable. What targeted engineering response should the team implement?
- Add the intended child output declaration and access it through module.network.<output_name> in the caller.
- Pass module.network.subnet_id as an input into the web module rather than duplicating resource creation or guessed values.
- Pass sensitive inputs through appropriately typed child variables and avoid exposing them via normal outputs or logs.
- Use the supported Git module source form with the correct double-slash subdirectory and pinned revision ref.
Explanation
Correct Answer
A:Add the intended child output declaration and access it through module.network.<output_name> in the caller. Output values are the supported way for a module to expose results to its parent; ordinary child locals are not exported. Confirm the cause with: Inspect the child module's output blocks and root expressions that refer to module.network values. A concrete acceptance test is: The caller can reference the exact authorized network ID without using private child implementation resource addresses.
Incorrect Answers
B: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 child output exposure to calling module mechanism. The relevant fix is: Add the intended child output declaration and access it through module.network.<output_name> in the caller.
C:Pass sensitive inputs through appropriately typed child variables and avoid exposing them via normal outputs or logs. This could address sensitive input forwarding between nested modules, but it does not correct the indicated child output exposure to calling module mechanism. The relevant fix is: Add the intended child output declaration and access it through module.network.<output_name> in the caller.
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 child output exposure to calling module mechanism. The relevant fix is: Add the intended child output declaration and access it through module.network.<output_name> in the caller.