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

chore(aws-events-targets): fix StepFunctions doc & tests role usage #19178

Merged
merged 9 commits into from
Mar 8, 2022
Merged

chore(aws-events-targets): fix StepFunctions doc & tests role usage #19178

merged 9 commits into from
Mar 8, 2022

Conversation

knightjoel
Copy link
Contributor

The role used in the aws-events-targets example and test code needs to be passed to the SfnStateMachine target, not to the StateMachine resource.

The role's trust policy trusts events.amazonaws.com so the state machine resource would be unable to use this role anyways. This PR modifies the example in README.md and the test code to have the StateMachine construct create its own role and pass the manually created role to SfnStateMachine where EventBridge will use it to start the state machine.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

The role needs to be passed to the SfnStateMachine target, not to the StateMachine resource.

The role's trust policy trusts events.amazonaws.com so the state machine resource would be unable to use this role anyways. Leave the StateMachine construct to create its own role. Instead, pass the role to SfnStateMachine where EventBridge will use it to start the state machine.
The role should be passed to the SfnStateMachine target, not to the StateMachine resource: the role is for EventBridge to start the state machine, not for the state machine to assume.

While this change won't affect the results of these tests, it makes the code correct and would prevent future propagation of the error via copy/paste or others reading the tests to learn how to implement this pattern.
@gitpod-io
Copy link

gitpod-io bot commented Feb 26, 2022

rix0rrr
rix0rrr previously approved these changes Feb 27, 2022
@mergify mergify bot dismissed rix0rrr’s stale review February 28, 2022 04:02

Pull request has been modified.

@knightjoel knightjoel requested a review from rix0rrr March 1, 2022 04:45
@mergify
Copy link
Contributor

mergify bot commented Mar 8, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: d455a83
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit a9dc8ac into aws:master Mar 8, 2022
@mergify
Copy link
Contributor

mergify bot commented Mar 8, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

TheRealAmazonKendra pushed a commit to TheRealAmazonKendra/aws-cdk that referenced this pull request Mar 11, 2022
…ws#19178)

The role used in the aws-events-targets example and test code needs to be passed to the SfnStateMachine target, not to the StateMachine resource.

The role's trust policy trusts events.amazonaws.com so the state machine resource would be unable to use this role anyways. This PR modifies the example in README.md and the test code to have the StateMachine construct create its own role and pass the manually created role to SfnStateMachine where EventBridge will use it to start the state machine.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants