Repository: aws-cloudformation/cfn-lint

Issue:
Length limit check on Route53 TXT records is two characters short
*cfn-lint version: (`cfn-lint --version`)* master

*Description of issue.*

The length limit check on TXT records takes into account the starting and ending double quote characters, but these aren't counted on the API, so cfn-lint is really restricting to 253 characters rather than 255.

```
$ cat test.yml
Resources:
  Example:
    Type: AWS::Route53::RecordSet
    Properties:
      HostedZoneId: abc123
      Name: example.com.
      Type: TXT
      TTL: '14400'
      ResourceRecords:
      # 255 "a" characters within appropriate quotes
      - '"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"'
$ cfn-lint test.yml
E3020 The length of the TXT record (257) exceeds the limit (255)
test.yml:9:7
```


Discussion:

Resolving patch:
diff --git a/src/cfnlint/rules/resources/route53/RecordSet.py b/src/cfnlint/rules/resources/route53/RecordSet.py
--- a/src/cfnlint/rules/resources/route53/RecordSet.py
+++ b/src/cfnlint/rules/resources/route53/RecordSet.py
@@ -154,7 +154,7 @@ def check_txt_record(self, path, recordset):
                 if not record.startswith('"') or not record.endswith('"'):
                     message = 'TXT record ({}) has to be enclosed in double quotation marks (")'
                     matches.append(RuleMatch(tree, message.format(record)))
-                elif len(record) > 255:
+                elif len(record) > 257:  # 2 extra characters for start and end double quotation marks
                     message = 'The length of the TXT record ({}) exceeds the limit (255)'
                     matches.append(RuleMatch(tree, message.format(len(record))))
 


Test patch:
diff --git a/test/fixtures/templates/bad/route53.yaml b/test/fixtures/templates/bad/route53.yaml
--- a/test/fixtures/templates/bad/route53.yaml
+++ b/test/fixtures/templates/bad/route53.yaml
@@ -21,7 +21,8 @@ Resources:
       Type: "TXT"
       TTL: "300"
       ResourceRecords:
-        - "\"google-site-verification=asdfasdfasdfasdfasdfasdfasd123123123786123871623876128376128736123f This is way too longasdfasdfasdfasdfasdfasdfasd123123123786123871623876128376128736123f This is way too longasdfasdfasdfasdfasdfasdfasd123123123786123871623876128376128736123f This is way too long\"" # Too long
+        # 256 "a" characters - too long
+        - '"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"'
         - "\"MS=ms123123\""
         - "test2" # No quotation
   MyARecordSet:
diff --git a/test/fixtures/templates/good/route53.yaml b/test/fixtures/templates/good/route53.yaml
--- a/test/fixtures/templates/good/route53.yaml
+++ b/test/fixtures/templates/good/route53.yaml
@@ -33,6 +33,8 @@ Resources:
       TTL: "300"
       ResourceRecords:
         - "\"MS=ms123123\""
+        # 255 "a" characters + quotes
+        - "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\""
   MyARecordSet:
     Type: "AWS::Route53::RecordSet"
     Properties: