Repository navigation
fix(termination-watcher): grant kms:Decrypt for GitHub App parameters - #5562
Merged
Brend-Smits merged 3 commits intoOct 29, 2026
Merged
Brend-Smits merged 3 commits into
Brend-Smits merged 3 commits into
Conversation
Brend-Smits
marked this pull request as ready for review
October 28, 2026 14:16
The termination notification, termination handler and deregister-retry Lambdas read the GitHub App credentials from SSM Parameter Store. When the parameters are SecureStrings encrypted with a customer-managed KMS key, the roles had no kms:Decrypt on it, so every read failed and runners were never deregistered. Add an optional github_app_kms_key_arn to the module config and build the credential-read policy once, so all three roles get the SSM actions and kms:Decrypt scoped to that key. The root module passes kms_key_arn and multi-runner passes the SSM storage provider key, so consumers need no new input. Deregistration disabled or no key keeps the previous policy. Builds on github-aws-runners#5467 and the earlier attempt in github-aws-runners#5274. Signed-off-by: Brend Smits <[email protected]>
Brend-Smits
force-pushed
the
fix/termination-watcher-kms-decrypt
branch
from
October 28, 2026 14:18
3faaec1 to
5418894
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The tests do not verify the roles’ actual SSM/KMS policy attachments and would still pass if those attachments were removed, leaving the targeted regression uncovered.
1 open issue
What changed in this PR
This PR adds scoped KMS decryption permissions so termination-watcher Lambdas can read GitHub App credentials encrypted with a customer-managed key and deregister runners.
Changes:
- Adds an optional KMS key ARN and forwards existing root and multi-runner key settings.
- Shares the SSM/KMS credential policy across notification, termination-handler, and retry roles.
- Adds Terraform tests for configured, absent, and apply-time key values, plus disabled deregistration.
| File | Description |
|---|---|
modules/termination-watcher/variables.tf |
Defines and documents the optional KMS key ARN. |
modules/termination-watcher/tests/kms.tftest.hcl |
Adds KMS policy and configuration tests. |
modules/termination-watcher/tests/fixtures/computed-kms/versions.tf |
Declares fixture Terraform and provider requirements. |
modules/termination-watcher/tests/fixtures/computed-kms/README.md |
Documents the computed-key fixture. |
modules/termination-watcher/tests/fixtures/computed-kms/main.tf |
Supplies a key ARN unknown until apply. |
modules/termination-watcher/termination/main.tf |
Uses the shared credential policy for the handler. |
modules/termination-watcher/README.md |
Documents the new configuration option. |
modules/termination-watcher/notification/main.tf |
Uses the shared credential policy for notifications. |
modules/termination-watcher/main.tf |
Builds the shared SSM policy with optional KMS access. |
modules/termination-watcher/deregister-retry.tf |
Uses the shared credential policy for retries. |
modules/multi-runner/termination-watcher.tf |
Forwards the SSM storage provider’s KMS key. |
main.tf |
Forwards the root module’s KMS key ARN. |
Review effort: Balanced
Brend-Smits
added a commit
to philips-forks/terraform-aws-github-runner
that referenced
this pull request
Oct 28, 2026
…s-decrypt chore: sync upstream main and adopt upstream github-aws-runners#5562
Check the policy actually attached to the deregister-retry role, and add child-module runs for the notification and handler roles, so the tests fail if a role loses its SSM/KMS policy. Signed-off-by: Brend Smits <[email protected]>
Contributor
Author
|
This change is verified working (tested in our staging environment). So we are good to merge it after getting the reviews in. |
Brend-Smits
enabled auto-merge (squash)
October 28, 2026 16:22
stuartp44
approved these changes
Oct 29, 2026
guicaulada
pushed a commit
that referenced
this pull request
Nov 3, 2026
🤖 I have created a release *beep* *boop* --- ## [8.1.0](v8.0.0...v8.1.0) (2026-10-29) ### Features * add stateless registration cleanup with multi-App support ([#5465](#5465)) ([5959d43](5959d43)) * **termination-watcher:** support additional GitHub Apps ([#5467](#5467)) ([eefcb1e](eefcb1e)) ### Bug Fixes * **lambda:** bump undici from 6.29.0 to 6.29.1 in /lambdas ([#5554](#5554)) ([94f46c7](94f46c7)) * **scale-down:** clean EC2 runners incrementally and isolate failures ([#5463](#5463)) ([60a4c66](60a4c66)) * **scale-down:** scope cached clients by selected GitHub App ([#5466](#5466)) ([bbd92fe](bbd92fe)) * **termination-watcher:** grant kms:Decrypt for GitHub App parameters ([#5562](#5562)) ([7b54664](7b54664)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: runners-releaser[bot] <194412594+runners-releaser[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
The termination-watcher Lambdas (notification, handler and deregister-retry) read the GitHub App credentials from SSM to deregister runners. If those parameters are SecureStrings encrypted with a customer-managed KMS key, the roles have no
kms:Decrypton it, so the read fails and the runner is never deregistered. #5467 fixed the SSM actions and parameter list, so this is the next thing that breaks.This adds an optional
github_app_kms_key_arnto the watcher config. When it is set and deregistration is enabled, all three roles getkms:Decrypton that key. The SSM and KMS statements are built once and shared by the three roles.multi-runnerpasses the SSM storage provider key and the root module passeskms_key_arn, so nobody has to change their inputs. Without a key, or with deregistration off, the policy is the same as before.Prior attempt in #5274, which is no longer active. It also changed how environment variables are preserved, which I left out here to keep this to the KMS access.
Test Plan
modules/termination-watcher/tests/kms.tftest.hcl: key set (SSM actions on all primary, additional-app and manifest ARNs pluskms:Decrypton only that key), no key, single app, deregistration disabled with a key set, and a key that is only known after apply.terraform testinmodules/termination-watcherandmodules/multi-runner,terraform validatein both and at the root,terraform fmt -check -recursive.yarn test,yarn lintandyarn format-checkinlambdas.Related Issues
Builds on #5467. Supersedes the KMS part of #5274.