Skip to content

Commit

Permalink
add optional wafv2 association
Browse files Browse the repository at this point in the history
  • Loading branch information
Guslington committed Oct 27, 2020
1 parent 2fae776 commit 6cc91c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion application-loadbalancer.cfhighlander.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
ComponentParam 'SubnetIds', type: 'CommaDelimitedList'
ComponentParam 'VPCId', type: 'AWS::EC2::VPC::Id'
ComponentParam 'SslCertId', ''

ComponentParam 'WebACLArn', ''

if use_zone_id == true
ComponentParam 'HostedZoneId', ''
end
Expand Down
8 changes: 8 additions & 0 deletions application-loadbalancer.cfndsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@
end
end

Condition(:AssociateWebACL, FnNot(FnEquals(:WebACLArn, '')))

WAFv2_WebACLAssociation(:WebACLAssociation) {
Condition :AssociateWebACL
ResourceArn Ref(:LoadBalancer)
WebACLArn Ref(:WebACLArn)
}

Output(:LoadBalancer) {
Value(Ref(:LoadBalancer))
Export FnSub("${EnvironmentName}-#{external_parameters[:component_name]}-LoadBalancer")
Expand Down

0 comments on commit 6cc91c6

Please sign in to comment.