Closed PatMyron closed 4 years ago
Is that now an error in the service itself? I've been thinking about this for a while. It used to be that didn't error out (when I tested it). I wanted to create it as a Warning since a Ref to the name could yield weird results. I'm actually glad this is an error and this should be an easy rule to write.
Errors out in the service itself, think I'm almost done with the rule, just want to test before opening PR:
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
from cfnlint.rules import CloudFormationLintRule, RuleMatch
class UniqueNames(CloudFormationLintRule):
id = ''
shortdesc = 'Unique resources and parameters'
description = 'All resources and parameters must have unique names'
source_url = ''
tags = ['parameters', 'resources']
def match(self, cfn):
matches = []
for resource in cfn.get_resources():
for parameter in cfn.template.get('Parameters', {}):
if resource == parameter:
matches.append(RuleMatch(['Resources', resource], 'Resources and Parameters must not share name: ' + resource))
return matches
@kddejong also which directory / rule namespace should this one go into? 🤔