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 30

Question 290

A research group wants Terraform to create a new storage bucket while only looking up an independently maintained DNS zone. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete. Verify: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.
  2. Implement: Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete. Verify: Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created.
  3. Implement: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state. Verify: Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created.
  4. Implement: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. Verify: Run a test apply and verify consumers can reference an approved subnet ID from an output while a sensitive output is not printed in ordinary CLI output.

Answer & Explanations

Correct answer: B

A.

The question is set in this situation: A research group wants Terraform to create a new storage bucket while only looking up an independently maintained DNS zone. The action is applicable: Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete. But its proposed test—Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.—addresses “Keep data-source lookups distinct from resource state ownership”. This requirement is confirmed instead by: Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created.

B.

The question is set in this situation: A research group wants Terraform to create a new storage bucket while only looking up an independently maintained DNS zone. Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete. Confirm it through this test: Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created. Managed resources have Terraform-controlled lifecycle and state bindings, whereas data sources read existing objects supplied by external systems or other owners.

C.

The question is set in this situation: A research group wants Terraform to create a new storage bucket while only looking up an independently maintained DNS zone. The test would be relevant: Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created. But the offered implementation—Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.—addresses “Keep data-source lookups distinct from resource state ownership”. The action needed here is: Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete.

D.

This action/test pair addresses “Use output values to expose only intentional module results”. Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. Run a test apply and verify consumers can reference an approved subnet ID from an output while a sensitive output is not printed in ordinary CLI output. The case instead calls for: Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete.

Question 291

A media startup needs the latest approved base image ID for test VMs without managing the central image-release pipeline. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.
  2. Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete.
  3. Add explicit depends_on on a resource or module only when the downstream operation relies on an upstream side effect not represented by a direct attribute reference.
  4. Use supported for expressions, conditionals and built-in functions to derive tags or normalized lists from validated inputs without shell scripting.

Answer & Explanations

Correct answer: A

A.

Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state. Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object. Verify the result with this test: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.

B.

Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete. This addresses “Use resource blocks to manage objects and data blocks to read them”, where the governing principle is: Managed resources have Terraform-controlled lifecycle and state bindings, whereas data sources read existing objects supplied by external systems or other owners. The stated case instead calls for: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

C.

Add explicit depends_on on a resource or module only when the downstream operation relies on an upstream side effect not represented by a direct attribute reference. This addresses “Use depends_on only for otherwise hidden dependencies”, where the governing principle is: Terraform already infers dependencies from expression references; explicit dependencies are for hidden ordering constraints and can make plans more conservative. The stated case instead calls for: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

D.

Use supported for expressions, conditionals and built-in functions to derive tags or normalized lists from validated inputs without shell scripting. This addresses “Use Terraform expressions and functions for predictable computed values”, where the governing principle is: Terraform evaluates expressions within the dependency graph and computes derived values from input collections, reducing duplicated literal configuration. The stated case instead calls for: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

Question 292

A media startup needs the latest approved base image ID for test VMs without managing the central image-release pipeline. The infrastructure engineer proposes this change: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state. Which mechanism explains why it works?

  1. Terraform already infers dependencies from expression references; explicit dependencies are for hidden ordering constraints and can make plans more conservative.
  2. Terraform evaluates expressions within the dependency graph and computes derived values from input collections, reducing duplicated literal configuration.
  3. Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object.
  4. Managed resources have Terraform-controlled lifecycle and state bindings, whereas data sources read existing objects supplied by external systems or other owners.

Answer & Explanations

Correct answer: C

A.

Terraform already infers dependencies from expression references; explicit dependencies are for hidden ordering constraints and can make plans more conservative. That explains “Use depends_on only for otherwise hidden dependencies”, not the mechanism behind the described change. The relevant principle is: Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object.

B.

Terraform evaluates expressions within the dependency graph and computes derived values from input collections, reducing duplicated literal configuration. That explains “Use Terraform expressions and functions for predictable computed values”, not the mechanism behind the described change. The relevant principle is: Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object.

C.

Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object. The corresponding implementation is: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

D.

Managed resources have Terraform-controlled lifecycle and state bindings, whereas data sources read existing objects supplied by external systems or other owners. That explains “Use resource blocks to manage objects and data blocks to read them”, not the mechanism behind the described change. The relevant principle is: Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object.

Question 293

A media startup needs the latest approved base image ID for test VMs without managing the central image-release pipeline. After implementing this change—Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.—which test most directly validates its intended outcome?

  1. Supply a synthetic map of environment labels, inspect the planned lowercased or merged values, and confirm the same inputs yield the same output.
  2. Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created.
  3. Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.
  4. Create a test dependency without a data reference, inspect graph ordering, and remove the explicit dependency to show why a direct reference would be preferable when possible.

Answer & Explanations

Correct answer: C

A.

Supply a synthetic map of environment labels, inspect the planned lowercased or merged values, and confirm the same inputs yield the same output. That would help test “Use Terraform expressions and functions for predictable computed values”, not the outcome required in this scenario. The relevant acceptance check is: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.

B.

Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created. That would help test “Use resource blocks to manage objects and data blocks to read them”, not the outcome required in this scenario. The relevant acceptance check is: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.

C.

Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion. This check is decisive because data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object.

D.

Create a test dependency without a data reference, inspect graph ordering, and remove the explicit dependency to show why a direct reference would be preferable when possible. That would help test “Use depends_on only for otherwise hidden dependencies”, not the outcome required in this scenario. The relevant acceptance check is: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.

Question 294

A media startup needs the latest approved base image ID for test VMs without managing the central image-release pipeline. Which proposed shortcut most directly risks conflicting resource ownership or unintended attempts to create existing objects and should therefore be rejected?

  1. Insert depends_on on every module in a workspace without analysis, expecting this to make plans faster and change-free.
  2. Define an existing production network as a new managed resource and assume Terraform will automatically adopt it without import or conflict.
  3. Execute a local random shell command during each plan to choose resource names and assume the resulting changes remain deterministic.
  4. Declare a shared public machine image as a resource solely to look up its ID, then assume no ownership or replacement risk.

Answer & Explanations

Correct answer: D

A.

Insert depends_on on every module in a workspace without analysis, expecting this to make plans faster and change-free. That shortcut risks unnecessary serialization and conservative unknown values that complicate plans. Here the specific shortcut is: Declare a shared public machine image as a resource solely to look up its ID, then assume no ownership or replacement risk.

B.

Define an existing production network as a new managed resource and assume Terraform will automatically adopt it without import or conflict. That shortcut risks duplicate creation attempts and unintended ownership of resources managed elsewhere. Here the specific shortcut is: Declare a shared public machine image as a resource solely to look up its ID, then assume no ownership or replacement risk.

C.

Execute a local random shell command during each plan to choose resource names and assume the resulting changes remain deterministic. That shortcut risks perpetual plan diffs or unpredictable resource identifiers from unstable computed values. Here the specific shortcut is: Declare a shared public machine image as a resource solely to look up its ID, then assume no ownership or replacement risk.

D.

Declare a shared public machine image as a resource solely to look up its ID, then assume no ownership or replacement risk. The foreseeable failure is conflicting resource ownership or unintended attempts to create existing objects. The safer response is: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

Question 295

A media startup needs the latest approved base image ID for test VMs without managing the central image-release pipeline. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state. Verify: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.
  2. Implement: Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete. Verify: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.
  3. Implement: Use supported for expressions, conditionals and built-in functions to derive tags or normalized lists from validated inputs without shell scripting. Verify: Supply a synthetic map of environment labels, inspect the planned lowercased or merged values, and confirm the same inputs yield the same output.
  4. Implement: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state. Verify: Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created.

Answer & Explanations

Correct answer: A

A.

Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state. Confirm it through this test: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion. Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object.

B.

The test would be relevant: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion. But the offered implementation—Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete.—addresses “Use resource blocks to manage objects and data blocks to read them”. The action needed here is: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

C.

This action/test pair addresses “Use Terraform expressions and functions for predictable computed values”. Use supported for expressions, conditionals and built-in functions to derive tags or normalized lists from validated inputs without shell scripting. Supply a synthetic map of environment labels, inspect the planned lowercased or merged values, and confirm the same inputs yield the same output. The case instead calls for: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

D.

The action is applicable: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state. But its proposed test—Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created.—addresses “Use resource blocks to manage objects and data blocks to read them”. This requirement is confirmed instead by: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.

Question 296

A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete.
  2. Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.
  3. Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.
  4. Define a variable validation rule for acceptable input values and use resource preconditions for assumptions that must hold before an operation proceeds.

Answer & Explanations

Correct answer: B

A.

The question is set in this situation: A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete. This addresses “Use resource blocks to manage objects and data blocks to read them”, where the governing principle is: Managed resources have Terraform-controlled lifecycle and state bindings, whereas data sources read existing objects supplied by external systems or other owners. The stated case instead calls for: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

B.

The question is set in this situation: A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state. Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object. Verify the result with this test: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.

C.

Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. This addresses “Prefer Terraform 1.12 ephemeral values and provider-supported write-only arguments”, where the governing principle is: Ephemeral values and write-only arguments can avoid storing the temporary secret in Terraform plan and state, unlike sensitive flags alone; providers must support them. The stated case instead calls for: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

D.

Define a variable validation rule for acceptable input values and use resource preconditions for assumptions that must hold before an operation proceeds. This addresses “Validate inputs using variable validation and lifecycle preconditions”, where the governing principle is: Variable validation rejects bad supplied configuration early; lifecycle preconditions guard resource operation assumptions and can use known dependent values. The stated case instead calls for: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

Question 297

A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. The infrastructure engineer proposes this change: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state. Which mechanism explains why it works?

  1. Ephemeral values and write-only arguments can avoid storing the temporary secret in Terraform plan and state, unlike sensitive flags alone; providers must support them.
  2. Variable validation rejects bad supplied configuration early; lifecycle preconditions guard resource operation assumptions and can use known dependent values.
  3. Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object.
  4. Managed resources have Terraform-controlled lifecycle and state bindings, whereas data sources read existing objects supplied by external systems or other owners.

Answer & Explanations

Correct answer: C

A.

Ephemeral values and write-only arguments can avoid storing the temporary secret in Terraform plan and state, unlike sensitive flags alone; providers must support them. That explains “Prefer Terraform 1.12 ephemeral values and provider-supported write-only arguments”, not the mechanism behind the described change. The relevant principle is: Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object.

B.

Variable validation rejects bad supplied configuration early; lifecycle preconditions guard resource operation assumptions and can use known dependent values. That explains “Validate inputs using variable validation and lifecycle preconditions”, not the mechanism behind the described change. The relevant principle is: Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object.

C.

The question is set in this situation: A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object. The corresponding implementation is: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

D.

The question is set in this situation: A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. Managed resources have Terraform-controlled lifecycle and state bindings, whereas data sources read existing objects supplied by external systems or other owners. That explains “Use resource blocks to manage objects and data blocks to read them”, not the mechanism behind the described change. The relevant principle is: Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object.

Question 298

A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. After implementing this change—Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.—which test most directly validates its intended outcome?

  1. Try an invalid CIDR or disallowed environment in an isolated plan and verify the custom error blocks the operation before creating resources.
  2. Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.
  3. Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created.
  4. Run a disposable rotation using a documented write-only argument, inspect artifacts for omitted secret text and confirm the version attribute triggers the expected update.

Answer & Explanations

Correct answer: B

A.

Try an invalid CIDR or disallowed environment in an isolated plan and verify the custom error blocks the operation before creating resources. That would help test “Validate inputs using variable validation and lifecycle preconditions”, not the outcome required in this scenario. The relevant acceptance check is: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.

B.

The question is set in this situation: A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion. This check is decisive because data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object.

C.

The question is set in this situation: A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created. That would help test “Use resource blocks to manage objects and data blocks to read them”, not the outcome required in this scenario. The relevant acceptance check is: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.

D.

Run a disposable rotation using a documented write-only argument, inspect artifacts for omitted secret text and confirm the version attribute triggers the expected update. That would help test “Prefer Terraform 1.12 ephemeral values and provider-supported write-only arguments”, not the outcome required in this scenario. The relevant acceptance check is: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.

Question 299

A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. Which proposed shortcut most directly risks conflicting resource ownership or unintended attempts to create existing objects and should therefore be rejected?

  1. Declare a shared public machine image as a resource solely to look up its ID, then assume no ownership or replacement risk.
  2. Assume a comment saying use only approved regions is an enforceable policy and omit all validation in shared modules.
  3. Assume every ordinary provider argument is write-only merely because the supplied variable is marked ephemeral or sensitive.
  4. Define an existing production network as a new managed resource and assume Terraform will automatically adopt it without import or conflict.

Answer & Explanations

Correct answer: A

A.

The question is set in this situation: A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. Declare a shared public machine image as a resource solely to look up its ID, then assume no ownership or replacement risk. The foreseeable failure is conflicting resource ownership or unintended attempts to create existing objects. The safer response is: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

B.

Assume a comment saying use only approved regions is an enforceable policy and omit all validation in shared modules. That shortcut risks invalid infrastructure settings reaching deployment despite written documentation. Here the specific shortcut is: Declare a shared public machine image as a resource solely to look up its ID, then assume no ownership or replacement risk.

C.

Assume every ordinary provider argument is write-only merely because the supplied variable is marked ephemeral or sensitive. That shortcut risks secret values unexpectedly persisted or an untracked rotation failing to update the remote system. Here the specific shortcut is: Declare a shared public machine image as a resource solely to look up its ID, then assume no ownership or replacement risk.

D.

The question is set in this situation: A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. Define an existing production network as a new managed resource and assume Terraform will automatically adopt it without import or conflict. That shortcut risks duplicate creation attempts and unintended ownership of resources managed elsewhere. Here the specific shortcut is: Declare a shared public machine image as a resource solely to look up its ID, then assume no ownership or replacement risk.

Question 300

A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state. Verify: Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created.
  2. Implement: Define a variable validation rule for acceptable input values and use resource preconditions for assumptions that must hold before an operation proceeds. Verify: Try an invalid CIDR or disallowed environment in an isolated plan and verify the custom error blocks the operation before creating resources.
  3. Implement: Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete. Verify: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.
  4. Implement: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state. Verify: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.

Answer & Explanations

Correct answer: D

A.

The question is set in this situation: A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. The action is applicable: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state. But its proposed test—Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created.—addresses “Use resource blocks to manage objects and data blocks to read them”. This requirement is confirmed instead by: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion.

B.

This action/test pair addresses “Validate inputs using variable validation and lifecycle preconditions”. Define a variable validation rule for acceptable input values and use resource preconditions for assumptions that must hold before an operation proceeds. Try an invalid CIDR or disallowed environment in an isolated plan and verify the custom error blocks the operation before creating resources. The case instead calls for: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

C.

The question is set in this situation: A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. The test would be relevant: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion. But the offered implementation—Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete.—addresses “Use resource blocks to manage objects and data blocks to read them”. The action needed here is: Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state.

D.

The question is set in this situation: A university project deploys workloads into a shared subnet and must reference the subnet without declaring it as newly owned infrastructure. Use a supported data block with explicit filters to discover a cloud image or shared network that is managed outside this Terraform state. Confirm it through this test: Plan a disposable VM using a known image lookup, verify the selected image ID and inspect that the plan contains no image creation or deletion. Data sources resolve remote values during planning or applying but do not grant the calling configuration lifecycle control over the looked-up object.

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