@@ -68,7 +68,7 @@ func NewDesiredLoadBalancer(o *NewDesiredLoadBalancerOptions) (newLoadBalancer *
68
68
options : options {
69
69
desired : opts {
70
70
idleTimeout : o .Annotations .ConnectionIdleTimeout ,
71
- wafACLID : o .Annotations .WafACLID ,
71
+ webACLId : o .Annotations .WebACLId ,
72
72
},
73
73
},
74
74
lb : lb {
@@ -103,7 +103,7 @@ func NewDesiredLoadBalancer(o *NewDesiredLoadBalancerOptions) (newLoadBalancer *
103
103
existinglb .lb .desired = newLoadBalancer .lb .desired
104
104
existinglb .tags .desired = newLoadBalancer .tags .desired
105
105
existinglb .options .desired .idleTimeout = newLoadBalancer .options .desired .idleTimeout
106
- existinglb .options .desired .wafACLID = newLoadBalancer .options .desired .wafACLID
106
+ existinglb .options .desired .webACLId = newLoadBalancer .options .desired .webACLId
107
107
if len (o .ExistingLoadBalancer .lb .desired .SecurityGroups ) == 0 {
108
108
existinglb .options .desired .ports = lsps
109
109
existinglb .options .desired .inboundCidrs = o .Annotations .InboundCidrs
@@ -245,13 +245,13 @@ func NewCurrentLoadBalancer(o *NewCurrentLoadBalancerOptions) (newLoadBalancer *
245
245
}
246
246
247
247
// Check WAF
248
- wafResult , err := albwaf .WAFRegionalsvc .GetWebACLSummary (o .LoadBalancer .LoadBalancerArn )
248
+ webACLResult , err := albwaf .WAFRegionalsvc .GetWebACLSummary (o .LoadBalancer .LoadBalancerArn )
249
249
if err != nil {
250
- return newLoadBalancer , fmt .Errorf ("Failed to get associated WAF ACL. Error: %s" , err .Error ())
250
+ return newLoadBalancer , fmt .Errorf ("Failed to get associated Web ACL. Error: %s" , err .Error ())
251
251
}
252
- var wafACLID * string
253
- if wafResult != nil {
254
- wafACLID = wafResult .WebACLId
252
+ var webACLId * string
253
+ if webACLResult != nil {
254
+ webACLId = webACLResult .WebACLId
255
255
}
256
256
257
257
newLoadBalancer = & LoadBalancer {
@@ -265,7 +265,7 @@ func NewCurrentLoadBalancer(o *NewCurrentLoadBalancerOptions) (newLoadBalancer *
265
265
ports : managedSGPorts ,
266
266
managedInstanceSG : managedInstanceSG ,
267
267
idleTimeout : idleTimeout ,
268
- wafACLID : wafACLID ,
268
+ webACLId : webACLId ,
269
269
},
270
270
},
271
271
}
@@ -519,11 +519,11 @@ func (l *LoadBalancer) create(rOpts *ReconcileOptions) error {
519
519
}
520
520
}
521
521
522
- if l .options .desired .wafACLID != nil {
523
- _ , err = albwaf .WAFRegionalsvc .Associate (l .lb .current .LoadBalancerArn , l .options .desired .wafACLID )
522
+ if l .options .desired .webACLId != nil {
523
+ _ , err = albwaf .WAFRegionalsvc .Associate (l .lb .current .LoadBalancerArn , l .options .desired .webACLId )
524
524
if err != nil {
525
- rOpts .Eventf (api .EventTypeWarning , "ERROR" , "%s WAF (%s) association failed: %s" , * l .lb .current .LoadBalancerName , l .options .desired .wafACLID , err .Error ())
526
- l .logger .Errorf ("Failed ELBV2 (ALB) WAF (%s) association: %s" , l .options .desired .wafACLID , err .Error ())
525
+ rOpts .Eventf (api .EventTypeWarning , "ERROR" , "%s Web ACL (%s) association failed: %s" , * l .lb .current .LoadBalancerName , l .options .desired .webACLId , err .Error ())
526
+ l .logger .Errorf ("Failed ELBV2 (ALB) Web ACL (%s) association: %s" , l .options .desired .webACLId , err .Error ())
527
527
return err
528
528
}
529
529
}
@@ -644,24 +644,24 @@ func (l *LoadBalancer) modify(rOpts *ReconcileOptions) error {
644
644
l .logger .Infof ("Completed ELBV2 tag modification. Attributes are %s." , log .Prettify (l .attributes .current ))
645
645
}
646
646
647
- if needsMod & wafAssociationModified != 0 {
648
- if l .options .desired .wafACLID != nil {
649
- if _ , err := albwaf .WAFRegionalsvc .Associate (l .lb .current .LoadBalancerArn , l .options .desired .wafACLID ); err != nil {
650
- rOpts .Eventf (api .EventTypeWarning , "ERROR" , "%s Waf (%s) association failed: %s" , * l .lb .current .LoadBalancerName , * l .options .desired .wafACLID , err .Error ())
651
- l .logger .Errorf ("Failed ELBV2 (ALB) Waf (%s) association failed : %s" , * l .options .desired .wafACLID , err .Error ())
647
+ if needsMod & webACLAssociationModified != 0 {
648
+ if l .options .desired .webACLId != nil {
649
+ if _ , err := albwaf .WAFRegionalsvc .Associate (l .lb .current .LoadBalancerArn , l .options .desired .webACLId ); err != nil {
650
+ rOpts .Eventf (api .EventTypeWarning , "ERROR" , "%s Web ACL (%s) association failed: %s" , * l .lb .current .LoadBalancerName , * l .options .desired .webACLId , err .Error ())
651
+ l .logger .Errorf ("Failure adding Web ACL (%s) association: %s" , * l .options .desired .webACLId , err .Error ())
652
652
} else {
653
- l .options .current .wafACLID = l .options .desired .wafACLID
654
- rOpts .Eventf (api .EventTypeNormal , "MODIFY" , "WAF Association updated to %s" , * l .options .desired .wafACLID )
655
- l .logger .Infof ("WAF Association updated %s" , * l .options .desired .wafACLID )
653
+ l .options .current .webACLId = l .options .desired .webACLId
654
+ rOpts .Eventf (api .EventTypeNormal , "MODIFY" , "Web ACL association updated to %s" , * l .options .desired .webACLId )
655
+ l .logger .Infof ("Web ACL association updated to %s" , * l .options .desired .webACLId )
656
656
}
657
- } else if l .options .current .wafACLID != nil {
657
+ } else if l .options .current .webACLId != nil {
658
658
if _ , err := albwaf .WAFRegionalsvc .Disassociate (l .lb .current .LoadBalancerArn ); err != nil {
659
- rOpts .Eventf (api .EventTypeWarning , "ERROR" , "%s Waf disassociation failed: %s" , * l .lb .current .LoadBalancerName , err .Error ())
660
- l .logger .Errorf ("Failed ELBV2 (ALB) Waf disassociation failed : %s" , err .Error ())
659
+ rOpts .Eventf (api .EventTypeWarning , "ERROR" , "%s Web ACL disassociation failed: %s" , * l .lb .current .LoadBalancerName , err .Error ())
660
+ l .logger .Errorf ("Failure removing Web ACL association : %s" , err .Error ())
661
661
} else {
662
- l .options .current .wafACLID = l .options .desired .wafACLID
663
- rOpts .Eventf (api .EventTypeNormal , "MODIFY" , "WAF Disassociated " )
664
- l .logger .Infof ("WAF Disassociated " )
662
+ l .options .current .webACLId = l .options .desired .webACLId
663
+ rOpts .Eventf (api .EventTypeNormal , "MODIFY" , "Web ACL disassociated " )
664
+ l .logger .Infof ("Web ACL disassociated " )
665
665
}
666
666
}
667
667
}
@@ -687,7 +687,7 @@ func (l *LoadBalancer) modify(rOpts *ReconcileOptions) error {
687
687
func (l * LoadBalancer ) delete (rOpts * ReconcileOptions ) error {
688
688
689
689
// we need to disassociate the WAF before deletion
690
- if l .options .current .wafACLID != nil {
690
+ if l .options .current .webACLId != nil {
691
691
if _ , err := albwaf .WAFRegionalsvc .Disassociate (l .lb .current .LoadBalancerArn ); err != nil {
692
692
rOpts .Eventf (api .EventTypeWarning , "ERROR" , "Error disassociating WAF for %s: %s" , * l .lb .current .LoadBalancerName , err .Error ())
693
693
l .logger .Errorf ("Failed disassociation of ELBV2 (ALB) WAF: %s." , err .Error ())
@@ -827,11 +827,11 @@ func (l *LoadBalancer) needsModification() (loadBalancerChange, bool) {
827
827
changes |= attributesModified
828
828
}
829
829
830
- if dopts .wafACLID != nil && copts .wafACLID == nil ||
831
- dopts .wafACLID == nil && copts .wafACLID != nil ||
832
- (copts .wafACLID != nil && dopts .wafACLID != nil && * copts .wafACLID != * dopts .wafACLID ) {
833
- l .logger .Debugf ("WAF needs to be changed: (%v != %v)" , log .Prettify (copts .wafACLID ), log .Prettify (dopts .wafACLID ))
834
- changes |= wafAssociationModified
830
+ if dopts .webACLId != nil && copts .webACLId == nil ||
831
+ dopts .webACLId == nil && copts .webACLId != nil ||
832
+ (copts .webACLId != nil && dopts .webACLId != nil && * copts .webACLId != * dopts .webACLId ) {
833
+ l .logger .Debugf ("WAF needs to be changed: (%v != %v)" , log .Prettify (copts .webACLId ), log .Prettify (dopts .webACLId ))
834
+ changes |= webACLAssociationModified
835
835
}
836
836
return changes , true
837
837
}
@@ -841,7 +841,7 @@ func (l *LoadBalancer) StripDesiredState() {
841
841
l .lb .desired = nil
842
842
l .options .desired .ports = nil
843
843
l .options .desired .managedSG = nil
844
- l .options .desired .wafACLID = nil
844
+ l .options .desired .webACLId = nil
845
845
if l .listeners != nil {
846
846
l .listeners .StripDesiredState ()
847
847
}
0 commit comments