Search code examples
amazon-web-servicesserverless

Serverless Framework won't create event bridge rule


I am using the Serverless Framework v3 to create an integration with Teams. I have a small function that captures events from codebuild and beanstalk, filters, and sends the correctly formatted information to a Teams channel.

Ideally, I would like to manage the EventBridge rules with my serverless.yml as below, but I am having an issue where the rules will not get created. If I create a scheduled rule, it works, but trying to create these event-based rules for codebuild and beanstalk does not work. Below is my serverless.yml file. I tried removing and redeploying, but no luck :/

service: aws-teams-beanstalk

frameworkVersion: '3'

provider:
  name: aws
  region: us-west-2
  runtime: python3.8
  environment:
    Stage: ${sls:stage}
    HookUrl: REMOVED

functions:
  send_message:
    handler: handler.create_beanstalk_teams_message
    events:
      - eventBridge:
          pattern:
            source:
              - aws.elasticbeanstalk
            detail-type:
              - Health status change
            detail:
              Status:
                - Environment health changed
              Severity:
                - WARN
                - SEVERE
                - ERROR
      - eventBridge:
          pattern:
            source:
              - aws.codebuild
            detail-type:
              - CodeBuild Build State Change
            detail:
              build-status:
                - SUCCEEDED
                - FAILED

Any help or direction would be appreciated! Thanks!


Solution

  • Ok. So not sure why or how this happened. But removing it yet again and redeploying worked. Sorry for the false alarm here! :)