Open garysassano opened 2 months ago
Hi @garysassano , thanks for reaching out.
IMO, as its clearly mentioned in the docs that StateMachineType can not be changed, I assume that's an acceptable behavior.
AFAIK, Since the StateMachineArn is not mutable, changing the StateMachineType is causing a replacement and hence the error. I am not really sure why you would want to do that.
It would be advisable to create a new StateMachine if type is changed. I am not clear on the usecase of changing the type when new one can be created. Could you please clarify?
See this as well -
StateMachineType is a prop of AWS::StepFunctions::StateMachine
so it's definitely allowed to change from CFN's perspective.
But we need to note:
Update requires: Replacement
This means a new StateMachine would be created in replacement of the previous one.
One common error is that when you have specified a custom name of the original one, creating a new one with exactly the same name as a replacement of the original one would cause duplication if the resource does not allow you to have duplicate name as the error indicates:
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.
Solution:
Let me know if it works for you.
PoC
// create a dummy statemachine
new sfn.StateMachine(this, 'StateMachine', {
definition: new sfn.Pass(this, 'Pass'),
stateMachineType: StateMachineType.EXPRESS, // update this and re-deploy
});
cdk diff
and cdk deploy
works with no error.
Describe the bug
CDK attempts to update the state machine when you switch from
StateMachineType.STANDARD
toStateMachineType.EXPRESS
, which is not allowed. As per the official docs:CDK should instead destroy the state machine and recreate it.
Expected Behavior
StateMachine
to be destroyed and recreated whenStateMachineType
changes.Current Behavior
CDK attempts to update in place the existing
StateMachine
.Reproduction Steps
Deploy a
StateMachine
, change theStateMachineType
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