Serverless Plugin Staging

homepage icon https://github.com/icarus-sullivan/serverless-plugin-staging
Follow @icarus-sullivan

Tracked

NPM Downloads Last Month
123
Issues
1
Stars
1
Forks
0
Watchers
1
Watch Star Fork Issue Download License NPM Build Status Coverage Status Contributors

Repo README Contents:

Serverless Staging

Downloads Version License

A plugin to restrict the deployment of resources or functions on a per stage basis.

Installation

npm install serverless-plugin-staging --save-dev

or

yarn add serverless-plugin-staging --dev

Usage

In your project’s serverless file, add serverless-plugin-staging within the plugins entry.

Example:

plugins:
  - serverless-plugin-staging

Configuration

To restrict which assets are deployed within a stage, create a custom variable named staging. Within that staged variable, excludeFunctions will be used to control what functions are ignored during a deployment, and the excludeResources to control the resources.

Example excluding the function prodFunctionHandler from deploying on beta stage

custom:
  staging:
    excludeFunctions:
      beta: 
        - prodFunctionHandler

Example excluding the Uploads S3 Bucket from deploying on beta stage

custom: 
  staging:
    excludeResources:
      beta:
        - UploadsBucket

Complete Example

service: serverless-plugin-staging-example

custom: 
  staging:
    excludeFunctions:
      beta:
        - prodFunctionHandler
    excludeResources:
      beta:
        - UploadsBucket

provider:
  name: aws
  runtime: nodejs8.10
  region: us-west-2 

functions:
  prodFunctionHandler:
    handler: handlers.prodLambda
  normalFunctionHandler:
    handler: handlers.normalLambda

resources: 
  Resources:
    UploadsBucket:
      Type: AWS::S3::Bucket
      Properties:
        BucketName: Uploads

plugins:
  - serverless-plugin-staging