0
votes

I'm trying to create an AWS Step function, but it is showing an error message as Field Parameters is not supported in the Choice state inside a Parallel branch. I used the following code:

{
"Comment": "A Parallel Step Function",
"StartAt": "ParentStep",
"States":
{
  "ParentStep":
  {
    "Comment": "Parallel test execution to check the Input Flow",
    "Type": "Parallel",
    "End": true,
    "Branches":
    [
        {
            "Comment": "Parallel Execution 1",
            "StartAt": "branch1",
            "States":
            {
                "branch1":
                {
                    "Comment": "branch1 started",
                    "Parameters":
                    {
                        "testvalue1.$": "$.value1"
                    },
                    "Type": "Choice",
                    "Choices":
                    [
                        {
                            "Variable": "$.testvalue1",
                            "NumericEquals": 1,
                            "Next": "subbranch1"
                        },
                        {
                            "Not":
                            {
                                "Variable": "$.testvalue1",
                                "NumericEquals": 1
                            },
                            "Next": "subbranch2"
                        }
                    ],
                    "Default": "subbranch2"
                },
                "subbranch1":
                {
                    "Comment": "sub-branch 1",
                    "Type": "Pass",
                    "End": true
                },
                "subbranch2":
                {
                    "Comment": "Ending branch 1",
                    "Type": "Pass",
                    "End": true
                }
            }
        },
        {
            "Comment": "Parallel Execution 2",
            "StartAt": "branch2",
            "States":
            {
                "branch2":
                {
                    "Comment": "starting branch 2",
                    "Parameters":
                    {
                        "testvalue2.$": "$.value2"
                    },
                    "Type": "Choice",
                    "Choices":
                    [
                        {
                            "Variable": "$.testvalue2",
                            "NumericEquals": 2,
                            "Next": "subbranch3"
                        },
                        {
                            "Not":
                            {
                                "Variable": "$.testvalue2",
                                "NumericEquals": 2
                            },
                            "Next": "subbranch4"
                        }
                    ],
                    "Default": "subbranch4"
                },
                "subbranch3":
                {
                    "Comment": "sub-branch 3",
                    "Type": "Pass",
                    "End": true
                },
                "subbranch4":
                {
                    "Comment": "Ending Parallel Execution 2",
                    "Type": "Pass",
                    "End": true
                }
            }
        }
    ]
}}}

However, the same code works if I replace the Choice state with a Task state. Is the field Parameters is not supported in the Choice state? I went through the AWS Step function documentation and couldn't see any information about this. Can someone shed some light on this?

Thank you

1

1 Answers

2
votes

Parameters at Choice state is not supporeted. As per this, you can only use Choices and Default. Also, you can check which fields are supported at the documentation. By the way, you can achieve your task by the following solution.

{
  "Comment": "A Parallel Step Function",
  "StartAt": "ParentStep",
  "States": {
    "ParentStep": {
      "Comment": "Parallel test execution to check the Input Flow",
      "Type": "Parallel",
      "End": true,
      "Branches": [
        {
          "Comment": "Parallel Execution 1",
          "StartAt": "branch1",
          "States": {
            "branch1": {
              "Comment": "branch1 started",
              "Type": "Choice",
              "Choices": [
                {
                  "Variable": "$.testvalue1",
                  "NumericEquals": 1,
                  "Next": "subbranch1"
                },
                {
                  "Not": {
                    "Variable": "$.testvalue1",
                    "NumericEquals": 1
                  },
                  "Next": "subbranch2"
                }
              ],
              "Default": "subbranch2"
            },
            "subbranch1": {
              "Comment": "sub-branch 1",
              "Type": "Pass",
              "Parameters": {
                "testvalue1.$": "$.value1"
              },
              "End": true
            },
            "subbranch2": {
              "Comment": "Ending branch 1",
              "Type": "Pass",
              "Parameters": {
                "testvalue1.$": "$.value1"
              },
              "End": true
            }
          }
        },
        {
          "Comment": "Parallel Execution 2",
          "StartAt": "branch2",
          "States": {
            "branch2": {
              "Comment": "starting branch 2",
              "Type": "Choice",
              "Choices": [
                {
                  "Variable": "$.testvalue2",
                  "NumericEquals": 2,
                  "Next": "subbranch3"
                },
                {
                  "Not": {
                    "Variable": "$.testvalue2",
                    "NumericEquals": 2
                  },
                  "Next": "subbranch4"
                }
              ],
              "Default": "subbranch4"
            },
            "subbranch3": {
              "Comment": "sub-branch 3",
              "Type": "Pass",
              "Parameters": {
                "testvalue2.$": "$.value2"
              },
              "End": true
            },
            "subbranch4": {
              "Comment": "Ending Parallel Execution 2",
              "Type": "Pass",
              "Parameters": {
                "testvalue2.$": "$.value2"
              },
              "End": true
            }
          }
        }
      ]
    }
  }
}