Lambda State Machine should depend on its IAM Policies #5336
Labels
@aws-cdk/aws-stepfunctions
Related to AWS StepFunctions
bug
This issue is a bug.
in-progress
This issue is being actively worked on.
p1
The policies created with a
@aws-cdk/aws-stepfunctions.StateMachine
have no references/dependencies to them. Therefore, when a stack deletion is initiated, the policies might be deleted first, then the state machine.In my situation, I am using the provider framework from
@aws-cdk/custom-resources
, which uses a State Machine to handle custom resource creation/deletion. When trying to delete a custom resource (via a stack deletion), the stack deletes the state machine's IAM policy before the state machine is finished deleting the custom resource. The state machine then loses its permission to invoke its associated lambda functions, and the custom resource remains in a DELETE_IN_PROGRESS state until a stack timeout occurs.Solution
See the fix in the code below. This is also how
@aws-cdk/aws-lambda.Function
handles its IAM dependencies.@aws-cdk/aws-stepfunctions/lib/state-machine.js
Environment
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: