We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Checkov failing to perform a check against a Terraform Plan when skipping a specific AWS check
**Describe the issue**
Checkov failing to perform a check against a Terraform Plan when skipping a specific AWS check

**Examples**
```
resource "aws_iam_role" "backend" {
  #checkov:skip=CKV_AWS_274:TODO Generate a policy from CloudTrail later
  name                = "${var.repo}-foo"
  assume_role_policy  = data.aws_iam_policy_document.backend-assume.json
  managed_policy_arns = ["arn:aws:iam::aws:policy/AdministratorAccess"]
  inline_policy {
    name   = "foo"
    policy = data.aws_iam_policy_document.backend-permissions.json
  }
  tags = {
    component = var.foo
  }
}
```

**Exception Trace**
```
Traceback (most recent call last):
  File "/usr/local/bin/checkov", line 9, in <module>
    sys.exit(run())
  File "/usr/local/lib/python3.9/site-packages/checkov/main.py", line 355, in run
    scan_reports = runner_registry.run(external_checks_dir=external_checks_dir, files=config.file,
  File "/usr/local/lib/python3.9/site-packages/checkov/common/runners/runner_registry.py", line 79, in run
    self.runners[0].run(root_folder, external_checks_dir=external_checks_dir, files=files,
  File "/usr/local/lib/python3.9/site-packages/checkov/terraform/plan_runner.py", line 81, in run
    self.check_tf_definition(report, root_folder, runner_filter)
  File "/usr/local/lib/python3.9/site-packages/checkov/terraform/plan_runner.py", line 99, in check_tf_definition
    self.run_block(definition[block_type], None, full_file_path, root_folder, report, scanned_file,
  File "/usr/local/lib/python3.9/site-packages/checkov/terraform/plan_runner.py", line 119, in run_block
    results = registry.scan(scanned_file, entity, [], runner_filter, report_type=CheckType.TERRAFORM_PLAN)
  File "/usr/local/lib/python3.9/site-packages/checkov/common/checks/base_check_registry.py", line 127, in scan
    result = self.run_check(check, entity_configuration, entity_name, entity_type, scanned_file, skip_info)
  File "/usr/local/lib/python3.9/site-packages/checkov/common/checks/base_check_registry.py", line 141, in run_check
    result = check.run(
  File "/usr/local/lib/python3.9/site-packages/checkov/common/checks/base_check.py", line 70, in run
    check_result["result"] = self.scan_entity_conf(entity_configuration, entity_type)
  File "/usr/local/lib/python3.9/site-packages/checkov/terraform/checks/resource/base_resource_check.py", line 43, in scan_entity_conf
    return self.scan_resource_conf(conf)
  File "/usr/local/lib/python3.9/site-packages/checkov/terraform/checks/resource/aws/IAMManagedAdminPolicy.py", line 42, in scan_resource_conf
    if conf.get("policy_arn")[0] == ADMIN_POLICY_ARN:
TypeError: 'NoneType' object is not subscriptable
```

**Desktop (please complete the following information):**
 - MacOS 11.7
 - Checkov Version 2.2.0

**Additional context**
This fails as of whateverv version CKV_AWS_274 was added. Last time a build didn't crash I was using 2.1.294 and it worked.
Also if I skip it with a command-line switch then this crash does not happen (which is going to be my temp workaround)


--- 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/IAMManagedAdminPolicy.py`
Content:
```
1 from checkov.common.models.enums import CheckResult, CheckCategories
2 from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
3 
4 
5 ADMIN_POLICY_NAME = "AdministratorAccess"
6 ADMIN_POLICY_ARN = f"arn:aws:iam::aws:policy/{ADMIN_POLICY_NAME}"
7 
8 
9 class IAMManagedAdminPolicy(BaseResourceCheck):
10     def __init__(self):
11         # This is the full description of your check
12         description = "Disallow IAM roles, users, and groups from using the AWS AdministratorAccess policy"
13 
14         # This is the Unique ID for your check
15         id = "CKV_AWS_274"
16 
17         # These are the terraform objects supported by this check (ex: aws_iam_policy_document)
18         supported_resources = (
19             "aws_iam_role",
20             "aws_iam_policy_attachment",
21             "aws_iam_role_policy_attachment",
22             "aws_iam_user_policy_attachment",
23             "aws_iam_group_policy_attachment",
24         )
25 
26         # Valid CheckCategories are defined in checkov/common/models/enums.py
27         categories = (CheckCategories.IAM,)
28         super().__init__(name=description, id=id, categories=categories, supported_resources=supported_resources)
29 
30     def scan_resource_conf(self, conf):
31         if self.entity_type == "aws_iam_role":
32             if "managed_policy_arns" in conf.keys():
33                 if ADMIN_POLICY_ARN in conf.get("managed_policy_arns")[0]:
34                     return CheckResult.FAILED
35 
36         elif self.entity_type in (
37             "aws_iam_policy_attachment",
38             "aws_iam_role_policy_attachment",
39             "aws_iam_user_policy_attachment",
40             "aws_iam_group_policy_attachment",
41         ):
42             if conf.get("policy_arn")[0] == ADMIN_POLICY_ARN:
43                 return CheckResult.FAILED
44 
45         return CheckResult.PASSED
46 
47 
48 check = IAMManagedAdminPolicy()
```
--- 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()

```

diff --git a/checkov/terraform/checks/resource/aws/IAMManagedAdminPolicy.py b/checkov/terraform/checks/resource/aws/IAMManagedAdminPolicy.py
--- a/checkov/terraform/checks/resource/aws/IAMManagedAdminPolicy.py
+++ b/checkov/terraform/checks/resource/aws/IAMManagedAdminPolicy.py
@@ -1,3 +1,7 @@
+from __future__ import annotations
+
+from typing import Any
+
 from checkov.common.models.enums import CheckResult, CheckCategories
 from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
 
@@ -7,7 +11,7 @@
 
 
 class IAMManagedAdminPolicy(BaseResourceCheck):
-    def __init__(self):
+    def __init__(self) -> None:
         # This is the full description of your check
         description = "Disallow IAM roles, users, and groups from using the AWS AdministratorAccess policy"
 
@@ -27,10 +31,10 @@
         categories = (CheckCategories.IAM,)
         super().__init__(name=description, 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:
         if self.entity_type == "aws_iam_role":
             if "managed_policy_arns" in conf.keys():
-                if ADMIN_POLICY_ARN in conf.get("managed_policy_arns")[0]:
+                if ADMIN_POLICY_ARN in conf["managed_policy_arns"][0]:
                     return CheckResult.FAILED
 
         elif self.entity_type in (
@@ -39,10 +43,11 @@
             "aws_iam_user_policy_attachment",
             "aws_iam_group_policy_attachment",
         ):
-            if conf.get("policy_arn")[0] == ADMIN_POLICY_ARN:
+            policy_arn = conf.get("policy_arn")
+            if policy_arn and policy_arn[0] == ADMIN_POLICY_ARN:
                 return CheckResult.FAILED
 
         return CheckResult.PASSED
 
 
-check = IAMManagedAdminPolicy()
\ No newline at end of file
+check = IAMManagedAdminPolicy()

{"golden_diff": "diff --git a/checkov/terraform/checks/resource/aws/IAMManagedAdminPolicy.py b/checkov/terraform/checks/resource/aws/IAMManagedAdminPolicy.py\n--- a/checkov/terraform/checks/resource/aws/IAMManagedAdminPolicy.py\n+++ b/checkov/terraform/checks/resource/aws/IAMManagedAdminPolicy.py\n@@ -1,3 +1,7 @@\n+from __future__ import annotations\n+\n+from typing import Any\n+\n from checkov.common.models.enums import CheckResult, CheckCategories\n from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n \n@@ -7,7 +11,7 @@\n \n \n class IAMManagedAdminPolicy(BaseResourceCheck):\n-    def __init__(self):\n+    def __init__(self) -> None:\n         # This is the full description of your check\n         description = \"Disallow IAM roles, users, and groups from using the AWS AdministratorAccess policy\"\n \n@@ -27,10 +31,10 @@\n         categories = (CheckCategories.IAM,)\n         super().__init__(name=description, 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         if self.entity_type == \"aws_iam_role\":\n             if \"managed_policy_arns\" in conf.keys():\n-                if ADMIN_POLICY_ARN in conf.get(\"managed_policy_arns\")[0]:\n+                if ADMIN_POLICY_ARN in conf[\"managed_policy_arns\"][0]:\n                     return CheckResult.FAILED\n \n         elif self.entity_type in (\n@@ -39,10 +43,11 @@\n             \"aws_iam_user_policy_attachment\",\n             \"aws_iam_group_policy_attachment\",\n         ):\n-            if conf.get(\"policy_arn\")[0] == ADMIN_POLICY_ARN:\n+            policy_arn = conf.get(\"policy_arn\")\n+            if policy_arn and policy_arn[0] == ADMIN_POLICY_ARN:\n                 return CheckResult.FAILED\n \n         return CheckResult.PASSED\n \n \n-check = IAMManagedAdminPolicy()\n\\ No newline at end of file\n+check = IAMManagedAdminPolicy()\n", "issue": "Checkov failing to perform a check against a Terraform Plan when skipping a specific AWS check\n**Describe the issue**\r\nCheckov failing to perform a check against a Terraform Plan when skipping a specific AWS check\r\n\r\n**Examples**\r\n```\r\nresource \"aws_iam_role\" \"backend\" {\r\n  #checkov:skip=CKV_AWS_274:TODO Generate a policy from CloudTrail later\r\n  name                = \"${var.repo}-foo\"\r\n  assume_role_policy  = data.aws_iam_policy_document.backend-assume.json\r\n  managed_policy_arns = [\"arn:aws:iam::aws:policy/AdministratorAccess\"]\r\n  inline_policy {\r\n    name   = \"foo\"\r\n    policy = data.aws_iam_policy_document.backend-permissions.json\r\n  }\r\n  tags = {\r\n    component = var.foo\r\n  }\r\n}\r\n```\r\n\r\n**Exception Trace**\r\n```\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/checkov\", line 9, in <module>\r\n    sys.exit(run())\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/main.py\", line 355, in run\r\n    scan_reports = runner_registry.run(external_checks_dir=external_checks_dir, files=config.file,\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/common/runners/runner_registry.py\", line 79, in run\r\n    self.runners[0].run(root_folder, external_checks_dir=external_checks_dir, files=files,\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/terraform/plan_runner.py\", line 81, in run\r\n    self.check_tf_definition(report, root_folder, runner_filter)\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/terraform/plan_runner.py\", line 99, in check_tf_definition\r\n    self.run_block(definition[block_type], None, full_file_path, root_folder, report, scanned_file,\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/terraform/plan_runner.py\", line 119, in run_block\r\n    results = registry.scan(scanned_file, entity, [], runner_filter, report_type=CheckType.TERRAFORM_PLAN)\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/common/checks/base_check_registry.py\", line 127, in scan\r\n    result = self.run_check(check, entity_configuration, entity_name, entity_type, scanned_file, skip_info)\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/common/checks/base_check_registry.py\", line 141, in run_check\r\n    result = check.run(\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/common/checks/base_check.py\", line 70, in run\r\n    check_result[\"result\"] = self.scan_entity_conf(entity_configuration, entity_type)\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/terraform/checks/resource/base_resource_check.py\", line 43, in scan_entity_conf\r\n    return self.scan_resource_conf(conf)\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/terraform/checks/resource/aws/IAMManagedAdminPolicy.py\", line 42, in scan_resource_conf\r\n    if conf.get(\"policy_arn\")[0] == ADMIN_POLICY_ARN:\r\nTypeError: 'NoneType' object is not subscriptable\r\n```\r\n\r\n**Desktop (please complete the following information):**\r\n - MacOS 11.7\r\n - Checkov Version 2.2.0\r\n\r\n**Additional context**\r\nThis fails as of whateverv version CKV_AWS_274 was added. Last time a build didn't crash I was using 2.1.294 and it worked.\r\nAlso if I skip it with a command-line switch then this crash does not happen (which is going to be my temp workaround)\r\n\n", "before_files": [{"content": "from checkov.common.models.enums import CheckResult, CheckCategories\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n\n\nADMIN_POLICY_NAME = \"AdministratorAccess\"\nADMIN_POLICY_ARN = f\"arn:aws:iam::aws:policy/{ADMIN_POLICY_NAME}\"\n\n\nclass IAMManagedAdminPolicy(BaseResourceCheck):\n    def __init__(self):\n        # This is the full description of your check\n        description = \"Disallow IAM roles, users, and groups from using the AWS AdministratorAccess policy\"\n\n        # This is the Unique ID for your check\n        id = \"CKV_AWS_274\"\n\n        # These are the terraform objects supported by this check (ex: aws_iam_policy_document)\n        supported_resources = (\n            \"aws_iam_role\",\n            \"aws_iam_policy_attachment\",\n            \"aws_iam_role_policy_attachment\",\n            \"aws_iam_user_policy_attachment\",\n            \"aws_iam_group_policy_attachment\",\n        )\n\n        # Valid CheckCategories are defined in checkov/common/models/enums.py\n        categories = (CheckCategories.IAM,)\n        super().__init__(name=description, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf):\n        if self.entity_type == \"aws_iam_role\":\n            if \"managed_policy_arns\" in conf.keys():\n                if ADMIN_POLICY_ARN in conf.get(\"managed_policy_arns\")[0]:\n                    return CheckResult.FAILED\n\n        elif self.entity_type in (\n            \"aws_iam_policy_attachment\",\n            \"aws_iam_role_policy_attachment\",\n            \"aws_iam_user_policy_attachment\",\n            \"aws_iam_group_policy_attachment\",\n        ):\n            if conf.get(\"policy_arn\")[0] == ADMIN_POLICY_ARN:\n                return CheckResult.FAILED\n\n        return CheckResult.PASSED\n\n\ncheck = IAMManagedAdminPolicy()", "path": "checkov/terraform/checks/resource/aws/IAMManagedAdminPolicy.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom typing import Any\n\nfrom checkov.common.models.enums import CheckResult, CheckCategories\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n\n\nADMIN_POLICY_NAME = \"AdministratorAccess\"\nADMIN_POLICY_ARN = f\"arn:aws:iam::aws:policy/{ADMIN_POLICY_NAME}\"\n\n\nclass IAMManagedAdminPolicy(BaseResourceCheck):\n    def __init__(self) -> None:\n        # This is the full description of your check\n        description = \"Disallow IAM roles, users, and groups from using the AWS AdministratorAccess policy\"\n\n        # This is the Unique ID for your check\n        id = \"CKV_AWS_274\"\n\n        # These are the terraform objects supported by this check (ex: aws_iam_policy_document)\n        supported_resources = (\n            \"aws_iam_role\",\n            \"aws_iam_policy_attachment\",\n            \"aws_iam_role_policy_attachment\",\n            \"aws_iam_user_policy_attachment\",\n            \"aws_iam_group_policy_attachment\",\n        )\n\n        # Valid CheckCategories are defined in checkov/common/models/enums.py\n        categories = (CheckCategories.IAM,)\n        super().__init__(name=description, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf: dict[str, list[Any]]) -> CheckResult:\n        if self.entity_type == \"aws_iam_role\":\n            if \"managed_policy_arns\" in conf.keys():\n                if ADMIN_POLICY_ARN in conf[\"managed_policy_arns\"][0]:\n                    return CheckResult.FAILED\n\n        elif self.entity_type in (\n            \"aws_iam_policy_attachment\",\n            \"aws_iam_role_policy_attachment\",\n            \"aws_iam_user_policy_attachment\",\n            \"aws_iam_group_policy_attachment\",\n        ):\n            policy_arn = conf.get(\"policy_arn\")\n            if policy_arn and policy_arn[0] == ADMIN_POLICY_ARN:\n                return CheckResult.FAILED\n\n        return CheckResult.PASSED\n\n\ncheck = IAMManagedAdminPolicy()\n", "path": "checkov/terraform/checks/resource/aws/IAMManagedAdminPolicy.py"}]}