Skip to content

Commit

Permalink
Disable management events for Lambda & S3 Cloudtrail event selectors
Browse files Browse the repository at this point in the history
Prevents duplicate management event selectors being created in the
organisation Cloud Trail.

Signed-off-by: Richard Baker <[email protected]>
  • Loading branch information
rjbaker committed May 14, 2024
1 parent acb6f29 commit 21cb076
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -821,15 +821,23 @@ export class OrganizationsStack extends AcceleratorStack {
});

if (this.stackProperties.globalConfig.logging.cloudtrail.organizationTrailSettings?.s3DataEvents ?? true) {
organizationsTrail.addEventSelector(cdk.aws_cloudtrail.DataResourceType.S3_OBJECT, [
`arn:${cdk.Stack.of(this).partition}:s3:::`,
]);
organizationsTrail.addEventSelector(
cdk.aws_cloudtrail.DataResourceType.S3_OBJECT,
[`arn:${cdk.Stack.of(this).partition}:s3:::`],
{
includeManagementEvents: false,
},
);
}

if (this.stackProperties.globalConfig.logging.cloudtrail.organizationTrailSettings?.lambdaDataEvents ?? true) {
organizationsTrail.addEventSelector(cdk.aws_cloudtrail.DataResourceType.LAMBDA_FUNCTION, [
`arn:${cdk.Stack.of(this).partition}:lambda`,
]);
organizationsTrail.addEventSelector(
cdk.aws_cloudtrail.DataResourceType.LAMBDA_FUNCTION,
[`arn:${cdk.Stack.of(this).partition}:lambda`],
{
includeManagementEvents: false,
},
);
}

organizationsTrail.node.addDependency(enableCloudtrailServiceAccess);
Expand Down

0 comments on commit 21cb076

Please sign in to comment.