serverless/lib/plugins/aws/lib/normalizeFiles.js
2018-11-29 10:55:52 -05:00

24 lines
635 B
JavaScript

'use strict';
const _ = require('lodash');
module.exports = {
normalizeCloudFormationTemplate(template) {
const normalizedTemplate = _.cloneDeep(template);
// reset all the S3Keys for AWS::Lambda::Function resources
_.forEach(normalizedTemplate.Resources, (value) => {
if (value.Type && value.Type === 'AWS::Lambda::Function') {
const newVal = value;
newVal.Properties.Code.S3Key = '';
}
if (value.Type && value.Type === 'AWS::Lambda::LayerVersion') {
const newVal = value;
newVal.Properties.Content.S3Key = '';
}
});
return normalizedTemplate;
},
};