Skip to content

fix(s3-deployment): preserve custom log groups during deletion - #38446

Open
Hashim1999164 wants to merge 2 commits into
aws:mainfrom
Hashim1999164:fix/s3-deployment-log-group-dependency
Open

fix(s3-deployment): preserve custom log groups during deletion#38446
Hashim1999164 wants to merge 2 commits into
aws:mainfrom
Hashim1999164:fix/s3-deployment-log-group-dependency

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Jul 29, 2026

Copy link
Copy Markdown

Issue # (if applicable)

Closes #35632.

Reason for this change

When a BucketDeployment uses a custom log group, make the singleton handler depend on that group. CloudFormation will then delete the handler before the log group, preventing late handler logs from recreating a group that the stack already deleted.

Description of change

  • Add a CloudFormation dependency from the singleton Lambda handler to the custom log group
  • Extend the existing log-group unit test to assert that dependency
  • Refresh the integ.bucket-deployment-loggroup snapshot so the template records the deletion order

Description of how you validated changes

  • npx jest aws-s3-deployment/test/bucket-deployment.test.ts --runInBand --coverage=false (71 tests passed)
  • yarn integ --dry-run --update-on-failed test/aws-s3-deployment/test/integ.bucket-deployment-loggroup.js (passed)

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Make the deployment handler depend on its custom log group so CloudFormation deletes the handler first and cannot recreate the group.
@github-actions github-actions Bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p2 labels Jul 29, 2026
@github-actions github-actions Bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Jul 29, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team July 29, 2026 17:51

@aws-cdk-automation aws-cdk-automation left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@Hashim1999164

Copy link
Copy Markdown
Author

Updated the PR description to put the issue reference in the template's Issue section.

This change already includes an integration snapshot update under packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-loggroup.js.snapshot/, plus unit coverage in bucket-deployment.test.ts. Please re-run the PR linter if it still wants another integ source edit; happy to adjust.

@Hashim1999164

Copy link
Copy Markdown
Author

Exemption Request: this fix already updates the integration snapshot at packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-loggroup.js.snapshot/ and adds unit coverage in bucket-deployment.test.ts. The integ test source itself did not need a logic change; only the resulting snapshot changed to record the new Lambda→log-group dependency / deletion order.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Jul 31, 2026
@aws-cdk-automation
aws-cdk-automation dismissed their stale review July 31, 2026 18:05

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2 pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-s3-deployment: custom logGroup of BucketDeployment is prevented from deletion

2 participants