Description
This is a Bug Report
Description
- What went wrong?
(Preface: In this issue I used an unreleased version of this plugin which incorporates the changes from #536)
When executing a state machine with a Map state in Distributed mode, the execution fails at the Map state because execution role does not have sufficient permissions to run a Distributed Map.
This is due to the required additional permissions, where the execution role for the state machine containing the Distributed Map must be able to StartExecution
on itself: https://docs.aws.amazon.com/step-functions/latest/dg/iam-policies-eg-dist-map.html
- What did you expect should have happened?
The Distributed Map state should have run without permissions issues.
- What was the config you used?
Not really applicable here, just a standard distributed map state:
MyMapState:
Type: Map
ItemProcessor:
ProcessorConfig:
Mode: DISTRIBUTED
ExecutionType: STANDARD
StartAt: FooState
States:
FooState:
....
- What stacktrace or error message from your provider did you see?
This is the error that appears on the AWS Dashboard during the execution of the state machine:
User: arn:aws:sts::12345:assumed-role/MyStateMachineRole/abcdef is not authorized to perform: states:StartExecution on resource: arn:aws:states:us-east-1:12345:stateMachine:MyStateMachineName because no identity-based policy allows the states:StartExecution action (Service: Sfn, Status Code: 400, Request ID: some-uuid)
Additional Data
- Serverless Framework Core Version you're using: 3.25.1
- The Plugin Version you're using: Unreleased; my package.json points to this commit: 42bd423
- Operating System: N/A
- Stack Trace: N/A
- Provider Error messages: N/A (see description above)
I've been able to brute-force a fix by adding the following rule to the set of IAM Permissions:
timorthi@fd1b36a#diff-5efbd2d24990cd41d11040072f12d980a6ae28e66faef40a046e8d30d69ff528R580-R590
There is probably a better/cleaner way to add the permissions based on the detection of a Distributed Map state, however it appears that getTaskStates
ignores "container" states like Maps and Parallels so there's no easy way to detect a Distributed Map without changing getTaskStates
.