constructor()

in source/lib/s3-staging-bucket.ts [27:66]


    constructor(scope: cdk.Construct, id: string) {
        super(scope, id);

        const securitySettings: s3.BucketProps = {
            blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,
            encryption: s3.BucketEncryption.S3_MANAGED,
            removalPolicy: cdk.RemovalPolicy.DESTROY
        };

        const rules: s3.LifecycleRule[] = [{
            id: 'multipart-upload-rule',
            enabled: true,
            abortIncompleteMultipartUploadAfter: cdk.Duration.days(7)
        }];

        this.Bucket = new s3.Bucket(this, 'StagingBucket', {
            ...securitySettings,
        });
        (this.Bucket.node.defaultChild as s3.CfnBucket).overrideLogicalId('stagingBucket');
        this.addCfnNagSuppressions(this.Bucket);

        this.Bucket.addToResourcePolicy(
            new iam.PolicyStatement({
                resources: [
                    `${this.Bucket.bucketArn}`,
                    `${this.Bucket.bucketArn}/*`
                ],
                actions: ["s3:*"],
                principals: [new iam.AnyPrincipal],
                effect: iam.Effect.DENY,
                conditions: {
                    Bool: {
                        'aws:SecureTransport': 'false'
                    }
                }
            })
        );

        this.addCfnNagSuppressions(this.Bucket);
    }