Repository navigation
fix(termination-watcher): preserve env vars and KMS access - #5274
Draft
edersonbrilhante wants to merge 2 commits into
Draft
edersonbrilhante wants to merge 2 commits into
edersonbrilhante wants to merge 2 commits into
Conversation
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
edersonbrilhante
force-pushed
the
fix-termination-watcher-ssm-kms
branch
from
September 3, 2026 10:12
221efdd to
453cbd4
Compare
Brend-Smits
added a commit
to Brend-Smits/terraform-aws-github-runner
that referenced
this pull request
Oct 28, 2026
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
added a commit
that referenced
this pull request
Oct 29, 2026
…#5562) ## 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:Decrypt` on 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_arn` to the watcher config. When it is set and deregistration is enabled, all three roles get `kms:Decrypt` on that key. The SSM and KMS statements are built once and shared by the three roles. `multi-runner` passes the SSM storage provider key and the root module passes `kms_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 - New `modules/termination-watcher/tests/kms.tftest.hcl`: key set (SSM actions on all primary, additional-app and manifest ARNs plus `kms:Decrypt` on only that key), no key, single app, deregistration disabled with a key set, and a key that is only known after apply. - `terraform test` in `modules/termination-watcher` and `modules/multi-runner`, `terraform validate` in both and at the root, `terraform fmt -check -recursive`. - `yarn test`, `yarn lint` and `yarn format-check` in `lambdas`. - Not deployed anywhere yet. ## Related Issues Builds on #5467. Supersedes the KMS part of #5274. --------- Signed-off-by: Brend Smits <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Contributor
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs. Thank you for your contributions. |
This branch has not been deployed
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
ssm_kms_key_idsupport and grantkms:Decryptto the notification, termination-handler, and deregistration-retry Lambda roles.kms_key_arninputs to the termination watcher.The runtime already requests decrypted SSM values, so no Lambda source change is required.
Test Plan
terraform validatefor the root module,modules/multi-runner, andmodules/termination-watcher.modules/termination-watcher.git diff --checkfor the affected files.Related Issues