File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 11import { Construct } from "constructs"
22import { LambdaFunction } from "../constructs/LambdaFunction"
3- import { ManagedPolicy } from "aws-cdk-lib/aws-iam"
3+ import { ManagedPolicy , PolicyStatement , Role } from "aws-cdk-lib/aws-iam"
44import { StringParameter } from "aws-cdk-lib/aws-ssm"
55import { Secret } from "aws-cdk-lib/aws-secretsmanager"
66import { TableV2 } from "aws-cdk-lib/aws-dynamodb"
@@ -75,6 +75,30 @@ export class Functions extends Construct {
7575 props . slackBotTokenSecret . grantRead ( slackBotLambda . function )
7676 props . slackBotSigningSecret . grantRead ( slackBotLambda . function )
7777
78+ if ( props . isPullRequest ) {
79+ const mainSlackBotLambdaExecutionRole = Role . fromRoleArn (
80+ this ,
81+ "mainRoleArn" ,
82+ props . mainSlackBotLambdaExecutionRoleArn , {
83+ mutable : true
84+ } )
85+
86+ const executeSlackBotPolicy = new ManagedPolicy ( this , "ExecuteSlackBotPolicy" , {
87+ description : "foo" ,
88+ statements : [
89+ new PolicyStatement ( {
90+ actions : [
91+ "lambda.invokeFunction"
92+ ] ,
93+ resources : [
94+ slackBotLambda . function . functionArn
95+ ]
96+ } )
97+ ]
98+ } )
99+ mainSlackBotLambdaExecutionRole . addManagedPolicy ( executeSlackBotPolicy )
100+ }
101+
78102 // Lambda function to sync knowledge base on S3 events
79103 const syncKnowledgeBaseFunction = new LambdaFunction ( this , "SyncKnowledgeBaseFunction" , {
80104 stackName : props . stackName ,
You can’t perform that action at this time.
0 commit comments