prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <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.
  
  
  
  
  
  
  
  </issue>
  <code>
  [start of checkov/terraform/checks/resource/aws/AppLoadBalancerTLS12.py]
  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 of checkov/terraform/checks/resource/aws/AppLoadBalancerTLS12.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: 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
  
verification_info: {"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"}]}