Skip to content

chore: add Grafana alerts service account token - #16

Merged
xnoto merged 2 commits into
mainfrom
chore/grafana-alerts-token
Aug 24, 2026
Merged

chore: add Grafana alerts service account token#16
xnoto merged 2 commits into
mainfrom
chore/grafana-alerts-token

Conversation

@xnoto

@xnoto xnoto commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

What

Adds grafana_alerts_token to the SOPS secrets — the operator-generated token minted by the GrafanaServiceAccount CR (kustomize-cluster#54), retrieved from the cluster and written via sops set. Replaces the placeholder distributed by #15.

On apply, GRAFANA_ALERTS_TOKEN becomes functional in all 11 active repos and the Dependabot PR alerting pipeline goes end-to-end:

Dependabot PR → caller workflow → shared-workflows reusable workflow → Cloudflare Access app → Grafana Alertmanager → Discord.

Validation

  • Token value handled entirely in subprocesses (kubectl → shell → sops set); never exposed in logs or this PR.
  • SOPS key existence verified post-write; make test hooks pass at commit.
  • Cluster-side objects confirmed synced: grafanacontactpoint/discord, grafananotificationpolicy/root-discord, grafanaserviceaccount/github-actions-alerts, secret/grafana-alerts-token, secret/discord-webhook.

After merge

End-to-end test: @dependabot recreate on cflan#9 → expect a Discord message within a minute of the reopened PR.

xnoto added 2 commits August 24, 2026 08:19
- gh-dependabot.tf also manages .github/workflows/dependabot-notify.yml
  in every active repo, calling the shared-workflows reusable workflow
  only when the pull_request actor is dependabot[bot]
- distribute CLOUDFLARE_AUTH_CLIENT_* to all active repos (new
  active_github_repositories local; archived repos cannot receive
  secrets)
- add GRAFANA_ALERTS_TOKEN with a documented placeholder until the
  operator-generated token is copied from the cluster secret
Operator-generated token from the GrafanaServiceAccount CR in
kustomize-cluster (grafana-alerts-token secret), copied via kubectl +
sops set. Replaces the placeholder distributed by #15.
@github-actions

Copy link
Copy Markdown

OpenTofu Plan

OpenTofu will perform the following actions:

  # github_actions_secret.secrets[".github_GRAFANA_ALERTS_TOKEN"] will be updated in-place
  ~ resource "github_actions_secret" "secrets" {
        id                = ".github:GRAFANA_ALERTS_TOKEN"
      ~ plaintext_value   = (sensitive value)
        # (7 unchanged attributes hidden)
    }

  # github_actions_secret.secrets["cflan_GRAFANA_ALERTS_TOKEN"] will be updated in-place
  ~ resource "github_actions_secret" "secrets" {
        id                = "cflan:GRAFANA_ALERTS_TOKEN"
      ~ plaintext_value   = (sensitive value)
        # (7 unchanged attributes hidden)
    }

  # github_actions_secret.secrets["images_GRAFANA_ALERTS_TOKEN"] will be updated in-place
  ~ resource "github_actions_secret" "secrets" {
        id                = "images:GRAFANA_ALERTS_TOKEN"
      ~ plaintext_value   = (sensitive value)
        # (7 unchanged attributes hidden)
    }

  # github_actions_secret.secrets["kustomize-cluster_GRAFANA_ALERTS_TOKEN"] will be updated in-place
  ~ resource "github_actions_secret" "secrets" {
        id                = "kustomize-cluster:GRAFANA_ALERTS_TOKEN"
      ~ plaintext_value   = (sensitive value)
        # (7 unchanged attributes hidden)
    }

  # github_actions_secret.secrets["shared-workflows_GRAFANA_ALERTS_TOKEN"] will be updated in-place
  ~ resource "github_actions_secret" "secrets" {
        id                = "shared-workflows:GRAFANA_ALERTS_TOKEN"
      ~ plaintext_value   = (sensitive value)
        # (7 unchanged attributes hidden)
    }

  # github_actions_secret.secrets["terraform-libvirt-domain_GRAFANA_ALERTS_TOKEN"] will be updated in-place
  ~ resource "github_actions_secret" "secrets" {
        id                = "terraform-libvirt-domain:GRAFANA_ALERTS_TOKEN"
      ~ plaintext_value   = (sensitive value)
        # (7 unchanged attributes hidden)
    }

  # github_actions_secret.secrets["tfroot-aws_GRAFANA_ALERTS_TOKEN"] will be updated in-place
  ~ resource "github_actions_secret" "secrets" {
        id                = "tfroot-aws:GRAFANA_ALERTS_TOKEN"
      ~ plaintext_value   = (sensitive value)
        # (7 unchanged attributes hidden)
    }

  # github_actions_secret.secrets["tfroot-cloudflare_GRAFANA_ALERTS_TOKEN"] will be updated in-place
  ~ resource "github_actions_secret" "secrets" {
        id                = "tfroot-cloudflare:GRAFANA_ALERTS_TOKEN"
      ~ plaintext_value   = (sensitive value)
        # (7 unchanged attributes hidden)
    }

  # github_actions_secret.secrets["tfroot-github_GRAFANA_ALERTS_TOKEN"] will be updated in-place
  ~ resource "github_actions_secret" "secrets" {
        id                = "tfroot-github:GRAFANA_ALERTS_TOKEN"
      ~ plaintext_value   = (sensitive value)
        # (7 unchanged attributes hidden)
    }

  # github_actions_secret.secrets["tfroot-libvirt_GRAFANA_ALERTS_TOKEN"] will be updated in-place
  ~ resource "github_actions_secret" "secrets" {
        id                = "tfroot-libvirt:GRAFANA_ALERTS_TOKEN"
      ~ plaintext_value   = (sensitive value)
        # (7 unchanged attributes hidden)
    }

  # github_actions_secret.secrets["www_GRAFANA_ALERTS_TOKEN"] will be updated in-place
  ~ resource "github_actions_secret" "secrets" {
        id                = "www:GRAFANA_ALERTS_TOKEN"
      ~ plaintext_value   = (sensitive value)
        # (7 unchanged attributes hidden)
    }

  # github_branch_protection.protections[".github"] will be updated in-place
  ~ resource "github_branch_protection" "protections" {
        id                              = "BPR_kwDOPDNmL84EC8t_"
        # (10 unchanged attributes hidden)

      ~ required_pull_request_reviews {
          ~ dismissal_restrictions          = [
              + "makeitworkcloud/admins",
            ]
          ~ pull_request_bypassers          = [
              + "makeitworkcloud/admins",
            ]
            # (5 unchanged attributes hidden)
        }

      ~ restrict_pushes {
          ~ push_allowances  = [
              + "makeitworkcloud/admins",
            ]
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

  # github_branch_protection.protections["cflan"] will be updated in-place
  ~ resource "github_branch_protection" "protections" {
        id                              = "BPR_kwDOOulWjM4EPi_e"
        # (10 unchanged attributes hidden)

      ~ required_pull_request_reviews {
          ~ dismissal_restrictions          = [
              + "makeitworkcloud/admins",
            ]
          ~ pull_request_bypassers          = [
              + "makeitworkcloud/admins",
            ]
            # (5 unchanged attributes hidden)
        }

      ~ restrict_pushes {
          ~ push_allowances  = [
              + "makeitworkcloud/admins",
            ]
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

  # github_branch_protection.protections["images"] will be updated in-place
  ~ resource "github_branch_protection" "protections" {
        id                              = "BPR_kwDOQsexys4EPi_f"
        # (10 unchanged attributes hidden)

      ~ required_pull_request_reviews {
          ~ dismissal_restrictions          = [
              + "makeitworkcloud/admins",
            ]
          ~ pull_request_bypassers          = [
              + "makeitworkcloud/admins",
            ]
            # (5 unchanged attributes hidden)
        }

      ~ restrict_pushes {
          ~ push_allowances  = [
              + "makeitworkcloud/admins",
            ]
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

  # github_branch_protection.protections["kustomize-cluster"] will be updated in-place
  ~ resource "github_branch_protection" "protections" {
        id                              = "BPR_kwDOQsxTyc4EPi_g"
        # (10 unchanged attributes hidden)

      ~ required_pull_request_reviews {
          ~ dismissal_restrictions          = [
              + "makeitworkcloud/admins",
            ]
          ~ pull_request_bypassers          = [
              + "makeitworkcloud/admins",
            ]
            # (5 unchanged attributes hidden)
        }

      ~ restrict_pushes {
          ~ push_allowances  = [
              + "makeitworkcloud/admins",
            ]
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

  # github_branch_protection.protections["shared-workflows"] will be updated in-place
  ~ resource "github_branch_protection" "protections" {
        id                              = "BPR_kwDOQsfaHs4EPi_h"
        # (10 unchanged attributes hidden)

      ~ required_pull_request_reviews {
          ~ dismissal_restrictions          = [
              + "makeitworkcloud/admins",
            ]
          ~ pull_request_bypassers          = [
              + "makeitworkcloud/admins",
            ]
            # (5 unchanged attributes hidden)
        }

      ~ restrict_pushes {
          ~ push_allowances  = [
              + "makeitworkcloud/admins",
            ]
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

  # github_branch_protection.protections["terraform-libvirt-domain"] will be updated in-place
  ~ resource "github_branch_protection" "protections" {
        id                              = "BPR_kwDOQsXn984EPi_i"
        # (10 unchanged attributes hidden)

      ~ required_pull_request_reviews {
          ~ dismissal_restrictions          = [
              + "makeitworkcloud/admins",
            ]
          ~ pull_request_bypassers          = [
              + "makeitworkcloud/admins",
            ]
            # (5 unchanged attributes hidden)
        }

      ~ restrict_pushes {
          ~ push_allowances  = [
              + "makeitworkcloud/admins",
            ]
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

  # github_branch_protection.protections["tfroot-aws"] will be updated in-place
  ~ resource "github_branch_protection" "protections" {
        id                              = "BPR_kwDOQsXn6c4EPi_j"
        # (10 unchanged attributes hidden)

      ~ required_pull_request_reviews {
          ~ dismissal_restrictions          = [
              + "makeitworkcloud/admins",
            ]
          ~ pull_request_bypassers          = [
              + "makeitworkcloud/admins",
            ]
            # (5 unchanged attributes hidden)
        }

      ~ restrict_pushes {
          ~ push_allowances  = [
              + "makeitworkcloud/admins",
            ]
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

  # github_branch_protection.protections["tfroot-cloudflare"] will be updated in-place
  ~ resource "github_branch_protection" "protections" {
        id                              = "BPR_kwDOQsXoEM4EPi_k"
        # (10 unchanged attributes hidden)

      ~ required_pull_request_reviews {
          ~ dismissal_restrictions          = [
              + "makeitworkcloud/admins",
            ]
          ~ pull_request_bypassers          = [
              + "makeitworkcloud/admins",
            ]
            # (5 unchanged attributes hidden)
        }

      ~ restrict_pushes {
          ~ push_allowances  = [
              + "makeitworkcloud/admins",
            ]
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

  # github_branch_protection.protections["tfroot-github"] will be updated in-place
  ~ resource "github_branch_protection" "protections" {
        id                              = "BPR_kwDOQsXoMs4EPi_l"
        # (10 unchanged attributes hidden)

      ~ required_pull_request_reviews {
          ~ dismissal_restrictions          = [
              + "makeitworkcloud/admins",
            ]
          ~ pull_request_bypassers          = [
              + "makeitworkcloud/admins",
            ]
            # (5 unchanged attributes hidden)
        }

      ~ restrict_pushes {
          ~ push_allowances  = [
              + "makeitworkcloud/admins",
            ]
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

  # github_branch_protection.protections["tfroot-libvirt"] will be updated in-place
  ~ resource "github_branch_protection" "protections" {
        id                              = "BPR_kwDOQsXoKM4EPi_n"
        # (10 unchanged attributes hidden)

      ~ required_pull_request_reviews {
          ~ dismissal_restrictions          = [
              + "makeitworkcloud/admins",
            ]
          ~ pull_request_bypassers          = [
              + "makeitworkcloud/admins",
            ]
            # (5 unchanged attributes hidden)
        }

      ~ restrict_pushes {
          ~ push_allowances  = [
              + "makeitworkcloud/admins",
            ]
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

  # github_branch_protection.protections["www"] will be updated in-place
  ~ resource "github_branch_protection" "protections" {
        id                              = "BPR_kwDOOuKZAc4EPi_o"
        # (10 unchanged attributes hidden)

      ~ required_pull_request_reviews {
          ~ dismissal_restrictions          = [
              + "makeitworkcloud/admins",
            ]
          ~ pull_request_bypassers          = [
              + "makeitworkcloud/admins",
            ]
            # (5 unchanged attributes hidden)
        }

      ~ restrict_pushes {
          ~ push_allowances  = [
              + "makeitworkcloud/admins",
            ]
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

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

@xnoto
xnoto merged commit 42dea73 into main Aug 24, 2026
3 checks passed
@xnoto
xnoto deleted the chore/grafana-alerts-token branch August 24, 2026 15:34
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