Bitzu

Terraform Associate 004 ยท Dependencies, validation and sensitive data

Ephemeral values, write-only arguments and Vault

Ephemeral variables/resources, write-only arguments that never reach state, Vault provider and dynamic secrets, avoiding hard-coded credentials (4h).

Key points

  • Ephemeral values exist only during one operation and are omitted from state and plan files (ephemeral variables and child module outputs, the ephemeral block, write-only arguments).
  • A write-only argument (name usually ends in _wo, paired with _wo_version) hands a temporary value to a managed resource without storing it.
  • Fetching secrets at run time, for example from Vault, avoids hard-coding credentials.

Source: https://developer.hashicorp.com/terraform/language/manage-sensitive-data

Practice questions

Single choice

Are values produced by an ephemeral resource stored in the state or plan file?

  1. No, they exist only during the operation
  2. Yes, but encrypted
  3. Yes, but only in the plan file
  4. Only if the output is marked sensitive
Show answer

Answer: A. No, they exist only during the operation

Terraform does not store ephemeral resources in state or plan files; they exist only for the current operation.

Select all that apply

Where may an ephemeral resource's value be referenced?

  1. A write-only argument of a managed resource
  2. A locals block
  3. A variable block with ephemeral = true
  4. An ordinary (non write-only) resource argument
  5. A root module output with ephemeral = true
Show answer

Answer: A. A write-only argument of a managed resource, B. A locals block, C. A variable block with ephemeral = true

Allowed: write-only arguments, locals, ephemeral variables and other contexts. An ordinary resource argument is rejected, and root module outputs cannot be ephemeral.

True or false

A write-only argument is saved in state like any other argument but is hidden in CLI output.

Show answer

Answer: False

False. Write-only arguments are never persisted to plan or state files; hiding display is what sensitive does.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More Terraform Associate 004 topics in this module