Salt Phase 2b: GPG-encrypted pillar + Terraform integration (#3) #4
No reviewers
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!4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "3-salt-phase-2b-gpg-encryption-secret-migr"
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?
Summary
~/secrets/to GPG-encrypted Salt pillarmake tofu-secrets(renderssecrets.auto.tfvarsfrom pillar)k3s.tfvarseliminated — replaced by auto-rendered file + variable defaultsChanges
salt/pillar/secrets/platform.sls: GPG-encrypted Tailscale, Grafana, Forgejo, Woodpecker, Harbor, MinIO secretssalt/pillar/secrets/services.sls: GPG-encrypted ArgoCD, Harbor CI, Forgejo ArgoCD tokensalt/pillar/secrets/forgejo.sls: GPG-encrypted Forgejo/Woodpecker CI credentialssalt/pillar/secrets/sops.sls: GPG-encrypted age private key + plaintext public keysalt/pillar/secrets_registry.sls: Plaintext metadata — origin, rotation schedule, backup locationssalt/pillar/top.sls: Assign all pillar data to archbox minionMakefile: Newtofu-secretstarget,tofu-plan/tofu-applyauto-depend on it, removed-var-file=k3s.tfvars.gitignore: Allowsalt/pillar/secrets/(GPG-encrypted content, safe to commit)OpenTofu notes:
tofu planoutput = "No changes. Your infrastructure matches the configuration."tofu fmtnot applicable (no .tf changes).Test Plan
salt-call pillar.itemsdecrypts all 20 secrets correctlymake tofu-secretsrenders 9 Terraform variables from encrypted pillarmake tofu-plan= "No changes" with zero warningsReview Checklist
.gitignoreexception is scoped tosalt/pillar/secrets/onlyRelated Notes
issue-pal-e-platform-salt-phase-2b-gpg-secrets— the issue this PR addressesplan-2026-02-26-salt-host-management— Phase 2blesson-salt-gpg-agent-config— GPG agent configuration lesson discovered during this workReview nits addressed (
ff72890)All 5 nits from the review have been fixed in a single commit:
Registry gap -- Added
services.harbor_admin_passwordentry referencingplatform.harbor_admin_passwordas canonical, matching the existing YAML style.Python escape special chars -- Values rendered into
secrets.auto.tfvarsnow escape backslashes, double quotes, and newlines viareplace()chain before printing.sudo pre-check --
sudo -n truecheck added as first line oftofu-secretsrecipe. Fails fast with a clear error message instead of silently hanging.Remove
valuefield fromage_public_key-- Removed the actual key value from the registry entry. Updatednotesto: "Plaintext in sops.sls pillar. Shared freely for SOPS encryption."Replace list comprehension with for loop -- Extracted the inline Python into a Makefile
defineblock (PILLAR_TO_TFVARS) for readability. Uses a properforloop. Allowed variable names are now passed assys.argv[1:]instead of inline Make variable expansion, which is cleaner.QA Review Round 2 — Nit fixes applied
Nit 1: Escaped quotes in
secrets_registry.slsReplaced escaped double quotes (
\"...\") with single quotes ('...') ingpg.identityandgpg.backup_locations. Cleaner YAML, same result.Nit 2: PR body secret count
Correction: test plan item should read "22 secrets" not "20". Actual count: 10 platform + 5 services + 5 forgejo + 2 sops = 22.
Nit 4: stderr suppression in Makefile
Removed
2>/dev/nullfrom thesudo /opt/salt/salt-callline in thetofu-secretstarget. Salt's stderr warnings won't corrupt the JSON output (stdout and stderr are separate pipes), and now real errors like GPG decrypt failures or minion-not-running will surface instead of being silently swallowed.Commit:
afb09a9