-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
CloudTrail missing DependsOn and /* , cdk deploy fails Incorrect S3 bucket policy is detected for bucket #1172
Labels
Comments
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html Shows the following : Trying to understand is the "/*" missing or extra "/" or something else BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket:
Ref: S3Bucket
PolicyDocument:
Version: "2012-10-17"
Statement:
-
Sid: "AWSCloudTrailAclCheck"
Effect: "Allow"
Principal:
Service: "cloudtrail.amazonaws.com"
Action: "s3:GetBucketAcl"
Resource:
!Sub |-
arn:aws:s3:::${S3Bucket}
-
Sid: "AWSCloudTrailWrite"
Effect: "Allow"
Principal:
Service: "cloudtrail.amazonaws.com"
Action: "s3:PutObject"
Resource:
!Sub |-
arn:aws:s3:::${S3Bucket}/AWSLogs/${AWS::AccountId}/*
Condition:
StringEquals:
s3:x-amz-acl: "bucket-owner-full-control" |
After some testing I think it is the DependsOn is missing: As manual deploy of the below worked Resources:
CloudTrailS310CD22F2:
Type: AWS::S3::Bucket
CloudTrailS3PolicyEA49A03E:
Type: AWS::S3::BucketPolicy
Properties:
Bucket:
Ref: CloudTrailS310CD22F2
PolicyDocument:
Statement:
- Action: s3:GetBucketAcl
Effect: Allow
Principal:
Service: cloudtrail.amazonaws.com
Resource: !Sub arn:aws:s3:::${CloudTrailS310CD22F2}
- Action: s3:PutObject
Condition:
StringEquals:
s3:x-amz-acl: bucket-owner-full-control
Effect: Allow
Principal:
Service: cloudtrail.amazonaws.com
Resource: !Sub arn:aws:s3:::${CloudTrailS310CD22F2}/AWSLogs/${AWS::AccountId}/*
Version: "2012-10-17"
CloudTrailA62D711D:
DependsOn:
- CloudTrailS3PolicyEA49A03E
Type: AWS::CloudTrail::Trail
Properties:
IsLogging: true
S3BucketName:
Ref: CloudTrailS310CD22F2
EnableLogFileValidation: true
EventSelectors:
[]
IncludeGlobalServiceEvents: true
IsMultiRegionTrail: false
CDKMetadata:
Type: AWS::CDK::Metadata
Properties:
Modules: "@aws-cdk/aws-cloudtrail=0.17.0,@aws-cdk/aws-cloudwatch=0.17.0,@aws-cdk\
/aws-codepipeline-api=0.17.0,@aws-cdk/aws-events=0.17.0,@aws-cdk/aws-ia\
m=0.17.0,@aws-cdk/aws-kms=0.17.0,@aws-cdk/aws-logs=0.17.0,@aws-cdk/aws-\
s3=0.17.0,@aws-cdk/aws-s3-notifications=0.17.0,@aws-cdk/cdk=0.17.0,@aws\
-cdk/cx-api=0.17.0,cdk=0.1.0" |
ygoodmn
changed the title
CloudTrail , cdk deploy fails Incorrect S3 bucket policy is detected for bucket
CloudTrail missing DependsOn and /* , cdk deploy fails Incorrect S3 bucket policy is detected for bucket
Nov 14, 2018
rix0rrr
added
bug
This issue is a bug.
@aws-cdk/aws-cloudtrail
Related to AWS CloudTrail
labels
Nov 19, 2018
8 tasks
rix0rrr
pushed a commit
that referenced
this issue
Dec 3, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to recreate:
CDK version 0.17.0 Typescript
Produces template: (was unable to get Yaml in Preview, sorry)
run cdk deploy:
Get
The text was updated successfully, but these errors were encountered: