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

feat: allow user to provide role for schedule #3363

Merged
merged 8 commits into from
Oct 5, 2023
Merged

Conversation

sidhujus
Copy link
Contributor

@sidhujus sidhujus commented Oct 3, 2023

Issue #, if available

feature request discussion #3290

Description of changes

Add new Role property to Schedule for user to pass in their own role to be used with the generated event rule
Example


  MyStateMachine:
    Type: AWS::Serverless::StateMachine
    Properties:
      Definition:
        Comment: A Hello World example of the Amazon States Language using Pass states
        StartAt: Hello
        States:
          Hello:
            Type: Pass
            Result: Hello
            Next: World
          World:
            Type: Pass
            Result: World
            End: true
      Policies:
      - Version: '2012-10-17'
        Statement:
        - Effect: Deny
          Action: '*'
          Resource: '*'

      Events:
        CWSchedule:
          Type: Schedule
          Properties:
            Schedule: rate(1 minute)
            Description: test schedule
            Enabled: false
            Role: with-role-MyStateMachineCWScheduleRole-RI4SGRI1ORL9

Description of how you validated changes

Validated with tests and tansformed a template with the new Role property and succesfully deployed and had it execute the state machine

Checklist

Examples?

Please reach out in the comments if you want to add an example. Examples will be
added to sam init through aws/aws-sam-cli-app-templates.

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

@sidhujus sidhujus requested a review from a team as a code owner October 3, 2023 22:48
@GavinZZ
Copy link
Contributor

GavinZZ commented Oct 3, 2023

nit: we usually name the PR
feat: xxxxx for feature request
fix: xxxxx for bug fix
chore: xxxxx for chore task

@sidhujus sidhujus changed the title allow user to provide role for schedule feat: allow user to provide role for schedule Oct 3, 2023
Copy link
Contributor

@GavinZZ GavinZZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed that this currently only supports hardcoded Role arn. SAM generally supports both hardcoded RoleArn or intrinsics !Ref to a role resource.

samtranslator/model/stepfunctions/events.py Outdated Show resolved Hide resolved
samtranslator/model/stepfunctions/events.py Outdated Show resolved Hide resolved
samtranslator/model/stepfunctions/events.py Outdated Show resolved Hide resolved
samtranslator/model/stepfunctions/events.py Outdated Show resolved Hide resolved
Copy link
Contributor

@GavinZZ GavinZZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Copy link
Contributor

@aaythapa aaythapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work

@sidhujus sidhujus merged commit cf8418b into aws:develop Oct 5, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants