-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cloudtrail): addS3EventSelector does not expose all options (#1854)
The documentation suggested one could pass an object as the second argument to `CloudTrail.addS3EventSelector`, however the real argument was `ReadWriteType`. Additionally the documentation suggested incorrect uses of the API that would lead to invalid templates being generated. BREAKING CHANGE: The `CloudTrail.addS3EventSelector` accepts an options object instead of only a `ReadWriteType` value. Fixes #1841
- Loading branch information
1 parent
f974531
commit 5c3431b
Showing
8 changed files
with
181 additions
and
13 deletions.
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
107 changes: 107 additions & 0 deletions
107
packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.expected.json
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 |
---|---|---|
@@ -0,0 +1,107 @@ | ||
{ | ||
"Resources": { | ||
"Bucket83908E77": { | ||
"Type": "AWS::S3::Bucket" | ||
}, | ||
"TrailS30071F172": { | ||
"Type": "AWS::S3::Bucket", | ||
"DeletionPolicy": "Retain" | ||
}, | ||
"TrailS3PolicyE42170FE": { | ||
"Type": "AWS::S3::BucketPolicy", | ||
"Properties": { | ||
"Bucket": { | ||
"Ref": "TrailS30071F172" | ||
}, | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "s3:GetBucketAcl", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "cloudtrail.amazonaws.com" | ||
}, | ||
"Resource": { | ||
"Fn::GetAtt": [ | ||
"TrailS30071F172", | ||
"Arn" | ||
] | ||
} | ||
}, | ||
{ | ||
"Action": "s3:PutObject", | ||
"Condition": { | ||
"StringEquals": { | ||
"s3:x-amz-acl": "bucket-owner-full-control" | ||
} | ||
}, | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "cloudtrail.amazonaws.com" | ||
}, | ||
"Resource": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
{ | ||
"Fn::GetAtt": [ | ||
"TrailS30071F172", | ||
"Arn" | ||
] | ||
}, | ||
"/AWSLogs/", | ||
{ | ||
"Ref": "AWS::AccountId" | ||
}, | ||
"/*" | ||
] | ||
] | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
} | ||
} | ||
}, | ||
"Trail022F0CF2": { | ||
"Type": "AWS::CloudTrail::Trail", | ||
"Properties": { | ||
"IsLogging": true, | ||
"S3BucketName": { | ||
"Ref": "TrailS30071F172" | ||
}, | ||
"EnableLogFileValidation": true, | ||
"EventSelectors": [ | ||
{ | ||
"DataResources": [ | ||
{ | ||
"Type": "AWS::S3::Object", | ||
"Values": [ | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
{ | ||
"Fn::GetAtt": [ | ||
"Bucket83908E77", | ||
"Arn" | ||
] | ||
}, | ||
"/" | ||
] | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"IncludeGlobalServiceEvents": true, | ||
"IsMultiRegionTrail": true | ||
}, | ||
"DependsOn": [ | ||
"TrailS3PolicyE42170FE" | ||
] | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.ts
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import s3 = require('@aws-cdk/aws-s3'); | ||
import cdk = require('@aws-cdk/cdk'); | ||
import cloudtrail = require('../lib'); | ||
|
||
const app = new cdk.App(); | ||
const stack = new cdk.Stack(app, 'integ-cloudtrail'); | ||
|
||
const bucket = new s3.Bucket(stack, 'Bucket', { removalPolicy: cdk.RemovalPolicy.Destroy }); | ||
|
||
const trail = new cloudtrail.CloudTrail(stack, 'Trail'); | ||
trail.addS3EventSelector([bucket.arnForObjects('')]); | ||
|
||
app.run(); |
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 |
---|---|---|
|
@@ -142,4 +142,4 @@ | |
"engines": { | ||
"node": ">= 8.10.0" | ||
} | ||
} | ||
} |