Platform · Config as data

Vault as the Control Plane: A Five-Tier Key Model with Locking

All onboarding configuration lives in Vault as typed keys layered from defaults to overrides to computed values, with a lock that protects customisations from re-runs.

  • HashiCorp Vault KV v2
  • Python
  • Terraform
  • GitHub Actions

// Overview

Terraform has no hardcoded team configuration. A Python populator writes standard defaults, then team overrides, then computed values; Terraform decodes each key (string, boolean, integer, JSON, list) and writes results back for downstream stages. A lock key stops later runs from overwriting live edits. The operator guide covers safe changes, rollback via KV v2 versions and adding new keys end to end.

// The problem

When CSV defaults, form values, manual edits and computed values all write the same store, config drifts and gets overwritten, and guessing at key types produces broken plans.

// Flow

Vault as the Control Plane: A Five-Tier Key Model with Locking flow1. Standard defaults → 2. Computed defaults → 3. Team overrides → 4. Network allocation → 5. Lock set → 6. Terraform read → 7. Write-back → 8. Change procedure → 9. Offboarding01Standard defaults02Computed defaults03Team overrides04Network allocation05 · GATELock set06Terraform read07Write-back08Change procedure09Offboarding
  1. Standard defaultsversion, network plugin, private cluster, feature flags per team and environment
  2. Computed defaultsnames and sizes derived from region and zone support
  3. Team overridesform values overwrite the defaults
  4. Network allocationfirst free block taken from a pool and marked allocated
  5. Lock set gatea locked flag stops later runs from overwriting customisations
  6. Terraform readone data source reads the secret; locals decode types, with safe defaults for optional keys
  7. Write-backoutputs such as cluster and identity ids are saved for later stages
  8. Change procedureread key and version, modify, write, plan; roll back via version history
  9. Offboardinglock reset and team removed from the registry so the name can be reused

// Design decisions & guardrails

  • Five tiers: standard CSV, team CSV, injected values, live edits, Terraform outputs. A key missing from the standard CSV is not missing from the system.
  • JSON-blob keys must be read before write, because a blind put destroys fields it does not re-specify.
  • Re-running the first stage resets team-CSV keys to their CSV values and re-locks; the lock does not protect the computed layer. This is documented, not hidden.
  • A missing required key fails the plan; there are no silent defaults.
  • Secrets are never in the repo or workflow; only generic path shapes are documented.

// Outcome

Typed, versioned, rollback-able configuration for every environment, with 35+ standard keys per customer environment.

// Related