Skip to content

Commit

Permalink
Added cloudFrontLoggingBucketProps to cloudfront-s3
Browse files Browse the repository at this point in the history
  • Loading branch information
mickychetta committed Oct 13, 2021
1 parent ffd8d17 commit 8e5097a
Show file tree
Hide file tree
Showing 7 changed files with 526 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ test('Cloudfront logging bucket with destroy removal policy and auto delete obje

const [_api] = defaults.RegionalLambdaRestApi(stack, func);

new CloudFrontToApiGateway(stack, 'cloudfront-s3', {
new CloudFrontToApiGateway(stack, 'cloudfront-apigateway', {
existingApiGatewayObj: _api,
cloudFrontLoggingBucketProps: {
removalPolicy: cdk.RemovalPolicy.DESTROY,
Expand All @@ -196,7 +196,7 @@ test('Cloudfront logging bucket with destroy removal policy and auto delete obje
]
},
BucketName: {
Ref: "cloudfronts3CloudfrontLoggingBucket5B845143"
Ref: "cloudfrontapigatewayCloudfrontLoggingBucket5948F496"
}
});
});
Expand All @@ -219,7 +219,7 @@ test('Cloudfront logging bucket error when providing existing log bucket and log

const logBucket = new s3.Bucket(stack, 'cloudfront-log-bucket', {});

const app = () => { new CloudFrontToApiGateway(stack, 'cloudfront-s3', {
const app = () => { new CloudFrontToApiGateway(stack, 'cloudfront-apigateway', {
existingApiGatewayObj: _api,
cloudFrontDistributionProps: {
logBucket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ _Parameters_
|cloudFrontDistributionProps?|[`cloudfront.DistributionProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudfront.DistributionProps.html)|Optional user provided props to override the default props for CloudFront Distribution|
|insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|
|loggingBucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.BucketProps.html)|Optional user provided props to override the default props for the S3 Logging Bucket.|
|cloudFrontLoggingBucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.BucketProps.html)|Optional user provided props to override the default props for the CloudFront Logging Bucket.|

## Pattern Properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ export interface CloudFrontToS3Props {
* @default - Default props are used
*/
readonly loggingBucketProps?: s3.BucketProps
/**
* Optional user provided props to override the default props for the CloudFront Logging Bucket.
*
* @default - Default props are used
*/
readonly cloudFrontLoggingBucketProps?: s3.BucketProps
}

export class CloudFrontToS3 extends Construct {
Expand Down Expand Up @@ -86,6 +92,6 @@ export class CloudFrontToS3 extends Construct {

[this.cloudFrontWebDistribution, this.cloudFrontFunction, this.cloudFrontLoggingBucket] =
defaults.CloudFrontDistributionForS3(this, this.s3BucketInterface,
props.cloudFrontDistributionProps, props.insertHttpSecurityHeaders);
props.cloudFrontDistributionProps, props.insertHttpSecurityHeaders, props.cloudFrontLoggingBucketProps);
}
}
Loading

0 comments on commit 8e5097a

Please sign in to comment.