Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-cdk-lib/aws-stepfunctions: Configure IAM policy to redrive from failure on labelled execution for DistributedMap failures #33578

Open
2 tasks
kshefchek opened this issue Feb 25, 2025 · 2 comments
Labels
@aws-cdk/aws-iam Related to AWS Identity and Access Management effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@kshefchek
Copy link

kshefchek commented Feb 25, 2025

Describe the feature

Currently when creating a state machine, the step function module automatically sets up necessary IAM policies to run a state machine as described here: https://github.com/aws/aws-cdk/blob/e03d11/packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine.ts#L221-L411

However, the ability to redrive from failure from a DistributedMap step(s) is not included, so this has to be added via addToRolePolicy or attachToRole

see also #28820 (comment)

Use Case

I want to create a state machine in cdk without manually adding an inline IAM policy to the state machine role that grants states:RedriveExecution on labelled executions

Proposed Solution

add a method to aws-cdk-lib/aws-stepfunctions/lib/state-machine.ts

  /**
   * Grant the given identity permissions to redrive an execution of this state
   * machine.
   */
  public grantRedriveOnExecution(identity: iam.IGrantable, ...actions: string[]) {
    return iam.Grant.addToPrincipal({
      grantee: identity,
      'states:RedriveExecution',
      resourceArns: [`${this.executionArn()}/*`],
    });
  }

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.179.0

Environment details (OS name and version, etc.)

mac os

@kshefchek kshefchek added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Feb 25, 2025
@github-actions github-actions bot added the @aws-cdk/aws-iam Related to AWS Identity and Access Management label Feb 25, 2025
@ashishdhingra ashishdhingra self-assigned this Feb 25, 2025
@ashishdhingra ashishdhingra added p2 and removed needs-triage This issue or PR still needs to be triaged. labels Feb 25, 2025
@ashishdhingra
Copy link
Contributor

Appear to be valid feature request. Marking it as P2. Community contributions are welcome.

@ashishdhingra ashishdhingra added the effort/small Small work item – less than a day of effort label Feb 25, 2025
@ashishdhingra ashishdhingra removed their assignment Feb 25, 2025
@kshefchek
Copy link
Author

kshefchek commented Feb 25, 2025

As an update I think this is only affecting redrive from a distributed map step failure, so my initial ticket is misleading, this partially overlapping with this ticket #28820 (comment)

Update: I edited the original ticket title and description to make this more clear.

@kshefchek kshefchek changed the title aws-cdk-lib/aws-stepfunctions: Configure IAM policy to redrive from failure on labelled execution aws-cdk-lib/aws-stepfunctions: Configure IAM policy to redrive from failure on labelled execution for DistributedMap failures Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-iam Related to AWS Identity and Access Management effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

2 participants