Repository: aws-cloudformation/cfn-lint

Issue:
Confusing behaviour with Type: List<Number>
### CloudFormation Lint Version

cfn-lint 1.3.2

### What operating system are you using?

Windows, Ubuntu 

### Describe the bug

If you have a `List<Number>` type and give it a single number cfn-lint reports E1019 messages. A single `List<Number>` can produce many E1019 messages depending upon how many times !Sub or !Ref is used in the template.

E.g. from the Reproduction Template
E1019 'A' is not one of ['Topic', 'AWS::AccountId', 'AWS::NoValue', 'AWS::NotificationARNs', 'AWS::Partition', 'AWS::Region', 'AWS::StackId', 'AWS::StackName', 'AWS::URLSuffix']
test.yaml:13:7

E1019 'A' is not one of ['Topic', 'AWS::AccountId', 'AWS::NoValue', 'AWS::NotificationARNs', 'AWS::Partition', 'AWS::Region', 'AWS::StackId', 'AWS::StackName', 'AWS::URLSuffix']
test.yaml:14:7

The AWS documentation https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html does not specify how to provide a single number to a List<Number> type which may be required in some circumstances to append to the list at a later date. However providing a single number as a string doesn't cause this issue.

### Expected behavior

The expected behaviour would be to have a single error message for each incorrect `List<Number>` type with the correct line rather than multiple messages with the wrong line. Assuming that a single number should be provided as a string.

### Reproduction template

```
---
AWSTemplateFormatVersion: "2010-09-09"
Parameters:
  A:
    Type: String
  B:
    Type: List<Number>
    Default: 20
Resources:
  Topic:
    Type: AWS::SNS::Topic
    Properties:
      DisplayName: !Sub "${A}-text"
      TopicName: !Sub "${A}-text"
```



Discussion:

Patch:
diff --git a/src/cfnlint/context/context.py b/src/cfnlint/context/context.py
index c0fea92e11..7a095d8eea 100644
--- a/src/cfnlint/context/context.py
+++ b/src/cfnlint/context/context.py
@@ -304,9 +304,16 @@ def __post_init__(self, parameter) -> None:
 
         if self.type == "CommaDelimitedList" or self.type.startswith("List<"):
             if "Default" in parameter:
-                self.default = parameter.get("Default", "").split(",")
+                default = parameter.get("Default", "")
+                if isinstance(default, str):
+                    self.default = default.split(",")
+                else:
+                    self.default = [default]
             for allowed_value in parameter.get("AllowedValues", []):
-                self.allowed_values.append(allowed_value.split(","))
+                if isinstance(allowed_value, str):
+                    self.allowed_values.append(allowed_value.split(","))
+                else:
+                    self.allowed_values.append([allowed_value])
         else:
             self.default = parameter.get("Default")
             self.allowed_values = parameter.get("AllowedValues")


Test patch:
diff --git a/test/unit/module/context/test_parameter.py b/test/unit/module/context/test_parameter.py
index 24781a4473..e081f418e9 100644
--- a/test/unit/module/context/test_parameter.py
+++ b/test/unit/module/context/test_parameter.py
@@ -75,6 +75,18 @@
             "Number",
             [("10", deque(["MinValue"])), ("20", deque(["MaxValue"]))],
         ),
+        (
+            "Valid list parameter with an integer value",
+            {"Type": "List<Number>", "Default": 10},
+            "List<Number>",
+            [(["10"], deque(["Default"]))],
+        ),
+        (
+            "Valid list parameter with an integer value",
+            {"Type": "List<Number>", "AllowedValues": [10]},
+            "List<Number>",
+            [(["10"], deque(["AllowedValues", 0]))],
+        ),
     ],
 )
 def test_parameter(name, instance, expected_type, expected_ref):