cert
cert-1
cert-2

Pass HashiCorp Terraform Associate 004 Exam in First Attempt Guaranteed!

Get 100% Latest Exam Questions, Accurate & Verified Answers to Pass the Actual Exam!
30 Days Free Updates, Instant Download!

cert-5
cert-6
Terraform Associate 004 Exam - Verified By Experts
Terraform Associate 004 Premium Bundle
$29.98

Terraform Associate 004 Premium Bundle

$79.99
$109.97
  • Premium File 167 Questions & Answers. Last update: Nov 28, 2026
  • Training Course 118 Video Lectures
  • Study Guide 285 Pages
 
$109.97
$79.99
accept 60 downloads in last 7 days
block-screenshots
Purchase HashiCorp Terraform Associate 004 Exam Training Products Individually
HashiCorp Terraform Associate 004 Premium File
Premium File 167 Q&A
$76.99$69.99
HashiCorp Terraform Associate 004 Video Training Course
Training Course 118 Lectures
$21.99 $19.99
HashiCorp Terraform Associate 004 PDF Study Guide
Study Guide 285 Pages
$21.99 $19.99
HashiCorp Terraform Associate 004 Practice Test 40

Question 390

During an isolated staging rehearsal of the Terraform workflow, the following condition occurs: Two contributors produce equivalent Terraform expressions using inconsistent spacing and indentation, causing noisy reviews despite no actual infrastructure differences. The operator must obtain auditable evidence before touching production resources. Which proposed remediation solves this failure without masking its cause?

  1. Use terraform validate to catch configuration errors and separately run plan or controlled provider checks to assess remote feasibility.
  2. Reformat the affected .tf files using terraform fmt and rerun both style checking and validation independently.
  3. Execute terraform init in the root configuration directory and resolve backend or provider setup failures before planning.
  4. Run terraform fmt or terraform fmt -recursive where intended, then review the resulting source formatting changes.

Explanation

Correct Answer

D:

Run terraform fmt or terraform fmt -recursive where intended, then review the resulting source formatting changes. terraform fmt standardizes syntax layout; it is not a validation of cloud permissions or a deployment action. Confirm the cause with: Inspect the current HCL formatting and whether a standard terraform fmt check flags style-only differences. A concrete acceptance test is: Equivalent configuration is presented in consistent canonical formatting while the resource plan remains semantically unchanged.

Incorrect Answers

A:

Use terraform validate to catch configuration errors and separately run plan or controlled provider checks to assess remote feasibility. This could address terraform validate versus cloud permission testing, but it does not correct the indicated terraform fmt normalizes hcl style mechanism. The relevant fix is: Run terraform fmt or terraform fmt -recursive where intended, then review the resulting source formatting changes.

B:

Reformat the affected.tf files using terraform fmt and rerun both style checking and validation independently. This could address ci terraform fmt check distinguishes style from validity, but it does not correct the indicated terraform fmt normalizes hcl style mechanism. The relevant fix is: Run terraform fmt or terraform fmt -recursive where intended, then review the resulting source formatting changes.

C:

Execute terraform init in the root configuration directory and resolve backend or provider setup failures before planning. This could address terraform init backend and provider preparation, but it does not correct the indicated terraform fmt normalizes hcl style mechanism. The relevant fix is: Run terraform fmt or terraform fmt -recursive where intended, then review the resulting source formatting changes.

Question 391

When reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: An application service needs a policy attachment completed before creating a dependent service, but no attribute reference exists to order the two operations. The engineer must respect declared resource contracts and data security boundaries. Which proposed remediation solves this failure without masking its cause?

  1. Express the necessary dependency explicitly or reference a resource attribute so the lookup can occur when its prerequisite exists.
  2. Declare the token input as ephemeral = true and pass it only into compatible runtime contexts such as provider configuration.
  3. Use lifecycle create_before_destroy when the platform allows coexistence and design unique names or a controlled cutover if required.
  4. Add an explicit depends_on reference to the necessary policy attachment where an ordinary attribute reference cannot express the relationship.

Explanation

Correct Answer

D:

Add an explicit depends_on reference to the necessary policy attachment where an ordinary attribute reference cannot express the relationship. depends_on expresses dependencies that cannot be inferred from configuration values, but unnecessary broad dependencies add conservatism. Confirm the cause with: Inspect the graph for a dependency edge and confirm the service genuinely requires the policy to exist first. A concrete acceptance test is: The plan orders the policy attachment before the application service, and the service no longer races its prerequisite.

Incorrect Answers

A:

Express the necessary dependency explicitly or reference a resource attribute so the lookup can occur when its prerequisite exists. This could address data source read ordering versus creation, but it does not correct the indicated explicit depends_on for behavior-only dependencies mechanism. The relevant fix is: Add an explicit depends_on reference to the necessary policy attachment where an ordinary attribute reference cannot express the relationship.

B:

Declare the token input as ephemeral = true and pass it only into compatible runtime contexts such as provider configuration. This could address ephemeral variable for short-lived token in terraform 1.12, but it does not correct the indicated explicit depends_on for behavior-only dependencies mechanism. The relevant fix is: Add an explicit depends_on reference to the necessary policy attachment where an ordinary attribute reference cannot express the relationship.

C:

Use lifecycle create_before_destroy when the platform allows coexistence and design unique names or a controlled cutover if required. This could address create_before_destroy lifecycle for availability, but it does not correct the indicated explicit depends_on for behavior-only dependencies mechanism. The relevant fix is: Add an explicit depends_on reference to the necessary policy attachment where an ordinary attribute reference cannot express the relationship.

Question 392

During an isolated staging rehearsal of the Terraform workflow, the following condition occurs: A test team runs terraform destroy from a shared state backend believing it removes only the temporary virtual machine they recently created. The operator must obtain auditable evidence before touching production resources. What measurable postchange observation would confirm that the correction worked?

  1. A reviewed apply changes only the intended managed attribute and the subsequent plan shows no unexpected pending action.
  2. A planned change is inspected before approval, then the resulting infrastructure matches the reviewed configuration where supported.
  3. The state no longer tracks the bucket and verification confirms the remote bucket and data still exist.
  4. Only the intended disposable environment's managed objects are removed and shared production resources remain in separate state.

Explanation

Correct Answer

D:

Only the intended disposable environment's managed objects are removed and shared production resources remain in separate state. Terraform destroy targets the managed resources recorded in the selected state, not only the objects recently added by one operator. It tests the correction: Use a dedicated isolated workspace/state and inspect terraform plan -destroy before removing its tracked infrastructure.

Incorrect Answers

A:

A reviewed apply changes only the intended managed attribute and the subsequent plan shows no unexpected pending action. This might validate workflow repeatability after configuration change, but it does not prove that terraform destroy is managed-scope deletion was resolved. Confirm instead: Only the intended disposable environment's managed objects are removed and shared production resources remain in separate state.

B:

A planned change is inspected before approval, then the resulting infrastructure matches the reviewed configuration where supported. This might validate core write plan apply workflow order, but it does not prove that terraform destroy is managed-scope deletion was resolved. Confirm instead: Only the intended disposable environment's managed objects are removed and shared production resources remain in separate state.

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 terraform destroy is managed-scope deletion was resolved. Confirm instead: Only the intended disposable environment's managed objects are removed and shared production resources remain in separate state.

Question 393

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. What should the engineer inspect FIRST to distinguish this issue from unrelated failures?

  1. Inspect the child module output declarations and the root's module block name and available output values.
  2. Inspect the provider resource schema for supported write-only arguments and associated rotation or version requirements.
  3. Inspect the variable's ephemeral setting and whether downstream use is an allowed ephemeral context such as provider configuration.
  4. Inspect the declared for_each keys, current state addresses, and references elsewhere in the configuration.

Explanation

Correct Answer

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 matters here because when reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: A database….

Incorrect Answers

A:

Inspect the child module output declarations and the root's module block name and available output values. This inspects module output references across composition rather than the reported write-only provider argument for managed secret rotation issue. The decisive investigation is: Inspect the provider resource schema for supported write-only arguments and associated rotation or version requirements.

C:

Inspect the variable's ephemeral setting and whether downstream use is an allowed ephemeral context such as provider configuration. This inspects ephemeral variable for short-lived token in terraform 1.12 rather than the reported write-only provider argument for managed secret rotation issue. The decisive investigation is: Inspect the provider resource schema for supported write-only arguments and associated rotation or version requirements. This matters here because when reviewing a reusable Terraform HCL configuration before deployment, the following condition occurs: A database….

D:

Inspect the declared for_each keys, current state addresses, and references elsewhere in the configuration. This inspects resource addressing with repeated instances rather than the reported write-only provider argument for managed secret rotation issue. The decisive investigation is: Inspect the provider resource schema for supported write-only arguments and associated rotation or version requirements.

Question 394

During a governed HCP Terraform workspace rollout, the following condition occurs: An HCP Terraform organization gives all users organization-wide apply privileges for convenience, despite only a small release team needing production access. The organization must retain auditable authorization for runs and state. Which TWO options together provide the relevant diagnosis and its targeted remediation? Select TWO.

  1. Attach supported Sentinel or OPA policies to the appropriate HCP Terraform workspaces with a suitable mandatory enforcement level.
  2. Inspect current HCP project assignments, workspace ownership patterns, and project/team permission boundaries.
  3. Review organization and workspace team roles, run permissions and audit records for sensitive environments.
  4. Create a controlled HCP Terraform variable set scoped to the intended workspaces and remove conflicting duplicated values.
  5. Grant scoped team access with read or plan permissions as appropriate, reserving apply and administration for authorized groups.

Explanation

Correct Answers

C:

Review organization and workspace team roles, run permissions and audit records for sensitive environments. Workspace team permissions separate collaboration from privileged operations and support auditable Terraform governance. A justified correction is: Grant scoped team access with read or plan permissions as appropriate, reserving apply and administration for authorized groups. This forms one element of the required two-step diagnosis and correction.

E:

Grant scoped team access with read or plan permissions as appropriate, reserving apply and administration for authorized groups. Workspace team permissions separate collaboration from privileged operations and support auditable Terraform governance. Confirm the cause with: Review organization and workspace team roles, run permissions and audit records for sensitive environments. A concrete acceptance test is: Contributors can collaborate on plans while unauthorized accounts cannot approve or apply production infrastructure changes. This forms one element of the required two-step diagnosis and correction.

Incorrect Answers

A:

Attach supported Sentinel or OPA policies to the appropriate HCP Terraform workspaces with a suitable mandatory enforcement level. This relates to hcp terraform policy enforcement governance rather than the matching diagnosis-and-remediation pair required here. Check: Review organization and workspace team roles, run permissions and audit records for sensitive environments. Then change: Grant scoped team access with read or plan permissions as appropriate, reserving apply and administration for authorized groups.

B:

Inspect current HCP project assignments, workspace ownership patterns, and project/team permission boundaries. This relates to hcp projects group workspaces by ownership rather than the matching diagnosis-and-remediation pair required here. Check: Review organization and workspace team roles, run permissions and audit records for sensitive environments. Then change: Grant scoped team access with read or plan permissions as appropriate, reserving apply and administration for authorized groups.

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: Review organization and workspace team roles, run permissions and audit records for sensitive environments. Then change: Grant scoped team access with read or plan permissions as appropriate, reserving apply and administration for authorized groups.

Question 395

As a second engineer rehearses an infrastructure state migration, the following condition occurs: A project stores a state file in a developer's home directory even though multiple engineers need consistent shared planning and state history. The operation must not delete or duplicate existing production objects. Which Terraform configuration or workflow change most directly corrects the described issue?

  1. Configure a suitable remote backend for shared operations or explicitly isolate disposable local state with restricted permissions.
  2. Declare a supported backend block with a reviewed storage location, then initialize and migrate state under controlled conditions.
  3. Use terraform force-unlock only after confirming the lock is stale and specifying its correct lock ID.
  4. Use the backend's supported environment or short-lived credential mechanism instead of hardcoding secrets into backend configuration.

Explanation

Correct Answer

B:

Declare a supported backend block with a reviewed storage location, then initialize and migrate state under controlled conditions. Terraform backend configuration selects where state snapshots are stored; migrating them requires careful initialization and authorization. Confirm the cause with: Inspect the current terraform backend declaration and permissions for the selected shared backend service. A concrete acceptance test is: Team plans use the same access-controlled state backend after migration without duplicating existing managed objects.

Incorrect Answers

A:

Configure a suitable remote backend for shared operations or explicitly isolate disposable local state with restricted permissions. This could address local backend path and exposure, but it does not correct the indicated remote backend block configuration mechanism. The relevant fix is: Declare a supported backend block with a reviewed storage location, then initialize and migrate state under controlled conditions.

C:

Use terraform force-unlock only after confirming the lock is stale and specifying its correct lock ID. This could address force unlock requires stale-lock verification, but it does not correct the indicated remote backend block configuration mechanism. The relevant fix is: Declare a supported backend block with a reviewed storage location, then initialize and migrate state under controlled conditions.

D:

Use the backend's supported environment or short-lived credential mechanism instead of hardcoding secrets into backend configuration. This could address backend credentials kept out of plan artifacts, but it does not correct the indicated remote backend block configuration mechanism. The relevant fix is: Declare a supported backend block with a reviewed storage location, then initialize and migrate state under controlled conditions.

Question 396

During a governed HCP Terraform workspace rollout, 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 organization must retain auditable authorization for runs and state. What measurable postchange observation would confirm that the correction worked?

  1. A shared setting update reaches exactly the approved workspaces while unrelated projects retain independent configuration.
  2. Teams locate and administer their approved workspaces without accidentally gaining access to unrelated project state.
  3. Plans and applies execute in the intended HCP run environment with centralized state and auditable run outcomes.
  4. An approved commit creates the intended Terraform plan run under the selected workspace without laptop-only execution.

Explanation

Correct Answer

C:

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. This matters here because a team runs Terraform independently on laptops while its shared HCP Terraform workspace is intended to control….

Incorrect Answers

A:

A shared setting update reaches exactly the approved workspaces while unrelated projects retain independent configuration. This might validate hcp workspace variable sets share scoped configuration, 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.

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. This matters here because a team runs Terraform independently on laptops while its shared HCP Terraform workspace is intended to control….

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. This matters here because a team runs Terraform independently on laptops while its shared HCP Terraform workspace is intended to control….

Question 397

During a controlled module integration test for a production Terraform stack, the following condition occurs: An automated Terraform run uses an obsolete deployment region even though an operator changed the default region in variables.tf, because another source supplies an overriding value. The desired fix must avoid unrelated resource changes. Which TWO options together provide the relevant diagnosis and its targeted remediation? Select TWO.

  1. Inspect the input values and expressions used to construct resource names and tags.
  2. Provide the required region input through the module call or a supported root variable assignment mechanism.
  3. Use an appropriate map type with key-based lookup or redesign the input as a list if order-based indexing is truly intended.
  4. Inspect command-line var flags, tfvars files, Terraform variable environment entries, and workspace variable values.
  5. Remove or update the overriding variable source and make the intended region input explicit for the controlled run.

Explanation

Correct Answers

D:

Inspect command-line var flags, tfvars files, Terraform variable environment entries, and workspace variable values. Terraform variable defaults apply only when no higher-precedence assignment supplies a different value. A justified correction is: Remove or update the overriding variable source and make the intended region input explicit for the controlled run. 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: An….

E:

Remove or update the overriding variable source and make the intended region input explicit for the controlled run. Terraform variable defaults apply only when no higher-precedence assignment supplies a different value. Confirm the cause with: Inspect command-line var flags, tfvars files, Terraform variable environment entries, and workspace variable values. A concrete acceptance test is: The plan records the authorized region value, and a second run produces the same selection under the same variable inputs. 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: An….

Incorrect Answers

A:

Inspect the input values and expressions used to construct resource names and tags. This relates to built-in functions for deterministic naming rather than the matching diagnosis-and-remediation pair required here. Check: Inspect command-line var flags, tfvars files, Terraform variable environment entries, and workspace variable values. Then change: Remove or update the overriding variable source and make the intended region input explicit for the controlled run.

B:

Provide the required region input through the module call or a supported root variable assignment mechanism. This relates to variable default versus required input rather than the matching diagnosis-and-remediation pair required here. Check: Inspect command-line var flags, tfvars files, Terraform variable environment entries, and workspace variable values. Then change: Remove or update the overriding variable source and make the intended region input explicit for the controlled run. This matters here because during a controlled module integration test for a production Terraform stack, the following condition occurs: An….

C:

Use an appropriate map type with key-based lookup or redesign the input as a list if order-based indexing is truly intended. This relates to map versus list addressing for environment inputs rather than the matching diagnosis-and-remediation pair required here. Check: Inspect command-line var flags, tfvars files, Terraform variable environment entries, and workspace variable values. Then change: Remove or update the overriding variable source and make the intended region input explicit for the controlled run.

Question 398

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 TWO options together provide the relevant diagnosis and its targeted remediation? Select TWO.

  1. Inspect the version constraint, lock file version, and the difference between ordinary terraform init and terraform init -upgrade behavior.
  2. Install and configure the appropriate provider through terraform init so Terraform can use its resource and data source implementations.
  3. Use resource references and output values so computed identifiers resolve after creation rather than hardcoding an invented ID.
  4. Correct the provider's supported credentials or least-privilege permissions without changing a successfully installed plugin.
  5. Inspect the resource type prefixes and required_providers source mappings before running terraform init.

Explanation

Correct Answers

B:

Install and configure the appropriate provider through terraform init so Terraform can use its resource and data source implementations. Terraform core evaluates configuration and resource graphs while provider plugins implement platform-specific CRUD and read behavior. Confirm the cause with: Inspect the resource type prefixes and required_providers source mappings before running terraform init. A concrete acceptance test is: Terraform can plan supported target API operations through the selected provider plugin and reports schema errors when arguments are invalid. This forms one element of the required two-step diagnosis and correction. This matters here because in a clean CI runner initializing a Terraform root configuration, the following condition occurs: A team expects the….

E:

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 forms one element of the required two-step diagnosis and correction. This matters here because in a clean CI runner initializing a Terraform root configuration, the following condition occurs: A team expects the….

Incorrect Answers

A:

Inspect the version constraint, lock file version, and the difference between ordinary terraform init and terraform init -upgrade behavior. This relates to controlled provider upgrade using init upgrade rather than the matching diagnosis-and-remediation pair required here. Check: Inspect the resource type prefixes and required_providers source mappings before running terraform init. Then change: Install and configure the appropriate provider through terraform init so Terraform can use its resource and data source implementations.

C:

Use resource references and output values so computed identifiers resolve after creation rather than hardcoding an invented ID. This relates to resource attribute outputs supplied by state rather than the matching diagnosis-and-remediation pair required here. Check: Inspect the resource type prefixes and required_providers source mappings before running terraform init. Then change: Install and configure the appropriate provider through terraform init so Terraform can use its resource and data source implementations.

D:

Correct the provider's supported credentials or least-privilege permissions without changing a successfully installed plugin. This relates to provider authorization versus installation failure rather than the matching diagnosis-and-remediation pair required here. Check: Inspect the resource type prefixes and required_providers source mappings before running terraform init. Then change: 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….

Question 399

During a controlled Terraform CLI recovery exercise, the following condition occurs: An engineer wants to know which indexed resources are managed before a refactor but greps the Terraform source and misses instances tracked in the active state. The same infrastructure must remain managed without unintended replacements. Which TWO options together provide the relevant diagnosis and its targeted remediation? Select TWO.

  1. Use terraform state list to enumerate the actual addresses tracked in the selected workspace state.
  2. Inspect terraform state list output for complete resource addresses including count indexes, for_each keys, and module paths.
  3. Inspect the resource's provider selection, active credentials and which account owns the remote object.
  4. Use terraform state show on the selected address to review tracked attributes without changing resources.
  5. Set TF_LOG to the intended log level together with TF_LOG_PATH and rerun the failing Terraform command.

Explanation

Correct Answers

A:

Use terraform state list to enumerate the actual addresses tracked in the selected workspace state. terraform state list inspects state bindings, which can differ from textual declarations after drift or refactoring. Confirm the cause with: Inspect terraform state list output for complete resource addresses including count indexes, for_each keys, and module paths. A concrete acceptance test is: The planned refactor covers every tracked instance and does not omit resources merely because source code is abstract. This forms one element of the required two-step diagnosis and correction. This matters here because an engineer wants to know which indexed resources are managed before a refactor but greps the Terraform source and….

B:

Inspect terraform state list output for complete resource addresses including count indexes, for_each keys, and module paths. terraform state list inspects state bindings, which can differ from textual declarations after drift or refactoring. A justified correction is: Use terraform state list to enumerate the actual addresses tracked in the selected workspace state. This forms one element of the required two-step diagnosis and correction. This matters here because an engineer wants to know which indexed resources are managed before a refactor but greps the Terraform source and….

Incorrect Answers

C:

Inspect the resource's provider selection, active credentials and which account owns the remote object. This relates to import source account and provider selection rather than the matching diagnosis-and-remediation pair required here. Check: Inspect terraform state list output for complete resource addresses including count indexes, for_each keys, and module paths. Then change: Use terraform state list to enumerate the actual addresses tracked in the selected workspace state.

D:

Use terraform state show on the selected address to review tracked attributes without changing resources. This relates to state show inspects one stored resource instance rather than the matching diagnosis-and-remediation pair required here. Check: Inspect terraform state list output for complete resource addresses including count indexes, for_each keys, and module paths. Then change: Use terraform state list to enumerate the actual addresses tracked in the selected workspace state. This matters here because an engineer wants to know which indexed resources are managed before a refactor but greps the Terraform source and….

E:

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: Inspect terraform state list output for complete resource addresses including count indexes, for_each keys, and module paths. Then change: Use terraform state list to enumerate the actual addresses tracked in the selected workspace state.

Question 400

As a second engineer rehearses an infrastructure state migration, the following condition occurs: A developer switches Terraform CLI workspaces using a local backend and assumes all named workspaces write to the same terraform.tfstate file. The operation must not delete or duplicate existing production objects. Which proposed remediation solves this failure without masking its cause?

  1. Use the backend's supported environment or short-lived credential mechanism instead of hardcoding secrets into backend configuration.
  2. Use one supported state integration for the root; choose the cloud block when adopting HCP Terraform's integrated workflow.
  3. Configure a suitable remote backend for shared operations or explicitly isolate disposable local state with restricted permissions.
  4. Select the intended workspace before planning and check the corresponding workspace-specific state directory.

Explanation

Correct Answer

D:

Select the intended workspace before planning and check the corresponding workspace-specific state directory. Local backend workspaces have separate state snapshots, though they share the same configuration and local backend mechanism. Confirm the cause with: Inspect the selected terraform workspace and the backend's paths used for nondefault workspace state. A concrete acceptance test is: A plan in staging reads staging bindings while a default workspace plan remains independent. This matters here because as a second engineer rehearses an infrastructure state migration, the following condition occurs: A developer….

Incorrect Answers

A:

Use the backend's supported environment or short-lived credential mechanism instead of hardcoding secrets into backend configuration. This could address backend credentials kept out of plan artifacts, but it does not correct the indicated local workspace state separation mechanism. The relevant fix is: Select the intended workspace before planning and check the corresponding workspace-specific state directory.

B:

Use one supported state integration for the root; choose the cloud block when adopting HCP Terraform's integrated workflow. This could address hcp cloud integration versus remote backend, but it does not correct the indicated local workspace state separation mechanism. The relevant fix is: Select the intended workspace before planning and check the corresponding workspace-specific state directory.

C:

Configure a suitable remote backend for shared operations or explicitly isolate disposable local state with restricted permissions. This could address local backend path and exposure, but it does not correct the indicated local workspace state separation mechanism. The relevant fix is: Select the intended workspace before planning and check the corresponding workspace-specific state directory. This matters here because as a second engineer rehearses an infrastructure state migration, the following condition occurs: A developer….

HashiCorp Certified: Terraform Associate (004) (Terraform Associate 004) Practice Tests