Keep secret values out of Terraform state (write-only, ephemeral) #98

Open
opened 2026-11-15 15:35:51 +00:00 by ginjiruu · 0 comments
Owner

Goal: Terraform state holds no secret values, so read access to state is not read access to secrets.

ADR-0002 already says secret values belong in OpenBao, not in IaC. OpenTofu 1.11 has two ways to keep a value out of state:

  • Write-only attributes (*_wo). The value goes to the API and is never stored. The harbor root already warns that harbor_robot_account.node_pull.secret has a secret_wo alternative.
  • Ephemeral resources and values, for example ephemeral "random_password" or an ephemeral OpenBao read. They exist only during the run.

Work

  1. Audit every root's state (openbao-config, kanidm-config, harbor-config) and list each attribute that holds a secret. Likely hits: the harbor robot password and oidc_client_secret.
  2. Move each one to a write-only attribute or an ephemeral value. When the provider has neither, record the gap here.
  3. Add a check that fails if a state contains an attribute the audit marked as secret.
Goal: Terraform state holds no secret values, so read access to state is not read access to secrets. ADR-0002 already says secret values belong in OpenBao, not in IaC. OpenTofu 1.11 has two ways to keep a value out of state: - Write-only attributes (`*_wo`). The value goes to the API and is never stored. The harbor root already warns that `harbor_robot_account.node_pull.secret` has a `secret_wo` alternative. - Ephemeral resources and values, for example `ephemeral "random_password"` or an ephemeral OpenBao read. They exist only during the run. ## Work 1. Audit every root's state (openbao-config, kanidm-config, harbor-config) and list each attribute that holds a secret. Likely hits: the harbor robot password and `oidc_client_secret`. 2. Move each one to a write-only attribute or an ephemeral value. When the provider has neither, record the gap here. 3. Add a check that fails if a state contains an attribute the audit marked as secret.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lab/iac#98
No description provided.