Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions lib/plugins/aws/package/compile/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ class AwsCompileFunctions {
} else if (role === 'IamRoleLambdaExecution') {
// role is the default role generated by the framework
compiledFunction.Properties.Role = { 'Fn::GetAtt': [role, 'Arn'] };
compiledFunction.DependsOn = (compiledFunction.DependsOn || []).concat(
'IamRoleLambdaExecution'
);
} else {
// role is a Logical Role Name
compiledFunction.Properties.Role = { 'Fn::GetAtt': [role, 'Arn'] };
Expand Down
79 changes: 39 additions & 40 deletions lib/plugins/aws/package/compile/functions/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ describe('AwsCompileFunctions', () => {
};
const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -547,7 +547,7 @@ describe('AwsCompileFunctions', () => {
};
const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -591,7 +591,7 @@ describe('AwsCompileFunctions', () => {
};
const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -637,7 +637,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -682,7 +682,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -732,7 +732,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -834,7 +834,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -899,7 +899,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -941,7 +941,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -983,7 +983,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1025,7 +1025,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1118,7 +1118,7 @@ describe('AwsCompileFunctions', () => {
Timeout: 6,
KmsKeyArn: { 'Fn::GetAtt': ['MyKms', 'Arn'] },
},
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
};

return expect(awsCompileFunctions.compileFunctions()).to.be.fulfilled.then(() => {
Expand Down Expand Up @@ -1155,7 +1155,7 @@ describe('AwsCompileFunctions', () => {
Timeout: 6,
KmsKeyArn: { Ref: 'foobar' },
},
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
};

return expect(awsCompileFunctions.compileFunctions()).to.be.fulfilled.then(() => {
Expand Down Expand Up @@ -1192,7 +1192,7 @@ describe('AwsCompileFunctions', () => {
Timeout: 6,
KmsKeyArn: { 'Fn::ImportValue': 'KmsKey' },
},
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
};

return expect(awsCompileFunctions.compileFunctions()).to.be.fulfilled.then(() => {
Expand Down Expand Up @@ -1246,7 +1246,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1290,7 +1290,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction1 = {
Type: 'AWS::Lambda::Function',
DependsOn: ['Func1LogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['Func1LogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand All @@ -1308,7 +1308,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction2 = {
Type: 'AWS::Lambda::Function',
DependsOn: ['Func2LogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['Func2LogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1362,7 +1362,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1411,7 +1411,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1476,7 +1476,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1523,7 +1523,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction1 = {
Type: 'AWS::Lambda::Function',
DependsOn: ['Func1LogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['Func1LogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand All @@ -1543,7 +1543,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction2 = {
Type: 'AWS::Lambda::Function',
DependsOn: ['Func2LogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['Func2LogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1599,7 +1599,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1650,7 +1650,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1702,7 +1702,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1749,7 +1749,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1795,7 +1795,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1844,7 +1844,7 @@ describe('AwsCompileFunctions', () => {

const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1953,7 +1953,7 @@ describe('AwsCompileFunctions', () => {
};
const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -1995,7 +1995,7 @@ describe('AwsCompileFunctions', () => {
return expect(awsCompileFunctions.compileFunctions()).to.be.fulfilled.then(() => {
const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -2032,7 +2032,7 @@ describe('AwsCompileFunctions', () => {
};
const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -2070,7 +2070,7 @@ describe('AwsCompileFunctions', () => {
};
const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -2111,7 +2111,7 @@ describe('AwsCompileFunctions', () => {
};
const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -2290,7 +2290,7 @@ describe('AwsCompileFunctions', () => {
};
const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -2346,7 +2346,7 @@ describe('AwsCompileFunctions', () => {
};
const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -2419,13 +2419,12 @@ describe('AwsCompileFunctions', () => {
});

describe('#compileRole()', () => {
it('adds the default role with DependsOn values', () => {
it('adds the default role without DependsOn values', () => {
const role = 'IamRoleLambdaExecution';
const resource = { Properties: {} };
awsCompileFunctions.compileRole(resource, role);

expect(resource).to.deep.equal({
DependsOn: [role],
Properties: {
Role: {
'Fn::GetAtt': [role, 'Arn'],
Expand Down Expand Up @@ -2523,7 +2522,7 @@ describe('AwsCompileFunctions', () => {
};
const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -2561,7 +2560,7 @@ describe('AwsCompileFunctions', () => {
};
const compiledFunction = {
Type: 'AWS::Lambda::Function',
DependsOn: ['FuncLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['FuncLogGroup'],
Properties: {
Code: {
S3Key: `${s3Folder}/${s3FileName}`,
Expand Down Expand Up @@ -2615,7 +2614,7 @@ describe('AwsCompileFunctions', () => {
expect(
awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources
.FuncLambdaFunction.DependsOn
).to.deep.equal(['FuncLogGroup', 'MyThing', 'MyOtherThing', 'IamRoleLambdaExecution']);
).to.deep.equal(['FuncLogGroup', 'MyThing', 'MyOtherThing']);
});
});
});
Expand Down
6 changes: 3 additions & 3 deletions tests/integration-package/cloudformation.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('Integration test - Packaging - CloudFormation', () => {
Runtime: 'nodejs12.x',
Timeout: 6,
},
DependsOn: ['HelloLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['HelloLogGroup'],
});
});

Expand Down Expand Up @@ -78,7 +78,7 @@ describe('Integration test - Packaging - CloudFormation', () => {
Runtime: 'nodejs12.x',
Timeout: 6,
},
DependsOn: ['HelloLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['HelloLogGroup'],
});
});

Expand Down Expand Up @@ -112,7 +112,7 @@ describe('Integration test - Packaging - CloudFormation', () => {
Runtime: 'nodejs12.x',
Timeout: 6,
},
DependsOn: ['HelloLogGroup', 'IamRoleLambdaExecution'],
DependsOn: ['HelloLogGroup'],
});
});

Expand Down