feat: wire WOODPECKER_ENCRYPTION_KEY through Terraform #99
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-platform#99
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Lineage
todo-woodpecker-secrets-terraform(no plan ancestry)Repo
forgejo_admin/pal-e-platformUser Story
As a platform operator
I want the Woodpecker encryption key managed by Terraform
So that stored secrets survive CNPG database migrations without becoming undecryptable
Context
Every time CNPG rebuilds the Woodpecker database, the encryption key stored in the DB is lost. This makes all stored secrets (repo secrets, global secrets) undecryptable, requiring manual re-entry of every secret. The fix is to pass
WOODPECKER_ENCRYPTION_KEYas an externally-managed env var via Helm values so Woodpecker uses that key instead of generating one internally. The key then lives in terraform state (sourced from Salt pillar), not the DB.File Targets
Files the agent should modify:
terraform/variables.tf-- addwoodpecker_encryption_keyvariable (sensitive)terraform/main.tf-- addset_sensitiveblock for the encryption key in the Woodpecker helm_releaseMakefile-- addwoodpecker_encryption_keytoTF_SECRET_VARS.woodpecker.yaml-- addTF_VAR_woodpecker_encryption_keyto plan and apply step environmentsFiles the agent should NOT touch:
salt/pillar/secrets/platform.sls-- the actual secret value is added by the operator separatelyAcceptance Criteria
woodpecker_encryption_keyvariable exists interraform/variables.tfas a sensitive stringset_sensitiveblock passes the key toserver.env.WOODPECKER_ENCRYPTION_KEYin the Woodpecker helm_releaseMakefileTF_SECRET_VARSincludeswoodpecker_encryption_key.woodpecker.yamlplan step includesTF_VAR_woodpecker_encryption_keyfrom secret.woodpecker.yamlapply step includesTF_VAR_woodpecker_encryption_keyfrom secrettofu fmt -checkpassestofu validateshows no syntax errors (missing variable value is expected)Test Expectations
tofu fmt -check -recursiveexits 0tofu validatefails only with "No value for required variable" (not syntax error)cd terraform && tofu fmt -check -recursive && tofu validateConstraints
set_sensitivepattern (lines 755-777 of main.tf) -- do NOT put sensitive values in theyamlencodeblockTF_SECRET_VARSnaming convention in Makefile.woodpecker.yamlChecklist
Related
pal-e-platform-- project this affects