prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Cloudformation NLB Listener Rules are incorrectly detected as ALB rules and fail the HTTPS expectation
  **Describe the bug**
  NLB listeners are evaluated as ALB listeners, and fail because they don't use HTTPS
  
  **To Reproduce**
  1. Create a Cloudformation template with NLB listeners (e.g. TCP)
  2. Run default tests
  3. Tests will fail with `"AWS::ElasticLoadBalancingV2::Listener.<listenername>\" failed in check \"Ensure ALB protocol is HTTPS\"
  
  **Expected behavior**
  NLB rules should pass. 
  
  **Screenshots**
  
  
  **Desktop (please complete the following information):**
   - OS: Ubuntu 20.04
   - Checkov Version: 1.0.423
  
  **Additional context**
  This resource:
  ```
      "ConsulDnsListener": {                                          
        "Type": "AWS::ElasticLoadBalancingV2::Listener",              
        "Properties": {                                               
          "DefaultActions": [                                         
            {                                                         
              "TargetGroupArn": {                                     
                "Ref": "ConsulDnsTargetGroup"                         
              },                                                      
              "Type": "forward"                                       
            }                                                         
          ],                                                          
          "LoadBalancerArn": {                                        
            "Ref": "LoadBalancerArn"                                  
          },                                                          
          "Port": 53,                                                 
          "Protocol": "TCP_UDP"                                       
        }                                                             
      },     
  ```
  Produces this error:
  ```
  {
    "type": "failure",
    "message": "Resource \"AWS::ElasticLoadBalancingV2::Listener.ConsulDnsListener\" failed in check \"Ensure ALB protocol is HTTPS\""
  }```
  
  </issue>
  <code>
  [start of checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py]
  1 from checkov.common.models.enums import CheckResult, CheckCategories
  2 from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
  3 
  4 class ALBListenerHTTPS(BaseResourceCheck):
  5 
  6     def __init__(self):
  7         name = "Ensure ALB protocol is HTTPS"
  8         id = "CKV_AWS_2"
  9         supported_resources = ['aws_lb_listener']
  10         categories = [CheckCategories.ENCRYPTION]
  11         super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
  12 
  13     def scan_resource_conf(self, conf):
  14         """
  15             validates kms rotation
  16             https://www.terraform.io/docs/providers/aws/r/lb_listener.html
  17         :param conf: aws_kms_key configuration
  18         :return: <CheckResult>
  19         """
  20         key = 'protocol'
  21         if key in conf.keys():
  22             if (
  23                 conf[key] == ["HTTPS"]
  24                 or
  25                 conf[key] == ["TLS"]
  26             ):
  27                 return CheckResult.PASSED
  28             elif conf[key] == ["HTTP"]:
  29                 if 'default_action' in conf.keys():
  30                     default_action = conf['default_action'][0]
  31                     action_type = default_action['type']
  32                     if action_type == ['redirect']:
  33                         if default_action['redirect'][0]['protocol'] == ['HTTPS']:
  34                             return CheckResult.PASSED
  35         return CheckResult.FAILED
  36 
  37 
  38 check = ALBListenerHTTPS()
  39
  [end of checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py]
  [start of checkov/cloudformation/checks/resource/aws/ALBListenerHTTPS.py]
  1 from checkov.common.models.enums import CheckResult, CheckCategories
  2 from checkov.cloudformation.checks.resource.base_resource_check import BaseResourceCheck
  3 
  4 class ALBListenerHTTPS(BaseResourceCheck):
  5 
  6     def __init__(self):
  7         name = "Ensure ALB protocol is HTTPS"
  8         id = "CKV_AWS_2"
  9         supported_resources = ['AWS::ElasticLoadBalancingV2::Listener']
  10         categories = [CheckCategories.ENCRYPTION]
  11         super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
  12 
  13     def scan_resource_conf(self, conf):
  14         """
  15             validates ALB protocol is HTTPS
  16             https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listener.html
  17         :param conf: aws_alb_listener configuration
  18         :return: <CheckResult>
  19         """
  20 
  21         if 'Properties' in conf.keys():
  22             if 'Protocol' in conf['Properties'].keys():
  23                 if conf['Properties']['Protocol'] in ('HTTPS', 'TLS'):
  24                     return CheckResult.PASSED
  25                 else:
  26                     if (
  27                         'DefaultActions' in conf['Properties'].keys()
  28                         and
  29                         conf['Properties']['DefaultActions'][0]['Type'] == 'redirect'
  30                         and
  31                         conf['Properties']['DefaultActions'][0]['RedirectConfig']['Protocol'] == "HTTPS"
  32                     ):
  33                         return CheckResult.PASSED
  34         return CheckResult.FAILED
  35 
  36 check = ALBListenerHTTPS()
  37
  [end of checkov/cloudformation/checks/resource/aws/ALBListenerHTTPS.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/cloudformation/checks/resource/aws/ALBListenerHTTPS.py b/checkov/cloudformation/checks/resource/aws/ALBListenerHTTPS.py
  --- a/checkov/cloudformation/checks/resource/aws/ALBListenerHTTPS.py
  +++ b/checkov/cloudformation/checks/resource/aws/ALBListenerHTTPS.py
  @@ -20,7 +20,7 @@
   
           if 'Properties' in conf.keys():
               if 'Protocol' in conf['Properties'].keys():
  -                if conf['Properties']['Protocol'] in ('HTTPS', 'TLS'):
  +                if conf['Properties']['Protocol'] in ('HTTPS', 'TLS', 'TCP', 'UDP', 'TCP_UDP'):
                       return CheckResult.PASSED
                   else:
                       if (
  diff --git a/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py b/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py
  --- a/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py
  +++ b/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py
  @@ -19,11 +19,7 @@
           """
           key = 'protocol'
           if key in conf.keys():
  -            if (
  -                conf[key] == ["HTTPS"]
  -                or
  -                conf[key] == ["TLS"]
  -            ):
  +            if conf[key] in (["HTTPS"], ["TLS"], ["TCP"], ["UDP"], ["TCP_UDP"]):
                   return CheckResult.PASSED
               elif conf[key] == ["HTTP"]:
                   if 'default_action' in conf.keys():
  
verification_info: {"golden_diff": "diff --git a/checkov/cloudformation/checks/resource/aws/ALBListenerHTTPS.py b/checkov/cloudformation/checks/resource/aws/ALBListenerHTTPS.py\n--- a/checkov/cloudformation/checks/resource/aws/ALBListenerHTTPS.py\n+++ b/checkov/cloudformation/checks/resource/aws/ALBListenerHTTPS.py\n@@ -20,7 +20,7 @@\n \n         if 'Properties' in conf.keys():\n             if 'Protocol' in conf['Properties'].keys():\n-                if conf['Properties']['Protocol'] in ('HTTPS', 'TLS'):\n+                if conf['Properties']['Protocol'] in ('HTTPS', 'TLS', 'TCP', 'UDP', 'TCP_UDP'):\n                     return CheckResult.PASSED\n                 else:\n                     if (\ndiff --git a/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py b/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py\n--- a/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py\n+++ b/checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py\n@@ -19,11 +19,7 @@\n         \"\"\"\n         key = 'protocol'\n         if key in conf.keys():\n-            if (\n-                conf[key] == [\"HTTPS\"]\n-                or\n-                conf[key] == [\"TLS\"]\n-            ):\n+            if conf[key] in ([\"HTTPS\"], [\"TLS\"], [\"TCP\"], [\"UDP\"], [\"TCP_UDP\"]):\n                 return CheckResult.PASSED\n             elif conf[key] == [\"HTTP\"]:\n                 if 'default_action' in conf.keys():\n", "issue": "Cloudformation NLB Listener Rules are incorrectly detected as ALB rules and fail the HTTPS expectation\n**Describe the bug**\r\nNLB listeners are evaluated as ALB listeners, and fail because they don't use HTTPS\r\n\r\n**To Reproduce**\r\n1. Create a Cloudformation template with NLB listeners (e.g. TCP)\r\n2. Run default tests\r\n3. Tests will fail with `\"AWS::ElasticLoadBalancingV2::Listener.<listenername>\\\" failed in check \\\"Ensure ALB protocol is HTTPS\\\"\r\n\r\n**Expected behavior**\r\nNLB rules should pass. \r\n\r\n**Screenshots**\r\n\r\n\r\n**Desktop (please complete the following information):**\r\n - OS: Ubuntu 20.04\r\n - Checkov Version: 1.0.423\r\n\r\n**Additional context**\r\nThis resource:\r\n```\r\n    \"ConsulDnsListener\": {                                          \r\n      \"Type\": \"AWS::ElasticLoadBalancingV2::Listener\",              \r\n      \"Properties\": {                                               \r\n        \"DefaultActions\": [                                         \r\n          {                                                         \r\n            \"TargetGroupArn\": {                                     \r\n              \"Ref\": \"ConsulDnsTargetGroup\"                         \r\n            },                                                      \r\n            \"Type\": \"forward\"                                       \r\n          }                                                         \r\n        ],                                                          \r\n        \"LoadBalancerArn\": {                                        \r\n          \"Ref\": \"LoadBalancerArn\"                                  \r\n        },                                                          \r\n        \"Port\": 53,                                                 \r\n        \"Protocol\": \"TCP_UDP\"                                       \r\n      }                                                             \r\n    },     \r\n```\r\nProduces this error:\r\n```\r\n{\r\n  \"type\": \"failure\",\r\n  \"message\": \"Resource \\\"AWS::ElasticLoadBalancingV2::Listener.ConsulDnsListener\\\" failed in check \\\"Ensure ALB protocol is HTTPS\\\"\"\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\nclass ALBListenerHTTPS(BaseResourceCheck):\n\n    def __init__(self):\n        name = \"Ensure ALB protocol is HTTPS\"\n        id = \"CKV_AWS_2\"\n        supported_resources = ['aws_lb_listener']\n        categories = [CheckCategories.ENCRYPTION]\n        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf):\n        \"\"\"\n            validates kms rotation\n            https://www.terraform.io/docs/providers/aws/r/lb_listener.html\n        :param conf: aws_kms_key configuration\n        :return: <CheckResult>\n        \"\"\"\n        key = 'protocol'\n        if key in conf.keys():\n            if (\n                conf[key] == [\"HTTPS\"]\n                or\n                conf[key] == [\"TLS\"]\n            ):\n                return CheckResult.PASSED\n            elif conf[key] == [\"HTTP\"]:\n                if 'default_action' in conf.keys():\n                    default_action = conf['default_action'][0]\n                    action_type = default_action['type']\n                    if action_type == ['redirect']:\n                        if default_action['redirect'][0]['protocol'] == ['HTTPS']:\n                            return CheckResult.PASSED\n        return CheckResult.FAILED\n\n\ncheck = ALBListenerHTTPS()\n", "path": "checkov/terraform/checks/resource/aws/ALBListenerHTTPS.py"}, {"content": "from checkov.common.models.enums import CheckResult, CheckCategories\nfrom checkov.cloudformation.checks.resource.base_resource_check import BaseResourceCheck\n\nclass ALBListenerHTTPS(BaseResourceCheck):\n\n    def __init__(self):\n        name = \"Ensure ALB protocol is HTTPS\"\n        id = \"CKV_AWS_2\"\n        supported_resources = ['AWS::ElasticLoadBalancingV2::Listener']\n        categories = [CheckCategories.ENCRYPTION]\n        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf):\n        \"\"\"\n            validates ALB protocol is HTTPS\n            https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listener.html\n        :param conf: aws_alb_listener configuration\n        :return: <CheckResult>\n        \"\"\"\n\n        if 'Properties' in conf.keys():\n            if 'Protocol' in conf['Properties'].keys():\n                if conf['Properties']['Protocol'] in ('HTTPS', 'TLS'):\n                    return CheckResult.PASSED\n                else:\n                    if (\n                        'DefaultActions' in conf['Properties'].keys()\n                        and\n                        conf['Properties']['DefaultActions'][0]['Type'] == 'redirect'\n                        and\n                        conf['Properties']['DefaultActions'][0]['RedirectConfig']['Protocol'] == \"HTTPS\"\n                    ):\n                        return CheckResult.PASSED\n        return CheckResult.FAILED\n\ncheck = ALBListenerHTTPS()\n", "path": "checkov/cloudformation/checks/resource/aws/ALBListenerHTTPS.py"}]}