We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
CKV_AWS_103 - Mentioned Checkov Checks producing an Exception, when the Listener protocol is HTTP (ALB).
Background of the Issue :  

We have been using mentioned Checkov inbuilt checks/policy ID (CKV_AWS_103/ BC_AWS_GENERAL_43) for connection requests in AWS Load balancer.  it was working fine when application team using the Module, "aws_lb_listener" "redirect" will only enable when application team users "HTTPS" Protocol. The particular issue is being presented when we attempt "HTTP" Protocol (Development Environment)

Sample Module snippet (AWS Load Balancer Listener ) (Re-direct Action) :- 

resource "aws_lb_listener" "redirect_http_listeneter" {
load_balancer_arn = aws_lb.front_end.arn
port = "80"
protocol = "HTTP" 
}

default action {
   type = "redirect"

redirect {
  port =  "443"
  }
}
}

ISSUE :- 
Exception Occur :- [If application team used the protocol HTTP]   

Exception message sample 
"[MainThread][ERROR] Failed to run check: Ensure the load balancer is using TLS1.2 for configuration:{'alpn_policy':[None],'arn':['arn:aws:elasticloadbalancing:**********:listener/app/dev-opsmanager-ec2-alb/******/*****],'certicate_arn':[None], 'default_action':

In bridgecrewio github,  [ checkov/terraform/checks/resource/aws/AppLoadBalancerTLS12.py ]
supports only HTTPS and it not producing any proper results, if we application team using HTTP.  So require your support to tweak globally in the in-built check ID. 

checkov version : 2.0.704

kindly let me know any other additional inputs require from our end.







--- 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/AppLoadBalancerTLS12.py`
Content:
```
1 from checkov.common.models.enums import CheckResult, CheckCategories
2 from checkov.common.util.type_forcers import force_list
3 from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
4 
5 
6 class AppLoadBalancerTLS12(BaseResourceCheck):
7     def __init__(self):
8         name = "Ensure that load balancer is using TLS 1.2"
9         id = "CKV_AWS_103"
10         supported_resources = ["aws_lb_listener", "aws_alb_listener"]
11         categories = [CheckCategories.GENERAL_SECURITY]
12         super().__init__(
13             name=name,
14             id=id,
15             categories=categories,
16             supported_resources=supported_resources,
17         )
18 
19     def scan_resource_conf(self, conf):
20         key = "protocol"
21         self.evaluated_keys = [key]
22         if key in conf.keys():
23             if conf[key] in (["HTTPS"], ["TLS"]):
24                 # Only interested in HTTPS & TLS listeners
25                 policy = "ssl_policy"
26                 if policy in conf.keys():
27                     self.evaluated_keys.append(policy)
28                     name = str(conf[policy]).strip("['']")
29                     if name.startswith("ELBSecurityPolicy-FS-1-2") or name.startswith("ELBSecurityPolicy-TLS-1-2"):
30                         return CheckResult.PASSED
31                 return CheckResult.FAILED
32             elif conf[key] in (["TCP"], ["UDP"], ["TCP_UDP"]):
33                 return CheckResult.PASSED
34             for idx_action, action in enumerate(conf.get("default_action", [])):
35                 redirects = action.get("redirect", [])
36                 for idx_redirect, redirect in enumerate(force_list(redirects)):
37                     if redirect.get("protocol", []) == ["HTTPS"]:
38                         redirect_index = f"[{idx_redirect}]/" if isinstance(redirects, list) else ""
39                         self.evaluated_keys.append(f'default_action/[{idx_action}]/redirect/{redirect_index}protocol')
40                         return CheckResult.PASSED
41         return CheckResult.FAILED
42 
43 
44 check = AppLoadBalancerTLS12()
45
```
--- 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/AppLoadBalancerTLS12.py b/checkov/terraform/checks/resource/aws/AppLoadBalancerTLS12.py
--- a/checkov/terraform/checks/resource/aws/AppLoadBalancerTLS12.py
+++ b/checkov/terraform/checks/resource/aws/AppLoadBalancerTLS12.py
@@ -1,14 +1,16 @@
+from typing import Dict, List, Any
+
 from checkov.common.models.enums import CheckResult, CheckCategories
 from checkov.common.util.type_forcers import force_list
 from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
 
 
 class AppLoadBalancerTLS12(BaseResourceCheck):
-    def __init__(self):
+    def __init__(self) -> None:
         name = "Ensure that load balancer is using TLS 1.2"
         id = "CKV_AWS_103"
-        supported_resources = ["aws_lb_listener", "aws_alb_listener"]
-        categories = [CheckCategories.GENERAL_SECURITY]
+        supported_resources = ("aws_lb_listener", "aws_alb_listener")
+        categories = (CheckCategories.GENERAL_SECURITY,)
         super().__init__(
             name=name,
             id=id,
@@ -16,7 +18,7 @@
             supported_resources=supported_resources,
         )
 
-    def scan_resource_conf(self, conf):
+    def scan_resource_conf(self, conf: Dict[str, List[Any]]) -> CheckResult:
         key = "protocol"
         self.evaluated_keys = [key]
         if key in conf.keys():
@@ -34,7 +36,7 @@
             for idx_action, action in enumerate(conf.get("default_action", [])):
                 redirects = action.get("redirect", [])
                 for idx_redirect, redirect in enumerate(force_list(redirects)):
-                    if redirect.get("protocol", []) == ["HTTPS"]:
+                    if isinstance(redirect, dict) and redirect.get("protocol", []) == ["HTTPS"]:
                         redirect_index = f"[{idx_redirect}]/" if isinstance(redirects, list) else ""
                         self.evaluated_keys.append(f'default_action/[{idx_action}]/redirect/{redirect_index}protocol')
                         return CheckResult.PASSED

{"golden_diff": "diff --git a/checkov/terraform/checks/resource/aws/AppLoadBalancerTLS12.py b/checkov/terraform/checks/resource/aws/AppLoadBalancerTLS12.py\n--- a/checkov/terraform/checks/resource/aws/AppLoadBalancerTLS12.py\n+++ b/checkov/terraform/checks/resource/aws/AppLoadBalancerTLS12.py\n@@ -1,14 +1,16 @@\n+from typing import Dict, List, Any\n+\n from checkov.common.models.enums import CheckResult, CheckCategories\n from checkov.common.util.type_forcers import force_list\n from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n \n \n class AppLoadBalancerTLS12(BaseResourceCheck):\n-    def __init__(self):\n+    def __init__(self) -> None:\n         name = \"Ensure that load balancer is using TLS 1.2\"\n         id = \"CKV_AWS_103\"\n-        supported_resources = [\"aws_lb_listener\", \"aws_alb_listener\"]\n-        categories = [CheckCategories.GENERAL_SECURITY]\n+        supported_resources = (\"aws_lb_listener\", \"aws_alb_listener\")\n+        categories = (CheckCategories.GENERAL_SECURITY,)\n         super().__init__(\n             name=name,\n             id=id,\n@@ -16,7 +18,7 @@\n             supported_resources=supported_resources,\n         )\n \n-    def scan_resource_conf(self, conf):\n+    def scan_resource_conf(self, conf: Dict[str, List[Any]]) -> CheckResult:\n         key = \"protocol\"\n         self.evaluated_keys = [key]\n         if key in conf.keys():\n@@ -34,7 +36,7 @@\n             for idx_action, action in enumerate(conf.get(\"default_action\", [])):\n                 redirects = action.get(\"redirect\", [])\n                 for idx_redirect, redirect in enumerate(force_list(redirects)):\n-                    if redirect.get(\"protocol\", []) == [\"HTTPS\"]:\n+                    if isinstance(redirect, dict) and redirect.get(\"protocol\", []) == [\"HTTPS\"]:\n                         redirect_index = f\"[{idx_redirect}]/\" if isinstance(redirects, list) else \"\"\n                         self.evaluated_keys.append(f'default_action/[{idx_action}]/redirect/{redirect_index}protocol')\n                         return CheckResult.PASSED\n", "issue": "CKV_AWS_103 - Mentioned Checkov Checks producing an Exception, when the Listener protocol is HTTP (ALB).\nBackground of the Issue :  \r\n\r\nWe have been using mentioned Checkov inbuilt checks/policy ID (CKV_AWS_103/ BC_AWS_GENERAL_43) for connection requests in AWS Load balancer.  it was working fine when application team using the Module, \"aws_lb_listener\" \"redirect\" will only enable when application team users \"HTTPS\" Protocol. The particular issue is being presented when we attempt \"HTTP\" Protocol (Development Environment)\r\n\r\nSample Module snippet (AWS Load Balancer Listener ) (Re-direct Action) :- \r\n\r\nresource \"aws_lb_listener\" \"redirect_http_listeneter\" {\r\nload_balancer_arn = aws_lb.front_end.arn\r\nport = \"80\"\r\nprotocol = \"HTTP\" \r\n}\r\n\r\ndefault action {\r\n   type = \"redirect\"\r\n\r\nredirect {\r\n  port =  \"443\"\r\n  }\r\n}\r\n}\r\n\r\nISSUE :- \r\nException Occur :- [If application team used the protocol HTTP]   \r\n\r\nException message sample \r\n\"[MainThread][ERROR] Failed to run check: Ensure the load balancer is using TLS1.2 for configuration:{'alpn_policy':[None],'arn':['arn:aws:elasticloadbalancing:**********:listener/app/dev-opsmanager-ec2-alb/******/*****],'certicate_arn':[None], 'default_action':\r\n\r\nIn bridgecrewio github,  [ checkov/terraform/checks/resource/aws/AppLoadBalancerTLS12.py ]\r\nsupports only HTTPS and it not producing any proper results, if we application team using HTTP.  So require your support to tweak globally in the in-built check ID. \r\n\r\ncheckov version : 2.0.704\r\n\r\nkindly let me know any other additional inputs require from our end.\r\n\r\n\r\n\r\n\r\n\r\n\n", "before_files": [{"content": "from checkov.common.models.enums import CheckResult, CheckCategories\nfrom checkov.common.util.type_forcers import force_list\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n\n\nclass AppLoadBalancerTLS12(BaseResourceCheck):\n    def __init__(self):\n        name = \"Ensure that load balancer is using TLS 1.2\"\n        id = \"CKV_AWS_103\"\n        supported_resources = [\"aws_lb_listener\", \"aws_alb_listener\"]\n        categories = [CheckCategories.GENERAL_SECURITY]\n        super().__init__(\n            name=name,\n            id=id,\n            categories=categories,\n            supported_resources=supported_resources,\n        )\n\n    def scan_resource_conf(self, conf):\n        key = \"protocol\"\n        self.evaluated_keys = [key]\n        if key in conf.keys():\n            if conf[key] in ([\"HTTPS\"], [\"TLS\"]):\n                # Only interested in HTTPS & TLS listeners\n                policy = \"ssl_policy\"\n                if policy in conf.keys():\n                    self.evaluated_keys.append(policy)\n                    name = str(conf[policy]).strip(\"['']\")\n                    if name.startswith(\"ELBSecurityPolicy-FS-1-2\") or name.startswith(\"ELBSecurityPolicy-TLS-1-2\"):\n                        return CheckResult.PASSED\n                return CheckResult.FAILED\n            elif conf[key] in ([\"TCP\"], [\"UDP\"], [\"TCP_UDP\"]):\n                return CheckResult.PASSED\n            for idx_action, action in enumerate(conf.get(\"default_action\", [])):\n                redirects = action.get(\"redirect\", [])\n                for idx_redirect, redirect in enumerate(force_list(redirects)):\n                    if redirect.get(\"protocol\", []) == [\"HTTPS\"]:\n                        redirect_index = f\"[{idx_redirect}]/\" if isinstance(redirects, list) else \"\"\n                        self.evaluated_keys.append(f'default_action/[{idx_action}]/redirect/{redirect_index}protocol')\n                        return CheckResult.PASSED\n        return CheckResult.FAILED\n\n\ncheck = AppLoadBalancerTLS12()\n", "path": "checkov/terraform/checks/resource/aws/AppLoadBalancerTLS12.py"}], "after_files": [{"content": "from typing import Dict, List, Any\n\nfrom checkov.common.models.enums import CheckResult, CheckCategories\nfrom checkov.common.util.type_forcers import force_list\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n\n\nclass AppLoadBalancerTLS12(BaseResourceCheck):\n    def __init__(self) -> None:\n        name = \"Ensure that load balancer is using TLS 1.2\"\n        id = \"CKV_AWS_103\"\n        supported_resources = (\"aws_lb_listener\", \"aws_alb_listener\")\n        categories = (CheckCategories.GENERAL_SECURITY,)\n        super().__init__(\n            name=name,\n            id=id,\n            categories=categories,\n            supported_resources=supported_resources,\n        )\n\n    def scan_resource_conf(self, conf: Dict[str, List[Any]]) -> CheckResult:\n        key = \"protocol\"\n        self.evaluated_keys = [key]\n        if key in conf.keys():\n            if conf[key] in ([\"HTTPS\"], [\"TLS\"]):\n                # Only interested in HTTPS & TLS listeners\n                policy = \"ssl_policy\"\n                if policy in conf.keys():\n                    self.evaluated_keys.append(policy)\n                    name = str(conf[policy]).strip(\"['']\")\n                    if name.startswith(\"ELBSecurityPolicy-FS-1-2\") or name.startswith(\"ELBSecurityPolicy-TLS-1-2\"):\n                        return CheckResult.PASSED\n                return CheckResult.FAILED\n            elif conf[key] in ([\"TCP\"], [\"UDP\"], [\"TCP_UDP\"]):\n                return CheckResult.PASSED\n            for idx_action, action in enumerate(conf.get(\"default_action\", [])):\n                redirects = action.get(\"redirect\", [])\n                for idx_redirect, redirect in enumerate(force_list(redirects)):\n                    if isinstance(redirect, dict) and redirect.get(\"protocol\", []) == [\"HTTPS\"]:\n                        redirect_index = f\"[{idx_redirect}]/\" if isinstance(redirects, list) else \"\"\n                        self.evaluated_keys.append(f'default_action/[{idx_action}]/redirect/{redirect_index}protocol')\n                        return CheckResult.PASSED\n        return CheckResult.FAILED\n\n\ncheck = AppLoadBalancerTLS12()\n", "path": "checkov/terraform/checks/resource/aws/AppLoadBalancerTLS12.py"}]}