@mapbox/magic-cfn-resources
Advanced tools
Comparing version 1.2.5 to 1.2.6
@@ -60,3 +60,3 @@ // builds cfn resources for lambda function | ||
CustomResource[params.LogicalName] = { | ||
Type: cf.join('',['Custom::',params.CustomResourceName]), | ||
Type: 'Custom::'+params.CustomResourceName, | ||
Properties: Object.assign({ ServiceToken: cf.getAtt(`${params.LogicalName}Function`, 'Arn')}, params.Properties) | ||
@@ -63,0 +63,0 @@ }; |
{ | ||
"name": "@mapbox/magic-cfn-resources", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"description": "Build Lambda-backed custom CloudFormation resources", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -207,27 +207,29 @@ const build = require('../lib/build').build; | ||
test('[build] success on SnsSubscription', assert => { | ||
const template = build({ | ||
CustomResourceName: 'SnsSubscription', | ||
LogicalName: 'SnsSubscriptionLogicalName', | ||
S3Key: 'lambda/code', | ||
S3Bucket: 'code', | ||
Handler: 'my.handler', | ||
Properties: { | ||
Protocol: 'email', | ||
TopicArn: 'arn:aws:sns:us-east-1:special-topic', | ||
Endpoint: 'someone@mapbox.com' | ||
} | ||
}); | ||
test('[build] success on SnsSubscription', assert => { | ||
const template = build({ | ||
CustomResourceName: 'SnsSubscription', | ||
LogicalName: 'SnsSubscriptionLogicalName', | ||
S3Key: 'lambda/code', | ||
S3Bucket: 'code', | ||
Handler: 'my.handler', | ||
Properties: { | ||
Protocol: 'email', | ||
TopicArn: 'arn:aws:sns:us-east-1:special-topic', | ||
Endpoint: 'someone@mapbox.com' | ||
} | ||
}); | ||
assert.deepEquals(Object.keys(template.Resources), ['SnsSubscriptionLogicalNameRole', 'SnsSubscriptionLogicalNameFunction', 'SnsSubscriptionLogicalName'], 'role, function, and custom resource use logical name'); | ||
assert.equals(template.Resources.SnsSubscriptionLogicalNameRole.Type, 'AWS::IAM::Role', 'Type is AWS::IAM::Role'); | ||
assert.equals(template.Resources.SnsSubscriptionLogicalNameFunction.Type, 'AWS::Lambda::Function', 'Type is AWS::Lambda::Function'); | ||
assert.equals(template.Resources.SnsSubscriptionLogicalNameFunction.Properties.Code.S3Bucket, 'code', 'S3Bucket is params.S3Bucket'); | ||
assert.deepEquals(template.Resources.SnsSubscriptionLogicalNameFunction.Properties.Code.S3Key, 'lambda/code', 'S3Key is params.S3Key'); | ||
assert.deepEqual(template.Resources.SnsSubscriptionLogicalName.Type,'Custom::SnsSubscription', 'Type equals Custom::SnSSubnscription'); | ||
assert.ok( typeof template.Resources.SnsSubscriptionLogicalName.Type === 'string', 'Resource Type name is a string'); | ||
assert.equals(template.Resources.SnsSubscriptionLogicalNameFunction.Properties.Handler, 'my.handler', 'Handler is params.Handler'); | ||
assert.end(); | ||
}); | ||
assert.deepEquals(Object.keys(template.Resources), ['SnsSubscriptionLogicalNameRole', 'SnsSubscriptionLogicalNameFunction', 'SnsSubscriptionLogicalName'], 'role, function, and custom resource use logical name'); | ||
assert.equals(template.Resources.SnsSubscriptionLogicalNameRole.Type, 'AWS::IAM::Role', 'Type is AWS::IAM::Role'); | ||
assert.equals(template.Resources.SnsSubscriptionLogicalNameFunction.Type, 'AWS::Lambda::Function', 'Type is AWS::Lambda::Function'); | ||
assert.equals(template.Resources.SnsSubscriptionLogicalNameFunction.Properties.Code.S3Bucket, 'code', 'S3Bucket is params.S3Bucket'); | ||
assert.deepEquals(template.Resources.SnsSubscriptionLogicalNameFunction.Properties.Code.S3Key, 'lambda/code', 'S3Key is params.S3Key'); | ||
assert.equals(template.Resources.SnsSubscriptionLogicalNameFunction.Properties.Handler, 'my.handler', 'Handler is params.Handler'); | ||
assert.end(); | ||
}); | ||
test('[build] success with Conditional', assert => { | ||
@@ -255,4 +257,5 @@ var params = { | ||
assert.equals(template.Resources.SpotFleetLogicalName.Condition, 'Conditional', 'Conditional in Custom Resource'); | ||
assert.deepEqual(template.Resources.SpotFleetLogicalName.Type, { 'Fn::Join': [ '', [ 'Custom::', params.CustomResourceName ] ] }, 'Type equals Custom::params.CustomResourceName'); | ||
assert.deepEqual(template.Resources.SpotFleetLogicalName.Type,'Custom::'+params.CustomResourceName, 'Type equals Custom::params.CustomResourceName'); | ||
assert.ok( typeof template.Resources.SpotFleetLogicalName.Type === 'string', 'Resource Type name is a string'); | ||
assert.end(); | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6
481322
21
1707