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 44

Question 430

A laboratory is moving sensitive parameter management from local variables to an encrypted state backend without publishing credentials. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. Verify: Apply a disposable nonproduction secret-shaped value, inspect state access policies and confirm no secret is printed in ordinary plan text.
  2. Implement: Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths. Verify: Apply a disposable nonproduction secret-shaped value, inspect state access policies and confirm no secret is printed in ordinary plan text.
  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: Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths. Verify: 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.

The question is set in this situation: A laboratory is moving sensitive parameter management from local variables to an encrypted state backend without publishing credentials. The test would be relevant: Apply a disposable nonproduction secret-shaped value, inspect state access policies and confirm no secret is printed in ordinary plan text. But the offered implementation—Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.—addresses “Prefer Terraform 1.12 ephemeral values and provider-supported write-only arguments”. The action needed here is: Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths.

B.

The question is set in this situation: A laboratory is moving sensitive parameter management from local variables to an encrypted state backend without publishing credentials. Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths. Confirm it through this test: Apply a disposable nonproduction secret-shaped value, inspect state access policies and confirm no secret is printed in ordinary plan text. Sensitive metadata suppresses ordinary CLI display but secrets can still persist in state or a saved plan depending on provider attributes.

C.

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: Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths.

D.

The question is set in this situation: A laboratory is moving sensitive parameter management from local variables to an encrypted state backend without publishing credentials. The action is applicable: Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths. But its proposed test—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.—addresses “Prefer Terraform 1.12 ephemeral values and provider-supported write-only arguments”. This requirement is confirmed instead by: Apply a disposable nonproduction secret-shaped value, inspect state access policies and confirm no secret is printed in ordinary plan text.

Question 431

A financial company rotates a managed database password and wants to avoid storing the actual new secret in Terraform state. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.
  2. Declare useful output blocks for created resource identifiers while marking genuinely sensitive values appropriately and avoiding broad data exposure.
  3. Select list when positional order matters and set when unique unordered membership is appropriate, especially before deriving keys for resources.
  4. Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths.

Answer & Explanations

Correct answer: A

A.

Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. 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. Verify the result with this test: 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.

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: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

C.

Select list when positional order matters and set when unique unordered membership is appropriate, especially before deriving keys for resources. This addresses “Use sets and lists with awareness of order and uniqueness”, where the governing principle is: Lists preserve ordering and can contain duplicates, while sets remove duplicates and do not guarantee positional indices for resource identity. The stated case instead calls for: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

D.

Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths. This addresses “Treat sensitive flags as display masking rather than zero-persistence”, where the governing principle is: Sensitive metadata suppresses ordinary CLI display but secrets can still persist in state or a saved plan depending on provider attributes. The stated case instead calls for: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

Question 432

A financial company rotates a managed database password and wants to avoid storing the actual new secret in Terraform state. The infrastructure engineer proposes this change: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. Which mechanism explains why it works?

  1. Outputs are a controlled interface between modules and users, but sensitive flags hide display rather than preventing all possible state persistence.
  2. Sensitive metadata suppresses ordinary CLI display but secrets can still persist in state or a saved plan depending on provider attributes.
  3. Lists preserve ordering and can contain duplicates, while sets remove duplicates and do not guarantee positional indices for resource identity.
  4. 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.

Answer & Explanations

Correct answer: D

A.

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

B.

Sensitive metadata suppresses ordinary CLI display but secrets can still persist in state or a saved plan depending on provider attributes. That explains “Treat sensitive flags as display masking rather than zero-persistence”, not the mechanism behind the described change. The relevant 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.

C.

Lists preserve ordering and can contain duplicates, while sets remove duplicates and do not guarantee positional indices for resource identity. That explains “Use sets and lists with awareness of order and uniqueness”, not the mechanism behind the described change. The relevant 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.

D.

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 corresponding implementation is: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

Question 433

A financial company rotates a managed database password and wants to avoid storing the actual new secret in Terraform state. After implementing this change—Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.—which test most directly validates its intended outcome?

  1. Apply a disposable nonproduction secret-shaped value, inspect state access policies and confirm no secret is printed in ordinary plan text.
  2. Feed intentionally duplicated environment labels into list and set test expressions and inspect resulting order, uniqueness and resource addresses.
  3. 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.
  4. 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: C

A.

Apply a disposable nonproduction secret-shaped value, inspect state access policies and confirm no secret is printed in ordinary plan text. That would help test “Treat sensitive flags as display masking rather than zero-persistence”, not the outcome required in this scenario. The relevant acceptance check is: 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.

B.

Feed intentionally duplicated environment labels into list and set test expressions and inspect resulting order, uniqueness and resource addresses. That would help test “Use sets and lists with awareness of order and uniqueness”, not the outcome required in this scenario. The relevant acceptance check is: 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.

C.

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. This check is decisive because 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.

D.

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 a disposable rotation using a documented write-only argument, inspect artifacts for omitted secret text and confirm the version attribute triggers the expected update.

Question 434

A financial company rotates a managed database password and wants to avoid storing the actual new secret in Terraform state. Which proposed shortcut most directly risks secret values unexpectedly persisted or an untracked rotation failing to update the remote system and should therefore be rejected?

  1. Use toset on an ordered subnet list and assume each element still has the same stable integer position for count.index.
  2. Assume every ordinary provider argument is write-only merely because the supplied variable is marked ephemeral or sensitive.
  3. Mark a database password sensitive and upload the resulting raw state and saved plan to a public issue tracker as if nothing sensitive were stored.
  4. Publish every secret attribute as a nonsensitive root output because downstream modules might eventually need to inspect it.

Answer & Explanations

Correct answer: B

A.

Use toset on an ordered subnet list and assume each element still has the same stable integer position for count.index. That shortcut risks unexpected element ordering or resource churn from the wrong collection type. Here the specific shortcut is: Assume every ordinary provider argument is write-only merely because the supplied variable is marked ephemeral or sensitive.

B.

Assume every ordinary provider argument is write-only merely because the supplied variable is marked ephemeral or sensitive. The foreseeable failure is secret values unexpectedly persisted or an untracked rotation failing to update the remote system. The safer response is: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

C.

Mark a database password sensitive and upload the resulting raw state and saved plan to a public issue tracker as if nothing sensitive were stored. That shortcut risks credentials exposed from state or plan artifacts despite CLI redaction. Here the specific shortcut is: Assume every ordinary provider argument is write-only merely because the supplied variable is marked ephemeral or sensitive.

D.

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: Assume every ordinary provider argument is write-only merely because the supplied variable is marked ephemeral or sensitive.

Question 435

A financial company rotates a managed database password and wants to avoid storing the actual new secret in Terraform state. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. Verify: 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.
  2. Implement: Select list when positional order matters and set when unique unordered membership is appropriate, especially before deriving keys for resources. Verify: Feed intentionally duplicated environment labels into list and set test expressions and inspect resulting order, uniqueness and resource addresses.
  3. Implement: Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths. Verify: 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.
  4. Implement: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. Verify: Apply a disposable nonproduction secret-shaped value, inspect state access policies and confirm no secret is printed in ordinary plan text.

Answer & Explanations

Correct answer: A

A.

Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. Confirm it through this test: 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. 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.

B.

This action/test pair addresses “Use sets and lists with awareness of order and uniqueness”. Select list when positional order matters and set when unique unordered membership is appropriate, especially before deriving keys for resources. Feed intentionally duplicated environment labels into list and set test expressions and inspect resulting order, uniqueness and resource addresses. The case instead calls for: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

C.

The test would be relevant: 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. But the offered implementation—Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths.—addresses “Treat sensitive flags as display masking rather than zero-persistence”. The action needed here is: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

D.

The action is applicable: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. But its proposed test—Apply a disposable nonproduction secret-shaped value, inspect state access policies and confirm no secret is printed in ordinary plan text.—addresses “Treat sensitive flags as display masking rather than zero-persistence”. This requirement is confirmed instead by: 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.

Question 436

A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. Which HashiCorp Terraform infrastructure implementation best satisfies this requirement?

  1. Apply lifecycle create_before_destroy for a replaceable resource when temporary coexistence is supported, identifiers are unique and downtime reduction matters.
  2. 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.
  3. Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths.
  4. Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

Answer & Explanations

Correct answer: D

A.

Apply lifecycle create_before_destroy for a replaceable resource when temporary coexistence is supported, identifiers are unique and downtime reduction matters. This addresses “Use create_before_destroy only when replacement sequencing is feasible”, where the governing principle is: Terraform may create a replacement before removing the old object, but a uniqueness constraint or shared name can prevent the two instances from coexisting. The stated case instead calls for: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

B.

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 an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

C.

The question is set in this situation: A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths. This addresses “Treat sensitive flags as display masking rather than zero-persistence”, where the governing principle is: Sensitive metadata suppresses ordinary CLI display but secrets can still persist in state or a saved plan depending on provider attributes. The stated case instead calls for: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

D.

The question is set in this situation: A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. 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. Verify the result with this test: 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.

Question 437

A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. The infrastructure engineer proposes this change: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. 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. 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.
  3. Sensitive metadata suppresses ordinary CLI display but secrets can still persist in state or a saved plan depending on provider attributes.
  4. Terraform may create a replacement before removing the old object, but a uniqueness constraint or shared name can prevent the two instances from coexisting.

Answer & Explanations

Correct answer: B

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

B.

The question is set in this situation: A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. 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 corresponding implementation is: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

C.

The question is set in this situation: A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. Sensitive metadata suppresses ordinary CLI display but secrets can still persist in state or a saved plan depending on provider attributes. That explains “Treat sensitive flags as display masking rather than zero-persistence”, not the mechanism behind the described change. The relevant 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.

D.

Terraform may create a replacement before removing the old object, but a uniqueness constraint or shared name can prevent the two instances from coexisting. That explains “Use create_before_destroy only when replacement sequencing is feasible”, not the mechanism behind the described change. The relevant 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.

Question 438

A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. After implementing this change—Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.—which test most directly validates its intended outcome?

  1. 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.
  2. Replace a disposable uniquely named resource and inspect the plan order while verifying the remote service allows both versions briefly.
  3. Apply a disposable nonproduction secret-shaped value, inspect state access policies and confirm no secret is printed in ordinary plan text.
  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: D

A.

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

B.

Replace a disposable uniquely named resource and inspect the plan order while verifying the remote service allows both versions briefly. That would help test “Use create_before_destroy only when replacement sequencing is feasible”, not the outcome required in this scenario. The relevant acceptance check is: 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.

C.

The question is set in this situation: A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. Apply a disposable nonproduction secret-shaped value, inspect state access policies and confirm no secret is printed in ordinary plan text. That would help test “Treat sensitive flags as display masking rather than zero-persistence”, not the outcome required in this scenario. The relevant acceptance check is: 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.

D.

The question is set in this situation: A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. 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. This check is decisive because 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.

Question 439

A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. Which proposed shortcut most directly risks secret values unexpectedly persisted or an untracked rotation failing to update the remote system 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. Mark a database password sensitive and upload the resulting raw state and saved plan to a public issue tracker as if nothing sensitive were stored.
  3. Assume every ordinary provider argument is write-only merely because the supplied variable is marked ephemeral or sensitive.
  4. Enable create_before_destroy on a globally unique fixed-name object without checking whether a second object can exist simultaneously.

Answer & Explanations

Correct answer: C

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: Assume every ordinary provider argument is write-only merely because the supplied variable is marked ephemeral or sensitive.

B.

The question is set in this situation: A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. Mark a database password sensitive and upload the resulting raw state and saved plan to a public issue tracker as if nothing sensitive were stored. That shortcut risks credentials exposed from state or plan artifacts despite CLI redaction. Here the specific shortcut is: Assume every ordinary provider argument is write-only merely because the supplied variable is marked ephemeral or sensitive.

C.

The question is set in this situation: A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. Assume every ordinary provider argument is write-only merely because the supplied variable is marked ephemeral or sensitive. The foreseeable failure is secret values unexpectedly persisted or an untracked rotation failing to update the remote system. The safer response is: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

D.

Enable create_before_destroy on a globally unique fixed-name object without checking whether a second object can exist simultaneously. That shortcut risks failed replacement or deployment outage caused by an impossible coexistence assumption. Here the specific shortcut is: Assume every ordinary provider argument is write-only merely because the supplied variable is marked ephemeral or sensitive.

Question 440

A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. Which combined implementation and verification plan is the best match for this workload?

  1. Implement: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. Verify: 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.
  2. Implement: 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. Verify: 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.
  3. Implement: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. Verify: Apply a disposable nonproduction secret-shaped value, inspect state access policies and confirm no secret is printed in ordinary plan text.
  4. Implement: Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths. Verify: 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: A

A.

The question is set in this situation: A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. Confirm it through this test: 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. 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.

B.

This action/test pair addresses “Use depends_on only for otherwise hidden dependencies”. 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. 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. The case instead calls for: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

C.

The question is set in this situation: A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. The action is applicable: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets. But its proposed test—Apply a disposable nonproduction secret-shaped value, inspect state access policies and confirm no secret is printed in ordinary plan text.—addresses “Treat sensitive flags as display masking rather than zero-persistence”. This requirement is confirmed instead by: 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.

D.

The question is set in this situation: A healthcare application obtains short-lived Vault credentials during Terraform execution and must pass them only into supported ephemeral contexts. The test would be relevant: 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. But the offered implementation—Mark confidential input variables sensitive, avoid displaying them in outputs, and separately protect state, plan files and credential injection paths.—addresses “Treat sensitive flags as display masking rather than zero-persistence”. The action needed here is: Use an ephemeral variable or resource with a supported provider write-only argument, and manage any companion version attribute when rotating secrets.

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