HashiCorp Terraform Associate 004 Practice Test 3 - Prepaway
Practice Exams:

Pass HashiCorp Terraform Associate 004 Exam in First Attempt Guaranteed!

Get 100% Latest Exam Questions, Accurate & Verified Answers!

30 Days Free Updates, Instant Download!

Verified By Experts
Premium Bundle
$29.98
$79.99 $109.97

Terraform Associate 004 Premium Bundle


  • Premium File 167 Questions & Answers. Last update: Nov 28, 2026
  • Training Course 118 Lectures
  • Study Guide 285 Pages

HashiCorp Terraform Associate 004 Practice Test 3

Question 20

A controlled cloud model operations assessment for a healthcare software provider concerns regulated clinical workflow infrastructure. Reviewers find that a hybrid workflow provisions a public cloud VM but tries to manage an on-premises virtualization inventory with the public cloud provider. The team proposes to select a supported provider for each API and use a combined Terraform root module with explicit provider configuration. Any change must preserve the approved model contract and show measurable verification evidence. Which post-change observation would establish the required infrastructure or configuration outcome?

  1. A consolidated review shows resource changes at their respective APIs before execution
  2. An attempted unreviewed rule change is blocked and approved changes have traceable reviewed plans
  3. Both cloud resources plan with their respective provider and no credentials cross an unintended boundary
  4. A single reviewed plan contains cloud and on-premises resources mapped to their proper provider plugins

Explanation

Correct Answer

D:

A single reviewed plan contains cloud and on-premises resources mapped to their proper provider plugins. Provider abstraction lets Terraform coordinate different service APIs without making them identical. Select a supported provider for each API and use a combined Terraform root module with explicit provider configuration.

Incorrect Answers

A:

A consolidated review shows resource changes at their respective APIs before execution. A single reviewed plan contains cloud and on-premises resources mapped to their proper provider plugins.

B:

An attempted unreviewed rule change is blocked and approved changes have traceable reviewed plans. A single reviewed plan contains cloud and on-premises resources mapped to their proper provider plugins. Provider abstraction lets Terraform coordinate different service APIs without making them identical.

C:

Both cloud resources plan with their respective provider and no credentials cross an unintended boundary. A single reviewed plan contains cloud and on-premises resources mapped to their proper provider plugins.

Question 21

For satellite data ingest and model systems at a geospatial analytics startup, the infrastructure platform team is investigating the following incident: a resource needing replacement has a default destroy-before-create behavior and a small production service has no other live replica. The relevant evidence is that plan shows deletion of the only active endpoint before a replacement is provisioned. The plan is to use create_before_destroy where the provider and unique naming permit it, with health-checked cutover. Which Terraform design principle best explains the chosen response?

  1. The lifecycle rule create_before_destroy changes replacement ordering but cannot override API uniqueness limits
  2. Terraform object types enforce named attribute constraints at module boundaries
  3. Data source reads must be constrained because a lookup does not create or govern the referenced resource
  4. Dynamic configuration constructs generate repeated nested structure from collections

Explanation

Correct Answer

A:

The lifecycle rule create_before_destroy changes replacement ordering but cannot override API uniqueness limits. Plan shows deletion of the only active endpoint before a replacement is provisioned. Use create_before_destroy where the provider and unique naming permit it, with health-checked cutover.

Incorrect Answers

B:

Terraform object types enforce named attribute constraints at module boundaries. The lifecycle rule create_before_destroy changes replacement ordering but cannot override API uniqueness limits.

C:

Data source reads must be constrained because a lookup does not create or govern the referenced resource. Plan shows deletion of the only active endpoint before a replacement is provisioned. The lifecycle rule create_before_destroy changes replacement ordering but cannot override API uniqueness limits.

D:

Dynamic configuration constructs generate repeated nested structure from collections. Plan shows deletion of the only active endpoint before a replacement is provisioned. The lifecycle rule create_before_destroy changes replacement ordering but cannot override API uniqueness limits.

Question 22

While protecting research and campus application environments, the Terraform team at a global university IT team confirms that a Terraform apply creates some cloud resources and then fails on a quota while the team assumes the whole deployment rolled back. The proposed remedy is to inspect the partial state and failures, resolve the quota condition, then rerun plan and apply for remaining differences. The team must preserve approved data handling and avoid widening access to sensitive features. Which finding would best distinguish the suspected cause from nearby Terraform configuration issues?

  1. Plan shows no changes because state and remote objects already match configuration
  2. Cloud inventory and updated state show partially created objects and one remaining failed resource
  3. Version and plan fingerprints differ between approved review and actual apply run
  4. The file layout is formatted yet terraform validate reports an undeclared reference

Explanation

Correct Answer

B:

Cloud inventory and updated state show partially created objects and one remaining failed resource. A Terraform apply creates some cloud resources and then fails on a quota while the team assumes the whole deployment rolled back. Inspect the partial state and failures, resolve the quota condition, then rerun plan and apply for remaining differences.

Incorrect Answers

A:

Plan shows no changes because state and remote objects already match configuration. Cloud inventory and updated state show partially created objects and one remaining failed resource. Inspect the partial state and failures, resolve the quota condition, then rerun plan and apply for remaining differences.

C:

Version and plan fingerprints differ between approved review and actual apply run. Inspect the partial state and failures, resolve the quota condition, then rerun plan and apply for remaining differences.

D:

The file layout is formatted yet terraform validate reports an undeclared reference. Cloud inventory and updated state show partially created objects and one remaining failed resource. Inspect the partial state and failures, resolve the quota condition, then rerun plan and apply for remaining differences.

Question 23

For field diagnostics and public service at a water utility engineering division, the infrastructure platform team is investigating the following incident: an operator changes an instance size outside Terraform and an unchanged HCL plan unexpectedly proposes an update. The team proposes to review drift evidence and decide whether to restore declared state or adopt an approved new configuration. The team must preserve approved data handling and avoid widening access to sensitive features. Which post-change observation would establish the required infrastructure or configuration outcome?

  1. Separate runs read the same authoritative state and no duplicate resources are proposed
  2. Each environment plan shows only its own managed objects and account resources
  3. The approved plan reconciles drift without unreviewed destruction
  4. The active apply is not interrupted and stale locks are removed only under a controlled incident record

Explanation

Correct Answer

C:

The approved plan reconciles drift without unreviewed destruction. An operator changes an instance size outside Terraform and an unchanged HCL plan unexpectedly proposes an update. Review drift evidence and decide whether to restore declared state or adopt an approved new configuration.

Incorrect Answers

A:

Separate runs read the same authoritative state and no duplicate resources are proposed. An operator changes an instance size outside Terraform and an unchanged HCL plan unexpectedly proposes an update. The approved plan reconciles drift without unreviewed destruction.

B:

Each environment plan shows only its own managed objects and account resources. An operator changes an instance size outside Terraform and an unchanged HCL plan unexpectedly proposes an update. The approved plan reconciles drift without unreviewed destruction.

D:

The active apply is not interrupted and stale locks are removed only under a controlled incident record. The approved plan reconciles drift without unreviewed destruction.

Question 24

For branch and account technology at a retail banking integration team, the infrastructure platform team is investigating the following incident: a child module tries to read an input variable that was declared only in the caller and gets an undeclared variable error. The proposed remedy is to define the child input variable and pass it explicitly in the module block. Service owners require a reproducible result without unsafe or unapproved production testing. Which finding would best distinguish the suspected cause from nearby Terraform configuration issues?

  1. Initialization log shows a new module version and plan errors on a removed output name
  2. Init logs show the same module source resolves to a newer commit than the reviewed deployment
  3. CI logs display a value derived from sensitive content when a root output is printed
  4. Validation identifies no variable declaration inside the child despite the parent defining a similarly named value

Explanation

Correct Answer

D:

Validation identifies no variable declaration inside the child despite the parent defining a similarly named value. A child module tries to read an input variable that was declared only in the caller and gets an undeclared variable error. Define the child input variable and pass it explicitly in the module block.

Incorrect Answers

A:

Initialization log shows a new module version and plan errors on a removed output name. Validation identifies no variable declaration inside the child despite the parent defining a similarly named value. Define the child input variable and pass it explicitly in the module block.

B:

Init logs show the same module source resolves to a newer commit than the reviewed deployment. Validation identifies no variable declaration inside the child despite the parent defining a similarly named value. Define the child input variable and pass it explicitly in the module block.

C:

CI logs display a value derived from sensitive content when a root output is printed. Validation identifies no variable declaration inside the child despite the parent defining a similarly named value. Define the child input variable and pass it explicitly in the module block.

Question 25

A controlled cloud model operations assessment for a market data company concerns analytics and private data feeds. Reviewers find that an application resource uses a manually copied subnet ID and deploys against the wrong network after an environment rebuild. The relevant evidence is that terraform references show a literal subnet ID rather than the subnet resource attribute from the same configuration. The plan is to reference the managed subnet attribute and let Terraform infer the dependency. Which Terraform design principle best explains the chosen response?

  1. Resource references both convey values and create dependency edges in Terraform's resource graph
  2. Module outputs form the explicit outward data interface for nested Terraform configuration
  3. Secret management should externalize short-lived credentials and minimize exposure in configuration and state
  4. depends_on expresses relationships not inferable from argument references

Explanation

Correct Answer

A:

Resource references both convey values and create dependency edges in Terraform's resource graph. Terraform references show a literal subnet ID rather than the subnet resource attribute from the same configuration. Reference the managed subnet attribute and let Terraform infer the dependency.

Incorrect Answers

B:

Module outputs form the explicit outward data interface for nested Terraform configuration. Terraform references show a literal subnet ID rather than the subnet resource attribute from the same configuration. Resource references both convey values and create dependency edges in Terraform's resource graph.

C:

Secret management should externalize short-lived credentials and minimize exposure in configuration and state. Terraform references show a literal subnet ID rather than the subnet resource attribute from the same configuration. Resource references both convey values and create dependency edges in Terraform's resource graph.

D:

Depends_on expresses relationships not inferable from argument references. Terraform references show a literal subnet ID rather than the subnet resource attribute from the same configuration. Resource references both convey values and create dependency edges in Terraform's resource graph.

Question 26

A controlled cloud model operations assessment for a retail banking integration team concerns branch and account technology. Reviewers find that a test cleanup script calls terraform destroy from a terminal whose active backend points at production. Observation: terraform workspace show and backend inspection reveal the production state is selected. Any change must preserve the approved model contract and show measurable verification evidence. Which intervention most directly addresses the underlying Terraform 1.12 infrastructure workflow failure?

  1. Generate a saved plan with terraform plan -out and apply the vetted plan artifact under change control
  2. Confirm backend and workspace identity and require explicit approved targeting before destructive cleanup
  3. Inspect the partial state and failures, resolve the quota condition, then rerun plan and apply for remaining differences
  4. Run terraform init within the correct root module before planning, using reviewed backend and plugin settings

Explanation

Correct Answer

B:

Confirm backend and workspace identity and require explicit approved targeting before destructive cleanup. Terraform destroy acts on the selected state and must be bounded by environment identity and review. The disposable test state is destroyed while production resources remain unchanged.

Incorrect Answers

A:

Generate a saved plan with terraform plan -out and apply the vetted plan artifact under change control. Confirm backend and workspace identity and require explicit approved targeting before destructive cleanup.

C:

Inspect the partial state and failures, resolve the quota condition, then rerun plan and apply for remaining differences. Confirm backend and workspace identity and require explicit approved targeting before destructive cleanup.

D:

Run terraform init within the correct root module before planning, using reviewed backend and plugin settings. Confirm backend and workspace identity and require explicit approved targeting before destructive cleanup. Terraform destroy acts on the selected state and must be bounded by environment identity and review.

Question 27

A controlled cloud model operations assessment for a food distribution operator concerns warehouse and supply chain services. Reviewers find that an engineer copies HCL files into a clean workspace and runs terraform plan before completing initialization. The team proposes to run terraform init within the correct root module before planning, using reviewed backend and plugin settings. Only a controlled and reversible ML workflow change fits the approved release window. Which post-change observation would establish the required infrastructure or configuration outcome?

  1. The reviewed execution proposal contains only approved in-place changes and protects persistent data
  2. The executed artifact hash matches the reviewed plan and unapproved later edits cannot enter the run
  3. Initialization installs required plugins and creates valid local working metadata for planning
  4. The next successful apply converges on desired configuration without recreating already tracked objects

Explanation

Correct Answer

C:

Initialization installs required plugins and creates valid local working metadata for planning. CLI reports that required provider plugins are not installed and the dependency lock is not hydrated. Run terraform init within the correct root module before planning, using reviewed backend and plugin settings.

Incorrect Answers

A:

The reviewed execution proposal contains only approved in-place changes and protects persistent data. CLI reports that required provider plugins are not installed and the dependency lock is not hydrated. Initialization installs required plugins and creates valid local working metadata for planning.

B:

The executed artifact hash matches the reviewed plan and unapproved later edits cannot enter the run. Initialization installs required plugins and creates valid local working metadata for planning.

D:

The next successful apply converges on desired configuration without recreating already tracked objects. CLI reports that required provider plugins are not installed and the dependency lock is not hydrated. Initialization installs required plugins and creates valid local working metadata for planning.

Question 28

During an authorized design and operations review at a geospatial analytics startup, engineers supporting satellite data ingest and model systems discover that a resource needing replacement has a default destroy-before-create behavior and a small production service has no other live replica. Observation: plan shows deletion of the only active endpoint before a replacement is provisioned. Only a controlled and reversible ML workflow change fits the approved release window. Which intervention most directly addresses the underlying Terraform 1.12 infrastructure workflow failure?

  1. Reference the managed subnet attribute and let Terraform infer the dependency
  2. Add a Terraform variable validation condition for accepted regions and a readable error message
  3. Add a narrow explicit depends_on edge for the real hidden side-effect dependency
  4. Use create_before_destroy where the provider and unique naming permit it, with health-checked cutover

Explanation

Correct Answer

D:

Use create_before_destroy where the provider and unique naming permit it, with health-checked cutover. Plan shows deletion of the only active endpoint before a replacement is provisioned. A replacement becomes available before the original is removed and validation catches name conflicts.

Incorrect Answers

A:

Reference the managed subnet attribute and let Terraform infer the dependency. Plan shows deletion of the only active endpoint before a replacement is provisioned. Use create_before_destroy where the provider and unique naming permit it, with health-checked cutover.

B:

Add a Terraform variable validation condition for accepted regions and a readable error message. Plan shows deletion of the only active endpoint before a replacement is provisioned. Use create_before_destroy where the provider and unique naming permit it, with health-checked cutover.

C:

Add a narrow explicit depends_on edge for the real hidden side-effect dependency. Use create_before_destroy where the provider and unique naming permit it, with health-checked cutover.

Question 29

A controlled cloud model operations assessment for a geospatial analytics startup concerns satellite data ingest and model systems. Reviewers find that a team wants to reference a pre-existing network yet declares a second managed network resource that Terraform plans to create. Confirming evidence shows that execution plan shows a new network instead of reading the existing network identified in service inventory. Service owners require a reproducible result without unsafe or unapproved production testing. Which implementation paired with its verification outcome addresses the same fault?

  1. Use a supported data source to query the existing network and reference its attributes from managed resources — verify: The plan reads the approved network identity without creating a duplicate
  2. Use a supported data source to query the existing network and reference its attributes from managed resources — verify: An authorized rotation occurs while the secret itself remains omitted from persisted plan and state
  3. Use a supported data source to query the existing network and reference its attributes from managed resources — verify: Authorized automation consumes the secret without exposing it in logs or unprotected artifacts
  4. Add provider scoping and precise data source filters for owner and image identity — verify: The resolved data object matches the approved owner and no unexpected image resource is provisioned

Explanation

Correct Answer

A:

Use a supported data source to query the existing network and reference its attributes from managed resources. The plan reads the approved network identity without creating a duplicate. Data blocks query existing information whereas resource blocks manage lifecycle of declared objects.

Incorrect Answers

B:

Use a supported data source to query the existing network and reference its attributes from managed resources. An authorized rotation occurs while the secret itself remains omitted from persisted plan and state. That uses the intended change yet measures the wrong result. The plan reads the approved network identity without creating a duplicate.

C:

Use a supported data source to query the existing network and reference its attributes from managed resources. Authorized automation consumes the secret without exposing it in logs or unprotected artifacts. The remedy may be appropriate, but that check does not establish the required recovery. The plan reads the approved network identity without creating a duplicate.

D:

Add provider scoping and precise data source filters for owner and image identity. The resolved data object matches the approved owner and no unexpected image resource is provisioned. Use a supported data source to query the existing network and reference its attributes from managed resources; The plan reads the approved network identity without creating a duplicate.

Question 30

A controlled cloud model operations assessment for a water utility engineering division concerns field diagnostics and public service. Reviewers find that a configuration builds a service hostname by naive concatenation and omits a separator when environment input is empty. Confirming evidence shows that plan renders an invalid DNS record name even though every individual variable is a string. Service owners require a reproducible result without unsafe or unapproved production testing. Which implementation paired with its verification outcome addresses the same fault?

  1. Use explicit formatting and conditional expressions with validation of optional pieces — verify: The plan reads the approved network identity without creating a duplicate
  2. Use explicit formatting and conditional expressions with validation of optional pieces — verify: Generated names match required patterns for all allowed inputs
  3. Use explicit formatting and conditional expressions with validation of optional pieces — verify: A replacement becomes available before the original is removed and validation catches name conflicts
  4. Expose a carefully scoped child output and reference module.<name>.<output> in the root — verify: The root obtains the intended nonsecret value through the module interface without reaching into internals

Explanation

Correct Answer

B:

Use explicit formatting and conditional expressions with validation of optional pieces. Generated names match required patterns for all allowed inputs. Plan renders an invalid DNS record name even though every individual variable is a string. Expressions and built-in functions derive reliable values only when type and edge cases are handled.

Incorrect Answers

A:

Use explicit formatting and conditional expressions with validation of optional pieces. The plan reads the approved network identity without creating a duplicate. The remedy may be appropriate, but that check does not establish the required recovery. Generated names match required patterns for all allowed inputs.

C:

Use explicit formatting and conditional expressions with validation of optional pieces. A replacement becomes available before the original is removed and validation catches name conflicts. That uses the intended change yet measures the wrong result. Generated names match required patterns for all allowed inputs.

D:

Expose a carefully scoped child output and reference module.<name>.<output> in the root. The root obtains the intended nonsecret value through the module interface without reaching into internals. Use explicit formatting and conditional expressions with validation of optional pieces; Generated names match required patterns for all allowed inputs.

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