HashiCorp Terraform Associate 004 Exam Dumps, Practice Test Questions

100% Latest & Updated HashiCorp Terraform Associate 004 Practice Test Questions, Exam Dumps & Verified Answers!
30 Days Free Updates, Instant Download!

HashiCorp Terraform Associate 004 Premium Bundle
$64.98
$54.98

Terraform Associate 004 Premium Bundle

  • Premium File: 167 Questions & Answers. Last update: Nov 9, 2026
  • Study Guide: 285 Pages
  • Latest Questions
  • 100% Accurate Answers
  • Fast Exam Updates

Terraform Associate 004 Premium Bundle

HashiCorp Terraform Associate 004 Premium Bundle
  • Premium File: 167 Questions & Answers. Last update: Nov 9, 2026
  • Study Guide: 285 Pages
  • Latest Questions
  • 100% Accurate Answers
  • Fast Exam Updates
$64.98
$54.98

HashiCorp Terraform Associate 004 Practice Test 27

Question 260

A Terraform platform team is coordinating 3 independent decisions. Workstream A: A configuration needs a map from environment names to individually selected instance classes, with each value a string. and Workstream B: A Terraform configuration contains both a cloud block and a backend block while planning to use HCP Terraform remote execution. and Workstream C: A service module declares use of a third-party provider but two different namespaces publish plugins with the same local name. Select exactly 3 actions, one addressing each distinct workstream.

  1. Review the generated plan and approve the apply prompt only if the changes are intended.
  2. Specify the provider's full registry source address under terraform.required_providers.
  3. Declare map(string) as the input type and select an entry by key, such as var.instance_class["staging"].
  4. Initialize the working directory, inspect a plan, and only then perform an authorized apply.
  5. Select the appropriate HCP Terraform cloud integration and remove the conflicting backend declaration.
  6. Declare aliases in the child required_providers and explicitly pass both in the parent module.providers mapping.

Explanation

Correct Answers

B:

For the workstream in which a service module declares use of a third-party provider but two different namespaces publish plugins with the same local name, use this action: Specify the provider's full registry source address under terraform.required_providers. Source addresses disambiguate providers that share local names. Verify: The lock entry identifies the intended registry namespace, provider type, and selected version. Limitation: Provider local names in HCL do not by themselves prove the external publisher namespace.

C:

For the workstream in which a configuration needs a map from environment names to individually selected instance classes, with each value a string, use this action: Declare map(string) as the input type and select an entry by key, such as var.instance_class["staging"]. Maps encode named associations rather than numeric sequence positions. Verify: The selected environment returns the class value under the requested map key. Limitation: A missing map key causes an expression error unless a default is explicitly handled.

E:

For the workstream in which a Terraform configuration contains both a cloud block and a backend block while planning to use HCP Terraform remote execution, use this action: Select the appropriate HCP Terraform cloud integration and remove the conflicting backend declaration. HCP Terraform cloud integration and an explicit backend block are mutually exclusive in one root configuration. Verify: Initialization uses the configured HCP organization and workspace association without a second backend block. Limitation: Migrating existing state to cloud-managed workspaces needs a controlled review and backup.

Incorrect Answers

A:

This action is appropriate instead for a different, unlisted requirement: A developer executes terraform apply interactively without a plan file and sees a proposed change summary. It would be checked by: The apply command waits for confirmation before changing resources in normal interactive use. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.

D:

This action is appropriate instead for a different, unlisted requirement: A newly hired engineer has a reviewed HCL repository but has not yet prepared its providers or backend. It would be checked by: The initialization succeeds and the reviewed plan enumerates proposed actions before change execution. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.

F:

This action is appropriate instead for a different, unlisted requirement: A child module must receive two non-default provider aliases for cross-region VPN creation. It would be checked by: The child's plan uses the two exact provider instances rather than silently defaulting to one region. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.

Question 261

An infrastructure team faces this specific situation: An application team must create one DNS record per hostname from a stable set of known domain names. Which Terraform action most directly satisfies the requirement?

  1. Use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration.
  2. Use a check block for an appropriate post-deployment assertion, and interpret its warning behavior correctly.
  3. Use for_each over a suitable set or map to create stable keyed resource instances.
  4. Add a variable validation block with a clear condition and error message appropriate for the supported expression.

Explanation

Correct Answer

C:

For this case, the appropriate action is: Use for_each over a suitable set or map to create stable keyed resource instances. For_each is useful when each instance has a stable logical key. Confirm it by checking: A change to one hostname affects its keyed address instead of renumbering unrelated instances. Boundary: Removing or renaming a key can still destroy or replace that keyed resource instance.

Incorrect Answers

A:

This is linked to a different situation: A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. There the relevant decision is: Use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration. For the question's actual requirement — An application team must create one DNS record per hostname from a stable set of known domain names. — the specifically relevant decision is: Use for_each over a suitable set or map to create stable keyed resource instances. It would therefore not resolve or assess the case as stated.

B:

This is linked to a different situation: An operations group wants an infrastructure health assertion that can report a diagnostic without behaving exactly like a resource precondition. There the relevant decision is: Use a check block for an appropriate post-deployment assertion, and interpret its warning behavior correctly. For the question's actual requirement — An application team must create one DNS record per hostname from a stable set of known domain names. — the specifically relevant decision is: Use for_each over a suitable set or map to create stable keyed resource instances. It would therefore not resolve or assess the case as stated.

D:

This is linked to a different situation: A reusable module needs to reject a user-provided CIDR that is outside a documented allowed address family. There the relevant decision is: Add a variable validation block with a clear condition and error message appropriate for the supported expression. For the question's actual requirement — An application team must create one DNS record per hostname from a stable set of known domain names. — the specifically relevant decision is: Use for_each over a suitable set or map to create stable keyed resource instances. It would therefore not resolve or assess the case as stated.

Question 262

A reviewer is confirming a change for the following use case: An application team must create one DNS record per hostname from a stable set of known domain names. The implementation follows this approach: Use for_each over a suitable set or map to create stable keyed resource instances. Which observation or acceptance test most directly verifies the intended result?

  1. The first, second, and third output elements correspond to documented ordered subnet assignments.
  2. After apply, terraform output reports the expected endpoint from state.
  3. A change to one hostname affects its keyed address instead of renumbering unrelated instances.
  4. The dependency graph orders the attachment action before the dependent rule operation.

Explanation

Correct Answer

C:

Acceptance evidence: A change to one hostname affects its keyed address instead of renumbering unrelated instances. It validates the proposed action, use for_each over a suitable set or map to create stable keyed resource instances, because for_each is useful when each instance has a stable logical key. Remaining limitation: Removing or renaming a key can still destroy or replace that keyed resource instance.

Incorrect Answers

A:

This is linked to a different situation: A module emits an ordered list of three subnet IDs aligned with ordered availability zones and consumers depend on position. There the relevant acceptance is: The first, second, and third output elements correspond to documented ordered subnet assignments. For the question's actual requirement — An application team must create one DNS record per hostname from a stable set of known domain names. — the specifically relevant acceptance is: A change to one hostname affects its keyed address instead of renumbering unrelated instances. It would therefore not resolve or assess the case as stated.

B:

This is linked to a different situation: An operations team must surface a load balancer endpoint after apply so downstream jobs can consume it. There the relevant acceptance is: After apply, terraform output reports the expected endpoint from state. For the question's actual requirement — An application team must create one DNS record per hostname from a stable set of known domain names. — the specifically relevant acceptance is: A change to one hostname affects its keyed address instead of renumbering unrelated instances. It would therefore not resolve or assess the case as stated.

D:

This is linked to a different situation: A firewall rule should be provisioned only after a policy attachment exists, but the rule's arguments do not reference that attachment. There the relevant acceptance is: The dependency graph orders the attachment action before the dependent rule operation. For the question's actual requirement — An application team must create one DNS record per hostname from a stable set of known domain names. — the specifically relevant acceptance is: A change to one hostname affects its keyed address instead of renumbering unrelated instances. It would therefore not resolve or assess the case as stated.

Question 263

Consider a proposed solution for this requirement: An application team must create one DNS record per hostname from a stable set of known domain names. The team plans to do the following: Use for_each over a suitable set or map to create stable keyed resource instances. Which limitation or operational caveat must remain in the review?

  1. Removing or renaming a key can still destroy or replace that keyed resource instance.
  2. An attribute may be unknown until apply, but Terraform can still preserve the dependency graph.
  3. Unique names, fixed addresses, quotas, and dependent resources may prevent this pattern from succeeding.
  4. Keys must exist and be stable; renaming a key may change addresses and induce replacement.

Explanation

Correct Answer

A:

The limitation is removing or renaming a key can still destroy or replace that keyed resource instance. The proposed change is use for_each over a suitable set or map to create stable keyed resource instances. Validate it by checking a change to one hostname affects its keyed address instead of renumbering unrelated instances. for_each is useful when each instance has a stable logical key.

Incorrect Answers

B:

This is linked to a different situation: A database security group must be passed into a managed database resource without copying IDs into hardcoded variables. There the relevant limitation is: An attribute may be unknown until apply, but Terraform can still preserve the dependency graph. For the question's actual requirement — An application team must create one DNS record per hostname from a stable set of known domain names. — the specifically relevant limitation is: Removing or renaming a key can still destroy or replace that keyed resource instance. It would therefore not resolve or assess the case as stated.

C:

This is linked to a different situation: A service cannot tolerate downtime when replacing a VM and the provider's planned operation requires destroy-and-create. There the relevant limitation is: Unique names, fixed addresses, quotas, and dependent resources may prevent this pattern from succeeding. For the question's actual requirement — An application team must create one DNS record per hostname from a stable set of known domain names. — the specifically relevant limitation is: Removing or renaming a key can still destroy or replace that keyed resource instance. It would therefore not resolve or assess the case as stated.

D:

This is linked to a different situation: A module uses for_each on a map of regions and must output one subnet ID for the us-east-1 instance. There the relevant limitation is: Keys must exist and be stable; renaming a key may change addresses and induce replacement. For the question's actual requirement — An application team must create one DNS record per hostname from a stable set of known domain names. — the specifically relevant limitation is: Removing or renaming a key can still destroy or replace that keyed resource instance. It would therefore not resolve or assess the case as stated.

Question 264

The team is reviewing a Terraform implementation for this case: An application team must create one DNS record per hostname from a stable set of known domain names. Which tempting assumption would be specifically incorrect for this proposed implementation?

  1. Assume a root variable of the same name is implicitly imported into all children.
  2. Assume all values fetched through Vault are automatically omitted from Terraform state.
  3. Use count with changing list positions while assuming unrelated indices can never shift.
  4. Use a numeric count index for a for_each resource that is addressed by map keys.

Explanation

Correct Answer

C:

Reject the assumption: Use count with changing list positions while assuming unrelated indices can never shift. Instead, use for_each over a suitable set or map to create stable keyed resource instances. for_each is useful when each instance has a stable logical key. Acceptance evidence: A change to one hostname affects its keyed address instead of renumbering unrelated instances.

Incorrect Answers

A:

This is linked to a different situation: A child module expects a variable named subnet_ids, but the calling root references an undeclared variable from inside the child. There the relevant misconception is: Assume a root variable of the same name is implicitly imported into all children. For the question's actual requirement — An application team must create one DNS record per hostname from a stable set of known domain names. — the specifically relevant misconception is: Use count with changing list positions while assuming unrelated indices can never shift. It would therefore not resolve or assess the case as stated.

B:

This is linked to a different situation: A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. There the relevant misconception is: Assume all values fetched through Vault are automatically omitted from Terraform state. For the question's actual requirement — An application team must create one DNS record per hostname from a stable set of known domain names. — the specifically relevant misconception is: Use count with changing list positions while assuming unrelated indices can never shift. It would therefore not resolve or assess the case as stated.

D:

This is linked to a different situation: A module uses for_each on a map of regions and must output one subnet ID for the us-east-1 instance. There the relevant misconception is: Use a numeric count index for a for_each resource that is addressed by map keys. For the question's actual requirement — An application team must create one DNS record per hostname from a stable set of known domain names. — the specifically relevant misconception is: Use count with changing list positions while assuming unrelated indices can never shift. It would therefore not resolve or assess the case as stated.

Question 265

A Terraform platform team is coordinating 2 independent decisions. Workstream A: An application team must create one DNS record per hostname from a stable set of known domain names. and Workstream B: A migration changes a backend location but the team must preserve all existing state bindings. Select exactly 2 actions, one addressing each distinct workstream.

  1. Back up the current state and use terraform init -migrate-state when moving to the newly configured backend.
  2. Create an appropriately scoped HCP Terraform variable set applied to those project workspaces.
  3. Re-run terraform init and review module/provider resolution within existing constraints.
  4. Declare aliases in the child required_providers and explicitly pass both in the parent module.providers mapping.
  5. Use for_each over a suitable set or map to create stable keyed resource instances.

Explanation

Correct Answers

A:

For the workstream in which a migration changes a backend location but the team must preserve all existing state bindings, use this action: Back up the current state and use terraform init -migrate-state when moving to the newly configured backend. Backend migration must transfer the existing state, not simply change where Terraform searches for it. Verify: The destination backend reflects the prior managed resource addresses and lineage after migration. Limitation: Misconfigured credentials or failed migration should block an apply rather than trigger new resource creation.

E:

For the workstream in which an application team must create one DNS record per hostname from a stable set of known domain names, use this action: Use for_each over a suitable set or map to create stable keyed resource instances. for_each is useful when each instance has a stable logical key. Verify: A change to one hostname affects its keyed address instead of renumbering unrelated instances. Limitation: Removing or renaming a key can still destroy or replace that keyed resource instance.

Incorrect Answers

B:

This option addresses a separate requirement: A platform administrator must reuse one nonsecret provider configuration variable across multiple workspaces in the same HCP project. Evidence for that other requirement would be new and existing workspaces in the project receive the intended shared variable; neither listed workstream asks for it.

C:

This option addresses a separate requirement: A CI job already has provider plugins cached and wants to reinitialize a checkout safely after an ordinary module change. Evidence for that other requirement would be initialization completes without destroying infrastructure and updates required module installations; neither listed workstream asks for it.

D:

This option addresses a separate requirement: A child module must receive two non-default provider aliases for cross-region VPN creation. Evidence for that other requirement would be the child's plan uses the two exact provider instances rather than silently defaulting to one region; neither listed workstream asks for it.

Question 266

An infrastructure team faces this specific situation: A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. Which Terraform action most directly satisfies the requirement?

  1. Read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported.
  2. Declare an input variable with type number and an appropriate default, overriding it per environment when needed.
  3. Use a dynamic nested block for the repeatable ingress structure when the provider schema allows it.
  4. Reference the security group resource attribute directly from the database argument.

Explanation

Correct Answer

C:

Use a dynamic nested block for the repeatable ingress structure when the provider schema allows it. Dynamic blocks construct repeatable nested provider-defined configuration blocks. Verify: Each input rule produces a corresponding nested ingress block in the planned resource. Limitation: dynamic can generate normal nested blocks, not arbitrary provider meta-arguments or resource blocks.

Incorrect Answers

A:

This is linked to a different situation: A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. There the relevant decision is: Read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported. For the question's actual requirement — A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. — the specifically relevant decision is: Use a dynamic nested block for the repeatable ingress structure when the provider schema allows it. It would therefore not resolve or assess the case as stated.

B:

This is linked to a different situation: A deployment needs separate port numbers per environment and a documented default for developer sandboxes. There the relevant decision is: Declare an input variable with type number and an appropriate default, overriding it per environment when needed. For the question's actual requirement — A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. — the specifically relevant decision is: Use a dynamic nested block for the repeatable ingress structure when the provider schema allows it. It would therefore not resolve or assess the case as stated.

D:

This is linked to a different situation: A database security group must be passed into a managed database resource without copying IDs into hardcoded variables. There the relevant decision is: Reference the security group resource attribute directly from the database argument. For the question's actual requirement — A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. — the specifically relevant decision is: Use a dynamic nested block for the repeatable ingress structure when the provider schema allows it. It would therefore not resolve or assess the case as stated.

Question 267

A reviewer is confirming a change for the following use case: A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. The implementation follows this approach: Use a dynamic nested block for the repeatable ingress structure when the provider schema allows it. Which observation or acceptance test most directly verifies the intended result?

  1. Repeated port values collapse to unique members without relying on list positions.
  2. The selected environment returns the class value under the requested map key.
  3. Each input rule produces a corresponding nested ingress block in the planned resource.
  4. Plans show environment-specific port values while preserving the declared type constraint.

Explanation

Correct Answer

C:

Acceptance evidence: Each input rule produces a corresponding nested ingress block in the planned resource. It validates the proposed action, use a dynamic nested block for the repeatable ingress structure when the provider schema allows it, because dynamic blocks construct repeatable nested provider-defined configuration blocks. Remaining limitation: dynamic can generate normal nested blocks, not arbitrary provider meta-arguments or resource blocks.

Incorrect Answers

A:

This is linked to a different situation: A security allowlist is an unordered set of unique ports and duplicate entries must not affect the configuration. There the relevant acceptance is: Repeated port values collapse to unique members without relying on list positions. For the question's actual requirement — A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. — the specifically relevant acceptance is: Each input rule produces a corresponding nested ingress block in the planned resource. It would therefore not resolve or assess the case as stated.

B:

This is linked to a different situation: A configuration needs a map from environment names to individually selected instance classes, with each value a string. There the relevant acceptance is: The selected environment returns the class value under the requested map key. For the question's actual requirement — A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. — the specifically relevant acceptance is: Each input rule produces a corresponding nested ingress block in the planned resource. It would therefore not resolve or assess the case as stated.

D:

This is linked to a different situation: A deployment needs separate port numbers per environment and a documented default for developer sandboxes. There the relevant acceptance is: Plans show environment-specific port values while preserving the declared type constraint. For the question's actual requirement — A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. — the specifically relevant acceptance is: Each input rule produces a corresponding nested ingress block in the planned resource. It would therefore not resolve or assess the case as stated.

Question 268

Consider a proposed solution for this requirement: A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. The team plans to do the following: Use a dynamic nested block for the repeatable ingress structure when the provider schema allows it. Which limitation or operational caveat must remain in the review?

  1. dynamic can generate normal nested blocks, not arbitrary provider meta-arguments or resource blocks.
  2. An attribute may be unknown until apply, but Terraform can still preserve the dependency graph.
  3. The data source requires access and will fail if its lookup criteria match no suitable object.
  4. Sets have no stable order and should not be indexed as though they were lists.

Explanation

Correct Answer

A:

The limitation is dynamic can generate normal nested blocks, not arbitrary provider meta-arguments or resource blocks. The proposed change is use a dynamic nested block for the repeatable ingress structure when the provider schema allows it. Validate it by checking each input rule produces a corresponding nested ingress block in the planned resource. Dynamic blocks construct repeatable nested provider-defined configuration blocks.

Incorrect Answers

B:

This is linked to a different situation: A database security group must be passed into a managed database resource without copying IDs into hardcoded variables. There the relevant limitation is: An attribute may be unknown until apply, but Terraform can still preserve the dependency graph. For the question's actual requirement — A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. — the specifically relevant limitation is: dynamic can generate normal nested blocks, not arbitrary provider meta-arguments or resource blocks. It would therefore not resolve or assess the case as stated.

C:

This is linked to a different situation: A web team must create a new load balancer and also look up an existing shared network ID managed by another team. There the relevant limitation is: The data source requires access and will fail if its lookup criteria match no suitable object. For the question's actual requirement — A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. — the specifically relevant limitation is: dynamic can generate normal nested blocks, not arbitrary provider meta-arguments or resource blocks. It would therefore not resolve or assess the case as stated.

D:

This is linked to a different situation: A security allowlist is an unordered set of unique ports and duplicate entries must not affect the configuration. There the relevant limitation is: Sets have no stable order and should not be indexed as though they were lists. For the question's actual requirement — A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. — the specifically relevant limitation is: dynamic can generate normal nested blocks, not arbitrary provider meta-arguments or resource blocks. It would therefore not resolve or assess the case as stated.

Question 269

The team is reviewing a Terraform implementation for this case: A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. Which tempting assumption would be specifically incorrect for this proposed implementation?

  1. Use dynamic to create multiple top-level resource blocks directly inside one resource.
  2. Assume local values declared inside a child are globally accessible by the root module.
  3. Assume a root variable of the same name is implicitly imported into all children.
  4. Convert the ordered IDs to set(string) while expecting indices to stay stable.

Explanation

Correct Answer

A:

Reject the assumption: Use dynamic to create multiple top-level resource blocks directly inside one resource. Instead, use a dynamic nested block for the repeatable ingress structure when the provider schema allows it. Dynamic blocks construct repeatable nested provider-defined configuration blocks. Acceptance evidence: Each input rule produces a corresponding nested ingress block in the planned resource.

Incorrect Answers

B:

This is linked to a different situation: A resource argument refers to an output produced by a child module, but the author attempts to read the child's internal local name directly. There the relevant misconception is: Assume local values declared inside a child are globally accessible by the root module. For the question's actual requirement — A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. — the specifically relevant misconception is: Use dynamic to create multiple top-level resource blocks directly inside one resource. It would therefore not resolve or assess the case as stated.

C:

This is linked to a different situation: A child module expects a variable named subnet_ids, but the calling root references an undeclared variable from inside the child. There the relevant misconception is: Assume a root variable of the same name is implicitly imported into all children. For the question's actual requirement — A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. — the specifically relevant misconception is: Use dynamic to create multiple top-level resource blocks directly inside one resource. It would therefore not resolve or assess the case as stated.

D:

This is linked to a different situation: A module emits an ordered list of three subnet IDs aligned with ordered availability zones and consumers depend on position. There the relevant misconception is: Convert the ordered IDs to set(string) while expecting indices to stay stable. For the question's actual requirement — A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. — the specifically relevant misconception is: Use dynamic to create multiple top-level resource blocks directly inside one resource. It would therefore not resolve or assess the case as stated.

Question 270

A Terraform platform team is coordinating 3 independent decisions. Workstream A: A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. and Workstream B: An operations team edits cloud VM tags manually, and normal Terraform plan shows an unexpected change even though HCL has not changed. and Workstream C: A configuration has two aliases of the same cloud provider and both use different regions; one resource must be created outside the default region. Select exactly 3 actions, one addressing each distinct workstream.

  1. Set provider = aws.secondary on that resource, referencing the aliased provider configuration.
  2. Select the correct workspace/backend state and run terraform destroy only after reviewing its destruction plan.
  3. Use a dynamic nested block for the repeatable ingress structure when the provider schema allows it.
  4. Inspect terraform plan -replace=ADDRESS and review any downstream dependencies before applying.
  5. Interpret the refreshed plan as detected drift and decide whether to restore declared tags or intentionally update configuration.
  6. Use terraform validate for the initialized configuration, then separately test variable values during a plan.

Explanation

Correct Answers

A:

For the workstream in which a configuration has two aliases of the same cloud provider and both use different regions; one resource must be created outside the default region, use this action: Set provider = aws.secondary on that resource, referencing the aliased provider configuration. Explicit provider selection lets a resource use a non-default provider configuration. Verify: The planned resource address resolves through the secondary provider while unqualified resources use the default. Limitation: Alias names are Terraform-local configuration references, not separate plugin versions.

C:

For the workstream in which a security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone, use this action: Use a dynamic nested block for the repeatable ingress structure when the provider schema allows it. Dynamic blocks construct repeatable nested provider-defined configuration blocks. Verify: Each input rule produces a corresponding nested ingress block in the planned resource. Limitation: dynamic can generate normal nested blocks, not arbitrary provider meta-arguments or resource blocks.

E:

For the workstream in which an operations team edits cloud VM tags manually, and normal Terraform plan shows an unexpected change even though HCL has not changed, use this action: Interpret the refreshed plan as detected drift and decide whether to restore declared tags or intentionally update configuration. Refreshing known remote objects exposes differences between actual and declared desired state. Verify: The reviewed plan explains which observed remote attributes differ from desired HCL. Limitation: Not every remote change is actionable drift; provider-computed attributes and intentional shared ownership need consideration.

Incorrect Answers

B:

This action is appropriate instead for a different, unlisted requirement: A disposable integration environment must be removed without unintentionally deleting shared infrastructure in another state. It would be checked by: The destruction plan lists the managed objects targeted in that state, not arbitrary cloud resources. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.

D:

This action is appropriate instead for a different, unlisted requirement: A deployment operator needs to replace a single degraded instance deliberately while keeping its resource address. It would be checked by: The proposed plan marks that particular resource instance for replacement. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.

F:

This action is appropriate instead for a different, unlisted requirement: A root module contains a new variable validation rule, and an engineer wants to check the HCL before accessing cloud credentials. It would be checked by: Static validation succeeds and an invalid supplied input is rejected at the stage where its custom condition is evaluated. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.

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

UP

SPECIAL OFFER: GET 10% OFF

This is ONE TIME OFFER

ExamSnap Discount Offer
Enter Your Email Address to Receive Your 10% Off Discount Code

A confirmation link will be sent to this email address to verify your login. *We value your privacy. We will not rent or sell your email address.

Download Free Demo of VCE Exam Simulator

Experience Avanset VCE Exam Simulator for yourself.

Simply submit your e-mail address below to get started with our interactive software demo of your free trial.

Free Demo Limits: In the demo version you will be able to access only first 5 questions from exam.