cfn-lint icon indicating copy to clipboard operation
cfn-lint copied to clipboard

Feature Request: AWS::StepFunctions::StateMachine - Add check for `DUPLICATE_STATE_NAME`

Open r-heimann opened this issue 6 months ago • 0 comments

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

New capability

Describe the feature you'd like to request

Currently cfn-lint is unable to find dublicate entries in

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-definition

which can cause the following CloudFormation deployment error:

Resource handler returned message: "Invalid State Machine Definition: 'DUPLICATE_STATE_NAME: Duplicate State name:...

Describe the solution you'd like

A simple check for this.

Additional context

AWSTemplateFormatVersion: 2010-09-09
Description: Test

Resources:
  Role:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Effect: Allow
            Principal:
              Service: states.amazonaws.com
            Action: sts:AssumeRole

  RolePolicy:
    Type: AWS::IAM::RolePolicy
    Properties:
      RoleName: !Ref Role
      PolicyName: "InlinePolicy"
      PolicyDocument:
        Version: 2012-10-17
        Statement:
          - Sid: "Access"
            Effect: Allow
            Action: "*"
            Resource: "*"

  StateMachine:
    Type: AWS::StepFunctions::StateMachine
    Properties:
      RoleArn: !GetAtt Role.Arn
      Definition:
        StartAt: ParallelExecution
        States:
          ParallelExecution:
            Type: Parallel
            Branches:
              - StartAt: Test1
                States:
                  Test1:
                    Type: Task
                    Parameters: {}
                    Resource: arn:aws:states:::aws-sdk:cloudformation:describeStacks
              - StartAt: Test1
                States:
                  Test1:
                    Type: Task
                    Parameters: {}
                    Resource: arn:aws:states:::aws-sdk:cloudformation:describeStacks

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

r-heimann avatar Aug 23 '24 12:08 r-heimann