Fix launch template check

This commit is contained in:
skyuecx0630 2024-08-07 21:39:20 +09:00
parent 2a92f6ee05
commit 825d563d99

View File

@ -13,10 +13,10 @@ def autoscaling_launch_template():
asgs = autoscaling_client.describe_auto_scaling_groups()["AutoScalingGroups"] asgs = autoscaling_client.describe_auto_scaling_groups()["AutoScalingGroups"]
for asg in asgs: for asg in asgs:
if "LaunchTemplate" in asg["MixedInstancesPolicy"]: if "LaunchConfigurationName" in asg:
compliant_resources.append(asg["AutoScalingGroupARN"])
else:
non_compliant_resources.append(asg["AutoScalingGroupARN"]) non_compliant_resources.append(asg["AutoScalingGroupARN"])
else:
compliant_resources.append(asg["AutoScalingGroupARN"])
return RuleCheckResult( return RuleCheckResult(
passed=not non_compliant_resources, passed=not non_compliant_resources,