Repository navigation
fix: wrap LOG_LEVEL env var with upper() for Powertools v2 compatibility - #5238
Merged
Merged
Conversation
Powertools v2 Logger reads LOG_LEVEL without calling .toUpperCase(), and the LogLevelThreshold map only has uppercase keys. Lowercase values like 'debug' fail validation silently, defaulting to INFO. Wrapping with upper() ensures the Lambda always receives uppercase regardless of the Terraform variable casing. Signed-off-by: Brend Smits <[email protected]>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates multiple Lambda module definitions so the LOG_LEVEL environment variable is always passed in uppercase, aligning with AWS Lambda Powertools Logger v2’s expected log level keys and preventing silent fallback to INFO.
Changes:
- Wrap
LOG_LEVELassignments with Terraformupper()across runner, webhook, and housekeeper Lambdas. - Standardize log level env-var casing for Powertools v2 compatibility across module entry points.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/runners/scale-up.tf | Uppercases LOG_LEVEL for the scale-up Lambda environment. |
| modules/runners/scale-down.tf | Uppercases LOG_LEVEL for the scale-down Lambda environment. |
| modules/runners/ssm-housekeeper.tf | Uppercases LOG_LEVEL for the SSM housekeeper Lambda environment. |
| modules/runners/pool/main.tf | Uppercases LOG_LEVEL for the pool Lambda environment. |
| modules/webhook/eventbridge/webhook.tf | Uppercases LOG_LEVEL for the EventBridge webhook Lambda environment. |
| modules/webhook/eventbridge/dispatcher.tf | Uppercases LOG_LEVEL for the dispatcher Lambda environment. |
| modules/webhook/direct/webhook.tf | Uppercases LOG_LEVEL for the direct webhook Lambda environment. |
| modules/ami-housekeeper/main.tf | Uppercases LOG_LEVEL for the AMI housekeeper Lambda environment. |
| modules/runner-binaries-syncer/runner-binaries-syncer.tf | Uppercases LOG_LEVEL for the runner-binaries syncer Lambda environment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
edersonbrilhante
approved these changes
Aug 4, 2026
edersonbrilhante
pushed a commit
that referenced
this pull request
Aug 11, 2026
🤖 I have created a release *beep* *boop* --- ## [7.10.2](v7.10.1...v7.10.2) (2026-08-10) ### Bug Fixes * **lambda:** bump postcss from 8.5.22 to 8.5.24 in /lambdas ([#5241](#5241)) ([17cd322](17cd322)) * **termination-watcher:** only emit SpotInterruptionWarning metric for actual spot interruption events ([#5245](#5245)) ([7480fd5](7480fd5)) * wrap LOG_LEVEL env var with upper() for Powertools v2 compatibility ([#5238](#5238)) ([2394f84](2394f84)) --- 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>
zxkane
added a commit
to zxkane/terraform-aws-github-runner
that referenced
this pull request
Oct 9, 2026
PR github-aws-runners#5238 wrapped every LOG_LEVEL assignment with upper() so that Powertools v2 stops silently discarding the value, but it missed modules/lambda/main.tf. That module builds the environment for four functions: runners/job-retry, termination-watcher/deregister-retry, termination-watcher/notification and termination-watcher/termination. The variable is validated against lowercase names only ("debug", "info", "warn", "error"), so the value reaching those four functions can never match Powertools' uppercase LogLevelThreshold keys. Every level silently resolves to INFO. Requesting "debug" yields no debug output, and requesting "warn" or "error" yields more output than asked for. POWERTOOLS_LOGGER_LOG_EVENT keeps comparing the raw lowercase variable, which is still correct.
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
Powertools v2 Logger reads the
LOG_LEVELenvironment variable without calling.toUpperCase(), and the internalLogLevelThresholdmap only has uppercase keys (DEBUG,INFO,WARN,ERROR). When a lowercase value likedebugis passed, it fails validation silently and defaults toINFO.This wraps all
LOG_LEVELassignments with Terraform'supper()function, ensuring the Lambda always receives an uppercase value regardless of how the Terraform variable is cased.Files changed (9):
modules/runners/scale-up.tfmodules/runners/scale-down.tfmodules/runners/ssm-housekeeper.tfmodules/runners/pool/main.tfmodules/webhook/eventbridge/webhook.tfmodules/webhook/eventbridge/dispatcher.tfmodules/webhook/direct/webhook.tfmodules/ami-housekeeper/main.tfmodules/runner-binaries-syncer/runner-binaries-syncer.tfTest Plan
log_level = "debug"and verified Lambdas receiveLOG_LEVEL=DEBUGterraform validatesuccessfullyRelated Issues
N/A — discovered during debugging of silent log level failures after upgrading to
@aws-lambda-powertools/loggerv2.31.0