Skip to content

feat(opentofu): source docs GitHub App key from Actions secret - #33

Merged
xnoto merged 1 commit into
mainfrom
feat/opentofu-docs-app-secret
Aug 30, 2026
Merged

feat(opentofu): source docs GitHub App key from Actions secret#33
xnoto merged 1 commit into
mainfrom
feat/opentofu-docs-app-secret

Conversation

@xnoto

@xnoto xnoto commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add optional CHART_UPDATER_GITHUB_APP_PRIVATE_KEY to the reusable OpenTofu workflow secret contract
  • source the generated-docs GitHub App key from that caller-mapped Actions secret instead of AWS OIDC + Secrets Manager
  • remove the github-actions-opentofu-docs credential and Secrets Manager steps from the test job; id-token: write is no longer needed there (plan/apply keep OIDC for SOPS KMS)
  • fail with a clear message when same-repository PR docs drift occurs without the App key, wired into the existing validation report
  • keep fork PRs uncredentialed; forks never receive secrets and still fail on docs drift

Context

Completes the migration started by tfroot-github#42 and tfroot-aws#30: the chart updater App key is canonically SOPS-backed in tfroot-github and distributed as a repository Actions secret (charts already consumes it this way). The AWS Secrets Manager copy is legacy per tfroot-github/docs/chart-updater-github-app.md; this removes the last workflow reference to it.

Caller impact

  • Callers passing CHART_UPDATER_GITHUB_APP_PRIVATE_KEY keep automatic App-authored docs commits, which retrigger PR validation on the resulting SHA.
  • Callers without the mapping fail test with an explicit message when README.md is out of date, matching the pre-autofix behavior.
  • Companion caller PRs add the mapping for tfroot-aws, tfroot-cloudflare, tfroot-gcp, tfroot-github, and tfroot-libvirt; they must merge after this PR so the secret input exists.

Validation

  • GitHub Actions checks on this pull request are the validation authority.
  • Reviewed the diff: no credentials, decrypted values, or state material included.

No merge or workflow dispatch performed.

@xnoto
xnoto requested a review from a team as a code owner August 30, 2026 16:58
@github-actions

Copy link
Copy Markdown

Shared workflows CI passed

View the workflow run.

Validation output (redacted, last 12000 characters)

[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/gitleaks/gitleaks.
[INFO] Initializing environment for https://github.com/rhysd/actionlint.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/gitleaks/gitleaks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/rhysd/actionlint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
check for case conflicts.................................................Passed
check for merge conflicts................................................Passed
check for broken symlinks............................(no files to check)Skipped
check vcs permalinks.....................................................Passed
detect destroyed symlinks................................................Passed
detect private key.......................................................Passed
mixed line ending........................................................Passed
trim trailing whitespace.................................................Passed
Detect hardcoded secrets.................................................Passed
Lint GitHub Actions workflow files.......................................Passed

@xnoto
xnoto merged commit a4be81e into main Aug 30, 2026
2 checks passed
@xnoto
xnoto deleted the feat/opentofu-docs-app-secret branch August 30, 2026 17:39
xnoto added a commit to makeitworkcloud/tfroot-github that referenced this pull request Aug 30, 2026
## Summary

- extend the existing SOPS-backed `chart_updater_github_app_private_key`
recipient list to the five OpenTofu caller roots: `tfroot-aws`,
`tfroot-cloudflare`, `tfroot-gcp`, `tfroot-github`, `tfroot-libvirt`
- **also fixes a pre-existing main breakage**: the `www_access_key_id` /
`www_secret_access_key` lookups drifted from the actual SOPS key names
(`www_aws_access_key_id` / `www_aws_secret_access_key`, matching the
`onion_aws_*` naming), which failed every plan on `main` with `Invalid
index` and blocked the post-#44 apply. The values never left
`secrets/secrets.yaml`; only the `main.tf` references were wrong. No
SOPS or secret-value changes.
- no secret name (`name =`) changes, so existing Actions secrets are
untouched

## Context

This finishes the migration started in #42. The shared OpenTofu
workflow's generated-docs commit path
(makeitworkcloud/shared-workflows#33) now consumes
`CHART_UPDATER_GITHUB_APP_PRIVATE_KEY` as an Actions secret, matching
how `charts` already uses it, so each caller repository needs the secret
provisioned. The chart updater GitHub App installation already covers
the organization.

Per `docs/chart-updater-github-app.md`, adding source repositories
broadens private-key distribution and requires explicit review. Once
this and the companion PRs merge and apply, the AWS Secrets Manager copy
becomes genuinely unreferenced; removing the
`github-actions-opentofu-docs` role is tracked in
makeitworkcloud/tfroot-aws#32 (draft).

## Validation

- PR CI plan is the validation authority; confirm it creates exactly
five new `github_actions_secret.secrets` instances plus the
already-pending
`github_branch_protection.relaxed_protections["agent-knowledge"]` from
#44, and modifies nothing else.
- Reviewed the diff: no decrypted values or plaintext material included.

## Rollout

Merge and let the environment-gated apply complete **before** merging
the five caller PRs, so the Actions secret exists when callers start
mapping it. Merge order: shared-workflows#33 first, then this PR, then
the caller PRs.
xnoto added a commit to makeitworkcloud/tfroot-aws that referenced this pull request Aug 30, 2026
## Summary

- map the repository `CHART_UPDATER_GITHUB_APP_PRIVATE_KEY` Actions
secret into the reusable OpenTofu workflow

## Context

Completes the chart updater App key migration for this root.
makeitworkcloud/shared-workflows#33 replaces the AWS OIDC + Secrets
Manager docs-commit credential with this secret;
makeitworkcloud/tfroot-github#45 provisions the secret to this
repository.

## Merge order

1. makeitworkcloud/shared-workflows#33
2. makeitworkcloud/tfroot-github#45 (apply provisions the secret)
3. This PR

CI on this PR calls the reusable workflow from `@main` and cannot pass
until shared-workflows#33 merges; re-run checks after that lands.

## Validation

- Reviewed the diff: one secret mapping added; no credentials or
decrypted values included.
- GitHub Actions checks are the validation authority after the
dependency merges.
xnoto added a commit to makeitworkcloud/tfroot-cloudflare that referenced this pull request Aug 30, 2026
## Summary

- map the repository `CHART_UPDATER_GITHUB_APP_PRIVATE_KEY` Actions
secret into the reusable OpenTofu workflow

## Context

Completes the chart updater App key migration for this root.
makeitworkcloud/shared-workflows#33 replaces the AWS OIDC + Secrets
Manager docs-commit credential with this secret;
makeitworkcloud/tfroot-github#45 provisions the secret to this
repository.

## Merge order

1. makeitworkcloud/shared-workflows#33
2. makeitworkcloud/tfroot-github#45 (apply provisions the secret)
3. This PR

CI on this PR calls the reusable workflow from `@main` and cannot pass
until shared-workflows#33 merges; re-run checks after that lands.

## Validation

- Reviewed the diff: one secret mapping added; no credentials or
decrypted values included.
- GitHub Actions checks are the validation authority after the
dependency merges.
xnoto added a commit to makeitworkcloud/tfroot-gcp that referenced this pull request Aug 30, 2026
## Summary

- map the repository `CHART_UPDATER_GITHUB_APP_PRIVATE_KEY` Actions
secret into the reusable OpenTofu workflow

## Context

Completes the chart updater App key migration for this root.
makeitworkcloud/shared-workflows#33 replaces the AWS OIDC + Secrets
Manager docs-commit credential with this secret;
makeitworkcloud/tfroot-github#45 provisions the secret to this
repository.

## Merge order

1. makeitworkcloud/shared-workflows#33
2. makeitworkcloud/tfroot-github#45 (apply provisions the secret)
3. This PR

CI on this PR calls the reusable workflow from `@main` and cannot pass
until shared-workflows#33 merges; re-run checks after that lands.

## Validation

- Reviewed the diff: one secret mapping added; no credentials or
decrypted values included.
- GitHub Actions checks are the validation authority after the
dependency merges.
xnoto added a commit to makeitworkcloud/tfroot-github that referenced this pull request Aug 30, 2026
## Summary

- map the repository `CHART_UPDATER_GITHUB_APP_PRIVATE_KEY` Actions
secret into the reusable OpenTofu workflow

## Context

Completes the chart updater App key migration for this root.
makeitworkcloud/shared-workflows#33 replaces the AWS OIDC + Secrets
Manager docs-commit credential with this secret;
#45 provisions the secret to this
repository.

## Merge order

1. makeitworkcloud/shared-workflows#33
2. #45 (apply provisions the secret)
3. This PR

CI on this PR calls the reusable workflow from `@main` and cannot pass
until shared-workflows#33 merges; re-run checks after that lands.

## Validation

- Reviewed the diff: one secret mapping added; no credentials or
decrypted values included.
- GitHub Actions checks are the validation authority after the
dependency merges.
xnoto added a commit to makeitworkcloud/tfroot-libvirt that referenced this pull request Aug 30, 2026
## Summary

- map the repository `CHART_UPDATER_GITHUB_APP_PRIVATE_KEY` Actions
secret into the reusable OpenTofu workflow alongside the existing SSH
key mappings

## Context

Completes the chart updater App key migration for this root.
makeitworkcloud/shared-workflows#33 replaces the AWS OIDC + Secrets
Manager docs-commit credential with this secret;
makeitworkcloud/tfroot-github#45 provisions the secret to this
repository.

## Merge order

1. makeitworkcloud/shared-workflows#33
2. makeitworkcloud/tfroot-github#45 (apply provisions the secret)
3. This PR

CI on this PR calls the reusable workflow from `@main` and cannot pass
until shared-workflows#33 merges; re-run checks after that lands.

## Validation

- Reviewed the diff: one secret mapping added; no credentials or
decrypted values included.
- GitHub Actions checks are the validation authority after the
dependency merges.
xnoto added a commit to makeitworkcloud/tfroot-aws that referenced this pull request Aug 30, 2026
## Summary

- remove the `github-actions-opentofu-docs` IAM role and its inline
Secrets Manager read policy

## Context

The shared OpenTofu workflow's generated-docs commit path no longer uses
AWS: makeitworkcloud/shared-workflows#33 sources the chart updater
GitHub App key from the caller-mapped
`CHART_UPDATER_GITHUB_APP_PRIVATE_KEY` Actions secret, provisioned by
makeitworkcloud/tfroot-github#45. After those land, nothing references
this role or the legacy Secrets Manager copy, matching
`tfroot-github/docs/chart-updater-github-app.md`.

This mirrors #30, which removed the charts-facing role. The manually
created Secrets Manager secret
(`xnoto-s-chart-updater-github-app-private-key-*`) is intentionally not
deleted here; per the runbook its deletion is a separate approved
cleanup after the agreed rollback window.

## Rollout dependency

Draft until all of the following have merged and applied:

1. makeitworkcloud/shared-workflows#33
2. makeitworkcloud/tfroot-github#45
3. Caller PRs: #31, tfroot-cloudflare#37,
tfroot-gcp#5, tfroot-github#46, tfroot-libvirt#26

Destroying this role before then breaks generated-docs commits on
same-repository PRs.

## Validation

- GitHub Actions OpenTofu test and plan are required before merge; the
plan must show only the role and policy destruction.
- Reviewed the diff: file deletion only; no credentials or decrypted
values included.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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