diff --git a/services/ec2.py b/services/ec2.py index b6abaa9..143135d 100644 --- a/services/ec2.py +++ b/services/ec2.py @@ -139,9 +139,9 @@ def ec2_no_amazon_key_pair(): if instance["State"]["Name"] == "terminated": continue if "KeyName" in instance: - compliant_resources.append(instance["InstanceId"]) - else: non_compliant_resources.append(instance["InstanceId"]) + else: + compliant_resources.append(instance["InstanceId"]) return RuleCheckResult( passed=not non_compliant_resources,