diff --git a/services/asg.py b/services/asg.py index 7177c14..efe8f85 100644 --- a/services/asg.py +++ b/services/asg.py @@ -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"])