user: add gitea-vault-admin site-admin bot with one-time Vault KV seeding #46
Reference in New Issue
Block a user
Delete Branch "benvin/gitea-vault-admin"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The
vault-plugin-secrets-giteaengine (deployed via terraform-vault #101) needs a purpose-built Gitea site-admin credential to mint and delete per-user tokens. Previously that account and its Vault KV seed were flagged as a manual gap. This closes the gap in Terraform: the account is created here and its generated password is seeded to Vault once, so no credential is ever created or copied by hand.Per Ben's request, the password is written to Vault exactly once and never updated afterwards.
Change
config/git.unkin.net/user/gitea-vault-admin.yaml— a local site-admin bot (admin: true, limited visibility, no org/repo creation).usermodule with an optionalvault_seed_path(+vault_seed_mount, defaultkv): when set, the account's generated password is written to Vault KV asadmin_username+admin_passwordviavault_kv_secret_v2.random_passwordhas no keepers, so it never regenerates; the seed value is stable.lifecycle { ignore_changes = [data_json] }makes the KV write create-only: written the first time and never re-written, so a latervault write -f gitea/config/rotate-root(which diverges the live Gitea password from this seed) is never clobbered by a re-apply.hashicorp/vaultprovider (module + root generate block); it readsVAULT_ADDR/VAULT_TOKENalready exported by the Makefile k8s auth login (rolewoodpecker_terraform_git).Dependencies / ordering
woodpecker_terraform_git) to merge + apply first, or this apply 403s writing the seed.gitea/configcreation time).https://claude.ai/code/session_015ur3i7D2azsMAWTSVABApv
@@ -11,1 +11,4 @@}vault = {source = "hashicorp/vault"version = ">= 4.3"This is an old release?
Re: the
go-gitea/giteaprovider pin onmodules/gitea_instance/modules/user/terraform.tf("This is an old release?") —It's not out of date: 0.7.0 is the latest published release of
go-gitea/gitea(published 2025-06-18) on both the OpenTofu and Terraform registries. This PR inherited the pin from the rest of the repo — all 7terraform.tffiles pin it to 0.7.0 consistently, so there's nothing to bump.There is a
v0.8.0git tag on go-gitea/terraform-provider-gitea, but it was never published to a registry (no GitHub release;/v1/providers/go-gitea/gitea/0.8.0/download/...404s on both registries), so it isn't installable via thego-gitea/giteasource address. If we want it, someone has to get it published upstream or mirror it into artifactapi first — happy to do that as a separate change if you'd like, but it's out of scope for this PR.New providers I added here:
hashicorp/vault>= 4.3(resolves to the current 5.10.1) matching the repo's floor-pin style forhashicorp/random>= 3.5(3.9.0). No existing-provider version changed, so the plan is only the newgitea-vault-adminuser + its one-time KV seed — no churn to existing users/repos.