Encrypt Terraform state with OpenBao Transit #99

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

Goal: Terraform state is encrypted at rest, and an OpenBao policy decides who can decrypt it.

OpenTofu has built-in state encryption, and one key provider is OpenBao Transit. The state Secret on mini holds ciphertext. Decrypting it needs the Transit key, so who may read each root's state becomes an OpenBao policy, and every decrypt shows up in OpenBao's audit log.

This is defence in depth on top of keeping secrets out of state.

Work

  1. Rehearse on the workstation OpenBao: a Transit key per root, an encryption block in a test root, then plan and apply round trips.
  2. Find out how the tofu-controller runner authenticates the key provider. It needs an OpenBao token in its environment. Runners log in by ServiceAccount (ADR-0010), except openbao-config, which uses the bootstrap AppRole.
  3. Decide what happens when OpenBao is down. openbao-config manages OpenBao itself, so encrypting its state with OpenBao can lock it out. It may need a different key provider or a fallback key.
  4. Migrate one root at a time with OpenTofu's fallback setting, so existing unencrypted state still reads.
Goal: Terraform state is encrypted at rest, and an OpenBao policy decides who can decrypt it. OpenTofu has built-in state encryption, and one key provider is OpenBao Transit. The state Secret on mini holds ciphertext. Decrypting it needs the Transit key, so who may read each root's state becomes an OpenBao policy, and every decrypt shows up in OpenBao's audit log. This is defence in depth on top of keeping secrets out of state. ## Work 1. Rehearse on the workstation OpenBao: a Transit key per root, an `encryption` block in a test root, then plan and apply round trips. 2. Find out how the tofu-controller runner authenticates the key provider. It needs an OpenBao token in its environment. Runners log in by ServiceAccount (ADR-0010), except openbao-config, which uses the bootstrap AppRole. 3. Decide what happens when OpenBao is down. openbao-config manages OpenBao itself, so encrypting its state with OpenBao can lock it out. It may need a different key provider or a fallback key. 4. Migrate one root at a time with OpenTofu's `fallback` setting, so existing unencrypted state still reads.
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#99
No description provided.