diff --git a/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/lib/index.ts b/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/lib/index.ts index 2758e3987..cbbfc3b54 100644 --- a/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/lib/index.ts +++ b/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/lib/index.ts @@ -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; diff --git a/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/test/test.cloudfront-s3.test.ts b/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/test/test.cloudfront-s3.test.ts index 2f190e204..3e02ae0da 100644 --- a/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/test/test.cloudfront-s3.test.ts +++ b/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/test/test.cloudfront-s3.test.ts @@ -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);