in cfn-lint-custom-rules/rules/AMSResourceUnsupportedAttributes.py [0:0]
def match(self, cfn):
"""Check CloudFormation Resources"""
matches = []
invalid_resource_attributes = {
"AWS::SecretsManager::Secret": ["SecretString"],
"AWS::DMS::Endpoint": ["MongoDbSettings"],
"AWS::EC2::LaunchTemplate": ["KeyName"]
}
for resource_name, resource_values in cfn.template.get("Resources", {}).items():
self.logger.debug("Validating Properties for %s resource", resource_name)
resource_type = resource_values.get("Type", "")
if resource_type in invalid_resource_attributes.keys():
check_attributes = set(invalid_resource_attributes[resource_type])
for attribute, _ in resource_values["Properties"].items():
if attribute in check_attributes:
message = "AMS - Attribute {0} for resource {1} is not supported by AMS"
matches.append(
RuleMatch(
["Resources", resource_name, attribute],
message.format(attribute, resource_name),
)
)
return matches