Practice Exams:

HashiCorp Terraform Associate 004 Dumps

EXAM: HashiCorp Certified: Terraform Associate (004)
Verified By Experts
Premium Bundle
$40.00
$59.97 $99.97

Terraform Associate 004 Premium Bundle


  • Premium File 167 Questions & Answers
  • Training Course 118 Lectures
  • Study Guide 285 Pages

HashiCorp Terraform Associate 004 Practice Test 8

Question 70

A school district wants developers on Linux and macOS to resolve the same approved Terraform provider version for routine changes. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion. Verify: Initialize two clean working directories from the same commit and inspect terraform providers and the lock file for the expected provider source and version.
  2. Implement: Specify provider source and compatible version constraints in required_providers, commit .terraform.lock.hcl, and run terraform init with the expected platform. Verify: Compare .terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.
  3. Implement: Configure required provider aliases in a child module's configuration_aliases when necessary and pass explicit provider mappings from the calling module. Verify: Run terraform validate and a sandbox plan with a module using two aliases and inspect which account each module-managed resource targets.
  4. Implement: Specify provider source and compatible version constraints in required_providers, commit .terraform.lock.hcl, and run terraform init with the expected platform. Verify: Initialize two clean working directories from the same commit and inspect terraform providers and the lock file for the expected provider source and version.

Answer & Explanations

Correct answer: D

A.

The question is set in this situation: A school district wants developers on Linux and macOS to resolve the same approved Terraform provider version for routine changes. The test would be relevant: Initialize two clean working directories from the same commit and inspect terraform providers and the lock file for the expected provider source and version. But the offered implementation—Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.—addresses “Upgrade a selected provider deliberately using terraform init -upgrade”. The action needed here is: Specify provider source and compatible version constraints in required_providers, commit.terraform.lock.hcl, and run terraform init with the expected platform.

B.

The question is set in this situation: A school district wants developers on Linux and macOS to resolve the same approved Terraform provider version for routine changes. The action is applicable: Specify provider source and compatible version constraints in required_providers, commit.terraform.lock.hcl, and run terraform init with the expected platform. But its proposed test—Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.—addresses “Upgrade a selected provider deliberately using terraform init -upgrade”. This requirement is confirmed instead by: Initialize two clean working directories from the same commit and inspect terraform providers and the lock file for the expected provider source and version.

C.

This action/test pair addresses “Pass nondefault provider aliases explicitly into child modules”. Configure required provider aliases in a child module's configuration_aliases when necessary and pass explicit provider mappings from the calling module. Run terraform validate and a sandbox plan with a module using two aliases and inspect which account each module-managed resource targets. The case instead calls for: Specify provider source and compatible version constraints in required_providers, commit.terraform.lock.hcl, and run terraform init with the expected platform.

D.

The question is set in this situation: A school district wants developers on Linux and macOS to resolve the same approved Terraform provider version for routine changes. Specify provider source and compatible version constraints in required_providers, commit.terraform.lock.hcl, and run terraform init with the expected platform. Confirm it through this test: Initialize two clean working directories from the same commit and inspect terraform providers and the lock file for the expected provider source and version. Constraints define allowed versions while the dependency lock file captures selected checksums and selections for repeatable installs across team machines.

Question 71

A retail team needs a provider bug fix but its production environment has a tightly controlled release and change-approval window. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.
  2. Specify provider source and compatible version constraints in required_providers, commit .terraform.lock.hcl, and run terraform init with the expected platform.
  3. Configure required provider aliases in a child module's configuration_aliases when necessary and pass explicit provider mappings from the calling module.
  4. Authenticate provider plugins using approved workload identity or environment credential mechanisms and grant only the required service permissions.

Answer & Explanations

Correct answer: A

A.

Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion. The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections. Verify the result with this test: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.

B.

Specify provider source and compatible version constraints in required_providers, commit.terraform.lock.hcl, and run terraform init with the expected platform. This addresses “Use explicit provider version constraints and lock files”, where the governing principle is: Constraints define allowed versions while the dependency lock file captures selected checksums and selections for repeatable installs across team machines. The stated case instead calls for: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

C.

Configure required provider aliases in a child module's configuration_aliases when necessary and pass explicit provider mappings from the calling module. This addresses “Pass nondefault provider aliases explicitly into child modules”, where the governing principle is: Modules can inherit default providers but nondefault configurations must be passed deliberately; otherwise resources may resolve to an unintended default or lack configuration. The stated case instead calls for: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

D.

Authenticate provider plugins using approved workload identity or environment credential mechanisms and grant only the required service permissions. This addresses “Keep provider credentials out of committed HCL code”, where the governing principle is: Provider configuration selects API endpoints and authentication; putting long-lived secrets in source creates distribution and rotation risks beyond Terraform state. The stated case instead calls for: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

Question 72

A retail team needs a provider bug fix but its production environment has a tightly controlled release and change-approval window. The infrastructure engineer proposes this change: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion. Which mechanism explains why it works?

  1. Modules can inherit default providers but nondefault configurations must be passed deliberately; otherwise resources may resolve to an unintended default or lack configuration.
  2. The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections.
  3. Provider configuration selects API endpoints and authentication; putting long-lived secrets in source creates distribution and rotation risks beyond Terraform state.
  4. Constraints define allowed versions while the dependency lock file captures selected checksums and selections for repeatable installs across team machines.

Answer & Explanations

Correct answer: B

A.

Modules can inherit default providers but nondefault configurations must be passed deliberately; otherwise resources may resolve to an unintended default or lack configuration. That explains “Pass nondefault provider aliases explicitly into child modules”, not the mechanism behind the described change. The relevant principle is: The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections.

B.

The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections. The corresponding implementation is: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

C.

Provider configuration selects API endpoints and authentication; putting long-lived secrets in source creates distribution and rotation risks beyond Terraform state. That explains “Keep provider credentials out of committed HCL code”, not the mechanism behind the described change. The relevant principle is: The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections.

D.

Constraints define allowed versions while the dependency lock file captures selected checksums and selections for repeatable installs across team machines. That explains “Use explicit provider version constraints and lock files”, not the mechanism behind the described change. The relevant principle is: The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections.

Question 73

A retail team needs a provider bug fix but its production environment has a tightly controlled release and change-approval window. After implementing this change—Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.—which test most directly validates its intended outcome?

  1. Initialize two clean working directories from the same commit and inspect terraform providers and the lock file for the expected provider source and version.
  2. Compare .terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.
  3. Run an isolated plan under a restricted CI identity, confirm approved reads succeed and a protected out-of-scope API call is denied.
  4. Run terraform validate and a sandbox plan with a module using two aliases and inspect which account each module-managed resource targets.

Answer & Explanations

Correct answer: B

A.

Initialize two clean working directories from the same commit and inspect terraform providers and the lock file for the expected provider source and version. That would help test “Use explicit provider version constraints and lock files”, not the outcome required in this scenario. The relevant acceptance check is: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.

B.

Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures. This check is decisive because the upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections.

C.

Run an isolated plan under a restricted CI identity, confirm approved reads succeed and a protected out-of-scope API call is denied. That would help test “Keep provider credentials out of committed HCL code”, not the outcome required in this scenario. The relevant acceptance check is: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.

D.

Run terraform validate and a sandbox plan with a module using two aliases and inspect which account each module-managed resource targets. That would help test “Pass nondefault provider aliases explicitly into child modules”, not the outcome required in this scenario. The relevant acceptance check is: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.

Question 74

A retail team needs a provider bug fix but its production environment has a tightly controlled release and change-approval window. Which proposed shortcut most directly risks unexpected destructive changes from unreviewed provider dependency upgrades and should therefore be rejected?

  1. Change a version constraint in production and apply immediately without inspecting the selected provider binary or resulting plan changes.
  2. Delete the dependency lock file on every CI run and accept whichever newest provider happens to be published that day.
  3. Assume any child module automatically receives every caller provider alias, without declaring or mapping those provider instances.
  4. Commit a project-owner token as a literal provider argument so every developer and fork of the repository can run terraform apply.

Answer & Explanations

Correct answer: A

A.

Change a version constraint in production and apply immediately without inspecting the selected provider binary or resulting plan changes. The foreseeable failure is unexpected destructive changes from unreviewed provider dependency upgrades. The safer response is: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

B.

Delete the dependency lock file on every CI run and accept whichever newest provider happens to be published that day. That shortcut risks nonreproducible plans or breaking provider upgrades between runs. Here the specific shortcut is: Change a version constraint in production and apply immediately without inspecting the selected provider binary or resulting plan changes.

C.

Assume any child module automatically receives every caller provider alias, without declaring or mapping those provider instances. That shortcut risks module resources deployed under a wrong provider configuration. Here the specific shortcut is: Change a version constraint in production and apply immediately without inspecting the selected provider binary or resulting plan changes.

D.

Commit a project-owner token as a literal provider argument so every developer and fork of the repository can run terraform apply. That shortcut risks persistent cloud credential exposure through version history and CI artifacts. Here the specific shortcut is: Change a version constraint in production and apply immediately without inspecting the selected provider binary or resulting plan changes.

Question 75

A retail team needs a provider bug fix but its production environment has a tightly controlled release and change-approval window. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion. Verify: Initialize two clean working directories from the same commit and inspect terraform providers and the lock file for the expected provider source and version.
  2. Implement: Authenticate provider plugins using approved workload identity or environment credential mechanisms and grant only the required service permissions. Verify: Run an isolated plan under a restricted CI identity, confirm approved reads succeed and a protected out-of-scope API call is denied.
  3. Implement: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion. Verify: Compare .terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.
  4. Implement: Specify provider source and compatible version constraints in required_providers, commit .terraform.lock.hcl, and run terraform init with the expected platform. Verify: Compare .terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.

Answer & Explanations

Correct answer: C

A.

The action is applicable: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion. But its proposed test—Initialize two clean working directories from the same commit and inspect terraform providers and the lock file for the expected provider source and version.—addresses “Use explicit provider version constraints and lock files”. This requirement is confirmed instead by: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.

B.

This action/test pair addresses “Keep provider credentials out of committed HCL code”. Authenticate provider plugins using approved workload identity or environment credential mechanisms and grant only the required service permissions. Run an isolated plan under a restricted CI identity, confirm approved reads succeed and a protected out-of-scope API call is denied. The case instead calls for: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

C.

Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion. Confirm it through this test: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures. The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections.

D.

The test would be relevant: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures. But the offered implementation—Specify provider source and compatible version constraints in required_providers, commit.terraform.lock.hcl, and run terraform init with the expected platform.—addresses “Use explicit provider version constraints and lock files”. The action needed here is: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

Question 76

A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Declare separate provider blocks with an alias and use the resource provider meta-argument to bind individual resources to the intended region or account.
  2. Specify provider source and compatible version constraints in required_providers, commit .terraform.lock.hcl, and run terraform init with the expected platform.
  3. Store state securely and let Terraform maintain the mapping between resource addresses and remote identifiers during reviewed apply operations.
  4. Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

Answer & Explanations

Correct answer: D

A.

Declare separate provider blocks with an alias and use the resource provider meta-argument to bind individual resources to the intended region or account. This addresses “Select aliased provider configurations for a second region”, where the governing principle is: Terraform selects the default provider unless an explicit alias is passed; each aliased instance carries its own endpoints and credential context. The stated case instead calls for: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

B.

The question is set in this situation: A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. Specify provider source and compatible version constraints in required_providers, commit.terraform.lock.hcl, and run terraform init with the expected platform. This addresses “Use explicit provider version constraints and lock files”, where the governing principle is: Constraints define allowed versions while the dependency lock file captures selected checksums and selections for repeatable installs across team machines. The stated case instead calls for: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

C.

Store state securely and let Terraform maintain the mapping between resource addresses and remote identifiers during reviewed apply operations. This addresses “Treat Terraform state as a resource-instance binding record”, where the governing principle is: State records identities and relevant resource attributes so Terraform can detect changes; deleting it does not automatically delete the remote infrastructure. The stated case instead calls for: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

D.

The question is set in this situation: A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion. The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections. Verify the result with this test: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.

Question 77

A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. The infrastructure engineer proposes this change: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion. Which mechanism explains why it works?

  1. The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections.
  2. Constraints define allowed versions while the dependency lock file captures selected checksums and selections for repeatable installs across team machines.
  3. State records identities and relevant resource attributes so Terraform can detect changes; deleting it does not automatically delete the remote infrastructure.
  4. Terraform selects the default provider unless an explicit alias is passed; each aliased instance carries its own endpoints and credential context.

Answer & Explanations

Correct answer: A

A.

The question is set in this situation: A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections. The corresponding implementation is: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

B.

The question is set in this situation: A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. Constraints define allowed versions while the dependency lock file captures selected checksums and selections for repeatable installs across team machines. That explains “Use explicit provider version constraints and lock files”, not the mechanism behind the described change. The relevant principle is: The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections.

C.

State records identities and relevant resource attributes so Terraform can detect changes; deleting it does not automatically delete the remote infrastructure. That explains “Treat Terraform state as a resource-instance binding record”, not the mechanism behind the described change. The relevant principle is: The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections.

D.

Terraform selects the default provider unless an explicit alias is passed; each aliased instance carries its own endpoints and credential context. That explains “Select aliased provider configurations for a second region”, not the mechanism behind the described change. The relevant principle is: The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections.

Question 78

A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. After implementing this change—Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.—which test most directly validates its intended outcome?

  1. Apply a disposable resource, inspect its state address and remote ID, then plan again without modifying state manually to confirm a no-change result.
  2. Compare .terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.
  3. Plan two disposable resources with distinct provider aliases and verify the expected region and account are recorded for each object.
  4. Initialize two clean working directories from the same commit and inspect terraform providers and the lock file for the expected provider source and version.

Answer & Explanations

Correct answer: B

A.

Apply a disposable resource, inspect its state address and remote ID, then plan again without modifying state manually to confirm a no-change result. That would help test “Treat Terraform state as a resource-instance binding record”, not the outcome required in this scenario. The relevant acceptance check is: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.

B.

The question is set in this situation: A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures. This check is decisive because the upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections.

C.

Plan two disposable resources with distinct provider aliases and verify the expected region and account are recorded for each object. That would help test “Select aliased provider configurations for a second region”, not the outcome required in this scenario. The relevant acceptance check is: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.

D.

The question is set in this situation: A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. Initialize two clean working directories from the same commit and inspect terraform providers and the lock file for the expected provider source and version. That would help test “Use explicit provider version constraints and lock files”, not the outcome required in this scenario. The relevant acceptance check is: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.

Question 79

A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. Which proposed shortcut most directly risks unexpected destructive changes from unreviewed provider dependency upgrades and should therefore be rejected?

  1. Delete the dependency lock file on every CI run and accept whichever newest provider happens to be published that day.
  2. Declare a second provider alias but forget to associate the regional resource with it, assuming Terraform selects the nearest geographic region.
  3. Change a version constraint in production and apply immediately without inspecting the selected provider binary or resulting plan changes.
  4. Delete terraform.tfstate to hide a drift warning and assume the cloud objects will automatically be destroyed or safely re-imported.

Answer & Explanations

Correct answer: C

A.

The question is set in this situation: A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. Delete the dependency lock file on every CI run and accept whichever newest provider happens to be published that day. That shortcut risks nonreproducible plans or breaking provider upgrades between runs. Here the specific shortcut is: Change a version constraint in production and apply immediately without inspecting the selected provider binary or resulting plan changes.

B.

Declare a second provider alias but forget to associate the regional resource with it, assuming Terraform selects the nearest geographic region. That shortcut risks creation of infrastructure in the wrong region or account. Here the specific shortcut is: Change a version constraint in production and apply immediately without inspecting the selected provider binary or resulting plan changes.

C.

The question is set in this situation: A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. Change a version constraint in production and apply immediately without inspecting the selected provider binary or resulting plan changes. The foreseeable failure is unexpected destructive changes from unreviewed provider dependency upgrades. The safer response is: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

D.

Delete terraform.tfstate to hide a drift warning and assume the cloud objects will automatically be destroyed or safely re-imported. That shortcut risks orphaned infrastructure or duplicate creation attempts after state bindings disappear. Here the specific shortcut is: Change a version constraint in production and apply immediately without inspecting the selected provider binary or resulting plan changes.

Question 80

A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Store state securely and let Terraform maintain the mapping between resource addresses and remote identifiers during reviewed apply operations. Verify: Apply a disposable resource, inspect its state address and remote ID, then plan again without modifying state manually to confirm a no-change result.
  2. Implement: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion. Verify: Initialize two clean working directories from the same commit and inspect terraform providers and the lock file for the expected provider source and version.
  3. Implement: Specify provider source and compatible version constraints in required_providers, commit .terraform.lock.hcl, and run terraform init with the expected platform. Verify: Compare .terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.
  4. Implement: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion. Verify: Compare .terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.

Answer & Explanations

Correct answer: D

A.

This action/test pair addresses “Treat Terraform state as a resource-instance binding record”. Store state securely and let Terraform maintain the mapping between resource addresses and remote identifiers during reviewed apply operations. Apply a disposable resource, inspect its state address and remote ID, then plan again without modifying state manually to confirm a no-change result. The case instead calls for: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

B.

The question is set in this situation: A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. The action is applicable: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion. But its proposed test—Initialize two clean working directories from the same commit and inspect terraform providers and the lock file for the expected provider source and version.—addresses “Use explicit provider version constraints and lock files”. This requirement is confirmed instead by: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures.

C.

The question is set in this situation: A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. The test would be relevant: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures. But the offered implementation—Specify provider source and compatible version constraints in required_providers, commit.terraform.lock.hcl, and run terraform init with the expected platform.—addresses “Use explicit provider version constraints and lock files”. The action needed here is: Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion.

D.

The question is set in this situation: A municipal cloud operations team wants to update a provider only after testing the exact dependency-lock diff against its sandbox. Review provider version constraints, run terraform init -upgrade in an isolated branch, inspect the lock-file diff and re-run validation and plans before promotion. Confirm it through this test: Compare.terraform.lock.hcl before and after a controlled upgrade in staging and ensure the plan has no unintended replacements or schema failures. The upgrade option allows choosing newer provider versions that satisfy configured constraints; a normal locked initialization typically reuses existing selections.

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