Describe the feature
AWS::StepFunctions::StateMachine has a StateMachineRevisionId read-only attribute which changes when the state machine is updated and produces a new revision. It can be used with CfnStateMachineVersion to automatically create a new state machine version when there is a new revision.
StateMachine should expose this property directly for convenience.
The current workaround is read the value from the L1. For example:
// StateMachine
const stateMachine = new sfn.StateMachine(this, 'myStateMachine', {
definition: new sfn.Pass(this, 'DefineRepositories', { result: sfn.Result.fromString("version 2") })
});
// StateMachineRevisionId is not exposed by the L2 Construct yet,
// so we need to reach down to the L1 to read the attribute
const cfnStateMachine = stateMachine.node.defaultChild as sfn.CfnStateMachine;
const revisionId = cfnStateMachine.attrStateMachineRevisionId
// Version that always points to the latest revision by using `stateMachineRevisionId`
const version = new sfn.CfnStateMachineVersion(this, 'Version', {
stateMachineArn: stateMachine.stateMachineArn,
stateMachineRevisionId: revisionId,
});
Use Case
StateMachineRevisionId is not accessible without using the L1. See above
Proposed Solution
Add a readonly property stateMachineRevisionId to StateMachine's properties. It can be assigned a value after the constructor creates the CfnStateMachine instance here: https://github.com/aws/aws-cdk/blob/efb0a4c785bb794e3ee2e7444b29e4a00d7d28f1/packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine.ts#L434C11-L442
Other Information
No response
Acknowledgements
CDK version used
2.87.0
Environment details (OS name and version, etc.)
MacOS 12.6.5
Describe the feature
AWS::StepFunctions::StateMachinehas aStateMachineRevisionIdread-only attribute which changes when the state machine is updated and produces a new revision. It can be used withCfnStateMachineVersionto automatically create a new state machine version when there is a new revision.StateMachine should expose this property directly for convenience.
The current workaround is read the value from the L1. For example:
Use Case
StateMachineRevisionId is not accessible without using the L1. See above
Proposed Solution
Add a readonly property
stateMachineRevisionIdtoStateMachine's properties. It can be assigned a value after the constructor creates the CfnStateMachine instance here: https://github.com/aws/aws-cdk/blob/efb0a4c785bb794e3ee2e7444b29e4a00d7d28f1/packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine.ts#L434C11-L442Other Information
No response
Acknowledgements
CDK version used
2.87.0
Environment details (OS name and version, etc.)
MacOS 12.6.5