diff --git a/src/cfnlint/rules/resources/PrimaryIdentifiers.py b/src/cfnlint/rules/resources/PrimaryIdentifiers.py index 7bc91501af..910d470aca 100644 --- a/src/cfnlint/rules/resources/PrimaryIdentifiers.py +++ b/src/cfnlint/rules/resources/PrimaryIdentifiers.py @@ -127,7 +127,9 @@ def _validate_resource_type_uniqueness(self, cfn, resource_type, ids): def match(self, cfn): tS = set() for _, resource_properties in cfn.get_resources().items(): - tS.add(resource_properties.get("Type")) + t = resource_properties.get("Type") + if isinstance(t, str): + tS.add(t) matches = [] for t in tS: diff --git a/src/cfnlint/rules/resources/properties/Properties.py b/src/cfnlint/rules/resources/properties/Properties.py index 541655edc8..a0ab9f72ae 100644 --- a/src/cfnlint/rules/resources/properties/Properties.py +++ b/src/cfnlint/rules/resources/properties/Properties.py @@ -71,7 +71,7 @@ def cfnresourceproperties(self, validator: Validator, _, instance: Any, schema): ) t = instance.get("Type") - if not t: + if not validator.is_type(t, "string"): return if t.startswith("Custom::"): diff --git a/test/fixtures/templates/bad/resources/primary_identifiers.yaml b/test/fixtures/templates/bad/resources/primary_identifiers.yaml index e6cbbdd82b..95be3b5f2b 100644 --- a/test/fixtures/templates/bad/resources/primary_identifiers.yaml +++ b/test/fixtures/templates/bad/resources/primary_identifiers.yaml @@ -152,3 +152,5 @@ Resources: - IsUsEast1 - us-east-1 - !Ref 'AWS::NoValue' + BadType: + Type: !Ref AWS::Region