Skip to content
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

chore(logs): migrate log retention handler #27814

Merged
merged 16 commits into from
Nov 17, 2023
1 change: 1 addition & 0 deletions packages/@aws-cdk/custom-resource-handlers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@aws-sdk/client-synthetics": "^3.421.0",
"@aws-sdk/client-ecr": "^3.421.0",
"@aws-sdk/client-s3": "^3.421.0",
"@aws-sdk/client-cloudwatch-logs": "^3.441.0",
"aws-sdk": "^2.1466.0"
},
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CloudWatchLogsClient, CloudWatchLogsClientResolvedConfig, CreateLogGrou
import { AwsStub, mockClient } from 'aws-sdk-client-mock';
import 'aws-sdk-client-mock-jest';
import * as nock from 'nock';
import * as provider from '../lib/log-retention-provider';
import * as provider from '../../lib/aws-logs/log-retention-provider/index';

const cloudwatchLogsMock = mockClient(CloudWatchLogsClient);
const OPERATION_ABORTED = new OperationAbortedException({ message: '', $metadata: {} });
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('log retention provider', () => {

expect(cloudwatchLogsMock).toHaveReceivedCommandWith(PutRetentionPolicyCommand, {
logGroupName: 'group',
retentionInDays: 30,
retentionInDays: 29,
});

expect(cloudwatchLogsMock).toHaveReceivedCommandWith(CreateLogGroupCommand, {
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-logs/lib/log-retention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class LogRetentionFunction extends Construct implements cdk.ITaggable {
super(scope, id);

const asset = new s3_assets.Asset(this, 'Code', {
path: path.join(__dirname, 'log-retention-provider'),
path: path.join(__dirname, '..', '..', 'custom-resource-handlers', 'dist', 'aws-logs', 'log-retention-provider'),
});

const role = props.role || new iam.Role(this, 'ServiceRole', {
Expand Down
Loading
Loading