Question 1 · choose 1
A pipeline passes a short-lived API token into a configuration only to configure a provider. The token must not end up in state or in saved plan files. How should the input variable be declared? (Terraform 1.12)
- AWith ephemeral = true, so it is usable during the run but never stored
- BWith a default of the token value, so it does not have to be passed on the command line
- CWith nullable = false, so Terraform refuses to write the value anywhere
- DWith type = string and a validation block that rejects stored values
Show the answer and why
AWith ephemeral = true, so it is usable during the run but never stored
Correct
The ephemeral argument makes a variable available at runtime while Terraform omits it from state and plan files; it can be used in contexts such as provider blocks.
BWith a default of the token value, so it does not have to be passed on the command line
Incorrect
A default puts the secret into the configuration itself.
CWith nullable = false, so Terraform refuses to write the value anywhere
Incorrect
nullable only controls whether null is accepted.
DWith type = string and a validation block that rejects stored values
Incorrect
Validation checks values; it cannot control where Terraform stores them.
Ephemeral variables (Terraform 1.10 and later) exist only for the run; nothing about them is written to state or plans.
HashiCorp documentation