100% Latest & Updated HashiCorp Terraform Associate 004 Practice Test Questions, Exam Dumps & Verified Answers!
30 Days Free Updates, Instant Download!
Question 470
A Terraform platform team is coordinating 3 independent decisions. Workstream A: A resource was renamed from aws_instance.app to aws_instance.frontend in HCL, but it is the same underlying VM. and Workstream B: An infrastructure release creates AWS resources in two regions, with a disaster-recovery instance explicitly assigned to the second region. and Workstream C: A module emits an ordered list of three subnet IDs aligned with ordered availability zones and consumers depend on position. Select exactly 3 actions, one addressing each distinct workstream.
- Treat each module call as a distinct instance with its own passed inputs and resource addresses.
- Create a child module with declared input variables, resource blocks, and output values, then invoke it from a root module.
- Configure default and aliased AWS providers and assign the disaster-recovery resource to the alias.
- Use a list(string) or tuple with explicit ordering semantics rather than a set.
- Use an appropriate moved block to preserve the instance's state address during the refactor.
- Keep one authoritative managed address per remote object and refactor references accordingly.
Explanation
Correct Answers
C:For the workstream in which an infrastructure release creates AWS resources in two regions, with a disaster-recovery instance explicitly assigned to the second region, use this action: Configure default and aliased AWS providers and assign the disaster-recovery resource to the alias. Multiple provider configurations allow one plugin to manage distinct endpoints or regions. Verify: The plan identifies primary and recovery resources using the intended regional provider instances. Limitation: Resources cannot infer an alias from a tag or name; it must be referenced by Terraform configuration.
D:For the workstream in which a module emits an ordered list of three subnet IDs aligned with ordered availability zones and consumers depend on position, use this action: Use a list(string) or tuple with explicit ordering semantics rather than a set. List and tuple values preserve positional meaning; sets do not. Verify: The first, second, and third output elements correspond to documented ordered subnet assignments. Limitation: Order-sensitive outputs should not be built from unordered map iteration without intentional sorting.
E:For the workstream in which a resource was renamed from aws_instance.app to aws_instance.frontend in HCL, but it is the same underlying VM, use this action: Use an appropriate moved block to preserve the instance's state address during the refactor. A moved block records intentional resource address changes while preserving managed object identity. Verify: The plan reports an address move instead of unnecessary destruction and recreation. Limitation: Moved blocks need correct old/new addresses and should be reviewed for concurrent changes.
Incorrect Answers
A:This action is appropriate instead for a different, unlisted requirement: Two module instances share the same source but have different input maps, and an engineer expects identical endpoint addresses. It would be checked by: The plan displays separate module.alpha and module.beta resource addresses with their respective values. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.
B:This action is appropriate instead for a different, unlisted requirement: A team is packaging a repeated VPC pattern and wants a stable interface for internal consumers. It would be checked by: Consumers can pass environment-specific inputs and receive selected outputs without editing child internals. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.
F:This action is appropriate instead for a different, unlisted requirement: An engineer is importing one cloud instance but attempts to assign the same remote object to two Terraform resource addresses. It would be checked by: State inspection shows the imported instance at a single intended address. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.
Question 471
An infrastructure team faces this specific situation: A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. Which Terraform action most directly satisfies the requirement?
- Run a refresh-only plan, review its state changes, and apply refresh-only if the update is appropriate.
- Use supported environment-based backend credentials or identity rather than embedding credentials in backend configuration.
- Ignore .terraform and protect state while committing the intended HCL and provider dependency lock file.
- Check the exact backend's current locking configuration and version-specific requirements before assuming locks work.
Explanation
Correct Answer
A:Run a refresh-only plan, review its state changes, and apply refresh-only if the update is appropriate. Refresh-only updates Terraform's recorded understanding rather than enforcing desired configuration. Verify: State and root outputs synchronize with observed remote data without changing the cloud object itself. Limitation: Refresh-only does not make configuration match reality or prevent later normal plans from proposing remediation.
Incorrect Answers
B:This is linked to a different situation: A security review finds AWS access keys passed in -backend-config and wants to reduce secret persistence in initialization files. There the relevant decision is: Use supported environment-based backend credentials or identity rather than embedding credentials in backend configuration. For the question's actual requirement — A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. — the specifically relevant decision is: Run a refresh-only plan, review its state changes, and apply refresh-only if the update is appropriate. It would therefore not resolve or assess the case as stated.
C:This is linked to a different situation: An engineer wants to commit the local .terraform directory to source control because it contains provider caches and backend settings. There the relevant decision is: Ignore .terraform and protect state while committing the intended HCL and provider dependency lock file. For the question's actual requirement — A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. — the specifically relevant decision is: Run a refresh-only plan, review its state changes, and apply refresh-only if the update is appropriate. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: An engineer asks whether selecting an S3 bucket as remote storage automatically guarantees supported state locking under every Terraform/backend version. There the relevant decision is: Check the exact backend's current locking configuration and version-specific requirements before assuming locks work. For the question's actual requirement — A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. — the specifically relevant decision is: Run a refresh-only plan, review its state changes, and apply refresh-only if the update is appropriate. It would therefore not resolve or assess the case as stated.
Question 472
A reviewer is confirming a change for the following use case: A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. The implementation follows this approach: Run a refresh-only plan, review its state changes, and apply refresh-only if the update is appropriate. Which observation or acceptance test most directly verifies the intended result?
- terraform init reports the selected backend and plan reads the correct shared state.
- State and root outputs synchronize with observed remote data without changing the cloud object itself.
- The destination backend reflects the prior managed resource addresses and lineage after migration.
- Backend initialization succeeds without static access keys embedded in .terraform or saved plan artifacts.
Explanation
Correct Answer
B:Acceptance evidence: State and root outputs synchronize with observed remote data without changing the cloud object itself. It validates the proposed action, run a refresh-only plan, review its state changes, and apply refresh-only if the update is appropriate, because refresh-only updates Terraform's recorded understanding rather than enforcing desired configuration. Remaining limitation: Refresh-only does not make configuration match reality or prevent later normal plans from proposing remediation.
Incorrect Answers
A:This is linked to a different situation: A new environment needs to save state in a specific shared backend, and the team attempts to write backend settings under a resource block. There the relevant acceptance is: terraform init reports the selected backend and plan reads the correct shared state. For the question's actual requirement — A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. — the specifically relevant acceptance is: State and root outputs synchronize with observed remote data without changing the cloud object itself. It would therefore not resolve or assess the case as stated.
C:This is linked to a different situation: A migration changes a backend location but the team must preserve all existing state bindings. There the relevant acceptance is: The destination backend reflects the prior managed resource addresses and lineage after migration. For the question's actual requirement — A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. — the specifically relevant acceptance is: State and root outputs synchronize with observed remote data without changing the cloud object itself. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: A security review finds AWS access keys passed in -backend-config and wants to reduce secret persistence in initialization files. There the relevant acceptance is: Backend initialization succeeds without static access keys embedded in .terraform or saved plan artifacts. For the question's actual requirement — A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. — the specifically relevant acceptance is: State and root outputs synchronize with observed remote data without changing the cloud object itself. It would therefore not resolve or assess the case as stated.
Question 473
Consider a proposed solution for this requirement: A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. The team plans to do the following: Run a refresh-only plan, review its state changes, and apply refresh-only if the update is appropriate. Which limitation or operational caveat must remain in the review?
- Refresh-only does not make configuration match reality or prevent later normal plans from proposing remediation.
- A repo may use a remote backend, but local initialization data can still expose backend credentials.
- State can contain sensitive values and should be protected against accidental exposure or competing writers.
- Storage location alone does not prove the required locking mechanism is configured or supported.
Explanation
Correct Answer
A:The limitation is refresh-only does not make configuration match reality or prevent later normal plans from proposing remediation. The proposed change is run a refresh-only plan, review its state changes, and apply refresh-only if the update is appropriate. Validate it by checking state and root outputs synchronize with observed remote data without changing the cloud object itself. Refresh-only updates Terraform's recorded understanding rather than enforcing desired configuration.
Incorrect Answers
B:This is linked to a different situation: An engineer wants to commit the local .terraform directory to source control because it contains provider caches and backend settings. There the relevant limitation is: A repo may use a remote backend, but local initialization data can still expose backend credentials. For the question's actual requirement — A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. — the specifically relevant limitation is: Refresh-only does not make configuration match reality or prevent later normal plans from proposing remediation. It would therefore not resolve or assess the case as stated.
C:This is linked to a different situation: A developer uses a fresh local Terraform directory with no backend block and asks where state will be written after apply. There the relevant limitation is: State can contain sensitive values and should be protected against accidental exposure or competing writers. For the question's actual requirement — A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. — the specifically relevant limitation is: Refresh-only does not make configuration match reality or prevent later normal plans from proposing remediation. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: An engineer asks whether selecting an S3 bucket as remote storage automatically guarantees supported state locking under every Terraform/backend version. There the relevant limitation is: Storage location alone does not prove the required locking mechanism is configured or supported. For the question's actual requirement — A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. — the specifically relevant limitation is: Refresh-only does not make configuration match reality or prevent later normal plans from proposing remediation. It would therefore not resolve or assess the case as stated.
Question 474
The team is reviewing a Terraform implementation for this case: A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. Which tempting assumption would be specifically incorrect for this proposed implementation?
- Run a normal apply and assume it only refreshes state while never changing infrastructure.
- Keep separate laptop-local states and manually merge their JSON content after each apply.
- Retry with -lock=false while the other pipeline is actively writing the same state.
- Assume the word remote guarantees every backend acquires a lock for every state write.
Explanation
Correct Answer
A:Reject the assumption: Run a normal apply and assume it only refreshes state while never changing infrastructure. Instead, run a refresh-only plan, review its state changes, and apply refresh-only if the update is appropriate. Refresh-only updates Terraform's recorded understanding rather than enforcing desired configuration. Acceptance evidence: State and root outputs synchronize with observed remote data without changing the cloud object itself.
Incorrect Answers
B:This is linked to a different situation: A team's state file is stored on a laptop and must be shared across several engineers without copying it manually after every change. There the relevant misconception is: Keep separate laptop-local states and manually merge their JSON content after each apply. For the question's actual requirement — A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. — the specifically relevant misconception is: Run a normal apply and assume it only refreshes state while never changing infrastructure. It would therefore not resolve or assess the case as stated.
C:This is linked to a different situation: Two release pipelines try to update the same remote state simultaneously and one sees a lock-acquisition failure. There the relevant misconception is: Retry with -lock=false while the other pipeline is actively writing the same state. For the question's actual requirement — A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. — the specifically relevant misconception is: Run a normal apply and assume it only refreshes state while never changing infrastructure. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: An engineer asks whether selecting an S3 bucket as remote storage automatically guarantees supported state locking under every Terraform/backend version. There the relevant misconception is: Assume the word remote guarantees every backend acquires a lock for every state write. For the question's actual requirement — A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. — the specifically relevant misconception is: Run a normal apply and assume it only refreshes state while never changing infrastructure. It would therefore not resolve or assess the case as stated.
Question 475
A Terraform platform team is coordinating 2 independent decisions. Workstream A: A company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet. and Workstream B: A child network module expects two AWS provider aliases, but the root module has only passed its default provider. Select exactly 2 actions, one addressing each distinct workstream.
- Run a refresh-only plan, review its state changes, and apply refresh-only if the update is appropriate.
- Declare an input variable with type number and an appropriate default, overriding it per environment when needed.
- Use lifecycle ignore_changes for the specifically shared tag attribute after agreeing which system owns it.
- Use a supported HCP Terraform API-driven workflow and upload a configuration version to the intended workspace.
- Declare configuration_aliases in the child and pass the intended configurations through module.providers.
Explanation
Correct Answers
A:For the workstream in which a company intentionally altered remote settings and wants Terraform state to reflect the real objects without proposing configuration-driven remediation yet, use this action: Run a refresh-only plan, review its state changes, and apply refresh-only if the update is appropriate. Refresh-only updates Terraform's recorded understanding rather than enforcing desired configuration. Verify: State and root outputs synchronize with observed remote data without changing the cloud object itself. Limitation: Refresh-only does not make configuration match reality or prevent later normal plans from proposing remediation.
E:For the workstream in which a child network module expects two AWS provider aliases, but the root module has only passed its default provider, use this action: Declare configuration_aliases in the child and pass the intended configurations through module.providers. Provider maps and alias declarations make cross-module provider association explicit. Verify: The child resource plans with the specifically mapped source and destination provider aliases. Limitation: Aliased provider instances are not inherited automatically by a child module.
Incorrect Answers
B:This option addresses a separate requirement: A deployment needs separate port numbers per environment and a documented default for developer sandboxes. Evidence for that other requirement would be plans show environment-specific port values while preserving the declared type constraint; neither listed workstream asks for it.
C:This option addresses a separate requirement: A managed resource's tag is updated by an external compliance agent, and Terraform must not revert only that tag on every plan. Evidence for that other requirement would be subsequent plans avoid proposing updates solely because the ignored tag changed outside Terraform; neither listed workstream asks for it.
D:This option addresses a separate requirement: An automation tool needs to submit a Terraform plan without relying on a VCS webhook workflow. Evidence for that other requirement would be a controlled run is created from the uploaded configuration version with the right workspace inputs; neither listed workstream asks for it.
Question 476
An infrastructure team faces this specific situation: A managed object should stop being controlled by Terraform while remaining physically available. Which Terraform action most directly satisfies the requirement?
- Use a reviewed removed block with destroy = false or a careful terraform state rm operation to forget its binding.
- Expect the default local backend to manage a terraform.tfstate file in the working directory.
- Let the state lock serialize operations and retry after the active writer finishes.
- Check the exact backend's current locking configuration and version-specific requirements before assuming locks work.
Explanation
Correct Answer
A:Use a reviewed removed block with destroy = false or a careful terraform state rm operation to forget its binding. Removing a state binding without destroying the object changes management ownership rather than infrastructure existence. Verify: Terraform no longer lists the address as managed, while the remote object remains available. Limitation: If configuration still declares the object, a normal later plan may attempt to create it again.
Incorrect Answers
B:This is linked to a different situation: A developer uses a fresh local Terraform directory with no backend block and asks where state will be written after apply. There the relevant decision is: Expect the default local backend to manage a terraform.tfstate file in the working directory. For the question's actual requirement — A managed object should stop being controlled by Terraform while remaining physically available. — the specifically relevant decision is: Use a reviewed removed block with destroy = false or a careful terraform state rm operation to forget its binding. It would therefore not resolve or assess the case as stated.
C:This is linked to a different situation: Two release pipelines try to update the same remote state simultaneously and one sees a lock-acquisition failure. There the relevant decision is: Let the state lock serialize operations and retry after the active writer finishes. For the question's actual requirement — A managed object should stop being controlled by Terraform while remaining physically available. — the specifically relevant decision is: Use a reviewed removed block with destroy = false or a careful terraform state rm operation to forget its binding. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: An engineer asks whether selecting an S3 bucket as remote storage automatically guarantees supported state locking under every Terraform/backend version. There the relevant decision is: Check the exact backend's current locking configuration and version-specific requirements before assuming locks work. For the question's actual requirement — A managed object should stop being controlled by Terraform while remaining physically available. — the specifically relevant decision is: Use a reviewed removed block with destroy = false or a careful terraform state rm operation to forget its binding. It would therefore not resolve or assess the case as stated.
Question 477
A reviewer is confirming a change for the following use case: A managed object should stop being controlled by Terraform while remaining physically available. The implementation follows this approach: Use a reviewed removed block with destroy = false or a careful terraform state rm operation to forget its binding. Which observation or acceptance test most directly verifies the intended result?
- State operations resume without releasing a lock held by an active independent job.
- Terraform no longer lists the address as managed, while the remote object remains available.
- Multiple team members read one central state snapshot and serialized operations when the backend supports locking.
- The destination backend reflects the prior managed resource addresses and lineage after migration.
Explanation
Correct Answer
B:Acceptance evidence: Terraform no longer lists the address as managed, while the remote object remains available. It validates the proposed action, use a reviewed removed block with destroy = false or a careful terraform state rm operation to forget its binding, because removing a state binding without destroying the object changes management ownership rather than infrastructure existence. Remaining limitation: If configuration still declares the object, a normal later plan may attempt to create it again.
Incorrect Answers
A:This is linked to a different situation: A Terraform job crashed and left a stale lock, but the team has not verified whether any other run is active. There the relevant acceptance is: State operations resume without releasing a lock held by an active independent job. For the question's actual requirement — A managed object should stop being controlled by Terraform while remaining physically available. — the specifically relevant acceptance is: Terraform no longer lists the address as managed, while the remote object remains available. It would therefore not resolve or assess the case as stated.
C:This is linked to a different situation: A team's state file is stored on a laptop and must be shared across several engineers without copying it manually after every change. There the relevant acceptance is: Multiple team members read one central state snapshot and serialized operations when the backend supports locking. For the question's actual requirement — A managed object should stop being controlled by Terraform while remaining physically available. — the specifically relevant acceptance is: Terraform no longer lists the address as managed, while the remote object remains available. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: A migration changes a backend location but the team must preserve all existing state bindings. There the relevant acceptance is: The destination backend reflects the prior managed resource addresses and lineage after migration. For the question's actual requirement — A managed object should stop being controlled by Terraform while remaining physically available. — the specifically relevant acceptance is: Terraform no longer lists the address as managed, while the remote object remains available. It would therefore not resolve or assess the case as stated.
Question 478
Consider a proposed solution for this requirement: A managed object should stop being controlled by Terraform while remaining physically available. The team plans to do the following: Use a reviewed removed block with destroy = false or a careful terraform state rm operation to forget its binding. Which limitation or operational caveat must remain in the review?
- Backend arguments cannot reference ordinary input variables or data-source attributes.
- A repo may use a remote backend, but local initialization data can still expose backend credentials.
- If configuration still declares the object, a normal later plan may attempt to create it again.
- Backend configuration data can be captured in local initialization metadata and plan files.
Explanation
Correct Answer
C:The limitation is if configuration still declares the object, a normal later plan may attempt to create it again. The proposed change is use a reviewed removed block with destroy = false or a careful terraform state rm operation to forget its binding. Validate it by checking terraform no longer lists the address as managed, while the remote object remains available. Removing a state binding without destroying the object changes management ownership rather than infrastructure existence.
Incorrect Answers
A:This is linked to a different situation: A new environment needs to save state in a specific shared backend, and the team attempts to write backend settings under a resource block. There the relevant limitation is: Backend arguments cannot reference ordinary input variables or data-source attributes. For the question's actual requirement — A managed object should stop being controlled by Terraform while remaining physically available. — the specifically relevant limitation is: If configuration still declares the object, a normal later plan may attempt to create it again. It would therefore not resolve or assess the case as stated.
B:This is linked to a different situation: An engineer wants to commit the local .terraform directory to source control because it contains provider caches and backend settings. There the relevant limitation is: A repo may use a remote backend, but local initialization data can still expose backend credentials. For the question's actual requirement — A managed object should stop being controlled by Terraform while remaining physically available. — the specifically relevant limitation is: If configuration still declares the object, a normal later plan may attempt to create it again. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: A security review finds AWS access keys passed in -backend-config and wants to reduce secret persistence in initialization files. There the relevant limitation is: Backend configuration data can be captured in local initialization metadata and plan files. For the question's actual requirement — A managed object should stop being controlled by Terraform while remaining physically available. — the specifically relevant limitation is: If configuration still declares the object, a normal later plan may attempt to create it again. It would therefore not resolve or assess the case as stated.
Question 479
The team is reviewing a Terraform implementation for this case: A managed object should stop being controlled by Terraform while remaining physically available. Which tempting assumption would be specifically incorrect for this proposed implementation?
- Retry with -lock=false while the other pipeline is actively writing the same state.
- Use terraform init -reconfigure as if it always copies state to a new backend.
- Run terraform destroy to remove the state binding while guaranteeing the live object survives.
- Keep simultaneous cloud and backend blocks and expect Terraform to merge their state locations.
Explanation
Correct Answer
C:Reject the assumption: Run terraform destroy to remove the state binding while guaranteeing the live object survives. Instead, use a reviewed removed block with destroy = false or a careful terraform state rm operation to forget its binding. Removing a state binding without destroying the object changes management ownership rather than infrastructure existence. Acceptance evidence: Terraform no longer lists the address as managed, while the remote object remains available.
Incorrect Answers
A:This is linked to a different situation: Two release pipelines try to update the same remote state simultaneously and one sees a lock-acquisition failure. There the relevant misconception is: Retry with -lock=false while the other pipeline is actively writing the same state. For the question's actual requirement — A managed object should stop being controlled by Terraform while remaining physically available. — the specifically relevant misconception is: Run terraform destroy to remove the state binding while guaranteeing the live object survives. It would therefore not resolve or assess the case as stated.
B:This is linked to a different situation: A migration changes a backend location but the team must preserve all existing state bindings. There the relevant misconception is: Use terraform init -reconfigure as if it always copies state to a new backend. For the question's actual requirement — A managed object should stop being controlled by Terraform while remaining physically available. — the specifically relevant misconception is: Run terraform destroy to remove the state binding while guaranteeing the live object survives. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: A Terraform configuration contains both a cloud block and a backend block while planning to use HCP Terraform remote execution. There the relevant misconception is: Keep simultaneous cloud and backend blocks and expect Terraform to merge their state locations. For the question's actual requirement — A managed object should stop being controlled by Terraform while remaining physically available. — the specifically relevant misconception is: Run terraform destroy to remove the state binding while guaranteeing the live object survives. It would therefore not resolve or assess the case as stated.
Question 480
A Terraform platform team is coordinating 3 independent decisions. Workstream A: A managed object should stop being controlled by Terraform while remaining physically available. and Workstream B: A security team calls the same reusable child module twice, once under each of two cloud accounts. and Workstream C: An application team must create one DNS record per hostname from a stable set of known domain names. Select exactly 3 actions, one addressing each distinct workstream.
- Reuse one reviewed Terraform module with explicit environment inputs instead of independently editing each deployment.
- Attach an appropriate policy set to relevant HCP workspaces and configure an enforcement level that blocks noncompliant applies.
- Pass a different root provider configuration into each module call through its providers map.
- Refer to the indexed module instance, such as module.worker[1].endpoint, with an appropriate count expression.
- Use for_each over a suitable set or map to create stable keyed resource instances.
- Use a reviewed removed block with destroy = false or a careful terraform state rm operation to forget its binding.
Explanation
Correct Answers
C:For the workstream in which a security team calls the same reusable child module twice, once under each of two cloud accounts, use this action: Pass a different root provider configuration into each module call through its providers map. Provider instances are configured at the root and passed to module instances as needed. Verify: Each module instance is associated with the correct account provider during plan. Limitation: Do not put shared provider configuration blocks inside a modern reusable child module to solve this mapping.
E:For the workstream in which an application team must create one DNS record per hostname from a stable set of known domain names, use this action: Use for_each over a suitable set or map to create stable keyed resource instances. for_each is useful when each instance has a stable logical key. Verify: A change to one hostname affects its keyed address instead of renumbering unrelated instances. Limitation: Removing or renaming a key can still destroy or replace that keyed resource instance.
F:For the workstream in which a managed object should stop being controlled by Terraform while remaining physically available, use this action: Use a reviewed removed block with destroy = false or a careful terraform state rm operation to forget its binding. Removing a state binding without destroying the object changes management ownership rather than infrastructure existence. Verify: Terraform no longer lists the address as managed, while the remote object remains available. Limitation: If configuration still declares the object, a normal later plan may attempt to create it again.
Incorrect Answers
A:This action is appropriate instead for a different, unlisted requirement: Two branches of a retailer deploy similar staging clusters, but each hand-built cluster gradually acquires different firewall rules. It would be checked by: Review version-control diffs and compare planned firewall changes for both environments. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.
B:This action is appropriate instead for a different, unlisted requirement: A governance team wants to prevent deployments of cloud resources that violate a mandatory tagging policy after plan evaluation. It would be checked by: A test run violating the rule is stopped at policy evaluation unless an explicitly permitted override applies. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.
D:This action is appropriate instead for a different, unlisted requirement: A deployment calls a reusable module with count = 3 and must reference the output of only the second instance. It would be checked by: The plan resolves the output for the intended counted module instance. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.
HashiCorp Certified: Terraform Associate (004) (Terraform Associate 004) Practice Tests