Vault IaC: tofu-controller manages Vault config from code #1515

Closed
opened 2026-08-07 15:49:17 +00:00 by ginjiruu · 5 comments
Owner

Vault IaC — tofu-controller manages Vault config from code

Part of the "Flux IAC tofu-controller with Vault" todo. Grilled and designed — see the design tree in ADR 0002/0003/0004 and plans/vault-iac-implementation.md.

Decision summary

  • Manager: tofu-controller runs on mini only; removed from portable (memory-saturated cluster).
  • Code home: top-level infra/vault/, extensible for future tofu-managed infrastructure.
  • Scope: Vault platform config (auth methods, policies, identity groups, secret engines) + KV schema scaffolding. tofu writes no secret values — nothing random, nothing in state/git.
  • Auth: runner uses an AppRole, bootstrapped once with the root token, and the AppRole + its policy are excluded from the IaC (prevents self-lockout).
  • Apply: plan-and-manually-apply (approvePlan: "", gate from Terraform.status). Branch Planner is deferred (see its own ticket).
  • Secret value ownership: ESO generators/PushSecret and CNPG own values; humans own OIDC client secrets / API keys / webhooks (tofu creates the KV path/schema, human supplies the value). Kanidm-provisioned OIDC accounts must be able to write their manual secrets to the relevant stores.

Work items

  1. Scaffold infra/vault/: provider config, migrate the OIDC auth backend + role + superadmins group from ../iac/vault (with a one-time terraform import — those 5 resources already exist live), ESO token policies (manager/reader), starter KV schema.
  2. One-time bootstrap: create the runner AppRole + policy with the root token, store the secret_id in a cluster secret; keep it out of the IaC.
  3. Wire the mini Terraform object (single object, approvePlan: "").
  4. Remove tofu-controller Kustomization from portable.
  5. Ensure Kanidm OIDC write path for manual secrets (Q17).
  6. Import the existing ../iac/vault state resources so tofu-controller owns them without recreation.
  • ADR 0002 (mini sole manager), 0003 (secret value ownership), 0004 (AppRole bootstrap)
  • Branch Planner deferral ticket (upstream gitea detection)
  • forgejo/firefly DB migration walkthrough ticket
# Vault IaC — tofu-controller manages Vault config from code Part of the "Flux IAC tofu-controller with Vault" todo. Grilled and designed — see the design tree in ADR 0002/0003/0004 and `plans/vault-iac-implementation.md`. ## Decision summary - **Manager**: tofu-controller runs on **mini only**; removed from portable (memory-saturated cluster). - **Code home**: top-level `infra/vault/`, extensible for future tofu-managed infrastructure. - **Scope**: Vault **platform config** (auth methods, policies, identity groups, secret engines) + **KV schema** scaffolding. tofu writes **no secret values** — nothing random, nothing in state/git. - **Auth**: runner uses an **AppRole**, bootstrapped once with the root token, and the AppRole + its policy are **excluded** from the IaC (prevents self-lockout). - **Apply**: plan-and-manually-apply (`approvePlan: ""`, gate from `Terraform.status`). Branch Planner is deferred (see its own ticket). - **Secret value ownership**: ESO generators/PushSecret and CNPG own values; humans own OIDC client secrets / API keys / webhooks (tofu creates the KV path/schema, human supplies the value). Kanidm-provisioned OIDC accounts must be able to write their manual secrets to the relevant stores. ## Work items 1. Scaffold `infra/vault/`: provider config, migrate the OIDC auth backend + role + superadmins group from `../iac/vault` (with a one-time `terraform import` — those 5 resources already exist live), ESO token policies (`manager`/`reader`), starter KV schema. 2. One-time bootstrap: create the runner AppRole + policy with the root token, store the secret_id in a cluster secret; keep it out of the IaC. 3. Wire the mini `Terraform` object (single object, `approvePlan: ""`). 4. Remove tofu-controller Kustomization from portable. 5. Ensure Kanidm OIDC write path for manual secrets (Q17). 6. Import the existing `../iac/vault` state resources so tofu-controller owns them without recreation. ## Related - ADR 0002 (mini sole manager), 0003 (secret value ownership), 0004 (AppRole bootstrap) - Branch Planner deferral ticket (upstream gitea detection) - forgejo/firefly DB migration walkthrough ticket
ginjiruu added this to the Vault IaC milestone 2026-08-07 15:49:31 +00:00
Author
Owner

Split applied: the Vault IaC now lives in lab/iac (vault/ path), watched by the new vault-infra GitRepository (dedicated deploy key, secret vault-infra). lab/clusters no longer holds the IaC; spec.approvePlan was reset. Fresh plan generated from the new source: plan-master-7f2dc887b1 — approvals committed to lab/clusters no longer invalidate the pending plan.

Split applied: the Vault IaC now lives in `lab/iac` (`vault/` path), watched by the new `vault-infra` GitRepository (dedicated deploy key, secret `vault-infra`). `lab/clusters` no longer holds the IaC; `spec.approvePlan` was reset. Fresh plan generated from the new source: `plan-master-7f2dc887b1` — approvals committed to `lab/clusters` no longer invalidate the pending plan.
Author
Owner

Completed

Completed
Author
Owner

Kanidm migration #1520 (work item 5 / Q17): resolved via terraform, not the kaniop operator. Kanidm management was moved into the terraform IaC and that migration is now complete — this item is satisfied.

Kanidm migration #1520 (work item 5 / Q17): resolved via terraform, not the kaniop operator. Kanidm management was moved into the terraform IaC and that migration is now complete — this item is satisfied.
Author
Owner

Resolution note for Q17: the Kanidm migration (originally #1520) was completed via Terraform rather than the kaniop operator — Kanidm management now lives in the terraform IaC (lab/iac, , applied on mini). The terraform Kanidm migration is complete; Q17's blocking dependency is resolved.

Resolution note for Q17: the Kanidm migration (originally #1520) was completed via Terraform rather than the kaniop operator — Kanidm management now lives in the terraform IaC (lab/iac, , applied on mini). The terraform Kanidm migration is complete; Q17's blocking dependency is resolved.
Author
Owner

Resolution note for Q17: the Kanidm migration (originally #1520) was completed via Terraform rather than the kaniop operator. Kanidm management now lives in the terraform IaC (lab/iac, kanidm-config, applied on mini). The terraform Kanidm migration is complete; the Q17 blocking dependency is resolved.

Resolution note for Q17: the Kanidm migration (originally #1520) was completed via Terraform rather than the kaniop operator. Kanidm management now lives in the terraform IaC (lab/iac, kanidm-config, applied on mini). The terraform Kanidm migration is complete; the Q17 blocking dependency is resolved.
Sign in to join this conversation.
No milestone
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/clusters#1515
No description provided.