Skip to content

refactor: read cross-root secrets via terraform_remote_state - #52

Draft
nbrieussel wants to merge 1 commit into
mainfrom
refactor/remote-state-secrets
Draft

refactor: read cross-root secrets via terraform_remote_state#52
nbrieussel wants to merge 1 commit into
mainfrom
refactor/remote-state-secrets

Conversation

@nbrieussel

Copy link
Copy Markdown
Contributor

Summary

  • approle_role_id/approle_secret_id (05-secrets/openbao/managed), the KMS unseal AWS keypair, and the backup bucket S3 credentials/bucket name (10-cluster/local, 10-cluster/scaleway) were hand-copied once into gitignored *.auto.tfvars from another root's terraform output and never re-derived.
  • Read them straight off the owning root's state instead, via data.terraform_remote_state — same pattern already used for dns_scaleway/backup_scaleway in 05-secrets/openbao/managed.
  • Also drops two bare string literals (bucket = "backup-dev-id", AWS_ACCESS_KEY_ID = "SCW8FGA70P4HY3A120KV") that weren't even variables.
  • Out of scope (confirmed): anything genuinely external and not Terraform-derivable — GitHub App/OAuth creds, Infisical creds, the OpenBao root token, argocd_admin_password_hash.

Test plan

  • terraform validate passes on all three touched roots
  • Every new data.terraform_remote_state block resolves correctly (plan showed no diff on the data source reads themselves)
  • Live-tested on a full 10-cluster/scaleway restart: bao status on openbao-0 shows Sealed: false / Seal Type: awskms — confirms the unseal creds sourced from 02-encryption/aws state are valid
  • openbao-init-restore job logs show a successful snapshot download from the backup bucket — confirms the S3 creds sourced from 03-storage/scaleway state are valid
  • All 21 ArgoCD Applications Synced/Healthy post-restart

🤖 Generated with Claude Code

https://claude.ai/code/session_012ywVH2Xdgo3QJLSueh2k2B

approle_role_id/secret_id (05-secrets/openbao/managed), the KMS unseal AWS
keypair, and the backup bucket S3 credentials/bucket name (10-cluster/local,
10-cluster/scaleway) were hand-copied once into gitignored *.auto.tfvars from
another root's `terraform output` and never re-derived. Read them straight
off the owning root's state instead (same data.terraform_remote_state
pattern already used for dns_scaleway/backup_scaleway), so they can't drift
silently. Also drops the last two bare string literals (bucket name, backup
bucket access key) that weren't even variables.

Verified live: unseal AWS creds and S3 backup creds both confirmed working
after a full scaleway cluster restart (bao status: sealed=false, awskms;
openbao-init-restore pulled the snapshot from the backup bucket).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ywVH2Xdgo3QJLSueh2k2B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant