-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests for - fix the case of per-function custom Role #157
Conversation
# Conflicts: # test/updateAliasStack.test.js
@HyperBrain I'm not sure about this fix, could you review? |
Relates to #88 as well BTW I use this fix in production, it works fine. |
@aleksdikanski could u review / approve? |
lib/stackops/lambdaRole.js
Outdated
}; | ||
const dependencyIndex = _.indexOf(func.DependsOn, 'IamRoleLambdaExecution'); | ||
func.DependsOn[dependencyIndex] = roleLogicalId; | ||
if (_.isEqual(func.Properties.Role, { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn' ]})) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to not use if
in this instance but use _.filter
to select the right elements. This goes more with the functional approach, e.g.,:
_.forEach(_.filter(functions, func => _.isEqual(func.Properties.Role, { 'Fn::Gett': ... })), func => ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it
…role Tests for - fix the case of per-function custom Role
duplicate of #145 with tests written for case when function has custom role name.