BUG? serverless.yml "functions/<fn name>/events/enabled" does not control AWS::Events::Rule/State value at all

I am unable to control the ENABLED/DISABLED state of a CloudWatch Rule that targets a Lambda function via the documented methods as described here: https://serverless.com/framework/docs/providers/aws/events/schedule/

I created this simple serverless.yml to demonstrate. It should create a Lambda that has a cron based CloudWatch Rule configured in a DISABLED state. However, the corresponding CloudFormation template is not generated correctly.

Is there anyway I am doing this incorrectly? Or a different approach I could take?

service: sls-schedule-control-test  # NOTE: update this with your service name

provider:
  name: aws
  runtime: python3.7

functions:
  hello:
    handler: handler.hello
    events:
      - schedule: cron(10 21 * * ? *)
        enabled: false

CFT Rule Section - Expected output:

"HelloEventsRuleSchedule1": {
  "Type": "AWS::Events::Rule",
  "Properties": {
    "ScheduleExpression": "cron(10 21 * * ? *)",
    "State": "DISABLED",
    "Targets": [
      {
        "Arn": {
          "Fn::GetAtt": [
            "HelloLambdaFunction",
            "Arn"
          ]
        },
        "Id": "helloSchedule"
      }
    ]
  }
},

CFT Rule Section - Actual (incorrect) output:

"HelloEventsRuleSchedule1": {
  "Type": "AWS::Events::Rule",
  "Properties": {
    "ScheduleExpression": "cron(10 21 * * ? *)",
    "State": "ENABLED",
    "Targets": [
      {
        "Arn": {
          "Fn::GetAtt": [
            "HelloLambdaFunction",
            "Arn"
          ]
        },
        "Id": "helloSchedule"
      }
    ]
  }
},

Output from ‘sls print’ command:

sls print
service: sls-schedule-control-test
provider:
  name: aws
  runtime: python3.7
functions:
  hello:
    handler: handler.hello
    events:
      - schedule: cron(10 21 * * ? *)
        enabled: false

what i’m noticing here is that i’m trying something similar using their declared syntax:
events:
- schedule: cron(2 * * * ? *)
input:
tables: ‘foo,bar’

sls package ignores the input/tables thing.

the other thing i’m noticing is that serverless folks have not responded. did you ever solve your problem?

I believe the indentation here is the issue for inputs. In YAML whitespace is used to determine how the data is structured. Here is an example of a function using the inputs.

functions:
  hello:
    handler: handler.hello
    events:
      - schedule:
          rate: cron(* * * * ? *)
          enabled: true
          input:
            myKey: stuff
            key2: value2

I’m looking into the issue with the enabled property now to see why that happened for you.

Edit*

I just confirmed that changing the above to enabled: false will correctly set the event in the CloudWatch event rule to disabled. Interestingly, in the AWS console the event still appears as enabled. But if you run the AWS CLI command to check the status of the rule it is actually disabled and not triggering any of the functions:

As an example:
aws events describe-rule --name inputest-dev-HelloEventsRuleSchedule1-EXAMPLE

Actually, I’m not sure this is a bug. The Event is still set to Enabled in the Lambda Console, however, going to the actual Schedule in CloudWatch Rules is set to Disabled. This makes sense to me as the Event is still the trigger for the lambda function, but the actual Schedule itself is Disabled.