Skip to content

Fix ServiceDeployer LogGroup conflict with useCdkManagedLogGroup feature flag#92

Merged
pcholakov merged 1 commit into
mainfrom
fix/issue-90-cdk-log-group
May 6, 2026
Merged

Fix ServiceDeployer LogGroup conflict with useCdkManagedLogGroup feature flag#92
pcholakov merged 1 commit into
mainfrom
fix/issue-90-cdk-log-group

Conversation

@pcholakov
Copy link
Copy Markdown
Collaborator

@pcholakov pcholakov commented May 5, 2026

Summary

  • Fixes Unable to deploy ServiceDeployer if "@aws-cdk/aws-lambda:useCdkManagedLogGroup" flag is enabled #90
  • When @aws-cdk/aws-lambda:useCdkManagedLogGroup is enabled (recommended default since CDK 2.200.0), the Lambda construct automatically creates a AWS::Logs::LogGroup resource. ServiceDeployer was also explicitly creating one with the same name, causing CloudFormation to fail with "already exists in stack".
  • Fix: check cdk.FeatureFlags.of(this).isEnabled(cx_api.USE_CDK_MANAGED_LAMBDA_LOGGROUP) before creating the explicit log group — skip it when CDK is managing log group creation.

Test plan

  • New unit test: synthesizes ServiceDeployer with the feature flag enabled via App context, asserts exactly one AWS::Logs::LogGroup resource exists (the CDK-managed one from Lambda)
  • All existing snapshot tests pass unchanged — no behaviour change when the flag is not set

@pcholakov pcholakov force-pushed the fix/issue-90-cdk-log-group branch from 3587c96 to a0c9b82 Compare May 6, 2026 17:55
…ure flag

When the @aws-cdk/aws-lambda:useCdkManagedLogGroup feature flag is enabled
(recommended default since CDK 2.200.0), the Lambda construct automatically
creates a CloudFormation LogGroup. ServiceDeployer was creating a second one
with the same name, causing a conflict during deployment.

Fix: check the feature flag via cdk.FeatureFlags before creating the explicit
LogGroup. Users who want custom retention with the flag enabled can pass a
logGroup via props (already supported).

Fixes #90
@pcholakov pcholakov force-pushed the fix/issue-90-cdk-log-group branch from a0c9b82 to 7e5ebe5 Compare May 6, 2026 19:14
@pcholakov pcholakov marked this pull request as ready for review May 6, 2026 19:51
@pcholakov pcholakov merged commit 88b1b22 into main May 6, 2026
3 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to deploy ServiceDeployer if "@aws-cdk/aws-lambda:useCdkManagedLogGroup" flag is enabled

1 participant