Skip to content

Tofu Controller

Tofu Controller lets Flux reconcile OpenTofu/Terraform configurations the same way it reconciles Kubernetes manifests. It’s the bridge that brings non-Kubernetes resources — Vault paths, Postgres databases, OIDC clients — into the GitOps loop.

FieldValue
Flux pathflux-clusters/stefanzhelev/apps/tofu-controller
Base pathflux-apps/tofu-controller
Namespaceflux-system
Sync wave1
Depends on
  • HelmRelease for the tofu-controller chart
  • The controller itself, which watches Terraform CRs anywhere in the cluster
  • allowCrossNamespaceRefs: true. A Terraform CR in one namespace can reference Secrets, ConfigMaps, and Source CRs from any other. This is what lets, for example, the CNPG Terraform CR pull a Vault token from the vault namespace.
  • No state backend in-cluster. Each Terraform CR points at its own remote state target as part of its module configuration.

Tofu Controller reconciles the Terraform CRs that other apps ship in their Flux folders:

ConsumerWhat Terraform manages
VaultInitial KV mounts and policies
CloudNative-PGPer-app databases and roles
AuthentikSecret key + admin password material
ForgejoAdmin user + DB credentials
GrafanaAdmin password + DB credentials
DremioAWS access keys
ClickStackClickHouse credentials
  • Flux: appears as just another HelmRelease, but enables Terraform CRs cluster-wide
  • Vault: the primary Terraform target for credential material
Terminal window
# Check the controller
kubectl get pods -n flux-system -l app.kubernetes.io/name=tofu-controller
# List Terraform CRs
kubectl get terraform -A
# Inspect a specific Terraform CR
kubectl describe terraform <name> -n <namespace>
# View controller logs
kubectl logs -n flux-system -l app.kubernetes.io/name=tofu-controller