Resources:
  MyDeadLetterQueue:
    Type: AWS::SQS::Queue

  MyLambdaFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.handler
      Runtime: nodejs14.x
      CodeUri: ${codeuri}
      MemorySize: 128
      Events:
        Repeat:
          Type: Schedule
          Properties:
            Schedule: rate(5 minutes)
            Input: '{"Hello": "world!"}'
            Description: test schedule
            Enabled: true
            DeadLetterConfig:
              Arn:
                Fn::GetAtt:
                - MyDeadLetterQueue
                - Arn
            RetryPolicy:
              MaximumRetryAttempts: 10

Outputs:
  ScheduleName:
    Description: Name of the cw schedule
    Value:
      Ref: MyLambdaFunctionRepeat
  MyDLQArn:
    Description: Arn of the dead-letter queue created for the Schedule rule target
    Value:
      Fn::GetAtt:
      - MyDeadLetterQueue
      - Arn
Metadata:
  SamTransformTest: true