serverless-plugin-resource-deep-merge

1.1.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i serverless-plugin-resource-deep-merge

Weekly Downloads

54

Version

1.1.0

License

ISC

Unpacked Size

4.96 kB

Total Files

6

Last publish

Collaborators

  • lesnitsky