aws-cloudformation / cfn-lint

CloudFormation Linter
MIT No Attribution
2.45k stars 594 forks source link

`E3601` - False-positive for AWS::StepFunctions::StateMachine `StringMatches` #3704

Closed r-heimann closed 1 month ago

r-heimann commented 1 month ago

CloudFormation Lint Version

cfn-lint 1.14.2

What operating system are you using?

Windows 11

Describe the bug

cfn-lint is unable to find "StringMatches" for "Choices". It gives the following error:

[cfn-lint] E3601: Only one of
[
  "And",
  "BooleanEquals",
  "BooleanEqualsPath",
  "IsBoolean",
  "IsNull",
  "IsNumeric",
  "IsPresent",
  "IsString",
  "IsTimestamp",
  "Not",
  "NumericEquals",
  "NumericEqualsPath",
  "NumericGreaterThan",
  "NumericGreaterThanPath",
  "NumericGreaterThanEquals",
  "NumericGreaterThanEqualsPath",
  "NumericLessThan",
  "NumericLessThanPath",
  "NumericLessThanEquals",
  "NumericLessThanEqualsPath",
  "Or",
  "StringEquals",
  "StringEqualsPath",
  "StringGreaterThan",
  "StringGreaterThanPath",
  "StringGreaterThanEquals",
  "StringGreaterThanEqualsPath",
  "StringLessThan",
  "StringLessThanPath",
  "StringLessThanEquals",
  "StringLessThanEqualsPath",
  "TimestampEquals",
  "TimestampEqualsPath",
  "TimestampGreaterThan",
  "TimestampGreaterThanPath",
  "TimestampGreaterThanEquals",
  "TimestampGreaterThanEqualsPath",
  "TimestampLessThan",
  "TimestampLessThanPath",
  "TimestampLessThanEquals",
  "TimestampLessThanEqualsPath",
]
is a required property

Expected behavior

cfn-lint allows the use of StringMatches

Reproduction template

AWSTemplateFormatVersion: 2010-09-09
Description: Test

Resources:
  StateMachine:
    Type: AWS::StepFunctions::StateMachine
    Properties:
      RoleArn: !GetAtt StepFunctionRole.Arn
      Definition:
        StartAt: Choice Test
        States:
          Choice Test:
            Type: Choice
            Choices:
              - Variable: $
                StringMatches: Test
                Next: Failed
            Default: Successful
          Successful:
            Type: Succeed
          Failed:
            Type: Fail
r-heimann commented 1 month ago

Just wanted to note that i am able to deploy the CloudFormation Stack using StringMatches