Last active
May 16, 2020 11:00
-
-
Save owfm/f6fac9fec786391ecdc055e10ebb6fea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: step-functions | |
plugins: | |
- serverless-step-functions | |
- serverless-bundle | |
provider: | |
profile: medium | |
name: aws | |
runtime: nodejs12.x | |
region: eu-west-1 | |
environment: | |
promotionsTable: !Ref PromotionsTable | |
iamManagedPolicies: | |
- arn:aws:iam::aws:policy/AWSStepFunctionsFullAccess | |
- arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess | |
functions: | |
proposePromotion: | |
handler: proposePromotion.call | |
getPendingPromotions: | |
handler: getPendingPromotions.call | |
events: | |
- http: | |
method: get | |
path: promotions | |
cors: true | |
storePromotions: | |
handler: storePromotions.call | |
stepFunctions: | |
stateMachines: | |
promotionFlow: | |
name: myCompanyPromotionFlowStateMachine-${opt:stage} | |
definition: | |
Comment: "Handles the manual approval of promotions." | |
StartAt: ProposePromotion | |
States: | |
ProposePromotion: | |
Type: Task | |
Resource: !GetAtt [proposePromotion, Arn] | |
ResultPath: "$.employeeDetails" | |
Next: GetManualReview | |
GetManualReview: | |
Type: Task | |
Resource: arn:aws:states:::lambda:invoke.waitForTaskToken | |
Parameters: | |
FunctionName: ${self:service}-${opt:stage}-storePromotions | |
Payload: | |
employeeDetails.$: "$.employeeDetails" | |
taskToken.$: "$$.Task.Token" | |
End: true | |
resources: | |
Resources: | |
PromotionsTable: | |
Type: AWS::DynamoDB::Table | |
Properties: | |
BillingMode: PAY_PER_REQUEST | |
AttributeDefinitions: | |
- AttributeName: taskToken | |
AttributeType: S | |
- AttributeName: decisionStatus | |
AttributeType: S | |
KeySchema: | |
- AttributeName: taskToken | |
KeyType: HASH | |
GlobalSecondaryIndexes: | |
- IndexName: decisionStatus | |
KeySchema: | |
- AttributeName: decisionStatus | |
KeyType: HASH | |
Projection: | |
ProjectionType: ALL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment