add-custom-resource
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -35,3 +35,3 @@ 'use strict'; | ||
return functionId; | ||
return { functionId, logGroupId }; | ||
}); | ||
@@ -47,6 +47,6 @@ } | ||
return ensureFunctionResources(template, config) | ||
.then(functionId => { | ||
template.Resources[resourceId] = makeResource(resourceName, functionId, config.resource); | ||
.then(({ functionId, logGroupId }) => { | ||
template.Resources[resourceId] = makeResource(resourceName, functionId, logGroupId, config.resource); | ||
return resourceId; | ||
}); | ||
}; |
'use strict'; | ||
module.exports = function makeLogGroup(functionName, retentionInDays) { | ||
module.exports = function makeLogGroup(functionId, retentionInDays) { | ||
const logGroup = { | ||
@@ -10,7 +10,8 @@ Type: 'AWS::Logs::LogGroup', | ||
'/aws/lambda/', | ||
{ Ref: functionName } | ||
{ Ref: functionId } | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
DependsOn: [functionId] | ||
}; | ||
@@ -17,0 +18,0 @@ |
'use strict'; | ||
module.exports = function makeResource(name, functionName, resourceOptions) { | ||
module.exports = function makeResource(name, functionId, logGroupId, resourceOptions) { | ||
const options = resourceOptions || {}; | ||
const dependencies = options.dependencies ? [].concat(options.dependencies) : []; | ||
dependencies.push(functionName); | ||
dependencies.push(functionId, logGroupId); | ||
@@ -13,3 +13,3 @@ return { | ||
ServiceToken: { | ||
'Fn::GetAtt': [functionName, 'Arn'] | ||
'Fn::GetAtt': [functionId, 'Arn'] | ||
} | ||
@@ -16,0 +16,0 @@ }), |
{ | ||
"name": "add-custom-resource", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "A helper library to add custom resources to a CloudFormation template", | ||
@@ -5,0 +5,0 @@ "main": "add-custom-resource.js", |
9973
191