Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate primaryIdentifier is unique against all resources in a template #3021

Closed
2 tasks done
kddejong opened this issue Jan 19, 2024 · 2 comments
Closed
2 tasks done
Labels
v1 v1.X

Comments

@kddejong
Copy link
Contributor

kddejong commented Jan 19, 2024

Is this feature request related to a new rule or cfn-lint capabilities?

rules

Describe the feature you'd like to request

As we convert to the schema there is new properties. We can look at primaryIdentifier (minus readOnlyProperties) and validate those primaryIdentifiers are unique against all resources in a template.

Example of this would be RoleName in AWS::IAM::Role

Describe the solution you'd like

A new rule that validates the uniqueness of primaryIdentifiers across all resources of a type

Additional context

root already exists in stack arn:aws:cloudformation:us-east-1:0123456789012:stack/stack-name/unique-id
for template

Resources:
  RootRole:
    Type: 'AWS::IAM::Role'
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - ec2.amazonaws.com
            Action:
              - 'sts:AssumeRole'
      Path: /
      RoleName: root
      Policies:
        - PolicyName: root
          PolicyDocument:
            Version: "2012-10-17"
            Statement:
              - Effect: Allow
                Action: '*'
                Resource: '*'
  RootRole2:
    Type: 'AWS::IAM::Role'
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - ec2.amazonaws.com
            Action:
              - 'sts:AssumeRole'
      Path: /
      RoleName: root
      Policies:
        - PolicyName: root
          PolicyDocument:
            Version: "2012-10-17"
            Statement:
              - Effect: Allow
                Action: '*'
                Resource: '*'

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • ⚠️ This feature might incur a breaking change
@PatMyron
Copy link
Contributor

PatMyron commented Jan 19, 2024

Duplicate: #1326

@kddejong
Copy link
Contributor Author

Whoops closing for the other ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1 v1.X
Projects
None yet
Development

No branches or pull requests

2 participants