From 6513a1c6feed24eed376efdebd26e62e84fffa89 Mon Sep 17 00:00:00 2001 From: Philipp Muens Date: Sun, 14 Aug 2016 20:52:06 +0200 Subject: [PATCH] Refactor merging of custom provider resources --- lib/plugins/aws/deploy/lib/createStack.js | 9 +-------- lib/plugins/aws/deploy/tests/createStack.js | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/plugins/aws/deploy/lib/createStack.js b/lib/plugins/aws/deploy/lib/createStack.js index 1dac2e471..3ee995386 100644 --- a/lib/plugins/aws/deploy/lib/createStack.js +++ b/lib/plugins/aws/deploy/lib/createStack.js @@ -93,14 +93,7 @@ module.exports = { // check if the user has added some "custom provider resources" // and merge them into the CloudFormation template if there are any - - _.forEach(this.serverless.service.resources, (resourceValue, resourceKey) => { - if (typeof resourceValue === 'string') { - coreCloudFormationTemplate[resourceKey] = resourceValue; - } else if (typeof resourceValue === 'object') { - _.merge(coreCloudFormationTemplate[resourceKey], resourceValue); - } - }); + _.merge(coreCloudFormationTemplate, this.serverless.service.resources); this.serverless.service.resources = coreCloudFormationTemplate; diff --git a/lib/plugins/aws/deploy/tests/createStack.js b/lib/plugins/aws/deploy/tests/createStack.js index 79e1d81d9..d8e5fc279 100644 --- a/lib/plugins/aws/deploy/tests/createStack.js +++ b/lib/plugins/aws/deploy/tests/createStack.js @@ -214,7 +214,7 @@ describe('createStack', () => { expect(awsDeploy.serverless.service.resources.Outputs.FakeOutput2) .to.deep.equal(customResourcesMock.Outputs.FakeOutput2); expect(awsDeploy.serverless.service.resources.CustomDefinition) - .to.deep.equal(customResourcesMock.Outputs.CustomDefinition); + .to.deep.equal(customResourcesMock.CustomDefinition); awsDeploy.sdk.request.restore(); });