Skip to content

feat(actions): provision chart updater app key - #42

Merged
xnoto merged 2 commits into
mainfrom
fix/chart-updater-actions-secret
Aug 28, 2026
Merged

feat(actions): provision chart updater app key#42
xnoto merged 2 commits into
mainfrom
fix/chart-updater-actions-secret

Conversation

@xnoto

@xnoto xnoto commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add the chart updater GitHub App private key to the canonical SOPS-backed secret map
  • provision CHART_UPDATER_GITHUB_APP_PRIVATE_KEY only to the charts repository
  • keep the PEM encrypted at rest in secrets/secrets.yaml
  • seed centrally managed repository files before enabling branch protection for newly managed repositories

Validation

  • sops filestatus secrets/secrets.yaml reports encrypted
  • verified the new value is ciphertext and no plaintext PEM marker exists
  • repository pre-commit hooks passed

Apply blocker resolved

Previous main applies raced tfroot-namecheap file creation against branch protection creation. GitHub rejected the direct file commits once required checks became active. The explicit dependency preserves both controls while making initial repository setup deterministic.

Rollout

Merge and allow the environment-gated apply to finish before merging the dependent charts workflow change.

@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

OpenTofu CI passed

View the workflow run.

Validation output (redacted, last 12000 characters)

Terraform validate.......................................................Passed
Terraform validate with tflint...........................................Passed
Checkov..................................................................Passed
Terraform fmt............................................................Passed
Terraform docs...........................................................Passed
Detect hardcoded secrets.................................................Passed
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
fix end of files.........................................................Passed
mixed line ending........................................................Passed
trim trailing whitespace.................................................Passed
don't commit to branch..................................................Skipped
check for added large files..............................................Passed

@github-actions

Copy link
Copy Markdown
Contributor

OpenTofu Plan

OpenTofu will perform the following actions:

[REDACTED: potentially sensitive plan output]
[REDACTED: potentially sensitive plan output]
      + created_at        = (known after apply)
      + id                = (known after apply)
      + key_id            = (known after apply)
      + plaintext_value   = (sensitive value)
      + remote_updated_at = (known after apply)
      + repository        = "charts"
      + repository_id     = (known after apply)
[REDACTED: potentially sensitive plan output]
      + updated_at        = (known after apply)
    }

  # github_branch_protection.protections["tfroot-namecheap"] will be created
  + resource "github_branch_protection" "protections" {
      + allows_deletions                = false
      + allows_force_pushes             = false
      + enforce_admins                  = true
      + id                              = (known after apply)
      + lock_branch                     = false
      + pattern                         = "main"
      + repository_id                   = "R_kgDOUGpRrQ"
      + require_conversation_resolution = true
      + require_signed_commits          = false
      + required_linear_history         = true

      + required_pull_request_reviews {
          + require_code_owner_reviews      = false
          + require_last_push_approval      = false
          + required_approving_review_count = 0
        }

      + required_status_checks {
          + contexts = [
              + "opentofu / plan",
              + "opentofu / test",
            ]
          + strict   = true
        }

      + restrict_pushes {
          + blocks_creations = true
          + push_allowances  = [
              + "makeitworkcloud/admins",
            ]
        }
    }

  # github_repository_file.dependabot["tfroot-namecheap"] will be created
  + resource "github_repository_file" "dependabot" {
      + autocreate_branch_source_sha = (known after apply)
      + branch                       = (known after apply)
      + commit_message               = "chore: sync managed dependabot configuration"
      + commit_sha                   = (known after apply)
      + content                      = <<-EOT
            # Managed by tfroot-github (gh-dependabot.tf); local edits are overwritten.
            "updates":
            - "directory": "/"
              "groups":
                "github-actions":
                  "patterns":
                  - "*"
              "package-ecosystem": "github-actions"
              "schedule":
                "interval": "daily"
            - "directory": "/"
              "groups":
                "opentofu":
                  "patterns":
                  - "*"
              "package-ecosystem": "opentofu"
              "schedule":
                "interval": "daily"
            "version": 2
        EOT
      + file                         = ".github/dependabot.yml"
      + id                           = (known after apply)
      + overwrite_on_create          = true
      + ref                          = (known after apply)
      + repository                   = "tfroot-namecheap"
      + repository_id                = (known after apply)
      + sha                          = (known after apply)
    }

  # github_repository_file.dependabot_notify["tfroot-namecheap"] will be created
  + resource "github_repository_file" "dependabot_notify" {
      + autocreate_branch_source_sha = (known after apply)
      + branch                       = (known after apply)
      + commit_message               = "chore: sync managed dependabot notification workflow"
      + commit_sha                   = (known after apply)
      + content                      = <<-EOT
            ---
            # Managed by tfroot-github (gh-dependabot.tf); local edits are overwritten.
            name: dependabot-notify
            
            on:
              pull_request:
                types: [opened, reopened]
            
            permissions: {}
            
            jobs:
              notify:
                if: github.actor == 'dependabot[bot]'
                uses: makeitworkcloud/shared-workflows/.github/workflows/_dependabot-notify.yml@main
[REDACTED: potentially sensitive plan output]
        EOT
      + file                         = ".github/workflows/dependabot-notify.yml"
      + id                           = (known after apply)
      + overwrite_on_create          = true
      + ref                          = (known after apply)
      + repository                   = "tfroot-namecheap"
      + repository_id                = (known after apply)
      + sha                          = (known after apply)
    }

Plan: 4 to add, 0 to change, 0 to destroy.
������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
OpenTofu used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

OpenTofu will perform the following actions:

[REDACTED: potentially sensitive plan output]
[REDACTED: potentially sensitive plan output]
      + created_at        = (known after apply)
      + id                = (known after apply)
      + key_id            = (known after apply)
      + plaintext_value   = (sensitive value)
      + remote_updated_at = (known after apply)
      + repository        = "charts"
      + repository_id     = (known after apply)
[REDACTED: potentially sensitive plan output]
      + updated_at        = (known after apply)
    }

  # github_branch_protection.protections["tfroot-namecheap"] will be created
  + resource "github_branch_protection" "protections" {
      + allows_deletions                = false
      + allows_force_pushes             = false
      + enforce_admins                  = true
      + id                              = (known after apply)
      + lock_branch                     = false
      + pattern                         = "main"
      + repository_id                   = "R_kgDOUGpRrQ"
      + require_conversation_resolution = true
      + require_signed_commits          = false
      + required_linear_history         = true

      + required_pull_request_reviews {
          + require_code_owner_reviews      = false
          + require_last_push_approval      = false
          + required_approving_review_count = 0
        }

      + required_status_checks {
          + contexts = [
              + "opentofu / plan",
              + "opentofu / test",
            ]
          + strict   = true
        }

      + restrict_pushes {
          + blocks_creations = true
          + push_allowances  = [
              + "makeitworkcloud/admins",
            ]
        }
    }

  # github_repository_file.dependabot["tfroot-namecheap"] will be created
  + resource "github_repository_file" "dependabot" {
      + autocreate_branch_source_sha = (known after apply)
      + branch                       = (known after apply)
      + commit_message               = "chore: sync managed dependabot configuration"
      + commit_sha                   = (known after apply)
      + content                      = <<-EOT
            # Managed by tfroot-github (gh-dependabot.tf); local edits are overwritten.
            "updates":
            - "directory": "/"
              "groups":
                "github-actions":
                  "patterns":
                  - "*"
              "package-ecosystem": "github-actions"
              "schedule":
                "interval": "daily"
            - "directory": "/"
              "groups":
                "opentofu":
                  "patterns":
                  - "*"
              "package-ecosystem": "opentofu"
              "schedule":
                "interval": "daily"
            "version": 2
        EOT
      + file                         = ".github/dependabot.yml"
      + id                           = (known after apply)
      + overwrite_on_create          = true
      + ref                          = (known after apply)
      + repository                   = "tfroot-namecheap"
      + repository_id                = (known after apply)
      + sha                          = (known after apply)
    }

  # github_repository_file.dependabot_notify["tfroot-namecheap"] will be created
  + resource "github_repository_file" "dependabot_notify" {
      + autocreate_branch_source_sha = (known after apply)
      + branch                       = (known after apply)
      + commit_message               = "chore: sync managed dependabot notification workflow"
      + commit_sha                   = (known after apply)
      + content                      = <<-EOT
            ---
            # Managed by tfroot-github (gh-dependabot.tf); local edits are overwritten.
            name: dependabot-notify
            
            on:
              pull_request:
                types: [opened, reopened]
            
            permissions: {}
            
            jobs:
              notify:
                if: github.actor == 'dependabot[bot]'
                uses: makeitworkcloud/shared-workflows/.github/workflows/_dependabot-notify.yml@main
[REDACTED: potentially sensitive plan output]
        EOT
      + file                         = ".github/workflows/dependabot-notify.yml"
      + id                           = (known after apply)
      + overwrite_on_create          = true
      + ref                          = (known after apply)
      + repository                   = "tfroot-namecheap"
      + repository_id                = (known after apply)
      + sha                          = (known after apply)
    }

Plan: 4 to add, 0 to change, 0 to destroy.

@xnoto
xnoto merged commit 1f64c6d into main Aug 28, 2026
3 checks passed
@xnoto
xnoto deleted the fix/chart-updater-actions-secret branch August 28, 2026 16:32
xnoto added a commit to makeitworkcloud/charts that referenced this pull request Aug 28, 2026
## Summary
- consume the SOPS-backed `CHART_UPDATER_GITHUB_APP_PRIVATE_KEY`
repository secret
- remove AWS OIDC credential configuration and Secrets Manager reads
- remove the now-unneeded `id-token: write` permission

## Validation
- `make test`
- `actionlint .github/workflows/helm.yml`
- workflow YAML parse and diff hygiene checks

## Rollout dependency
Merge only after makeitworkcloud/tfroot-github#42 has applied the
repository secret.
xnoto added a commit to makeitworkcloud/tfroot-aws that referenced this pull request Aug 28, 2026
## Summary
- remove the chart updater GitHub Actions OIDC role
- remove its inline Secrets Manager read policy
- update generated resource documentation

## Validation
- repository pre-commit hooks passed after removing a stale local
`.terraform` cache
- Terraform validate, tflint, Checkov, fmt, docs, and secret-detection
hooks passed

## Rollout dependency
Merge only after makeitworkcloud/tfroot-github#42 has applied and
makeitworkcloud/charts#13 is merged. This ensures the updater no longer
references the role before Terraform destroys it.

The manually created Secrets Manager secret is intentionally not deleted
by this PR.
xnoto added a commit that referenced this pull request Aug 30, 2026
Temporary copy of secrets/secrets.yaml as of the PR #42 merge
(1f64c6d) so the AWS access key values can be manually copied into
secrets/secrets.yaml under the key names referenced by this branch.
Delete this file once the values are migrated.
xnoto added a commit that referenced this pull request Aug 30, 2026
No value migration is needed: the www AWS values still exist in
secrets/secrets.yaml under the www_aws_* key names; only the main.tf
lookups had drifted.
xnoto added a commit 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.
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