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 34

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.

Question 331

A security team needs to share a network ID across modules without exporting internal credentials or unrelated object metadata. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.
  2. Use supported for expressions, conditionals and built-in functions to derive tags or normalized lists from validated inputs without shell scripting.
  3. Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.
  4. Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

Answer & Explanations

Correct answer: D

A.

Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. This addresses “Use typed variables and supplied values without hardcoded environment secrets”, where the governing 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. The stated case instead calls for: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

B.

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: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

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: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

D.

Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence. Verify the result with this 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.

Question 332

A security team needs to share a network ID across modules without exporting internal credentials or unrelated object metadata. The infrastructure engineer proposes this change: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. 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. Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.
  3. Terraform evaluates expressions within the dependency graph and computes derived values from input collections, reducing duplicated literal configuration.
  4. Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.

Answer & Explanations

Correct answer: B

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: Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.

B.

Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence. The corresponding implementation is: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

C.

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: Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.

D.

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

Question 333

A security team needs to share a network ID across modules without exporting internal credentials or unrelated object metadata. After implementing this change—Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.—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. Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.
  3. 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. 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: 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: 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.

B.

Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical. That would help test “Use typed variables and supplied values without hardcoded environment secrets”, not the outcome required in this scenario. The relevant acceptance check is: 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.

C.

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. This check is decisive because outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.

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: 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.

Question 334

A security team needs to share a network ID across modules without exporting internal credentials or unrelated object metadata. Which proposed shortcut most directly risks unnecessary exposure of credentials and unstable cross-module interfaces and should therefore be rejected?

  1. Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it.
  2. Assume every ordinary provider argument is write-only merely because the supplied variable is marked ephemeral or sensitive.
  3. Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control.
  4. Execute a local random shell command during each plan to choose resource names and assume the resulting changes remain deterministic.

Answer & Explanations

Correct answer: A

A.

Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it. The foreseeable failure is unnecessary exposure of credentials and unstable cross-module interfaces. The safer response is: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

B.

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: Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it.

C.

Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control. That shortcut risks configuration divergence and secret exposure from uncontrolled variable handling. Here the specific shortcut is: Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it.

D.

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: Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it.

Question 335

A security team needs to share a network ID across modules without exporting internal credentials or unrelated object metadata. 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 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. 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.
  3. 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.
  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: D

A.

The test would be relevant: 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. But the offered implementation—Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.—addresses “Use typed variables and supplied values without hardcoded environment secrets”. The action needed here is: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

B.

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: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

C.

The action is applicable: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. But its proposed test—Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.—addresses “Use typed variables and supplied values without hardcoded environment secrets”. This requirement is confirmed instead by: 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.

D.

Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. Confirm it through this 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. Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.

Question 336

A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.
  2. Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.
  3. Use typed object variables with documented attributes, optional values where appropriate, and consistent validation to pass related configuration settings together.
  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 municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence. This addresses “Use typed variables and supplied values without hardcoded environment secrets”, where the governing 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. The stated case instead calls for: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

B.

The question is set in this situation: A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence. Verify the result with this 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.

C.

Use typed object variables with documented attributes, optional values where appropriate, and consistent validation to pass related configuration settings together. This addresses “Define an object type for structured module input”, where the governing principle is: An object has named attributes and defined types, whereas an untyped string cannot safely represent a structured group of configuration decisions. The stated case instead calls for: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

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: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

Question 337

A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. The infrastructure engineer proposes this change: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. Which mechanism explains why it works?

  1. Variable validation rejects bad supplied configuration early; lifecycle preconditions guard resource operation assumptions and can use known dependent values.
  2. An object has named attributes and defined types, whereas an untyped string cannot safely represent a structured group of configuration decisions.
  3. Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.
  4. Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size.

Answer & Explanations

Correct answer: C

A.

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: Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.

B.

An object has named attributes and defined types, whereas an untyped string cannot safely represent a structured group of configuration decisions. That explains “Define an object type for structured module input”, not the mechanism behind the described change. The relevant principle is: Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.

C.

The question is set in this situation: A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence. The corresponding implementation is: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

D.

The question is set in this situation: A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. Terraform resolves declared variables from the supported input hierarchy, making a module reusable without editing its source for every region or instance size. That explains “Use typed variables and supplied values without hardcoded environment secrets”, not the mechanism behind the described change. The relevant principle is: Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.

Question 338

A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. After implementing this change—Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.—which test most directly validates its intended outcome?

  1. Supply a valid typed object and then a missing required key in a test, confirming Terraform reports the error before any apply.
  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. Try an invalid CIDR or disallowed environment in an isolated plan and verify the custom error blocks the operation before creating resources.
  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: B

A.

Supply a valid typed object and then a missing required key in a test, confirming Terraform reports the error before any apply. That would help test “Define an object type for structured module input”, not the outcome required in this scenario. The relevant acceptance check is: 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.

B.

The question is set in this situation: A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. 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. This check is decisive because outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.

C.

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: 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.

D.

The question is set in this situation: A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical. That would help test “Use typed variables and supplied values without hardcoded environment secrets”, not the outcome required in this scenario. The relevant acceptance check is: 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.

Question 339

A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. Which proposed shortcut most directly risks unnecessary exposure of credentials and unstable cross-module interfaces and should therefore be rejected?

  1. Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it.
  2. Pass a comma-delimited untyped string as a pretend object and parse it ad hoc in resource names without checking fields.
  3. Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control.
  4. Assume a comment saying use only approved regions is an enforceable policy and omit all validation in shared modules.

Answer & Explanations

Correct answer: A

A.

The question is set in this situation: A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it. The foreseeable failure is unnecessary exposure of credentials and unstable cross-module interfaces. The safer response is: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

B.

Pass a comma-delimited untyped string as a pretend object and parse it ad hoc in resource names without checking fields. That shortcut risks silent misconfiguration and broken attribute access across shared modules. Here the specific shortcut is: Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it.

C.

The question is set in this situation: A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. Edit an embedded administrator password in a shared variables.tf file for each environment and commit those credentials to version control. That shortcut risks configuration divergence and secret exposure from uncontrolled variable handling. Here the specific shortcut is: Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it.

D.

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: Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it.

Question 340

A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. 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 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. 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 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.
  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: D

A.

The question is set in this situation: A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. The test would be relevant: 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. But the offered implementation—Define input variables with appropriate types and defaults, provide environment-specific values through supported tfvars or command options and review precedence.—addresses “Use typed variables and supplied values without hardcoded environment secrets”. The action needed here is: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

B.

The question is set in this situation: A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. The action is applicable: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. But its proposed test—Run plans with two separate tfvars fixtures and confirm the chosen resource sizing changes while immutable module source remains identical.—addresses “Use typed variables and supplied values without hardcoded environment secrets”. This requirement is confirmed instead by: 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.

C.

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: Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.

D.

The question is set in this situation: A municipal IT office wants automation to read a new load balancer address while keeping database passwords out of routine CLI output. Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure. Confirm it through this 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. Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.

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