Step function cloud formation issue with Fn::Sub when passing list as second parameter












0















I am trying to create step function using cloud formation. I want to pass the lambda arns as second argument to Fn::Sub function. It works if I pass just one Arn but fails when I pass multiple. (with Fn::Get). I checked the template with Yml validator and did not see any issues.



Cloud formation template definition for Step:






---
Resources:
ContractDraftStateMachine:
Type: "AWS::StepFunctions::StateMachine"
Properties:
RoleArn:
Fn::GetAtt: [ StepFunctionExecutionRole, Arn ]
DefinitionString:
Fn::Sub:
- |-
{
"Comment" : "Sample draft process",
"StartAt" : "AdvanceWorkflowToDraftInProgress",
"States" : {
"AdvanceWorkflowToDraftInProgress" : {
"Type" : "Task",
"Resource": "${WorkflowStateChangeLambdaArn}",
"InputPath":"$.contractId",
"OutputPath":"$",
"ResultPath":null,
"Next" : "CheckQuestionnaireType",
"Retry" : [
{
"ErrorEquals" : ["States.TaskTimeout"],
"MaxAttempts": 5,
"IntervalSeconds": 1
},
{
"ErrorEquals" : ["CustomErrorA"],
"MaxAttempts": 5
}
],
"Catch": [
{
"ErrorEquals": [ "States.ALL" ],
"Next": "FailureNotifier"
}
]
},

"CheckQuestionnaireType" : {
"Type" : "Choice",
"Choices" : [
{
"Variable" : "$.questionnaireType",
"StringEquals" : "CE",
"Next" : "PublishQuestionnaireAnswersToCE"
},
{
"Variable" : "$.questionnaireType",
"StringEquals" : "LEAF",
"Next" : "PublishQuestionnaireAnswersToLeaf"
}
]
},

"PublishQuestionnaireAnswersToCE" : {
"Type" : "Task",
"Resource": "${WorkflowStateChangeLambdaArn}",
"Next" : "UpdateCEMetadataAndGenerateDocuments",
"ResultPath" : null,
"OutputPath" : "$",
"Retry" : [
{
"ErrorEquals" : ["States.TaskTimeout"],
"MaxAttempts": 5,
"IntervalSeconds": 1
},
{
"ErrorEquals" : ["CustomErrorA"],
"MaxAttempts": 5
}
],
"Catch": [
{
"ErrorEquals": [ "States.ALL" ],
"Next": "FailureNotifier"
}
]
},

"PublishQuestionnaireAnswersToLeaflet" : {
"Type" : "Task",
"Resource": "${WorkflowStateChangeLambdaArn}",
"End" : true,
"Retry" : [
{
"ErrorEquals" : ["States.TaskTimeout"],
"MaxAttempts": 5,
"IntervalSeconds": 1
},
{
"ErrorEquals" : ["CustomErrorA"],
"MaxAttempts": 5
}
],
"Catch": [
{
"ErrorEquals": [ "States.ALL" ],
"Next": "FailureNotifier"
}
]
},

"UpdateCEMetadataAndGenerateDocuments" : {
"Type" : "Task",
"Resource": "${WorkflowStateChangeLambdaArn}",
"End" : true,
"Retry" : [
{
"ErrorEquals" : ["States.TaskTimeout"],
"MaxAttempts": 5,
"IntervalSeconds": 1
},
{
"ErrorEquals" : ["CustomErrorA"],
"MaxAttempts": 5
}
],
"Catch": [
{
"ErrorEquals": [ "States.ALL" ],
"Next": "FailureNotifier"
}
]
},
"FailureNotifier" : {
"Type" : "Task",
"Resource": "${FailureNotifierLambdaArn}",
"End" : true,
"Retry" : [
{
"ErrorEquals" : ["States.TaskTimeout"],
"MaxAttempts": 5,
"IntervalSeconds": 1
},
{
"ErrorEquals" : ["CustomErrorA"],
"MaxAttempts": 5
}
]
}
}
}
- WorkflowStateChangeLambdaArn:
Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]
- FailureNotifierLambdaArn:
Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]





Error - Template error: One or more Fn::Sub intrinsic functions don't specify expected arguments. Specify a string as first argument, and an optional second argument to specify a mapping of values to replace in the string



This is just a sample with same lambda used multiple times but the problem is in passing list/map to Fn::Sub.



Could anyone help me resolve this issue or provide an alternate solution to achieve the same?



Thanks,










share|improve this question



























    0















    I am trying to create step function using cloud formation. I want to pass the lambda arns as second argument to Fn::Sub function. It works if I pass just one Arn but fails when I pass multiple. (with Fn::Get). I checked the template with Yml validator and did not see any issues.



    Cloud formation template definition for Step:






    ---
    Resources:
    ContractDraftStateMachine:
    Type: "AWS::StepFunctions::StateMachine"
    Properties:
    RoleArn:
    Fn::GetAtt: [ StepFunctionExecutionRole, Arn ]
    DefinitionString:
    Fn::Sub:
    - |-
    {
    "Comment" : "Sample draft process",
    "StartAt" : "AdvanceWorkflowToDraftInProgress",
    "States" : {
    "AdvanceWorkflowToDraftInProgress" : {
    "Type" : "Task",
    "Resource": "${WorkflowStateChangeLambdaArn}",
    "InputPath":"$.contractId",
    "OutputPath":"$",
    "ResultPath":null,
    "Next" : "CheckQuestionnaireType",
    "Retry" : [
    {
    "ErrorEquals" : ["States.TaskTimeout"],
    "MaxAttempts": 5,
    "IntervalSeconds": 1
    },
    {
    "ErrorEquals" : ["CustomErrorA"],
    "MaxAttempts": 5
    }
    ],
    "Catch": [
    {
    "ErrorEquals": [ "States.ALL" ],
    "Next": "FailureNotifier"
    }
    ]
    },

    "CheckQuestionnaireType" : {
    "Type" : "Choice",
    "Choices" : [
    {
    "Variable" : "$.questionnaireType",
    "StringEquals" : "CE",
    "Next" : "PublishQuestionnaireAnswersToCE"
    },
    {
    "Variable" : "$.questionnaireType",
    "StringEquals" : "LEAF",
    "Next" : "PublishQuestionnaireAnswersToLeaf"
    }
    ]
    },

    "PublishQuestionnaireAnswersToCE" : {
    "Type" : "Task",
    "Resource": "${WorkflowStateChangeLambdaArn}",
    "Next" : "UpdateCEMetadataAndGenerateDocuments",
    "ResultPath" : null,
    "OutputPath" : "$",
    "Retry" : [
    {
    "ErrorEquals" : ["States.TaskTimeout"],
    "MaxAttempts": 5,
    "IntervalSeconds": 1
    },
    {
    "ErrorEquals" : ["CustomErrorA"],
    "MaxAttempts": 5
    }
    ],
    "Catch": [
    {
    "ErrorEquals": [ "States.ALL" ],
    "Next": "FailureNotifier"
    }
    ]
    },

    "PublishQuestionnaireAnswersToLeaflet" : {
    "Type" : "Task",
    "Resource": "${WorkflowStateChangeLambdaArn}",
    "End" : true,
    "Retry" : [
    {
    "ErrorEquals" : ["States.TaskTimeout"],
    "MaxAttempts": 5,
    "IntervalSeconds": 1
    },
    {
    "ErrorEquals" : ["CustomErrorA"],
    "MaxAttempts": 5
    }
    ],
    "Catch": [
    {
    "ErrorEquals": [ "States.ALL" ],
    "Next": "FailureNotifier"
    }
    ]
    },

    "UpdateCEMetadataAndGenerateDocuments" : {
    "Type" : "Task",
    "Resource": "${WorkflowStateChangeLambdaArn}",
    "End" : true,
    "Retry" : [
    {
    "ErrorEquals" : ["States.TaskTimeout"],
    "MaxAttempts": 5,
    "IntervalSeconds": 1
    },
    {
    "ErrorEquals" : ["CustomErrorA"],
    "MaxAttempts": 5
    }
    ],
    "Catch": [
    {
    "ErrorEquals": [ "States.ALL" ],
    "Next": "FailureNotifier"
    }
    ]
    },
    "FailureNotifier" : {
    "Type" : "Task",
    "Resource": "${FailureNotifierLambdaArn}",
    "End" : true,
    "Retry" : [
    {
    "ErrorEquals" : ["States.TaskTimeout"],
    "MaxAttempts": 5,
    "IntervalSeconds": 1
    },
    {
    "ErrorEquals" : ["CustomErrorA"],
    "MaxAttempts": 5
    }
    ]
    }
    }
    }
    - WorkflowStateChangeLambdaArn:
    Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]
    - FailureNotifierLambdaArn:
    Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]





    Error - Template error: One or more Fn::Sub intrinsic functions don't specify expected arguments. Specify a string as first argument, and an optional second argument to specify a mapping of values to replace in the string



    This is just a sample with same lambda used multiple times but the problem is in passing list/map to Fn::Sub.



    Could anyone help me resolve this issue or provide an alternate solution to achieve the same?



    Thanks,










    share|improve this question

























      0












      0








      0








      I am trying to create step function using cloud formation. I want to pass the lambda arns as second argument to Fn::Sub function. It works if I pass just one Arn but fails when I pass multiple. (with Fn::Get). I checked the template with Yml validator and did not see any issues.



      Cloud formation template definition for Step:






      ---
      Resources:
      ContractDraftStateMachine:
      Type: "AWS::StepFunctions::StateMachine"
      Properties:
      RoleArn:
      Fn::GetAtt: [ StepFunctionExecutionRole, Arn ]
      DefinitionString:
      Fn::Sub:
      - |-
      {
      "Comment" : "Sample draft process",
      "StartAt" : "AdvanceWorkflowToDraftInProgress",
      "States" : {
      "AdvanceWorkflowToDraftInProgress" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "InputPath":"$.contractId",
      "OutputPath":"$",
      "ResultPath":null,
      "Next" : "CheckQuestionnaireType",
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },

      "CheckQuestionnaireType" : {
      "Type" : "Choice",
      "Choices" : [
      {
      "Variable" : "$.questionnaireType",
      "StringEquals" : "CE",
      "Next" : "PublishQuestionnaireAnswersToCE"
      },
      {
      "Variable" : "$.questionnaireType",
      "StringEquals" : "LEAF",
      "Next" : "PublishQuestionnaireAnswersToLeaf"
      }
      ]
      },

      "PublishQuestionnaireAnswersToCE" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "Next" : "UpdateCEMetadataAndGenerateDocuments",
      "ResultPath" : null,
      "OutputPath" : "$",
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },

      "PublishQuestionnaireAnswersToLeaflet" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "End" : true,
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },

      "UpdateCEMetadataAndGenerateDocuments" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "End" : true,
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },
      "FailureNotifier" : {
      "Type" : "Task",
      "Resource": "${FailureNotifierLambdaArn}",
      "End" : true,
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ]
      }
      }
      }
      - WorkflowStateChangeLambdaArn:
      Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]
      - FailureNotifierLambdaArn:
      Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]





      Error - Template error: One or more Fn::Sub intrinsic functions don't specify expected arguments. Specify a string as first argument, and an optional second argument to specify a mapping of values to replace in the string



      This is just a sample with same lambda used multiple times but the problem is in passing list/map to Fn::Sub.



      Could anyone help me resolve this issue or provide an alternate solution to achieve the same?



      Thanks,










      share|improve this question














      I am trying to create step function using cloud formation. I want to pass the lambda arns as second argument to Fn::Sub function. It works if I pass just one Arn but fails when I pass multiple. (with Fn::Get). I checked the template with Yml validator and did not see any issues.



      Cloud formation template definition for Step:






      ---
      Resources:
      ContractDraftStateMachine:
      Type: "AWS::StepFunctions::StateMachine"
      Properties:
      RoleArn:
      Fn::GetAtt: [ StepFunctionExecutionRole, Arn ]
      DefinitionString:
      Fn::Sub:
      - |-
      {
      "Comment" : "Sample draft process",
      "StartAt" : "AdvanceWorkflowToDraftInProgress",
      "States" : {
      "AdvanceWorkflowToDraftInProgress" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "InputPath":"$.contractId",
      "OutputPath":"$",
      "ResultPath":null,
      "Next" : "CheckQuestionnaireType",
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },

      "CheckQuestionnaireType" : {
      "Type" : "Choice",
      "Choices" : [
      {
      "Variable" : "$.questionnaireType",
      "StringEquals" : "CE",
      "Next" : "PublishQuestionnaireAnswersToCE"
      },
      {
      "Variable" : "$.questionnaireType",
      "StringEquals" : "LEAF",
      "Next" : "PublishQuestionnaireAnswersToLeaf"
      }
      ]
      },

      "PublishQuestionnaireAnswersToCE" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "Next" : "UpdateCEMetadataAndGenerateDocuments",
      "ResultPath" : null,
      "OutputPath" : "$",
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },

      "PublishQuestionnaireAnswersToLeaflet" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "End" : true,
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },

      "UpdateCEMetadataAndGenerateDocuments" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "End" : true,
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },
      "FailureNotifier" : {
      "Type" : "Task",
      "Resource": "${FailureNotifierLambdaArn}",
      "End" : true,
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ]
      }
      }
      }
      - WorkflowStateChangeLambdaArn:
      Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]
      - FailureNotifierLambdaArn:
      Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]





      Error - Template error: One or more Fn::Sub intrinsic functions don't specify expected arguments. Specify a string as first argument, and an optional second argument to specify a mapping of values to replace in the string



      This is just a sample with same lambda used multiple times but the problem is in passing list/map to Fn::Sub.



      Could anyone help me resolve this issue or provide an alternate solution to achieve the same?



      Thanks,






      ---
      Resources:
      ContractDraftStateMachine:
      Type: "AWS::StepFunctions::StateMachine"
      Properties:
      RoleArn:
      Fn::GetAtt: [ StepFunctionExecutionRole, Arn ]
      DefinitionString:
      Fn::Sub:
      - |-
      {
      "Comment" : "Sample draft process",
      "StartAt" : "AdvanceWorkflowToDraftInProgress",
      "States" : {
      "AdvanceWorkflowToDraftInProgress" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "InputPath":"$.contractId",
      "OutputPath":"$",
      "ResultPath":null,
      "Next" : "CheckQuestionnaireType",
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },

      "CheckQuestionnaireType" : {
      "Type" : "Choice",
      "Choices" : [
      {
      "Variable" : "$.questionnaireType",
      "StringEquals" : "CE",
      "Next" : "PublishQuestionnaireAnswersToCE"
      },
      {
      "Variable" : "$.questionnaireType",
      "StringEquals" : "LEAF",
      "Next" : "PublishQuestionnaireAnswersToLeaf"
      }
      ]
      },

      "PublishQuestionnaireAnswersToCE" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "Next" : "UpdateCEMetadataAndGenerateDocuments",
      "ResultPath" : null,
      "OutputPath" : "$",
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },

      "PublishQuestionnaireAnswersToLeaflet" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "End" : true,
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },

      "UpdateCEMetadataAndGenerateDocuments" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "End" : true,
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },
      "FailureNotifier" : {
      "Type" : "Task",
      "Resource": "${FailureNotifierLambdaArn}",
      "End" : true,
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ]
      }
      }
      }
      - WorkflowStateChangeLambdaArn:
      Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]
      - FailureNotifierLambdaArn:
      Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]





      ---
      Resources:
      ContractDraftStateMachine:
      Type: "AWS::StepFunctions::StateMachine"
      Properties:
      RoleArn:
      Fn::GetAtt: [ StepFunctionExecutionRole, Arn ]
      DefinitionString:
      Fn::Sub:
      - |-
      {
      "Comment" : "Sample draft process",
      "StartAt" : "AdvanceWorkflowToDraftInProgress",
      "States" : {
      "AdvanceWorkflowToDraftInProgress" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "InputPath":"$.contractId",
      "OutputPath":"$",
      "ResultPath":null,
      "Next" : "CheckQuestionnaireType",
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },

      "CheckQuestionnaireType" : {
      "Type" : "Choice",
      "Choices" : [
      {
      "Variable" : "$.questionnaireType",
      "StringEquals" : "CE",
      "Next" : "PublishQuestionnaireAnswersToCE"
      },
      {
      "Variable" : "$.questionnaireType",
      "StringEquals" : "LEAF",
      "Next" : "PublishQuestionnaireAnswersToLeaf"
      }
      ]
      },

      "PublishQuestionnaireAnswersToCE" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "Next" : "UpdateCEMetadataAndGenerateDocuments",
      "ResultPath" : null,
      "OutputPath" : "$",
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },

      "PublishQuestionnaireAnswersToLeaflet" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "End" : true,
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },

      "UpdateCEMetadataAndGenerateDocuments" : {
      "Type" : "Task",
      "Resource": "${WorkflowStateChangeLambdaArn}",
      "End" : true,
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ],
      "Catch": [
      {
      "ErrorEquals": [ "States.ALL" ],
      "Next": "FailureNotifier"
      }
      ]
      },
      "FailureNotifier" : {
      "Type" : "Task",
      "Resource": "${FailureNotifierLambdaArn}",
      "End" : true,
      "Retry" : [
      {
      "ErrorEquals" : ["States.TaskTimeout"],
      "MaxAttempts": 5,
      "IntervalSeconds": 1
      },
      {
      "ErrorEquals" : ["CustomErrorA"],
      "MaxAttempts": 5
      }
      ]
      }
      }
      }
      - WorkflowStateChangeLambdaArn:
      Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]
      - FailureNotifierLambdaArn:
      Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]






      yaml amazon-cloudformation aws-step-functions






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 '18 at 8:04









      sujithsujith

      2152416




      2152416
























          2 Answers
          2






          active

          oldest

          votes


















          0














          Fn::Sub takes either a single string as a parameter or a list. When using the list method there should be just two elemenets in the list. The first element is a string (the template) and the second is a map.



          From the Fn::Sub documentation



          Fn::Sub:
          - String
          - { Var1Name: Var1Value, Var2Name: Var2Value }


          Note: since you are just using Fn::Get attribute to build the substitution value you can just use ${CreateContractFromQuestionnaireFunction.Arn} and use the single string version of Fn::Sub.



          E.g. (I've shortened the step function for clarity.



             Fn::Sub:|-
          {
          "Comment" : "Sample draft process",
          "StartAt" : "AdvanceWorkflowToDraftInProgress",
          "States" : {
          "AdvanceWorkflowToDraftInProgress" : {
          "Type" : "Task",
          "Resource": "${CreateContractFromQuestionnaireFunction.Arn}",
          "InputPath":"$.contractId",
          "OutputPath":"$",
          "ResultPath":null,
          "Next" : "CheckQuestionnaireType",
          "Retry" : [
          ...





          share|improve this answer
























          • I tried referencing them directly using $ and it worked. I get the same error when I remove the second argument completely. I am passing a dummy second argument for now but shouldn't it be optional?

            – sujith
            Nov 21 '18 at 6:48



















          0














          Try:






          - { WorkflowStateChangeLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]}, FailureNotifierLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]} }





          Instead of:




          -  WorkflowStateChangeLambdaArn:
          Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]
          - FailureNotifierLambdaArn:
          Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]








          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388617%2fstep-function-cloud-formation-issue-with-fnsub-when-passing-list-as-second-par%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Fn::Sub takes either a single string as a parameter or a list. When using the list method there should be just two elemenets in the list. The first element is a string (the template) and the second is a map.



            From the Fn::Sub documentation



            Fn::Sub:
            - String
            - { Var1Name: Var1Value, Var2Name: Var2Value }


            Note: since you are just using Fn::Get attribute to build the substitution value you can just use ${CreateContractFromQuestionnaireFunction.Arn} and use the single string version of Fn::Sub.



            E.g. (I've shortened the step function for clarity.



               Fn::Sub:|-
            {
            "Comment" : "Sample draft process",
            "StartAt" : "AdvanceWorkflowToDraftInProgress",
            "States" : {
            "AdvanceWorkflowToDraftInProgress" : {
            "Type" : "Task",
            "Resource": "${CreateContractFromQuestionnaireFunction.Arn}",
            "InputPath":"$.contractId",
            "OutputPath":"$",
            "ResultPath":null,
            "Next" : "CheckQuestionnaireType",
            "Retry" : [
            ...





            share|improve this answer
























            • I tried referencing them directly using $ and it worked. I get the same error when I remove the second argument completely. I am passing a dummy second argument for now but shouldn't it be optional?

              – sujith
              Nov 21 '18 at 6:48
















            0














            Fn::Sub takes either a single string as a parameter or a list. When using the list method there should be just two elemenets in the list. The first element is a string (the template) and the second is a map.



            From the Fn::Sub documentation



            Fn::Sub:
            - String
            - { Var1Name: Var1Value, Var2Name: Var2Value }


            Note: since you are just using Fn::Get attribute to build the substitution value you can just use ${CreateContractFromQuestionnaireFunction.Arn} and use the single string version of Fn::Sub.



            E.g. (I've shortened the step function for clarity.



               Fn::Sub:|-
            {
            "Comment" : "Sample draft process",
            "StartAt" : "AdvanceWorkflowToDraftInProgress",
            "States" : {
            "AdvanceWorkflowToDraftInProgress" : {
            "Type" : "Task",
            "Resource": "${CreateContractFromQuestionnaireFunction.Arn}",
            "InputPath":"$.contractId",
            "OutputPath":"$",
            "ResultPath":null,
            "Next" : "CheckQuestionnaireType",
            "Retry" : [
            ...





            share|improve this answer
























            • I tried referencing them directly using $ and it worked. I get the same error when I remove the second argument completely. I am passing a dummy second argument for now but shouldn't it be optional?

              – sujith
              Nov 21 '18 at 6:48














            0












            0








            0







            Fn::Sub takes either a single string as a parameter or a list. When using the list method there should be just two elemenets in the list. The first element is a string (the template) and the second is a map.



            From the Fn::Sub documentation



            Fn::Sub:
            - String
            - { Var1Name: Var1Value, Var2Name: Var2Value }


            Note: since you are just using Fn::Get attribute to build the substitution value you can just use ${CreateContractFromQuestionnaireFunction.Arn} and use the single string version of Fn::Sub.



            E.g. (I've shortened the step function for clarity.



               Fn::Sub:|-
            {
            "Comment" : "Sample draft process",
            "StartAt" : "AdvanceWorkflowToDraftInProgress",
            "States" : {
            "AdvanceWorkflowToDraftInProgress" : {
            "Type" : "Task",
            "Resource": "${CreateContractFromQuestionnaireFunction.Arn}",
            "InputPath":"$.contractId",
            "OutputPath":"$",
            "ResultPath":null,
            "Next" : "CheckQuestionnaireType",
            "Retry" : [
            ...





            share|improve this answer













            Fn::Sub takes either a single string as a parameter or a list. When using the list method there should be just two elemenets in the list. The first element is a string (the template) and the second is a map.



            From the Fn::Sub documentation



            Fn::Sub:
            - String
            - { Var1Name: Var1Value, Var2Name: Var2Value }


            Note: since you are just using Fn::Get attribute to build the substitution value you can just use ${CreateContractFromQuestionnaireFunction.Arn} and use the single string version of Fn::Sub.



            E.g. (I've shortened the step function for clarity.



               Fn::Sub:|-
            {
            "Comment" : "Sample draft process",
            "StartAt" : "AdvanceWorkflowToDraftInProgress",
            "States" : {
            "AdvanceWorkflowToDraftInProgress" : {
            "Type" : "Task",
            "Resource": "${CreateContractFromQuestionnaireFunction.Arn}",
            "InputPath":"$.contractId",
            "OutputPath":"$",
            "ResultPath":null,
            "Next" : "CheckQuestionnaireType",
            "Retry" : [
            ...






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 20 '18 at 15:11









            cementblockscementblocks

            1,644814




            1,644814













            • I tried referencing them directly using $ and it worked. I get the same error when I remove the second argument completely. I am passing a dummy second argument for now but shouldn't it be optional?

              – sujith
              Nov 21 '18 at 6:48



















            • I tried referencing them directly using $ and it worked. I get the same error when I remove the second argument completely. I am passing a dummy second argument for now but shouldn't it be optional?

              – sujith
              Nov 21 '18 at 6:48

















            I tried referencing them directly using $ and it worked. I get the same error when I remove the second argument completely. I am passing a dummy second argument for now but shouldn't it be optional?

            – sujith
            Nov 21 '18 at 6:48





            I tried referencing them directly using $ and it worked. I get the same error when I remove the second argument completely. I am passing a dummy second argument for now but shouldn't it be optional?

            – sujith
            Nov 21 '18 at 6:48













            0














            Try:






            - { WorkflowStateChangeLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]}, FailureNotifierLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]} }





            Instead of:




            -  WorkflowStateChangeLambdaArn:
            Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]
            - FailureNotifierLambdaArn:
            Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]








            share|improve this answer




























              0














              Try:






              - { WorkflowStateChangeLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]}, FailureNotifierLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]} }





              Instead of:




              -  WorkflowStateChangeLambdaArn:
              Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]
              - FailureNotifierLambdaArn:
              Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]








              share|improve this answer


























                0












                0








                0







                Try:






                - { WorkflowStateChangeLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]}, FailureNotifierLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]} }





                Instead of:




                -  WorkflowStateChangeLambdaArn:
                Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]
                - FailureNotifierLambdaArn:
                Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]








                share|improve this answer













                Try:






                - { WorkflowStateChangeLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]}, FailureNotifierLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]} }





                Instead of:




                -  WorkflowStateChangeLambdaArn:
                Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]
                - FailureNotifierLambdaArn:
                Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]








                - { WorkflowStateChangeLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]}, FailureNotifierLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]} }





                - { WorkflowStateChangeLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]}, FailureNotifierLambdaArn: {Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]} }





                -  WorkflowStateChangeLambdaArn:
                Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]
                - FailureNotifierLambdaArn:
                Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]





                -  WorkflowStateChangeLambdaArn:
                Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]
                - FailureNotifierLambdaArn:
                Fn::GetAtt: [ CreateContractFromQuestionnaireFunction, Arn ]






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 20 '18 at 15:25









                astast

                35




                35






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53388617%2fstep-function-cloud-formation-issue-with-fnsub-when-passing-list-as-second-par%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                    ComboBox Display Member on multiple fields

                    Is it possible to collect Nectar points via Trainline?