Skip to content

feat: add cloudwatch_logs_log_group_name variable for log group name override#92

Open
supersidor wants to merge 1 commit intocloudposse:mainfrom
supersidor:as/cloudwatch-log-group-name-override
Open

feat: add cloudwatch_logs_log_group_name variable for log group name override#92
supersidor wants to merge 1 commit intocloudposse:mainfrom
supersidor:as/cloudwatch-log-group-name-override

Conversation

@supersidor
Copy link
Copy Markdown

@supersidor supersidor commented Mar 31, 2026

NOTE:
I am working in Life360, cant create PR using my Github enterprise user

Adds a new cloudwatch_logs_log_group_name variable that allows overriding the default CloudWatch log group name (/aws/lambda/{function_name}).

This is needed when migrating legacy Terraform configurations to Atmos, where existing Lambda functions may already have CloudWatch log groups with non-standard names. Without this override, the module would
try to recreate the log group with the default naming convention, causing resource conflicts or unnecessary destroy/create cycles during migration.

Changes

  • Added cloudwatch_logs_log_group_name variable (string, default null) to variables.tf
  • Updated main.tf to use coalesce() to prefer the explicit name when provided, falling back to the default /aws/lambda/${var.function_name}
  • Set label_value_case = "none" when a custom name is provided to prevent the cloudposse/cloudwatch-logs/aws module from transforming the log group name with label casing

Usage

module "lambda" {
source = "cloudposse/lambda-function/aws"

# Preserve existing log group name during Atmos migration
cloudwatch_logs_log_group_name = "/aws/lambda/my-legacy-function"

# ... other variables

}

When cloudwatch_logs_log_group_name is not set (default null), behavior is unchanged — the log group defaults to /aws/lambda/{function_name}.

…verride

The CloudWatch log group name was hardcoded as /aws/lambda/{function_name}
and lowercased by null-label's default label_value_case. This prevented
importing existing log groups with mixed-case names. When the new variable
is set, label_value_case=none preserves the exact name provided.

Refs: CE-62455

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@supersidor supersidor requested review from a team as code owners March 31, 2026 16:54
@mergify mergify bot added the triage Needs triage label Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage Needs triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants