Skip to content

Commit

Permalink
fix(type-safe-api): ensure uniqueness of waf web acl name
Browse files Browse the repository at this point in the history
Fixes #750
  • Loading branch information
cogwirrel committed Apr 4, 2024
1 parent 7afa3b7 commit f823fcd
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ export class OpenApiGatewayWebAcl extends Construct {

const aclName = `${PDKNag.getStackPrefix(Stack.of(this))
.split("/")
.join("-")}-${id}-WebAcl`;
.join("-")}${id}-${this.node.addr.slice(-8)}`;
const ipSetName = `${aclName}-IPSet`;

// Create the IP Set if requested
this.ipSet = props.cidrAllowList
? new CfnIPSet(this, "IPSet", {
? new CfnIPSet(this, "ApiIPSet", {
name: ipSetName,
addresses: props.cidrAllowList.cidrRanges,
ipAddressVersion: props.cidrAllowList.cidrType,
Expand Down Expand Up @@ -120,7 +120,7 @@ export class OpenApiGatewayWebAcl extends Construct {
),
];

this.webAcl = new CfnWebACL(this, "WebACL", {
this.webAcl = new CfnWebACL(this, "ApiWebACL", {
name: aclName,
defaultAction: {
// Allow by default, and use rules to deny unwanted requests
Expand Down
Loading

0 comments on commit f823fcd

Please sign in to comment.