  Resources:

    ### Role for the AppSync to access necessary resources

    AppSyncRole:
      Type: AWS::IAM::Role
      Properties:
        AssumeRolePolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Action:
                - sts:AssumeRole
              Principal:
                Service:
                  - appsync.amazonaws.com
        Policies:
          - PolicyName: AppSyncLambdaPolicy
            PolicyDocument:
              Version: "2012-10-17"
              Statement:
                - Effect: Allow
                  Action:
                    - lambda:InvokeFunction
                  Resource: 
                    - !GetAtt InternalRequestsLambdaFunction.Arn
        RoleName: ${{self:custom.apiName}}-appsync-role
