# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: > nested-workflows SAM Template to demonstrate nested-workflows Resources: ################################################################################ # Parent Standard Workflow ################################################################################ ParentWorkflow: Type: AWS::Serverless::StateMachine Properties: Name: Parent Role: !GetAtt ParentWorkflowRole.Arn DefinitionUri: statemachine/parent.asl.json DefinitionSubstitutions: FailingChildWorkflowArn: !Ref FailingChildWorkflow SucceedingChildWorkflowArn: !Ref SucceedingChildWorkflow ################################################################################ # Failing Child Express Workflow ################################################################################ FailingChildWorkflow: Type: AWS::Serverless::StateMachine Properties: Name: Failing-Child Type: EXPRESS Role: !GetAtt NoOpWorkflowRole.Arn DefinitionUri: statemachine/failing-child.asl.json ################################################################################ # Succeeding Child Express Workflow ################################################################################ SucceedingChildWorkflow: Type: AWS::Serverless::StateMachine Properties: Name: Succeeding-Child Type: EXPRESS Role: !GetAtt NoOpWorkflowRole.Arn DefinitionUri: statemachine/succeeding-child.asl.json ################################################################################ # Parent IAM role ################################################################################ ParentWorkflowRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: "2012-10-17" Statement: - Effect: Allow Principal: Service: - !Sub states.${AWS::Region}.amazonaws.com Action: sts:AssumeRole Policies: - PolicyName: ParentWorkflowExecutionPolicy PolicyDocument: Version: "2012-10-17" Statement: - Effect: Allow Action: - states:StartExecution Resource: - !Ref FailingChildWorkflow - !Ref SucceedingChildWorkflow # The following stanzas are required for .sync invocations of workflows - Effect: Allow Action: - states:DescribeExecution - states:StopExecution Resource: - !Ref FailingChildWorkflow - !Ref SucceedingChildWorkflow - Effect: Allow Action: - events:PutTargets - events:PutRule - events:DescribeRule Resource: - !Sub "arn:aws:events:${AWS::Region}:${AWS::AccountId}:rule/StepFunctionsGetEventsForStepFunctionsExecutionRule" ################################################################################ # No-op IAM role for child workflows ################################################################################ NoOpWorkflowRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: "2012-10-17" Statement: - Effect: Allow Principal: Service: - !Sub states.${AWS::Region}.amazonaws.com Action: sts:AssumeRole