{"action":"created","issue":{"url":"https://api.github.com/repos/serverless/serverless/issues/3083","repository_url":"https://api.github.com/repos/serverless/serverless","labels_url":"https://api.github.com/repos/serverless/serverless/issues/3083/labels{/name}","comments_url":"https://api.github.com/repos/serverless/serverless/issues/3083/comments","events_url":"https://api.github.com/repos/serverless/serverless/issues/3083/events","html_url":"https://github.com/serverless/serverless/pull/3083","id":199986309,"number":3083,"title":"Allow Role 'Fn::GetAtt' for Lambda `role`","user":{"login":"erikerikson","id":571200,"avatar_url":"https://avatars.githubusercontent.com/u/571200?v=3","gravatar_id":"","url":"https://api.github.com/users/erikerikson","html_url":"https://github.com/erikerikson","followers_url":"https://api.github.com/users/erikerikson/followers","following_url":"https://api.github.com/users/erikerikson/following{/other_user}","gists_url":"https://api.github.com/users/erikerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/erikerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikerikson/subscriptions","organizations_url":"https://api.github.com/users/erikerikson/orgs","repos_url":"https://api.github.com/users/erikerikson/repos","events_url":"https://api.github.com/users/erikerikson/events{/privacy}","received_events_url":"https://api.github.com/users/erikerikson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/serverless/serverless/milestones/21","html_url":"https://github.com/serverless/serverless/milestone/21","labels_url":"https://api.github.com/repos/serverless/serverless/milestones/21/labels","id":2204191,"number":21,"title":"1.6","description":"OpenWhisk support, CloudWatch Event source, F# template, Inline policies, custom stack names, local invocation of Python-based runtime support, Opt-out for Lambda versioning, SNS events for existing topics, refactorings and bugfixes.","creator":{"login":"eahefnawy","id":2312463,"avatar_url":"https://avatars.githubusercontent.com/u/2312463?v=3","gravatar_id":"","url":"https://api.github.com/users/eahefnawy","html_url":"https://github.com/eahefnawy","followers_url":"https://api.github.com/users/eahefnawy/followers","following_url":"https://api.github.com/users/eahefnawy/following{/other_user}","gists_url":"https://api.github.com/users/eahefnawy/gists{/gist_id}","starred_url":"https://api.github.com/users/eahefnawy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eahefnawy/subscriptions","organizations_url":"https://api.github.com/users/eahefnawy/orgs","repos_url":"https://api.github.com/users/eahefnawy/repos","events_url":"https://api.github.com/users/eahefnawy/events{/privacy}","received_events_url":"https://api.github.com/users/eahefnawy/received_events","type":"User","site_admin":false},"open_issues":18,"closed_issues":17,"state":"open","created_at":"2016-12-19T10:20:23Z","updated_at":"2017-01-24T18:17:37Z","due_on":"2017-01-31T08:00:00Z","closed_at":null},"comments":2,"created_at":"2017-01-11T02:14:09Z","updated_at":"2017-01-24T18:18:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/serverless/serverless/pulls/3083","html_url":"https://github.com/serverless/serverless/pull/3083","diff_url":"https://github.com/serverless/serverless/pull/3083.diff","patch_url":"https://github.com/serverless/serverless/pull/3083.patch"},"body":"<!--\r\n1. Please check out and follow our Contributing Guidelines: https://github.com/serverless/serverless/blob/master/CONTRIBUTING.md\r\n2. Do not remove any section of the template. If something is not applicable leave it empty but leave it in the PR\r\n3. Please follow the template, otherwise we'll have to ask you to update it and it will take longer until your PR is merged\r\n-->\r\n\r\n## What did you implement:\r\n\r\nFixes https://github.com/serverless/serverless/issues/3081 by allowing the role defined for a Lambda to be a reference (e.g. `{ 'Fn::GetAtt', [ 'LambdaLogicalId', 'Arn'] }`) to a role in the current service.  If the `role` attribute is defined, check whether it is a role reference and if it is, fill the `DependsOn` attribute for the event mapping to be that logical ID.\r\nAdd tests that make sure this use case is covered in future incarnations of the code.\r\n\r\n<!--\r\nBriefly describe the feature if no issue exists for this PR\r\n-->\r\n\r\n## How did you implement it:\r\n\r\n<!--\r\nIf this is a nontrivial change please briefly describe your implementation so its easy for us to understand and review your code.\r\n-->\r\n\r\nevaluate the role attribute (from either function or provider) and if it is a `Fn::GetAtt` to an ARN (which uses a LogicalId) use that logical ID as the value for `DependsOn`.\r\n\r\n## How can we verify it:\r\n\r\n<!--\r\nAdd any applicable config, commands, screenshots or other resources\r\nto make it easy for us to verify this works. The easier you make it for us\r\nto review a PR, the faster we can review and merge it.\r\n\r\nExamples:\r\n* serverless.yml - Fully functioning to easily deploy changes\r\n* Screenshots - Showing the difference between your output and the master\r\n* AWS CLI commands - To list AWS resources and show that the correct config is in place\r\n* Other - Anything else that comes to mind to help us evaluate\r\n-->\r\n\r\nSee tests in this PR.  Alternatively, define a role in your service.  Then use that role by reference by defining role on the provider and subsequently on the function.  Deploy with both configurations. \r\n\r\n## Todos:\r\n\r\n- [x] Write tests\r\n- [x] Write documentation\r\n- [x] Fix linting errors\r\n- [x] Make sure code coverage hasn't dropped\r\n- [x] Provide verification config/commands/resources\r\n- [x] Enable [\"Allow edits from maintainers\"](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) for this PR\r\n- [x] Change ready for review message below\r\n\r\nNote that with regards to the documentation, this shouldn't be a change.  I didn't check.\r\n\r\n***Is this ready for review?:*** YES\r\n***Is it a breaking change?:*** NO"},"comment":{"url":"https://api.github.com/repos/serverless/serverless/issues/comments/274889158","html_url":"https://github.com/serverless/serverless/pull/3083#issuecomment-274889158","issue_url":"https://api.github.com/repos/serverless/serverless/issues/3083","id":274889158,"user":{"login":"erikerikson","id":571200,"avatar_url":"https://avatars.githubusercontent.com/u/571200?v=3","gravatar_id":"","url":"https://api.github.com/users/erikerikson","html_url":"https://github.com/erikerikson","followers_url":"https://api.github.com/users/erikerikson/followers","following_url":"https://api.github.com/users/erikerikson/following{/other_user}","gists_url":"https://api.github.com/users/erikerikson/gists{/gist_id}","starred_url":"https://api.github.com/users/erikerikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikerikson/subscriptions","organizations_url":"https://api.github.com/users/erikerikson/orgs","repos_url":"https://api.github.com/users/erikerikson/repos","events_url":"https://api.github.com/users/erikerikson/events{/privacy}","received_events_url":"https://api.github.com/users/erikerikson/received_events","type":"User","site_admin":false},"created_at":"2017-01-24T18:18:03Z","updated_at":"2017-01-24T18:18:03Z","body":"Thanks @pmuens!"}}
{"actor":{"display_login":"erikerikson"}}