HashiCorp Terraform Associate 004 Practice Test 65
Question 640
In a clean CI runner initializing a Terraform root configuration, the following condition occurs: A team expects the Terraform CLI to create cloud database resources without installing the provider named by their resource types. The engineers must keep provider choices and identities reproducible. Which investigation would most directly establish the reported Terraform failure?
- Compare state resource addresses to actual remote objects and the active backend's selected state snapshot.
- Review provider requirement declarations, provider configuration blocks, and the platform's supported authentication mechanisms.
- Inspect the resource type prefixes and required_providers source mappings before running terraform init.
- Check which resource attributes are computed by the provider and how state records them after successful operations.
Explanation
Correct Answer
C:Inspect the resource type prefixes and required_providers source mappings before running terraform init. Terraform core evaluates configuration and resource graphs while provider plugins implement platform-specific CRUD and read behavior. A justified correction is: Install and configure the appropriate provider through terraform init so Terraform can use its resource and data source implementations. This matters here because in a clean CI runner initializing a Terraform root configuration, the following condition occurs: A team expects the….
Incorrect Answers
A:Compare state resource addresses to actual remote objects and the active backend's selected state snapshot. This inspects state binding between resource address and remote object rather than the reported provider plugin manages api resources and data reads issue. The decisive investigation is: Inspect the resource type prefixes and required_providers source mappings before running terraform init.
B:Review provider requirement declarations, provider configuration blocks, and the platform's supported authentication mechanisms. This inspects provider block credentials versus required_providers rather than the reported provider plugin manages api resources and data reads issue. The decisive investigation is: Inspect the resource type prefixes and required_providers source mappings before running terraform init.
D:Check which resource attributes are computed by the provider and how state records them after successful operations. This inspects resource attribute outputs supplied by state rather than the reported provider plugin manages api resources and data reads issue. The decisive investigation is: Inspect the resource type prefixes and required_providers source mappings before running terraform init. This matters here because in a clean CI runner initializing a Terraform root configuration, the following condition occurs: A team expects the….
Question 641
During a controlled module integration test for a production Terraform stack, the following condition occurs: A compliance controller adds a standard cost tag after provisioning and each Terraform plan tries to revert the independently managed tag. The desired fix must avoid unrelated resource changes. Which TWO complementary choices identify the cause and implement the appropriate fix? Select TWO.
- Remove or update the overriding variable source and make the intended region input explicit for the controlled run.
- Identify the externally owned attribute and verify that ignoring it does not mask business-critical configuration drift.
- Use lifecycle create_before_destroy when the platform allows coexistence and design unique names or a controlled cutover if required.
- Inspect the declared for_each keys, current state addresses, and references elsewhere in the configuration.
- Use a narrowly scoped lifecycle ignore_changes list for that attribute only when its ownership has been formally delegated.
Explanation
Correct Answers
B:Identify the externally owned attribute and verify that ignoring it does not mask business-critical configuration drift. ignore_changes omits configured attribute differences from update decisions and should not be a blanket excuse to hide drift. A justified correction is: Use a narrowly scoped lifecycle ignore_changes list for that attribute only when its ownership has been formally delegated. 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….
E:Use a narrowly scoped lifecycle ignore_changes list for that attribute only when its ownership has been formally delegated. ignore_changes omits configured attribute differences from update decisions and should not be a blanket excuse to hide drift. Confirm the cause with: Identify the externally owned attribute and verify that ignoring it does not mask business-critical configuration drift. A concrete acceptance test is: Normal plans do not oscillate the delegated tag, while other resource drift remains visible and managed. 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
A:Remove or update the overriding variable source and make the intended region input explicit for the controlled run. This relates to variable input precedence and configuration injection rather than the matching diagnosis-and-remediation pair required here. Check: Identify the externally owned attribute and verify that ignoring it does not mask business-critical configuration drift. Then change: Use a narrowly scoped lifecycle ignore_changes list for that attribute only when its ownership has been formally delegated.
C:Use lifecycle create_before_destroy when the platform allows coexistence and design unique names or a controlled cutover if required. This relates to create_before_destroy lifecycle for availability rather than the matching diagnosis-and-remediation pair required here. Check: Identify the externally owned attribute and verify that ignoring it does not mask business-critical configuration drift. Then change: Use a narrowly scoped lifecycle ignore_changes list for that attribute only when its ownership has been formally delegated.
D:Inspect the declared for_each keys, current state addresses, and references elsewhere in the configuration. This relates to resource addressing with repeated instances rather than the matching diagnosis-and-remediation pair required here. Check: Identify the externally owned attribute and verify that ignoring it does not mask business-critical configuration drift. Then change: Use a narrowly scoped lifecycle ignore_changes list for that attribute only when its ownership has been formally delegated.
Question 642
During a clean initialization of a newly composed infrastructure root module, the following condition occurs: A module source from the public registry resolves to an unexpected major version after a new release and changes its input contract. The team must preserve reproducibility across callers. Which outcome most directly validates the intended fix?
- Normal CI initialization selects the reviewed compatible module version and unsupported major releases are not adopted silently.
- The child module receives the intended environment value without accessing variables declared only in its caller.
- The root plan resolves the new module output names with no dangling references or unintended replacements.
- Dependent modules receive only necessary authorized values and terminal output does not reveal secret material.
Explanation
Correct Answer
A:Normal CI initialization selects the reviewed compatible module version and unsupported major releases are not adopted silently. Registry module versions follow explicit constraints; leaving compatibility open can cause unreviewed module interface changes. It tests the correction: Add an appropriate version constraint for a registry module and review upgrades with plans and compatibility tests. This matters here because during a clean initialization of a newly composed infrastructure root module, the following condition occurs: A….
Incorrect Answers
B:The child module receives the intended environment value without accessing variables declared only in its caller. This might validate root and child variable scope isolation, but it does not prove that registry module version pin to avoid breaking releases was resolved. Confirm instead: Normal CI initialization selects the reviewed compatible module version and unsupported major releases are not adopted silently.
C:The root plan resolves the new module output names with no dangling references or unintended replacements. This might validate module upgrade plan review with changed outputs, but it does not prove that registry module version pin to avoid breaking releases was resolved. Confirm instead: Normal CI initialization selects the reviewed compatible module version and unsupported major releases are not adopted silently.
D:Dependent modules receive only necessary authorized values and terminal output does not reveal secret material. This might validate sensitive input forwarding between nested modules, but it does not prove that registry module version pin to avoid breaking releases was resolved. Confirm instead: Normal CI initialization selects the reviewed compatible module version and unsupported major releases are not adopted silently.
Question 643
As a second engineer rehearses an infrastructure state migration, the following condition occurs: A team assumes a default Terraform directory automatically stores state in a centralized shared service, but every engineer sees their own terraform.tfstate file. The operation must not delete or duplicate existing production objects. Which outcome most directly validates the intended fix?
- Authorized team members reference one intended remote snapshot rather than maintaining conflicting independent local files.
- Team plans use the same access-controlled state backend after migration without duplicating existing managed objects.
- Concurrent runs against the same state are serialized according to the backend's supported locking contract.
- A plan in staging reads staging bindings while a default workspace plan remains independent.
Explanation
Correct Answer
A:Authorized team members reference one intended remote snapshot rather than maintaining conflicting independent local files. The local backend persists state on the executing filesystem; it does not provide shared remote coordination by default. It tests the correction: Configure a suitable remote backend for shared operations or explicitly isolate disposable local state with restricted permissions.
Incorrect Answers
B:Team plans use the same access-controlled state backend after migration without duplicating existing managed objects. This might validate remote backend block configuration, but it does not prove that local backend path and exposure was resolved. Confirm instead: Authorized team members reference one intended remote snapshot rather than maintaining conflicting independent local files.
C:Concurrent runs against the same state are serialized according to the backend's supported locking contract. This might validate backend-specific state locking support, but it does not prove that local backend path and exposure was resolved. Confirm instead: Authorized team members reference one intended remote snapshot rather than maintaining conflicting independent local files.
D:A plan in staging reads staging bindings while a default workspace plan remains independent. This might validate local workspace state separation, but it does not prove that local backend path and exposure was resolved. Confirm instead: Authorized team members reference one intended remote snapshot rather than maintaining conflicting independent local files.
Question 644
While diagnosing a Terraform state or import issue in a staging workspace, the following condition occurs: An existing managed network is defined in Terraform but has never been imported, so the next plan attempts to create a duplicate resource with an already-used name. The investigator must avoid unreviewed state writes. Which proposed remediation solves this failure without masking its cause?
- Use an import block or terraform import with the correct resource address and provider-specific remote ID before a reviewed plan.
- Use terraform state list to enumerate the actual addresses tracked in the selected workspace state.
- Select the appropriate aliased provider configuration and import using the real identifier in its owning account.
- Use terraform state show on the selected address to review tracked attributes without changing resources.
Explanation
Correct Answer
A:Use an import block or terraform import with the correct resource address and provider-specific remote ID before a reviewed plan. Import establishes a state binding for a real object; it does not automatically infer or validate the complete HCL desired configuration. Confirm the cause with: Compare the declared resource address and remote identifier against the selected state snapshot. A concrete acceptance test is: The existing object is tracked under the intended resource address and Terraform no longer proposes a duplicate creation.
Incorrect Answers
B:Use terraform state list to enumerate the actual addresses tracked in the selected workspace state. This could address state list for tracking managed addresses, but it does not correct the indicated terraform import binds preexisting remote object mechanism. The relevant fix is: Use an import block or terraform import with the correct resource address and provider-specific remote ID before a reviewed plan.
C:Select the appropriate aliased provider configuration and import using the real identifier in its owning account. This could address import source account and provider selection, but it does not correct the indicated terraform import binds preexisting remote object mechanism. The relevant fix is: Use an import block or terraform import with the correct resource address and provider-specific remote ID before a reviewed plan.
D:Use terraform state show on the selected address to review tracked attributes without changing resources. This could address state show inspects one stored resource instance, but it does not correct the indicated terraform import binds preexisting remote object mechanism. The relevant fix is: Use an import block or terraform import with the correct resource address and provider-specific remote ID before a reviewed plan.
Question 645
As a second engineer rehearses an infrastructure state migration, the following condition occurs: Two engineers start applying changes to the same backend and one receives a state lock error; the second engineer proposes disabling locking to save time. The operation must not delete or duplicate existing production objects. Which investigation would most directly establish the reported Terraform failure?
- Inspect backend state lock records, the lock identifier, and the status of any still-running apply before unlocking.
- Inspect active runs and lock metadata to determine whether another legitimate operation owns the state lock.
- Inspect the terraform block for mutually incompatible cloud and backend settings and the intended HCP Terraform workspace.
- Compare old and new resource addresses and verify the provider object is the same logical managed resource.
Explanation
Correct Answer
B:Inspect active runs and lock metadata to determine whether another legitimate operation owns the state lock. State locking serializes state-mutating operations and helps prevent lost updates from concurrent Terraform runs. A justified correction is: Wait for or safely resolve the conflicting operation and keep backend-supported state locking enabled. This matters here because as a second engineer rehearses an infrastructure state migration, the following condition occurs: Two engineers….
Incorrect Answers
A:Inspect backend state lock records, the lock identifier, and the status of any still-running apply before unlocking. This inspects force unlock requires stale-lock verification rather than the reported state locking prevents concurrent writes issue. The decisive investigation is: Inspect active runs and lock metadata to determine whether another legitimate operation owns the state lock.
C:Inspect the terraform block for mutually incompatible cloud and backend settings and the intended HCP Terraform workspace. This inspects hcp cloud integration versus remote backend rather than the reported state locking prevents concurrent writes issue. The decisive investigation is: Inspect active runs and lock metadata to determine whether another legitimate operation owns the state lock.
D:Compare old and new resource addresses and verify the provider object is the same logical managed resource. This inspects moved block preserves state during address refactor rather than the reported state locking prevents concurrent writes issue. The decisive investigation is: Inspect active runs and lock metadata to determine whether another legitimate operation owns the state lock. This matters here because as a second engineer rehearses an infrastructure state migration, the following condition occurs: Two engineers….
Question 646
When maintaining Terraform modules used by several application teams, the following condition occurs: A module source from the public registry resolves to an unexpected major version after a new release and changes its input contract. The module interface must remain stable and reviewable. Which Terraform configuration or workflow change most directly corrects the described issue?
- Add the intended child output declaration and access it through module.network.<output_name> in the caller.
- Use for_each on the module block with a stable keyed collection and pass each.key or each.value to the child input contract.
- Add an appropriate version constraint for a registry module and review upgrades with plans and compatibility tests.
- 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:Add an appropriate version constraint for a registry module and review upgrades with plans and compatibility tests. Registry module versions follow explicit constraints; leaving compatibility open can cause unreviewed module interface changes. Confirm the cause with: Check the module source address, allowed version range and current module selections from initialization. A concrete acceptance test is: Normal CI initialization selects the reviewed compatible module version and unsupported major releases are not adopted silently. This matters here because when maintaining Terraform modules used by several application teams, the following condition occurs: A module….
Incorrect Answers
A:Add the intended child output declaration and access it through module.network.<output_name> in the caller. This could address child output exposure to calling module, but it does not correct the indicated registry module version pin to avoid breaking releases mechanism. The relevant fix is: Add an appropriate version constraint for a registry module and review upgrades with plans and compatibility tests.
B:Use for_each on the module block with a stable keyed collection and pass each.key or each.value to the child input contract. This could address for_each at module call for multiple environments, but it does not correct the indicated registry module version pin to avoid breaking releases mechanism. The relevant fix is: Add an appropriate version constraint for a registry module and review upgrades with plans and compatibility tests.
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 registry module version pin to avoid breaking releases mechanism. The relevant fix is: Add an appropriate version constraint for a registry module and review upgrades with plans and compatibility tests. This matters here because when maintaining Terraform modules used by several application teams, the following condition occurs: A module….
Question 647
During an operational review of a Terraform state backend, 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 team must preserve managed-object identity and safe collaboration. Which diagnostic check provides the strongest evidence for the underlying problem?
- Inspect the selected terraform workspace and the backend's paths used for nondefault workspace state.
- Compare old and new resource addresses and verify the provider object is the same logical managed resource.
- Compare the refreshed real object with its prior state and declared configuration to identify an outside change.
- Inspect active runs and lock metadata to determine whether another legitimate operation owns the state lock.
Explanation
Correct Answer
C:Compare the refreshed real object with its prior state and declared configuration to identify an outside change. Terraform can detect remote drift during refresh and propose changes back to declared configuration rather than treating console edits as code. A justified correction is: Review whether to restore desired IaC attributes or update configuration deliberately to adopt the observed change. This matters here because a network rule is modified directly in a cloud console and a subsequent Terraform plan proposes reverting it….
Incorrect Answers
A:Inspect the selected terraform workspace and the backend's paths used for nondefault workspace state. This inspects local workspace state separation rather than the reported out-of-band drift detection in managed resource issue. The decisive investigation is: Compare the refreshed real object with its prior state and declared configuration to identify an outside change.
B:Compare old and new resource addresses and verify the provider object is the same logical managed resource. This inspects moved block preserves state during address refactor rather than the reported out-of-band drift detection in managed resource issue. The decisive investigation is: Compare the refreshed real object with its prior state and declared configuration to identify an outside change.
D:Inspect active runs and lock metadata to determine whether another legitimate operation owns the state lock. This inspects state locking prevents concurrent writes rather than the reported out-of-band drift detection in managed resource issue. The decisive investigation is: Compare the refreshed real object with its prior state and declared configuration to identify an outside change. This matters here because a network rule is modified directly in a cloud console and a subsequent Terraform plan proposes reverting it….
Question 648
During an isolated staging rehearsal of the Terraform workflow, the following condition occurs: A CI job rejects valid HCL files because their alignment differs from canonical formatting, while engineers mistakenly change provider versions to fix it. The operator must obtain auditable evidence before touching production resources. What measurable postchange observation would confirm that the correction worked?
- Equivalent configuration is presented in consistent canonical formatting while the resource plan remains semantically unchanged.
- A full plan becomes clean after approved changes and does not conceal unrelated pending resource actions.
- The state no longer tracks the bucket and verification confirms the remote bucket and data still exist.
- The formatting gate passes without any provider upgrade or unintended managed-resource change.
Explanation
Correct Answer
D:The formatting gate passes without any provider upgrade or unintended managed-resource change. A formatting check tests canonical HCL presentation, whereas provider version resolution and configuration validity are separate concerns. It tests the correction: Reformat the affected.tf files using terraform fmt and rerun both style checking and validation independently. This matters here because a CI job rejects valid HCL files because their alignment differs from canonical formatting, while engineers….
Incorrect Answers
A:Equivalent configuration is presented in consistent canonical formatting while the resource plan remains semantically unchanged. This might validate terraform fmt normalizes hcl style, but it does not prove that ci terraform fmt check distinguishes style from validity was resolved. Confirm instead: The formatting gate passes without any provider upgrade or unintended managed-resource change. This matters here because a CI job rejects valid HCL files because their alignment differs from canonical formatting, while engineers….
B:A full plan becomes clean after approved changes and does not conceal unrelated pending resource actions. This might validate targeted apply limitations for normal changes, but it does not prove that ci terraform fmt check distinguishes style from validity was resolved. Confirm instead: The formatting gate passes without any provider upgrade or unintended managed-resource change.
C:The state no longer tracks the bucket and verification confirms the remote bucket and data still exist. This might validate selective cleanup without destroying retained object, but it does not prove that ci terraform fmt check distinguishes style from validity was resolved. Confirm instead: The formatting gate passes without any provider upgrade or unintended managed-resource change.
Question 649
While diagnosing a Terraform state or import issue in a staging workspace, the following condition occurs: An existing managed network is defined in Terraform but has never been imported, so the next plan attempts to create a duplicate resource with an already-used name. The investigator must avoid unreviewed state writes. Which TWO complementary choices identify the cause and implement the appropriate fix? Select TWO.
- Use an import block or terraform import with the correct resource address and provider-specific remote ID before a reviewed plan.
- Inspect the failure mode and select an appropriate TF_LOG verbosity level while protecting credential-bearing log data.
- Declare reviewed import blocks for known objects, plan the adoption, and reconcile configuration with the resulting resource state.
- Set TF_LOG to the intended log level together with TF_LOG_PATH and rerun the failing Terraform command.
- Compare the declared resource address and remote identifier against the selected state snapshot.
Explanation
Correct Answers
A:Use an import block or terraform import with the correct resource address and provider-specific remote ID before a reviewed plan. Import establishes a state binding for a real object; it does not automatically infer or validate the complete HCL desired configuration. Confirm the cause with: Compare the declared resource address and remote identifier against the selected state snapshot. A concrete acceptance test is: The existing object is tracked under the intended resource address and Terraform no longer proposes a duplicate creation. This forms one element of the required two-step diagnosis and correction.
E:Compare the declared resource address and remote identifier against the selected state snapshot. Import establishes a state binding for a real object; it does not automatically infer or validate the complete HCL desired configuration. A justified correction is: Use an import block or terraform import with the correct resource address and provider-specific remote ID before a reviewed plan. This forms one element of the required two-step diagnosis and correction.
Incorrect Answers
B:Inspect the failure mode and select an appropriate TF_LOG verbosity level while protecting credential-bearing log data. This relates to tf_log for troubleshooting provider and cli diagnostics rather than the matching diagnosis-and-remediation pair required here. Check: Compare the declared resource address and remote identifier against the selected state snapshot. Then change: Use an import block or terraform import with the correct resource address and provider-specific remote ID before a reviewed plan.
C:Declare reviewed import blocks for known objects, plan the adoption, and reconcile configuration with the resulting resource state. This relates to import blocks for reproducible adoption workflow rather than the matching diagnosis-and-remediation pair required here. Check: Compare the declared resource address and remote identifier against the selected state snapshot. Then change: Use an import block or terraform import with the correct resource address and provider-specific remote ID before a reviewed plan.
D:Set TF_LOG to the intended log level together with TF_LOG_PATH and rerun the failing Terraform command. This relates to tf_log_path requires enabled logging rather than the matching diagnosis-and-remediation pair required here. Check: Compare the declared resource address and remote identifier against the selected state snapshot. Then change: Use an import block or terraform import with the correct resource address and provider-specific remote ID before a reviewed plan.
Question 650
In a clean CI runner initializing a Terraform root configuration, the following condition occurs: A Terraform directory configures two accounts of the same platform but the provider blocks share a broad credential so the blast radius is unclear. The engineers must keep provider choices and identities reproducible. Which outcome most directly validates the intended fix?
- Two clean checkouts select the reviewed compatible provider binaries rather than silently upgrading independently.
- The plan uses the reviewed new compatible provider version and the updated lock file captures it for teammates.
- The child module's resources are planned under the intended alternate region rather than silently using the default provider.
- Read and write operations in one account do not gain unnecessary authorization to unrelated account resources.
Explanation
Correct Answer
D:Read and write operations in one account do not gain unnecessary authorization to unrelated account resources. Multiple provider configurations can share a plugin while representing distinct authenticated API clients. It tests the correction: Use distinct least-privilege credentials or supported role assumptions for each aliased provider and map resources explicitly.
Incorrect Answers
A:Two clean checkouts select the reviewed compatible provider binaries rather than silently upgrading independently. This might validate dependency lock file reproducible selection, but it does not prove that multiple provider instances requiring separate authentication was resolved. Confirm instead: Read and write operations in one account do not gain unnecessary authorization to unrelated account resources.
B:The plan uses the reviewed new compatible provider version and the updated lock file captures it for teammates. This might validate controlled provider upgrade using init upgrade, but it does not prove that multiple provider instances requiring separate authentication was resolved. Confirm instead: Read and write operations in one account do not gain unnecessary authorization to unrelated account resources.
C:The child module's resources are planned under the intended alternate region rather than silently using the default provider. This might validate module provider mapping for aliased configurations, but it does not prove that multiple provider instances requiring separate authentication was resolved. Confirm instead: Read and write operations in one account do not gain unnecessary authorization to unrelated account resources.