Skip to content

Commit

Permalink
Update the cloudfront-to-s3 construct to correctly set the logging bu…
Browse files Browse the repository at this point in the history
…cket property. (#930)
  • Loading branch information
georgebearden committed Mar 23, 2023
1 parent 26a69f3 commit c909a16
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export class CloudFrontToS3 extends Construct {
logS3AccessLogs: props.logS3AccessLogs
});
this.s3Bucket = buildS3BucketResponse.bucket;
this.s3LoggingBucket = buildS3BucketResponse.loggingBucket;
bucket = this.s3Bucket;
} else {
bucket = props.existingBucketObj;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ function deploy(stack: cdk.Stack, props?: CloudFrontToS3Props) {
});
}

test('construct defaults set properties correctly', () => {
const stack = new cdk.Stack();
const construct = new CloudFrontToS3(stack, 'test-cloudfront-s3', {});

expect(construct.cloudFrontWebDistribution).toBeDefined();
expect(construct.cloudFrontFunction).toBeDefined();
expect(construct.cloudFrontLoggingBucket).toBeDefined();
expect(construct.s3Bucket).toBeDefined();
expect(construct.s3LoggingBucket).toBeDefined();
expect(construct.s3BucketInterface).toBeDefined();
});

test('check s3Bucket default encryption', () => {
const stack = new cdk.Stack();
deploy(stack);
Expand Down

0 comments on commit c909a16

Please sign in to comment.