Skip to content

Commit

Permalink
Merge pull request #99 from hudl/SK24-AddRoleToSlackInstallFunc
Browse files Browse the repository at this point in the history
SK24 - Add role to Slack Install in order to access secrets
  • Loading branch information
ppoulsen authored Oct 24, 2024
2 parents 1463285 + 6b29ff0 commit 10c391a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ functions:
- http:
path: 'slack/install'
method: get
role: slackbotRole
create-user:
handler: src/index.createUser
events:
Expand Down Expand Up @@ -124,6 +125,16 @@ resources:
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'table/cal2slack-usersettings'
- Effect: Allow
Action:
- secretsmanager:GetSecretValue
Resource:
- 'Fn::Join':
- ':'
- - 'arn:aws:secretsmanager'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'secret:${self:custom.lambda.slackbot.secretsPrefix}/*'
- Effect: 'Allow'
Action:
- lambda:InvokeFunction
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export const authorizeMicrosoftGraph: Handler = async (event: any) => {
};

export const slackInstall: Handler = async () => {
console.log('Slack install requested.')
const clientId = await getSlackClientIdWithKey('clientId');

return {
Expand Down

0 comments on commit 10c391a

Please sign in to comment.