Before Terraform 1.11, managing sensitive values was a challenge as they were persisting to plan artifacts and state, but ephemerality was introduced to handle this securely.
In computing, ephemerality refers to creating temporary data that exists briefly and is discarded after use, and Terraform uses this concept for managing sensitive data.
Ephemeral resources in Terraform are temporary and allow for secure handling of sensitive data without persisting them to the plan artifact or state file.
Ephemeral resources run during both plan and apply stages and depend on existing resources, ensuring proper dependency management.
Write-only arguments in Terraform are used for managing sensitive values securely and are not persisted to the plan artifact or state file.
Terraform providers implement write-only arguments to handle sensitive values like passwords and tokens, ensuring their security.
Write-only version arguments help track changes in write-only values and allow for updating them by incrementing the version number.
Ephemeral resources in Terraform can be deferred to the apply stage if their input arguments reference values not known during planning.
The lifecycle of an ephemeral resource involves opening for data access, renewing if needed for longer access, and closing once no longer required.
By persisting ephemeral secrets in a secure manner, Terraform ensures that sensitive values are handled safely and reliably during the apply stage.