Skip to content

fix(lambda): uppercase LOG_LEVEL in the shared lambda module - #5303

Open
zxkane wants to merge 1 commit into
github-aws-runners:mainfrom
zxkane:fix/lambda-module-log-level
Open

fix(lambda): uppercase LOG_LEVEL in the shared lambda module#5303
zxkane wants to merge 1 commit into
github-aws-runners:mainfrom
zxkane:fix/lambda-module-log-level

Conversation

@zxkane

@zxkane zxkane commented Aug 27, 2026

Copy link
Copy Markdown

Description

#5238 wrapped every LOG_LEVEL assignment with upper() so Powertools v2 stops silently discarding the value, but it missed modules/lambda/main.tf. That module builds the environment for four functions:

  • modules/runners/job-retry
  • modules/termination-watcher/deregister-retry
  • modules/termination-watcher/notification
  • modules/termination-watcher/termination

var.lambda.log_level 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. Asking for debug produces no debug output, and asking for warn or error produces more output than requested.

POWERTOOLS_LOGGER_LOG_EVENT still compares the raw lowercase variable, which remains correct, so it is left untouched.

Test Plan

Reproduced against the @aws-lambda-powertools/logger version this repository already depends on:

LOG_LEVEL effective level
debug INFO
DEBUG DEBUG
warn INFO
WARN WARN

Confirmed on a live deployment before this change: the functions created through modules/lambda had LOG_LEVEL=info, while every function fixed by #5238 had LOG_LEVEL=INFO.

Checks run locally:

  • terraform fmt -recursive -check=true -write=false
  • terraform validate on modules/lambda, modules/runners/job-retry, modules/termination-watcher, modules/termination-watcher/notification and modules/termination-watcher/termination
  • Confirmed no lowercase LOG_LEVEL assignment remains anywhere under modules/

Applying this to a running deployment is an in-place Lambda environment update — no resource replacement.

Related Issues

Follow-up to #5238.

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.

Signed-off-by: Kane Zhu <843303+zxkane@users.noreply.github.com>
@zxkane
zxkane requested a review from a team as a code owner August 27, 2026 06:15
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