in cfn-lint-custom-rules/rules/AMSRequiredAttributeValues.py [0:0]
def match_allowed_values(self, attribute, attribute_value, resource_type):
"""Validate attribute as matching AMS rules
Arguments:
attribute {string} -- CloudFormation resource attribute type
attribute_value {string} -- CloudFormation resource attribute value
resource_type {string} -- CloudFormation resource type
"""
check_attributes = set(self.required_attribute_values[resource_type])
# Don't verify parameters or dynamic references
if (
attribute not in check_attributes
or not isinstance(attribute_value, str)
or re.match(REGEX_DYN_REF, attribute_value)
):
return True
for pattern in self.required_attribute_values[resource_type][attribute]:
p = re.compile(pattern, re.IGNORECASE)
m = p.match(attribute_value)
if m:
return True
return False