prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Don't hardcode all for AvailabilityZones not relevant for AWS::ElasticLoadBalancingV2::TargetGroup
  Hello, 
  
  *cfn-lint version: 0.19.1*
  
  *Description of issue.*
  
  The following snippet : 
  
  ```
  Resources:
    DefaultTargetGroup:
      Type: "AWS::ElasticLoadBalancingV2::TargetGroup"
      Properties:
        VpcId: hello
        Port: 80
        Protocol: HTTP
        HealthCheckIntervalSeconds: 30
        HealthCheckPath: "/"
        HealthCheckPort: "80"
        HealthCheckProtocol: "HTTP"
        HealthCheckTimeoutSeconds: 5
        HealthyThresholdCount: 5
        TargetType: ip
        Targets:
          - 
            Id: "10.31.33.28"
            AvailabilityZone: all
        Matcher:
          HttpCode: "200"
        TargetGroupAttributes:
          - Key: deregistration_delay.timeout_seconds
            Value: "20"
  ```
  
  Triggers this warn message : 
  
  > W3010 Don't hardcode all for AvailabilityZones 
  
  In the case of AWS::ElasticLoadBalancingV2::TargetGroup, there is legitimacy to hardcode all for AvailabilityZones : 
  >  If the IP address is outside the VPC, this parameter is required. With an Application Load Balancer, if the target type is ip and the IP address is outside the VPC for the target group, the only supported value is all. 
  
  I'm unsure what to PR here. Should we get rid of this line ? https://github.com/aws-cloudformation/cfn-python-lint/blob/master/src/cfnlint/rules/resources/properties/AvailabilityZone.py#L52 
  
  Thanks for the suggestions. 
  
  [1] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetdescription.html#aws-properties-elasticloadbalancingv2-targetgroup-targetdescription-properties
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/cfnlint/rules/resources/properties/AvailabilityZone.py`
  Content:
  ```
  1 """
  2   Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3 
  4   Permission is hereby granted, free of charge, to any person obtaining a copy of this
  5   software and associated documentation files (the "Software"), to deal in the Software
  6   without restriction, including without limitation the rights to use, copy, modify,
  7   merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
  8   permit persons to whom the Software is furnished to do so.
  9 
  10   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  11   INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  12   PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  13   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  14   OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  15   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16 """
  17 from cfnlint import CloudFormationLintRule
  18 from cfnlint import RuleMatch
  19 
  20 
  21 class AvailabilityZone(CloudFormationLintRule):
  22     """Check Availibility Zone parameter checks """
  23     id = 'W3010'
  24     shortdesc = 'Availability Zone Parameters should not be hardcoded'
  25     description = 'Check if an Availability Zone property is hardcoded.'
  26     source_url = 'https://github.com/aws-cloudformation/cfn-python-lint'
  27     tags = ['parameters', 'availabilityzone']
  28 
  29     def __init__(self):
  30         """Init"""
  31         super(AvailabilityZone, self).__init__()
  32         resource_type_specs = [
  33             'AWS::DAX::Cluster',
  34             'AWS::AutoScaling::AutoScalingGroup',
  35             'AWS::RDS::DBCluster',
  36             'AWS::EC2::Volume',
  37             'AWS::ElasticLoadBalancing::LoadBalancer',
  38             'AWS::OpsWorks::Instance',
  39             'AWS::RDS::DBInstance',
  40             'AWS::EC2::Host',
  41             'AWS::EC2::Subnet',
  42             'AWS::DMS::ReplicationInstance',
  43             'AWS::EC2::Instance'
  44         ]
  45 
  46         property_type_specs = [
  47             # Singular
  48             'AWS::EC2::LaunchTemplate.Placement',
  49             'AWS::EC2::SpotFleet.SpotPlacement',
  50             'AWS::EMR::Cluster.PlacementType',
  51             'AWS::Glue::Connection.PhysicalConnectionRequirements',
  52             'AWS::ElasticLoadBalancingV2::TargetGroup.TargetDescription',
  53             'AWS::EC2::SpotFleet.LaunchTemplateOverrides',
  54         ]
  55 
  56         for resource_type_spec in resource_type_specs:
  57             self.resource_property_types.append(resource_type_spec)
  58         for property_type_spec in property_type_specs:
  59             self.resource_sub_property_types.append(property_type_spec)
  60 
  61     # pylint: disable=W0613
  62     def check_az_value(self, value, path):
  63         """Check ref for VPC"""
  64         matches = []
  65 
  66         if path[-1] != 'Fn::GetAZs':
  67             message = 'Don\'t hardcode {0} for AvailabilityZones'
  68             matches.append(RuleMatch(path, message.format(value)))
  69 
  70         return matches
  71 
  72     def check(self, properties, resource_type, path, cfn):
  73         """Check itself"""
  74         matches = []
  75 
  76         matches.extend(
  77             cfn.check_value(
  78                 properties, 'AvailabilityZone', path,
  79                 check_value=self.check_az_value, check_ref=None,
  80                 check_find_in_map=None, check_split=None, check_join=None
  81             )
  82         )
  83         matches.extend(
  84             cfn.check_value(
  85                 properties, 'AvailabilityZones', path,
  86                 check_value=self.check_az_value, check_ref=None,
  87                 check_find_in_map=None, check_split=None, check_join=None
  88             )
  89         )
  90 
  91         return matches
  92 
  93     def match_resource_sub_properties(self, properties, property_type, path, cfn):
  94         """Match for sub properties"""
  95         matches = []
  96 
  97         matches.extend(self.check(properties, property_type, path, cfn))
  98 
  99         return matches
  100 
  101     def match_resource_properties(self, properties, resource_type, path, cfn):
  102         """Check CloudFormation Properties"""
  103         matches = []
  104 
  105         matches.extend(self.check(properties, resource_type, path, cfn))
  106 
  107         return matches
  108
  ```
  --- 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/src/cfnlint/rules/resources/properties/AvailabilityZone.py b/src/cfnlint/rules/resources/properties/AvailabilityZone.py
  --- a/src/cfnlint/rules/resources/properties/AvailabilityZone.py
  +++ b/src/cfnlint/rules/resources/properties/AvailabilityZone.py
  @@ -63,9 +63,11 @@
           """Check ref for VPC"""
           matches = []
   
  -        if path[-1] != 'Fn::GetAZs':
  -            message = 'Don\'t hardcode {0} for AvailabilityZones'
  -            matches.append(RuleMatch(path, message.format(value)))
  +        # value of `all` is a valide exception in AWS::ElasticLoadBalancingV2::TargetGroup
  +        if value not in ['all']:
  +            if path[-1] != ['Fn::GetAZs']:
  +                message = 'Don\'t hardcode {0} for AvailabilityZones'
  +                matches.append(RuleMatch(path, message.format(value)))
   
           return matches
  
verification_info: {"golden_diff": "diff --git a/src/cfnlint/rules/resources/properties/AvailabilityZone.py b/src/cfnlint/rules/resources/properties/AvailabilityZone.py\n--- a/src/cfnlint/rules/resources/properties/AvailabilityZone.py\n+++ b/src/cfnlint/rules/resources/properties/AvailabilityZone.py\n@@ -63,9 +63,11 @@\n         \"\"\"Check ref for VPC\"\"\"\n         matches = []\n \n-        if path[-1] != 'Fn::GetAZs':\n-            message = 'Don\\'t hardcode {0} for AvailabilityZones'\n-            matches.append(RuleMatch(path, message.format(value)))\n+        # value of `all` is a valide exception in AWS::ElasticLoadBalancingV2::TargetGroup\n+        if value not in ['all']:\n+            if path[-1] != ['Fn::GetAZs']:\n+                message = 'Don\\'t hardcode {0} for AvailabilityZones'\n+                matches.append(RuleMatch(path, message.format(value)))\n \n         return matches\n", "issue": "Don't hardcode all for AvailabilityZones not relevant for AWS::ElasticLoadBalancingV2::TargetGroup\nHello, \r\n\r\n*cfn-lint version: 0.19.1*\r\n\r\n*Description of issue.*\r\n\r\nThe following snippet : \r\n\r\n```\r\nResources:\r\n  DefaultTargetGroup:\r\n    Type: \"AWS::ElasticLoadBalancingV2::TargetGroup\"\r\n    Properties:\r\n      VpcId: hello\r\n      Port: 80\r\n      Protocol: HTTP\r\n      HealthCheckIntervalSeconds: 30\r\n      HealthCheckPath: \"/\"\r\n      HealthCheckPort: \"80\"\r\n      HealthCheckProtocol: \"HTTP\"\r\n      HealthCheckTimeoutSeconds: 5\r\n      HealthyThresholdCount: 5\r\n      TargetType: ip\r\n      Targets:\r\n        - \r\n          Id: \"10.31.33.28\"\r\n          AvailabilityZone: all\r\n      Matcher:\r\n        HttpCode: \"200\"\r\n      TargetGroupAttributes:\r\n        - Key: deregistration_delay.timeout_seconds\r\n          Value: \"20\"\r\n```\r\n\r\nTriggers this warn message : \r\n\r\n> W3010 Don't hardcode all for AvailabilityZones \r\n\r\nIn the case of AWS::ElasticLoadBalancingV2::TargetGroup, there is legitimacy to hardcode all for AvailabilityZones : \r\n>  If the IP address is outside the VPC, this parameter is required. With an Application Load Balancer, if the target type is ip and the IP address is outside the VPC for the target group, the only supported value is all. \r\n\r\nI'm unsure what to PR here. Should we get rid of this line ? https://github.com/aws-cloudformation/cfn-python-lint/blob/master/src/cfnlint/rules/resources/properties/AvailabilityZone.py#L52 \r\n\r\nThanks for the suggestions. \r\n\r\n[1] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetdescription.html#aws-properties-elasticloadbalancingv2-targetgroup-targetdescription-properties\r\n\n", "before_files": [{"content": "\"\"\"\n  Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n\n  Permission is hereby granted, free of charge, to any person obtaining a copy of this\n  software and associated documentation files (the \"Software\"), to deal in the Software\n  without restriction, including without limitation the rights to use, copy, modify,\n  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n  permit persons to whom the Software is furnished to do so.\n\n  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\"\"\"\nfrom cfnlint import CloudFormationLintRule\nfrom cfnlint import RuleMatch\n\n\nclass AvailabilityZone(CloudFormationLintRule):\n    \"\"\"Check Availibility Zone parameter checks \"\"\"\n    id = 'W3010'\n    shortdesc = 'Availability Zone Parameters should not be hardcoded'\n    description = 'Check if an Availability Zone property is hardcoded.'\n    source_url = 'https://github.com/aws-cloudformation/cfn-python-lint'\n    tags = ['parameters', 'availabilityzone']\n\n    def __init__(self):\n        \"\"\"Init\"\"\"\n        super(AvailabilityZone, self).__init__()\n        resource_type_specs = [\n            'AWS::DAX::Cluster',\n            'AWS::AutoScaling::AutoScalingGroup',\n            'AWS::RDS::DBCluster',\n            'AWS::EC2::Volume',\n            'AWS::ElasticLoadBalancing::LoadBalancer',\n            'AWS::OpsWorks::Instance',\n            'AWS::RDS::DBInstance',\n            'AWS::EC2::Host',\n            'AWS::EC2::Subnet',\n            'AWS::DMS::ReplicationInstance',\n            'AWS::EC2::Instance'\n        ]\n\n        property_type_specs = [\n            # Singular\n            'AWS::EC2::LaunchTemplate.Placement',\n            'AWS::EC2::SpotFleet.SpotPlacement',\n            'AWS::EMR::Cluster.PlacementType',\n            'AWS::Glue::Connection.PhysicalConnectionRequirements',\n            'AWS::ElasticLoadBalancingV2::TargetGroup.TargetDescription',\n            'AWS::EC2::SpotFleet.LaunchTemplateOverrides',\n        ]\n\n        for resource_type_spec in resource_type_specs:\n            self.resource_property_types.append(resource_type_spec)\n        for property_type_spec in property_type_specs:\n            self.resource_sub_property_types.append(property_type_spec)\n\n    # pylint: disable=W0613\n    def check_az_value(self, value, path):\n        \"\"\"Check ref for VPC\"\"\"\n        matches = []\n\n        if path[-1] != 'Fn::GetAZs':\n            message = 'Don\\'t hardcode {0} for AvailabilityZones'\n            matches.append(RuleMatch(path, message.format(value)))\n\n        return matches\n\n    def check(self, properties, resource_type, path, cfn):\n        \"\"\"Check itself\"\"\"\n        matches = []\n\n        matches.extend(\n            cfn.check_value(\n                properties, 'AvailabilityZone', path,\n                check_value=self.check_az_value, check_ref=None,\n                check_find_in_map=None, check_split=None, check_join=None\n            )\n        )\n        matches.extend(\n            cfn.check_value(\n                properties, 'AvailabilityZones', path,\n                check_value=self.check_az_value, check_ref=None,\n                check_find_in_map=None, check_split=None, check_join=None\n            )\n        )\n\n        return matches\n\n    def match_resource_sub_properties(self, properties, property_type, path, cfn):\n        \"\"\"Match for sub properties\"\"\"\n        matches = []\n\n        matches.extend(self.check(properties, property_type, path, cfn))\n\n        return matches\n\n    def match_resource_properties(self, properties, resource_type, path, cfn):\n        \"\"\"Check CloudFormation Properties\"\"\"\n        matches = []\n\n        matches.extend(self.check(properties, resource_type, path, cfn))\n\n        return matches\n", "path": "src/cfnlint/rules/resources/properties/AvailabilityZone.py"}], "after_files": [{"content": "\"\"\"\n  Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n\n  Permission is hereby granted, free of charge, to any person obtaining a copy of this\n  software and associated documentation files (the \"Software\"), to deal in the Software\n  without restriction, including without limitation the rights to use, copy, modify,\n  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n  permit persons to whom the Software is furnished to do so.\n\n  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\"\"\"\nfrom cfnlint import CloudFormationLintRule\nfrom cfnlint import RuleMatch\n\n\nclass AvailabilityZone(CloudFormationLintRule):\n    \"\"\"Check Availibility Zone parameter checks \"\"\"\n    id = 'W3010'\n    shortdesc = 'Availability Zone Parameters should not be hardcoded'\n    description = 'Check if an Availability Zone property is hardcoded.'\n    source_url = 'https://github.com/aws-cloudformation/cfn-python-lint'\n    tags = ['parameters', 'availabilityzone']\n\n    def __init__(self):\n        \"\"\"Init\"\"\"\n        super(AvailabilityZone, self).__init__()\n        resource_type_specs = [\n            'AWS::DAX::Cluster',\n            'AWS::AutoScaling::AutoScalingGroup',\n            'AWS::RDS::DBCluster',\n            'AWS::EC2::Volume',\n            'AWS::ElasticLoadBalancing::LoadBalancer',\n            'AWS::OpsWorks::Instance',\n            'AWS::RDS::DBInstance',\n            'AWS::EC2::Host',\n            'AWS::EC2::Subnet',\n            'AWS::DMS::ReplicationInstance',\n            'AWS::EC2::Instance'\n        ]\n\n        property_type_specs = [\n            # Singular\n            'AWS::EC2::LaunchTemplate.Placement',\n            'AWS::EC2::SpotFleet.SpotPlacement',\n            'AWS::EMR::Cluster.PlacementType',\n            'AWS::Glue::Connection.PhysicalConnectionRequirements',\n            'AWS::ElasticLoadBalancingV2::TargetGroup.TargetDescription',\n            'AWS::EC2::SpotFleet.LaunchTemplateOverrides',\n        ]\n\n        for resource_type_spec in resource_type_specs:\n            self.resource_property_types.append(resource_type_spec)\n        for property_type_spec in property_type_specs:\n            self.resource_sub_property_types.append(property_type_spec)\n\n    # pylint: disable=W0613\n    def check_az_value(self, value, path):\n        \"\"\"Check ref for VPC\"\"\"\n        matches = []\n\n        # value of `all` is a valide exception in AWS::ElasticLoadBalancingV2::TargetGroup\n        if value not in ['all']:\n            if path[-1] != ['Fn::GetAZs']:\n                message = 'Don\\'t hardcode {0} for AvailabilityZones'\n                matches.append(RuleMatch(path, message.format(value)))\n\n        return matches\n\n    def check(self, properties, resource_type, path, cfn):\n        \"\"\"Check itself\"\"\"\n        matches = []\n\n        matches.extend(\n            cfn.check_value(\n                properties, 'AvailabilityZone', path,\n                check_value=self.check_az_value, check_ref=None,\n                check_find_in_map=None, check_split=None, check_join=None\n            )\n        )\n        matches.extend(\n            cfn.check_value(\n                properties, 'AvailabilityZones', path,\n                check_value=self.check_az_value, check_ref=None,\n                check_find_in_map=None, check_split=None, check_join=None\n            )\n        )\n\n        return matches\n\n    def match_resource_sub_properties(self, properties, property_type, path, cfn):\n        \"\"\"Match for sub properties\"\"\"\n        matches = []\n\n        matches.extend(self.check(properties, property_type, path, cfn))\n\n        return matches\n\n    def match_resource_properties(self, properties, resource_type, path, cfn):\n        \"\"\"Check CloudFormation Properties\"\"\"\n        matches = []\n\n        matches.extend(self.check(properties, resource_type, path, cfn))\n\n        return matches\n", "path": "src/cfnlint/rules/resources/properties/AvailabilityZone.py"}]}