aws-stepfunctions: CDK doesn't realize that it has to destroy the `StateMachine` if `StateMachineType` changes
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
```sh
1:51:23 AM | UPDATE_FAILED | AWS::StepFunctions::StateMachine | SfnStateMachineCF6AB1C9
CloudFormation cannot update a stack when a custom-named resource requires replacing. Rename arn:aws:states:eu-central-1:XXXXXXXXXXXX:stateMachine:sfn-state-machine and update the stack again.
```
CDK attempts to update the state machine when you switch from `StateMachineType.STANDARD` to `StateMachineType.EXPRESS`, which is not allowed. As per the [official docs](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-standard-vs-express.html):

CDK should instead destroy the state machine and recreate it.
### Expected Behavior
`StateMachine` to be destroyed and recreated when `StateMachineType` changes.
### Current Behavior
CDK attempts to update in place the existing `StateMachine`.
### Reproduction Steps
Deploy a `StateMachine`, change the `StateMachineType` and try to deploy it again.
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.145.0
### Framework Version
_No response_
### Node.js Version
20.15.0
### OS
Ubuntu 22.04.3 LTS
### Language
TypeScript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start by reproducing the deployment with an AWS Step Functions StateMachine, then change StateMachineType from STANDARD to EXPRESS and inspect the generated CloudFormation update behavior. Done means CDK marks the StateMachine for replacement so the deployment destroys and recreates it instead of attempting an in-place update.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100