prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  CKV_AWS_300 fails if there are more rules than one
  **Describe the issue**
  CKV_AWS_300 fails if there's more rules than one defined in `aws_s3_bucket_lifecycle_configuration`
  
  **Examples**
  ```
  resource "aws_s3_bucket_lifecycle_configuration" "bucket" {
    bucket = aws_s3_bucket.bucket.bucket
  
    rule {
      id = "id-1"
      status = "Enabled"
  
      abort_incomplete_multipart_upload {
        days_after_initiation = 1
      }
    }
  
    rule {
      id     = "id-2"
      status = "Enabled"
  
      noncurrent_version_expiration {
        noncurrent_days = 1
      }
    }
  }
  ```
  
  **Version (please complete the following information):**
   - Checkov Version 2.3.111
  
  Fails with:
  
  ```
  Check: CKV_AWS_300: "Ensure S3 lifecycle configuration sets period for aborting failed uploads"
  	FAILED for resource: aws_s3_bucket_lifecycle_configuration.bucket
  	File: s3.tf:1-1
  
  		122 | resource "aws_s3_bucket_lifecycle_configuration" "bucket" {
  		123 |   bucket = aws_s3_bucket.bucket.bucket
  		124 | 
  		125 |   rule {
  		126 |     id = "id-1"
  		127 | 
  		128 |     abort_incomplete_multipart_upload {
  		129 |       days_after_initiation = 1
  		130 |     }
  		131 | 
  		132 |     status = "Enabled"
  		133 |   }
  		134 | 
  		135 |   rule {
  		136 |     id     = "id-2"
  		137 |     status = "Enabled"
  		138 | 
  		139 |     noncurrent_version_expiration {
  		140 |       noncurrent_days = 1
  		141 |     }
  		142 |   }
  		143 | }
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py`
  Content:
  ```
  1 from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
  2 from checkov.common.models.enums import CheckCategories, CheckResult
  3 
  4 
  5 class S3AbortIncompleteUploads(BaseResourceCheck):
  6     def __init__(self):
  7         """
  8         If you don't set this value in a lifecycle configuration you'll end up paying for s3
  9         resources you never could use
  10         """
  11         name = "Ensure S3 lifecycle configuration sets period for aborting failed uploads"
  12         id = "CKV_AWS_300"
  13         supported_resources = ('aws_s3_bucket_lifecycle_configuration',)
  14         categories = (CheckCategories.GENERAL_SECURITY,)
  15         super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
  16 
  17     def scan_resource_conf(self, conf):
  18         self.evaluated_keys = ["rule"]
  19         rules = conf.get("rule")
  20         if rules and isinstance(rules, list):
  21             for idx_rule, rule in enumerate(rules):
  22                 if not rule.get("abort_incomplete_multipart_upload"):
  23                     self.evaluated_keys = [f"rule/[{idx_rule}]/"]
  24                     return CheckResult.FAILED
  25             return CheckResult.PASSED
  26         return CheckResult.FAILED
  27 
  28 
  29 check = S3AbortIncompleteUploads()
  30
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py b/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py
  --- a/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py
  +++ b/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py
  @@ -1,28 +1,36 @@
  +from __future__ import annotations
  +
  +from typing import Any
  +
   from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
   from checkov.common.models.enums import CheckCategories, CheckResult
   
   
   class S3AbortIncompleteUploads(BaseResourceCheck):
  -    def __init__(self):
  +    def __init__(self) -> None:
           """
           If you don't set this value in a lifecycle configuration you'll end up paying for s3
           resources you never could use
           """
           name = "Ensure S3 lifecycle configuration sets period for aborting failed uploads"
           id = "CKV_AWS_300"
  -        supported_resources = ('aws_s3_bucket_lifecycle_configuration',)
  +        supported_resources = ("aws_s3_bucket_lifecycle_configuration",)
           categories = (CheckCategories.GENERAL_SECURITY,)
           super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
   
  -    def scan_resource_conf(self, conf):
  +    def scan_resource_conf(self, conf: dict[str, list[Any]]) -> CheckResult:
           self.evaluated_keys = ["rule"]
           rules = conf.get("rule")
           if rules and isinstance(rules, list):
               for idx_rule, rule in enumerate(rules):
  -                if not rule.get("abort_incomplete_multipart_upload"):
  -                    self.evaluated_keys = [f"rule/[{idx_rule}]/"]
  -                    return CheckResult.FAILED
  -            return CheckResult.PASSED
  +                if (
  +                    rule.get("abort_incomplete_multipart_upload")
  +                    and rule.get("status") == ["Enabled"]
  +                    and not rule.get("filter")
  +                ):
  +                    self.evaluated_keys = [f"rule/[{idx_rule}]/abort_incomplete_multipart_upload"]
  +                    return CheckResult.PASSED
  +
           return CheckResult.FAILED
  
verification_info: {"golden_diff": "diff --git a/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py b/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py\n--- a/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py\n+++ b/checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py\n@@ -1,28 +1,36 @@\n+from __future__ import annotations\n+\n+from typing import Any\n+\n from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n from checkov.common.models.enums import CheckCategories, CheckResult\n \n \n class S3AbortIncompleteUploads(BaseResourceCheck):\n-    def __init__(self):\n+    def __init__(self) -> None:\n         \"\"\"\n         If you don't set this value in a lifecycle configuration you'll end up paying for s3\n         resources you never could use\n         \"\"\"\n         name = \"Ensure S3 lifecycle configuration sets period for aborting failed uploads\"\n         id = \"CKV_AWS_300\"\n-        supported_resources = ('aws_s3_bucket_lifecycle_configuration',)\n+        supported_resources = (\"aws_s3_bucket_lifecycle_configuration\",)\n         categories = (CheckCategories.GENERAL_SECURITY,)\n         super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n \n-    def scan_resource_conf(self, conf):\n+    def scan_resource_conf(self, conf: dict[str, list[Any]]) -> CheckResult:\n         self.evaluated_keys = [\"rule\"]\n         rules = conf.get(\"rule\")\n         if rules and isinstance(rules, list):\n             for idx_rule, rule in enumerate(rules):\n-                if not rule.get(\"abort_incomplete_multipart_upload\"):\n-                    self.evaluated_keys = [f\"rule/[{idx_rule}]/\"]\n-                    return CheckResult.FAILED\n-            return CheckResult.PASSED\n+                if (\n+                    rule.get(\"abort_incomplete_multipart_upload\")\n+                    and rule.get(\"status\") == [\"Enabled\"]\n+                    and not rule.get(\"filter\")\n+                ):\n+                    self.evaluated_keys = [f\"rule/[{idx_rule}]/abort_incomplete_multipart_upload\"]\n+                    return CheckResult.PASSED\n+\n         return CheckResult.FAILED\n", "issue": "CKV_AWS_300 fails if there are more rules than one\n**Describe the issue**\r\nCKV_AWS_300 fails if there's more rules than one defined in `aws_s3_bucket_lifecycle_configuration`\r\n\r\n**Examples**\r\n```\r\nresource \"aws_s3_bucket_lifecycle_configuration\" \"bucket\" {\r\n  bucket = aws_s3_bucket.bucket.bucket\r\n\r\n  rule {\r\n    id = \"id-1\"\r\n    status = \"Enabled\"\r\n\r\n    abort_incomplete_multipart_upload {\r\n      days_after_initiation = 1\r\n    }\r\n  }\r\n\r\n  rule {\r\n    id     = \"id-2\"\r\n    status = \"Enabled\"\r\n\r\n    noncurrent_version_expiration {\r\n      noncurrent_days = 1\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n**Version (please complete the following information):**\r\n - Checkov Version 2.3.111\r\n\r\nFails with:\r\n\r\n```\r\nCheck: CKV_AWS_300: \"Ensure S3 lifecycle configuration sets period for aborting failed uploads\"\r\n\tFAILED for resource: aws_s3_bucket_lifecycle_configuration.bucket\r\n\tFile: s3.tf:1-1\r\n\r\n\t\t122 | resource \"aws_s3_bucket_lifecycle_configuration\" \"bucket\" {\r\n\t\t123 |   bucket = aws_s3_bucket.bucket.bucket\r\n\t\t124 | \r\n\t\t125 |   rule {\r\n\t\t126 |     id = \"id-1\"\r\n\t\t127 | \r\n\t\t128 |     abort_incomplete_multipart_upload {\r\n\t\t129 |       days_after_initiation = 1\r\n\t\t130 |     }\r\n\t\t131 | \r\n\t\t132 |     status = \"Enabled\"\r\n\t\t133 |   }\r\n\t\t134 | \r\n\t\t135 |   rule {\r\n\t\t136 |     id     = \"id-2\"\r\n\t\t137 |     status = \"Enabled\"\r\n\t\t138 | \r\n\t\t139 |     noncurrent_version_expiration {\r\n\t\t140 |       noncurrent_days = 1\r\n\t\t141 |     }\r\n\t\t142 |   }\r\n\t\t143 | }\r\n```\n", "before_files": [{"content": "from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\nfrom checkov.common.models.enums import CheckCategories, CheckResult\n\n\nclass S3AbortIncompleteUploads(BaseResourceCheck):\n    def __init__(self):\n        \"\"\"\n        If you don't set this value in a lifecycle configuration you'll end up paying for s3\n        resources you never could use\n        \"\"\"\n        name = \"Ensure S3 lifecycle configuration sets period for aborting failed uploads\"\n        id = \"CKV_AWS_300\"\n        supported_resources = ('aws_s3_bucket_lifecycle_configuration',)\n        categories = (CheckCategories.GENERAL_SECURITY,)\n        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf):\n        self.evaluated_keys = [\"rule\"]\n        rules = conf.get(\"rule\")\n        if rules and isinstance(rules, list):\n            for idx_rule, rule in enumerate(rules):\n                if not rule.get(\"abort_incomplete_multipart_upload\"):\n                    self.evaluated_keys = [f\"rule/[{idx_rule}]/\"]\n                    return CheckResult.FAILED\n            return CheckResult.PASSED\n        return CheckResult.FAILED\n\n\ncheck = S3AbortIncompleteUploads()\n", "path": "checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom typing import Any\n\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\nfrom checkov.common.models.enums import CheckCategories, CheckResult\n\n\nclass S3AbortIncompleteUploads(BaseResourceCheck):\n    def __init__(self) -> None:\n        \"\"\"\n        If you don't set this value in a lifecycle configuration you'll end up paying for s3\n        resources you never could use\n        \"\"\"\n        name = \"Ensure S3 lifecycle configuration sets period for aborting failed uploads\"\n        id = \"CKV_AWS_300\"\n        supported_resources = (\"aws_s3_bucket_lifecycle_configuration\",)\n        categories = (CheckCategories.GENERAL_SECURITY,)\n        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf: dict[str, list[Any]]) -> CheckResult:\n        self.evaluated_keys = [\"rule\"]\n        rules = conf.get(\"rule\")\n        if rules and isinstance(rules, list):\n            for idx_rule, rule in enumerate(rules):\n                if (\n                    rule.get(\"abort_incomplete_multipart_upload\")\n                    and rule.get(\"status\") == [\"Enabled\"]\n                    and not rule.get(\"filter\")\n                ):\n                    self.evaluated_keys = [f\"rule/[{idx_rule}]/abort_incomplete_multipart_upload\"]\n                    return CheckResult.PASSED\n\n        return CheckResult.FAILED\n\n\ncheck = S3AbortIncompleteUploads()\n", "path": "checkov/terraform/checks/resource/aws/S3AbortIncompleteUploads.py"}]}