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

fix: 945 set log retention to 90 days default #1129

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ const provider = new SopsSyncProvider(this, 'MySopsSyncProvider', {
securityGroups: [ // securitygroups to your
customSecurityGroup // needs.
],
logRetention: RetentionDays.INFINITE, // you can increase the default log retention
});

provider.addToRolePolicy( // You cann pass PolicyStatements
Expand Down
12 changes: 10 additions & 2 deletions src/SopsSync.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as fs from 'fs';
import * as path from 'path';
import {
Annotations,
CustomResource,
Expand All @@ -18,9 +16,12 @@ import {
} from 'aws-cdk-lib/aws-iam';
import { IKey, Key } from 'aws-cdk-lib/aws-kms';
import { Code, Runtime, SingletonFunction } from 'aws-cdk-lib/aws-lambda';
import { RetentionDays } from 'aws-cdk-lib/aws-logs';
import { Asset } from 'aws-cdk-lib/aws-s3-assets';
import { ISecret } from 'aws-cdk-lib/aws-secretsmanager';
import { Construct } from 'constructs';
import * as fs from 'fs';
import * as path from 'path';
import { SopsSyncResourcePropertys } from './LambdaInterface';

export enum UploadType {
Expand Down Expand Up @@ -176,6 +177,12 @@ export interface SopsSyncProviderProps {
* @default - a new role will be created
*/
readonly role?: IRole;
/**
* The duration how long logs of the Sops Sync Lambda will be saved in RetentionDays.
*
* @default - 90 Days
*/
readonly logRetention?: RetentionDays;
}

export class SopsSyncProvider extends SingletonFunction implements IGrantable {
Expand Down Expand Up @@ -203,6 +210,7 @@ export class SopsSyncProvider extends SingletonFunction implements IGrantable {
vpc: props?.vpc,
vpcSubnets: props?.vpcSubnets,
securityGroups: props?.securityGroups,
logRetention: props?.logRetention ?? RetentionDays.THREE_MONTHS,
});
this.sopsAgeKeys = [];
}
Expand Down
Loading