henhal / serverless-plugin-layer-manager

Plugin for the Serverless framework that offers improved AWS Lambda layer management
MIT License
12 stars 8 forks source link

Custom options are used before they are evaluated #3

Closed henhal closed 4 years ago

henhal commented 4 years ago

If using references to other variables within the custom.layerConfig object, they are not resolved when the plugin reads them. The hook used to run the plugin is apparently before any references have been resolved to values.

Example:

custom:
  stage: ${opt:stage, self:provider.stage}
  version: ${opt:version, '1-0-0'}
  id: ${self:custom.stage}-${self:custom.version}
  layerConfig:
    installLayers: false
    exportPrefix: ${self:service}-${self:custom.id}-

This will not properly resolve the exportPrefix using the actual value of self:service etc.

Kudos to Robert Etcheverry for reporting this.