serverless-plugin-resource-deep-merge

serverless-plugin-resource-deep-merge JS library on npm Download serverless-plugin-resource-deep-merge JS library

Serverless plugin which allows to modify CloudFormation templates

Version 1.1.0 License ISC
serverless-plugin-resource-deep-merge has no homepage
serverless-plugin-resource-deep-merge JS library on GitHub
serverless-plugin-resource-deep-merge JS library on npm
Download serverless-plugin-resource-deep-merge JS library

Serverless plugin resource deep merge

Installation

npm i -D serverless-plugin-resource-deep-merge
plugins:
  - serverless-plugin-resource-deep-merge

Usage

serverless.yaml

functions:
  urlrewrite:
    handler: handler.urlrewrite
    events:
      - cloudFront:
          eventType: origin-request
          origin: https://${self:custom.s3Origin}
          isDefaultOrigin: true

☝️ This Lambda@Edge function will create a CloudFront distribution which is, unfortunately, hardly customizable due to the default behavior of resources.extensions:

As per doc:

Here's how the extension logic is defined:

Resource attribute Operation
Properties Merge. If a property with the same name exists in the resource, the value will be replaced with the extension value.

Properties.DistributionConfig replacement equals to handcrafted CloudFront config, so deepmerge of config might be more useful. For example, if you want to add a custom alias to your CloudFront distribution, add the following section to the serverless.yaml

custom:
  mergeResources:
    CloudFrontDistribution:
      Properties:
        DistributionConfig:
          Aliases:
            - some.domain.com

Contributors

LICENSE

WTFPL