SNS topic enabled/disabled

Is there a way to disable sns topic events? I tried something like this:

events:
  - sns:
      arn: [SNS_ARN]
      enabled: false

I’d like to have the sns topic enabled on my production environment and disabled on my dev environment.

Sorry I don’t know the answer of your main question…

But about the second part (enabling/disabling according to environnement), I use the following trick for schedule enabling

I have a js file with two functions :

enabled.js :

module.exports.dev = () => false;
module.exports.production = () => true;

serverless.yml :

functions:
  myfunc:
    #...
    events:
      - schedule: 
          #...
          enabled: ${file(./enabled.js):${opt:stage}}

I’m not sure it is the best way to do it, but it works :slight_smile:

Note that with this example, the stage must be declared explicitely at deployment with --stage or -s.

schedule has an enable option that sns doesn’t seem to support.

@chris_sf I’d try setting something like

custom:
   dev:
      func:
        events:
   prod:
      func:
        events:
          - sns:
              arn: [SNS_ARN]
  stage: ${opt:stage, self:provider.stage}

then you could use

events: ${self:custom.${self:custom.stage}.func.events}