Check ELB healthcheck only for ASGs attached to load balancers
This commit is contained in:
parent
885115d91d
commit
3bb3cd14a0
@ -11,10 +11,10 @@ def autoscaling_group_elb_healthcheck_required():
|
||||
asgs = client.describe_auto_scaling_groups()["AutoScalingGroups"]
|
||||
|
||||
for asg in asgs:
|
||||
if asg.get("HealthCheckType", {}) == "ELB":
|
||||
compliant_resources.append(asg["AutoScalingGroupARN"])
|
||||
else:
|
||||
if asg["LoadBalancerNames"] or asg["TargetGroupARNs"] and asg["HealthCheckType"] != "ELB":
|
||||
non_compliant_resources.append(asg["AutoScalingGroupARN"])
|
||||
else:
|
||||
compliant_resources.append(asg["AutoScalingGroupARN"])
|
||||
|
||||
return RuleCheckResult(
|
||||
passed=not non_compliant_resources,
|
||||
@ -29,7 +29,7 @@ def autoscaling_multiple_az():
|
||||
asgs = client.describe_auto_scaling_groups()["AutoScalingGroups"]
|
||||
|
||||
for asg in asgs:
|
||||
if len(asg.get("AvailabilityZones", 0)) > 1:
|
||||
if len(asg["AvailabilityZones"]) > 1:
|
||||
compliant_resources.append(asg["AutoScalingGroupARN"])
|
||||
else:
|
||||
non_compliant_resources.append(asg["AutoScalingGroupARN"])
|
||||
|
Loading…
Reference in New Issue
Block a user