From d9abc039a9c9768df098b9b12f12736092e23a77 Mon Sep 17 00:00:00 2001 From: skyuecx0630 <48788794+skyuecx0630@users.noreply.github.com> Date: Wed, 7 Aug 2024 21:39:35 +0900 Subject: [PATCH] Fix key pair check --- services/ec2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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,