-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(s3): add autoDeleteObjectsLogGroup
to pass log group to custom resource lambda
#30333
Closed
samson-keung
wants to merge
6
commits into
aws:main
from
samson-keung:customize-bucket-auto-delete-objects-lambda-logging
Closed
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1821e00
CustomResourceProvider: supports passing LoggingConfig into provider …
samson-keung 1427fe9
s3.Bucket: accept new prop autoDeleteObjectsLogGroup
samson-keung d296fb3
s3.Bucket: update README to include
samson-keung 61a02d0
s3.Bucket: auto-delete-objects integ test
samson-keung e554487
Fix aws-s3 README
samson-keung 5a201cb
Make import statememts style consistent
samson-keung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import { testDeprecated } from '@aws-cdk/cdk-build-tools'; | |
import { Annotations, Match, Template } from '../../assertions'; | ||
import * as iam from '../../aws-iam'; | ||
import * as kms from '../../aws-kms'; | ||
import { LogGroup } from '../../aws-logs'; | ||
import * as cdk from '../../core'; | ||
import * as s3 from '../lib'; | ||
|
||
|
@@ -3463,6 +3464,26 @@ describe('bucket', () => { | |
Template.fromStack(stack).resourceCountIs('AWS::Lambda::Function', 1); | ||
}); | ||
|
||
test('with autoDeleteObjectsLogGroup', () => { | ||
const stack = new cdk.Stack(); | ||
|
||
new s3.Bucket(stack, 'MyBucket', { | ||
removalPolicy: cdk.RemovalPolicy.DESTROY, | ||
autoDeleteObjects: true, | ||
autoDeleteObjectsLogGroup: new LogGroup(stack, 'LogGroup1', { | ||
logGroupName: 'MyLogGroup', | ||
}), | ||
}); | ||
|
||
Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { | ||
LoggingConfig: { | ||
LogGroup: { | ||
'Ref': 'LogGroup106AAD846', | ||
}, | ||
}, | ||
}); | ||
}); | ||
Comment on lines
+3478
to
+3485
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: should we also be checking if the log group resource was created? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea. Will update |
||
|
||
test('autoDeleteObjects throws if RemovalPolicy is not DESTROY', () => { | ||
const stack = new cdk.Stack(); | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if
autoDeleteObjectsLogGroup
is set butautoDeleteObjects
isn't set to true?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is ignored.