Skip to content

Commit

Permalink
feat(static-website): add option to disable web acl (#454)
Browse files Browse the repository at this point in the history
Like TypeSafeRestApi, we use a web ACL by default but allow the user to disable it
  • Loading branch information
cogwirrel committed Jun 2, 2023
1 parent b71a28f commit e44926d
Show file tree
Hide file tree
Showing 4 changed files with 1,896 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/static-website/src/cloudfront-web-acl.ts
Expand Up @@ -75,6 +75,12 @@ export interface CloudFrontWebAclProps {
* @default - undefined
*/
readonly cidrAllowList?: CidrAllowList;

/**
* Set to true to prevent creation of a web acl for the static website
* @default false
*/
readonly disable?: boolean;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions packages/static-website/src/static-website.ts
Expand Up @@ -165,8 +165,9 @@ export class StaticWebsite extends Construct {
// Web ACL
const { distributionProps } = props;
const webAclArn =
distributionProps?.webAclId ??
new CloudfrontWebAcl(this, "WebsiteAcl", props.webAclProps).webAclArn;
distributionProps?.webAclId ?? props.webAclProps?.disable
? undefined
: new CloudfrontWebAcl(this, "WebsiteAcl", props.webAclProps).webAclArn;

// Cloudfront Distribution
const logBucket =
Expand Down

0 comments on commit e44926d

Please sign in to comment.