Skip to content

chore(iam): remove OpenTofu docs GitHub App OIDC role - #32

Merged
xnoto merged 3 commits into
mainfrom
chore/remove-opentofu-docs-aws-role
Aug 30, 2026
Merged

chore(iam): remove OpenTofu docs GitHub App OIDC role#32
xnoto merged 3 commits into
mainfrom
chore/remove-opentofu-docs-aws-role

Conversation

@xnoto

@xnoto xnoto commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

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. feat(opentofu): source docs GitHub App key from Actions secret shared-workflows#33
  2. feat(actions): distribute chart updater app key to OpenTofu roots tfroot-github#45
  3. Caller PRs: chore(ci): map chart updater app key for generated docs #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.

@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

OpenTofu Test

OpenTofu test passed.

View the workflow run.

View run output
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

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
xnoto marked this pull request as ready for review August 30, 2026 18:51
@xnoto
xnoto requested a review from a team as a code owner August 30, 2026 18:51
@github-actions

Copy link
Copy Markdown
Contributor

OpenTofu Plan

OpenTofu plan passed.

View the workflow run.

View run output
OpenTofu will perform the following actions:

  # aws_iam_role.github_actions_opentofu_docs will be destroyed
  # (because aws_iam_role.github_actions_opentofu_docs is not in configuration)
  - resource "aws_iam_role" "github_actions_opentofu_docs" {
      - arn                   = "arn:aws:iam::332355796717:role/github-actions-opentofu-docs" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRoleWithWebIdentity"
                      - Condition = {
                          - StringEquals = {
[REDACTED: potentially sensitive plan output]
                            }
                          - StringLike   = {
[REDACTED: potentially sensitive plan output]
                                  - "repo:makeitworkcloud/tfroot-aws:pull_request",
                                  - "repo:makeitworkcloud/tfroot-cloudflare:pull_request",
                                  - "repo:makeitworkcloud/tfroot-gcp:pull_request",
                                  - "repo:makeitworkcloud/tfroot-github:pull_request",
                                  - "repo:makeitworkcloud/tfroot-libvirt:pull_request",
                                  - "repo:makeitworkcloud/tfroot-namecheap:pull_request",
                                ]
                            }
                        }
                      - Effect    = "Allow"
                      - Principal = {
[REDACTED: potentially sensitive plan output]
                        }
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-08-28T04:32:59Z" -> null
      - force_detach_policies = false -> null
      - id                    = "github-actions-opentofu-docs" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "github-actions-opentofu-docs" -> null
      - path                  = "/" -> null
      - tags                  = {
          - "ManagedBy" = "Terraform"
          - "Purpose"   = "opentofu-generated-docs"
        } -> null
      - tags_all              = {
          - "ManagedBy" = "Terraform"
          - "Purpose"   = "opentofu-generated-docs"
        } -> null
      - unique_id             = "AROAU2YPS73WSIM3DKCUX" -> null

      - inline_policy {
          - name   = "read-opentofu-docs-github-app-key" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
[REDACTED: potentially sensitive plan output]
[REDACTED: potentially sensitive plan output]
                            ]
                          - Effect   = "Allow"
[REDACTED: potentially sensitive plan output]
                          - Sid      = "ReadOpenTofuDocsGitHubAppKey"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # aws_iam_role_policy.github_actions_opentofu_docs will be destroyed
  # (because aws_iam_role_policy.github_actions_opentofu_docs is not in configuration)
  - resource "aws_iam_role_policy" "github_actions_opentofu_docs" {
      - id     = "github-actions-opentofu-docs:read-opentofu-docs-github-app-key" -> null
      - name   = "read-opentofu-docs-github-app-key" -> null
      - policy = jsonencode(
            {
              - Statement = [
                  - {
                      - Action   = [
[REDACTED: potentially sensitive plan output]
[REDACTED: potentially sensitive plan output]
                        ]
                      - Effect   = "Allow"
[REDACTED: potentially sensitive plan output]
                      - Sid      = "ReadOpenTofuDocsGitHubAppKey"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - role   = "github-actions-opentofu-docs" -> null
    }

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

OpenTofu will perform the following actions:

  # aws_iam_role.github_actions_opentofu_docs will be destroyed
  # (because aws_iam_role.github_actions_opentofu_docs is not in configuration)
  - resource "aws_iam_role" "github_actions_opentofu_docs" {
      - arn                   = "arn:aws:iam::332355796717:role/github-actions-opentofu-docs" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRoleWithWebIdentity"
                      - Condition = {
                          - StringEquals = {
[REDACTED: potentially sensitive plan output]
                            }
                          - StringLike   = {
[REDACTED: potentially sensitive plan output]
                                  - "repo:makeitworkcloud/tfroot-aws:pull_request",
                                  - "repo:makeitworkcloud/tfroot-cloudflare:pull_request",
                                  - "repo:makeitworkcloud/tfroot-gcp:pull_request",
                                  - "repo:makeitworkcloud/tfroot-github:pull_request",
                                  - "repo:makeitworkcloud/tfroot-libvirt:pull_request",
                                  - "repo:makeitworkcloud/tfroot-namecheap:pull_request",
                                ]
                            }
                        }
                      - Effect    = "Allow"
                      - Principal = {
[REDACTED: potentially sensitive plan output]
                        }
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-08-28T04:32:59Z" -> null
      - force_detach_policies = false -> null
      - id                    = "github-actions-opentofu-docs" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "github-actions-opentofu-docs" -> null
      - path                  = "/" -> null
      - tags                  = {
          - "ManagedBy" = "Terraform"
          - "Purpose"   = "opentofu-generated-docs"
        } -> null
      - tags_all              = {
          - "ManagedBy" = "Terraform"
          - "Purpose"   = "opentofu-generated-docs"
        } -> null
      - unique_id             = "AROAU2YPS73WSIM3DKCUX" -> null

      - inline_policy {
          - name   = "read-opentofu-docs-github-app-key" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
[REDACTED: potentially sensitive plan output]
[REDACTED: potentially sensitive plan output]
                            ]
                          - Effect   = "Allow"
[REDACTED: potentially sensitive plan output]
                          - Sid      = "ReadOpenTofuDocsGitHubAppKey"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # aws_iam_role_policy.github_actions_opentofu_docs will be destroyed
  # (because aws_iam_role_policy.github_actions_opentofu_docs is not in configuration)
  - resource "aws_iam_role_policy" "github_actions_opentofu_docs" {
      - id     = "github-actions-opentofu-docs:read-opentofu-docs-github-app-key" -> null
      - name   = "read-opentofu-docs-github-app-key" -> null
      - policy = jsonencode(
            {
              - Statement = [
                  - {
                      - Action   = [
[REDACTED: potentially sensitive plan output]
[REDACTED: potentially sensitive plan output]
                        ]
                      - Effect   = "Allow"
[REDACTED: potentially sensitive plan output]
                      - Sid      = "ReadOpenTofuDocsGitHubAppKey"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - role   = "github-actions-opentofu-docs" -> null
    }

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

@xnoto
xnoto merged commit ffb1c3c into main Aug 30, 2026
3 checks passed
@xnoto
xnoto deleted the chore/remove-opentofu-docs-aws-role branch August 30, 2026 18:56
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