diff --git a/src/cfnlint/rules/functions/Cidr.py b/src/cfnlint/rules/functions/Cidr.py index 7fe32cc8e1..dd1c52620e 100644 --- a/src/cfnlint/rules/functions/Cidr.py +++ b/src/cfnlint/rules/functions/Cidr.py @@ -74,6 +74,11 @@ def check_ip_block(self, value, path): def check_count(self, value, path): matches = [] count_parameters = [] + if isinstance(value, str): + try: + value = int(value) + except Exception: # pylint: disable=broad-exception-caught + pass if isinstance(value, dict): if len(value) == 1: for index_key, index_value in value.items(): @@ -116,6 +121,11 @@ def check_count(self, value, path): def check_size_mask(self, value, path): matches = [] size_mask_parameters = [] + if isinstance(value, str): + try: + value = int(value) + except Exception: # pylint: disable=broad-exception-caught + pass if isinstance(value, dict): if len(value) == 1: for index_key, index_value in value.items(): diff --git a/test/fixtures/templates/good/functions/cidr.yaml b/test/fixtures/templates/good/functions/cidr.yaml index 5bc4c1aaab..99ec5fb557 100644 --- a/test/fixtures/templates/good/functions/cidr.yaml +++ b/test/fixtures/templates/good/functions/cidr.yaml @@ -63,8 +63,8 @@ Resources: - 8 - 4 - 6 - - 2 - - 4 + - "2" + - "4" VpcId: 'vpc-123456' PublicSubnet1: Type: AWS::EC2::Subnet