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 33

Question 320

A network team provisions three test subnets with count and needs to reference the second subnet without guessing its provider ID. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Use indexed addresses for count-created instances and key-based addresses for for_each-created instances when referencing individual resource attributes. Verify: Plan a disposable subnet and server, inspect resource ordering and verify the server uses the created subnet's ID rather than a manually copied string.
  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: Use indexed addresses for count-created instances and key-based addresses for for_each-created instances when referencing individual resource attributes. Verify: Create an isolated test resource for each environment key, inspect terraform state list and prove the intended key selects only its matching resource.
  4. Implement: Reference a created network resource's ID in a dependent instance resource argument so Terraform builds its dependency graph automatically. Verify: Create an isolated test resource for each environment key, inspect terraform state list and prove the intended key selects only its matching resource.

Answer & Explanations

Correct answer: C

A.

The question is set in this situation: A network team provisions three test subnets with count and needs to reference the second subnet without guessing its provider ID. The action is applicable: Use indexed addresses for count-created instances and key-based addresses for for_each-created instances when referencing individual resource attributes. But its proposed test—Plan a disposable subnet and server, inspect resource ordering and verify the server uses the created subnet's ID rather than a manually copied string.—addresses “Use direct resource references to establish implicit dependencies”. This requirement is confirmed instead by: Create an isolated test resource for each environment key, inspect terraform state list and prove the intended key selects only its matching resource.

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 indexed addresses for count-created instances and key-based addresses for for_each-created instances when referencing individual resource attributes.

C.

The question is set in this situation: A network team provisions three test subnets with count and needs to reference the second subnet without guessing its provider ID. Use indexed addresses for count-created instances and key-based addresses for for_each-created instances when referencing individual resource attributes. Confirm it through this test: Create an isolated test resource for each environment key, inspect terraform state list and prove the intended key selects only its matching resource. Resource instance addresses encode either numeric instance positions or stable collection keys; confusing them causes invalid references or churn.

D.

The question is set in this situation: A network team provisions three test subnets with count and needs to reference the second subnet without guessing its provider ID. The test would be relevant: Create an isolated test resource for each environment key, inspect terraform state list and prove the intended key selects only its matching resource. But the offered implementation—Reference a created network resource's ID in a dependent instance resource argument so Terraform builds its dependency graph automatically.—addresses “Use direct resource references to establish implicit dependencies”. The action needed here is: Use indexed addresses for count-created instances and key-based addresses for for_each-created instances when referencing individual resource attributes.

Question 321

A video-streaming platform runs the same network module in test and production but requires different instance counts and no credentials in code. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Reference a created network resource's ID in a dependent instance resource argument so Terraform builds its dependency graph automatically.
  2. Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.
  3. Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete.
  4. Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

Answer & Explanations

Correct answer: D

A.

Reference a created network resource's ID in a dependent instance resource argument so Terraform builds its dependency graph automatically. This addresses “Use direct resource references to establish implicit dependencies”, where the governing principle is: Terraform analyzes expressions that reference resource attributes and schedules dependent operations after the values needed for them are available. The stated case instead calls for: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

B.

Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. This addresses “Use output values to expose only intentional module results”, where the governing principle is: Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence. The stated case instead calls for: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

C.

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: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

D.

Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size. Verify the result with this test: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.

Question 322

A video-streaming platform runs the same network module in test and production but requires different instance counts and no credentials in code. The infrastructure engineer proposes this change: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. Which mechanism explains why it works?

  1. Managed resources have Terraform-controlled lifecycle and state bindings, whereas data sources read existing objects supplied by external systems or other owners.
  2. Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.
  3. Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.
  4. Terraform analyzes expressions that reference resource attributes and schedules dependent operations after the values needed for them are available.

Answer & Explanations

Correct answer: B

A.

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: Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.

B.

Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size. The corresponding implementation is: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

C.

Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence. That explains “Use output values to expose only intentional module results”, not the mechanism behind the described change. The relevant principle is: Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.

D.

Terraform analyzes expressions that reference resource attributes and schedules dependent operations after the values needed for them are available. That explains “Use direct resource references to establish implicit dependencies”, not the mechanism behind the described change. The relevant principle is: Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.

Question 323

A video-streaming platform runs the same network module in test and production but requires different instance counts and no credentials in code. After implementing this change—Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.—which test most directly validates its intended outcome?

  1. Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.
  2. 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.
  3. Plan a disposable subnet and server, inspect resource ordering and verify the server uses the created subnet's ID rather than a manually copied string.
  4. 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.

Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical. This check is decisive because terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.

B.

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. That would help test “Use output values to expose only intentional module results”, not the outcome required in this scenario. The relevant acceptance check is: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.

C.

Plan a disposable subnet and server, inspect resource ordering and verify the server uses the created subnet's ID rather than a manually copied string. That would help test “Use direct resource references to establish implicit dependencies”, not the outcome required in this scenario. The relevant acceptance check is: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.

D.

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: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.

Question 324

A video-streaming platform runs the same network module in test and production but requires different instance counts and no credentials in code. Which proposed shortcut most directly risks configuration divergence and secret exposure from uncontrolled variable handling and should therefore be rejected?

  1. Define an existing production network as a new managed resource and assume Terraform will automatically adopt it without import or conflict.
  2. Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it.
  3. Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control.
  4. Hardcode a subnet name while relying on Terraform to infer a dependency on a separately declared resource with no expression reference.

Answer & Explanations

Correct answer: C

A.

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: Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control.

B.

Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it. That shortcut risks unnecessary exposure of credentials and unstable cross-module interfaces. Here the specific shortcut is: Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control.

C.

Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control. The foreseeable failure is configuration divergence and secret exposure from uncontrolled variable handling. The safer response is: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

D.

Hardcode a subnet name while relying on Terraform to infer a dependency on a separately declared resource with no expression reference. That shortcut risks race conditions or binding a server to the wrong network after changes. Here the specific shortcut is: Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control.

Question 325

A video-streaming platform runs the same network module in test and production but requires different instance counts and no credentials in code. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. Verify: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.
  2. Implement: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. Verify: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.
  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 managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created.
  4. Implement: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. 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: A

A.

Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. Confirm it through this test: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical. Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.

B.

The test would be relevant: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical. But the offered implementation—Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.—addresses “Use output values to expose only intentional module results”. The action needed here is: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

C.

This action/test pair addresses “Use resource blocks to manage objects and data blocks to read them”. Declare Terraform resource blocks for objects the configuration owns and data blocks to query existing objects the configuration should not create or delete. Plan a disposable managed bucket alongside a data lookup of an approved existing network and inspect which objects would be created. The case instead calls for: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

D.

The action is applicable: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. But its proposed test—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.—addresses “Use output values to expose only intentional module results”. This requirement is confirmed instead by: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.

Question 326

A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Use indexed addresses for count-created instances and key-based addresses for for_each-created instances when referencing individual resource attributes.
  2. Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.
  3. Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.
  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: B

A.

Use indexed addresses for count-created instances and key-based addresses for for_each-created instances when referencing individual resource attributes. This addresses “Address resources correctly when count and for_each are used”, where the governing principle is: Resource instance addresses encode either numeric instance positions or stable collection keys; confusing them causes invalid references or churn. The stated case instead calls for: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

B.

The question is set in this situation: A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size. Verify the result with this test: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.

C.

The question is set in this situation: A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. This addresses “Use output values to expose only intentional module results”, where the governing principle is: Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence. The stated case instead calls for: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

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: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

Question 327

A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. The infrastructure engineer proposes this change: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. Which mechanism explains why it works?

  1. Resource instance addresses encode either numeric instance positions or stable collection keys; confusing them causes invalid references or churn.
  2. Terraform evaluates expressions within the dependency graph and computes derived values from input collections, reducing duplicated literal configuration.
  3. Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.
  4. Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.

Answer & Explanations

Correct answer: C

A.

Resource instance addresses encode either numeric instance positions or stable collection keys; confusing them causes invalid references or churn. That explains “Address resources correctly when count and for_each are used”, not the mechanism behind the described change. The relevant principle is: Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.

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: Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.

C.

The question is set in this situation: A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size. The corresponding implementation is: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

D.

The question is set in this situation: A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence. That explains “Use output values to expose only intentional module results”, not the mechanism behind the described change. The relevant principle is: Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.

Question 328

A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. After implementing this change—Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.—which test most directly validates its intended outcome?

  1. 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.
  2. Supply a synthetic map of environment labels, inspect the planned lowercased or merged values, and confirm the same inputs yield the same output.
  3. Create an isolated test resource for each environment key, inspect terraform state list and prove the intended key selects only its matching resource.
  4. Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.

Answer & Explanations

Correct answer: D

A.

The question is set in this situation: A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. 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. That would help test “Use output values to expose only intentional module results”, not the outcome required in this scenario. The relevant acceptance check is: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.

B.

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: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.

C.

Create an isolated test resource for each environment key, inspect terraform state list and prove the intended key selects only its matching resource. That would help test “Address resources correctly when count and for_each are used”, not the outcome required in this scenario. The relevant acceptance check is: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.

D.

The question is set in this situation: A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical. This check is decisive because terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.

Question 329

A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. Which proposed shortcut most directly risks configuration divergence and secret exposure from uncontrolled variable handling and should therefore be rejected?

  1. Execute a local random shell command during each plan to choose resource names and assume the resulting changes remain deterministic.
  2. Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it.
  3. Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control.
  4. Refer to a for_each-created resource as a singleton name with no index or key and expect Terraform to select one arbitrary instance.

Answer & Explanations

Correct answer: C

A.

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: Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control.

B.

The question is set in this situation: A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it. That shortcut risks unnecessary exposure of credentials and unstable cross-module interfaces. Here the specific shortcut is: Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control.

C.

The question is set in this situation: A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control. The foreseeable failure is configuration divergence and secret exposure from uncontrolled variable handling. The safer response is: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

D.

Refer to a for_each-created resource as a singleton name with no index or key and expect Terraform to select one arbitrary instance. That shortcut risks invalid references and accidental resource changes caused by incorrect addresses. Here the specific shortcut is: Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control.

Question 330

A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. Verify: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.
  2. Implement: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. Verify: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.
  3. Implement: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. 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.
  4. Implement: Use indexed addresses for count-created instances and key-based addresses for for_each-created instances when referencing individual resource attributes. Verify: Create an isolated test resource for each environment key, inspect terraform state list and prove the intended key selects only its matching resource.

Answer & Explanations

Correct answer: A

A.

The question is set in this situation: A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. Confirm it through this test: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical. Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.

B.

The question is set in this situation: A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. The test would be relevant: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical. But the offered implementation—Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.—addresses “Use output values to expose only intentional module results”. The action needed here is: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

C.

The question is set in this situation: A college IT department distributes a reusable Terraform example and needs students to provide safe per-project region and naming inputs. The action is applicable: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. But its proposed test—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.—addresses “Use output values to expose only intentional module results”. This requirement is confirmed instead by: Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.

D.

This action/test pair addresses “Address resources correctly when count and for_each are used”. Use indexed addresses for count-created instances and key-based addresses for for_each-created instances when referencing individual resource attributes. Create an isolated test resource for each environment key, inspect terraform state list and prove the intended key selects only its matching resource. The case instead calls for: Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.

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