diff --git a/lib/classes/Service.js b/lib/classes/Service.js index d87ff5a1f74..39872c72bbc 100644 --- a/lib/classes/Service.js +++ b/lib/classes/Service.js @@ -20,7 +20,7 @@ class Service { this.serviceObject = null; this.provider = { stage: 'dev', - variableSyntax: '\\${([^{}:]+?(?:\\(|:)[^:{}][^{}]*?)}', + variableSyntax: '\\${([^{}:]+?(?:\\(|:)(?:[^:{}][^{}]*?)?)}', }; this.custom = {}; this.plugins = []; diff --git a/lib/classes/Variables.test.js b/lib/classes/Variables.test.js index 7eb09d04b42..e4ea2c55dd3 100644 --- a/lib/classes/Variables.test.js +++ b/lib/classes/Variables.test.js @@ -2769,5 +2769,8 @@ module.exports = { it('should support ${self:key} syntax', () => { expect(processedConfig.custom.selfReference).to.equal('bar'); }); + it('should support ${self:} syntax', () => { + expect(processedConfig.custom.serviceReference).to.equal(processedConfig); + }); }); }); diff --git a/test/fixtures/variables/serverless.yml b/test/fixtures/variables/serverless.yml index dc34906a217..c1f51d93906 100644 --- a/test/fixtures/variables/serverless.yml +++ b/test/fixtures/variables/serverless.yml @@ -10,3 +10,4 @@ custom: awsVariable: ${AWS::Region} cloudFormationReference: ${AnotherResource} selfReference: ${self:custom.importedFileWithKey} + serviceReference: ${self:}