When creating Step Functions StateMachine there is no possibility to provide already created definition string.
Also there is no way of creating IChainable from definition string of JSON which would also solve the issue.
That would be extremely useful for our use-case, when it is more convenient to define initial flow steps in JSON file and then edit them programmatically.
When using low-level CfnStateMachine there is no way of getting state machine ARN, so workaround is to construct it by hands, also we loose some helpers there.
Having possibility to convert IChainable to and from JSON would also help a lot for early state machine testing and debugging.
a) Add JSON input support to Chain similar to one we have in CustomState which does accept JSON as input, but works only for single state.
b) Add support for definitionString in StateMachine similar to one we have in CfnStateMachine
c) Add support for definitionJson in StateMachine similar to one we have in CustomState
This is a :rocket: Feature Request
@erik-telesoftas thanks for logging the issue! I think that's an interesting use case and one that would be useful. I like option a as getting a Chain back as you do in custom state allows you to manipulate and reuse a definition or partial definition of a state machine in addition to using the definition json directly.
for option b I'm more hesitant because we have introduced a few new concepts in authoring state machines within the CDK and it feels like we might be taking a step back into the L1. I think it's the least flexible of the group.
Another motivation point is that AWS have nice support for working with JSON definition, so would be great to have possibility to import it nicely into CDK
https://aws.amazon.com/blogs/compute/aws-step-functions-support-in-visual-studio-code/
Most helpful comment
Another motivation point is that AWS have nice support for working with JSON definition, so would be great to have possibility to import it nicely into CDK
https://aws.amazon.com/blogs/compute/aws-step-functions-support-in-visual-studio-code/