File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ module.exports = {
1212 customRolesProvided . push ( 'role' in stateMachineObj ) ;
1313
1414 const stateMachineJson = JSON . stringify ( stateMachineObj ) ;
15- const regex = new RegExp ( / " R e s o u r c e " : " ( [ a - z : # { } _ \- . ] * ) " / gi) ;
15+ const regex = new RegExp ( / " R e s o u r c e " : " ( [ \w \- : * ] * ) " / gi) ;
1616 let match = regex . exec ( stateMachineJson ) ;
1717 while ( match !== null ) {
1818 functionArns . push ( match [ 1 ] ) ;
Original file line number Diff line number Diff line change @@ -87,8 +87,9 @@ describe('#compileIamRole', () => {
8787 } ) ;
8888
8989 it ( 'should give invokeFunction permission for only functions referenced by state machine' , ( ) => {
90- const helloLambda = 'arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:hello' ;
91- const worldLambda = 'arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:world' ;
90+ const helloLambda = 'arn:aws:lambda:123:*:function:hello' ;
91+ const worldLambda = 'arn:aws:lambda:*:*:function:world' ;
92+ const fooLambda = 'arn:aws:lambda:us-west-2::function:foo_' ;
9293 serverless . service . stepFunctions = {
9394 stateMachines : {
9495 myStateMachine1 : {
@@ -117,6 +118,19 @@ describe('#compileIamRole', () => {
117118 } ,
118119 } ,
119120 } ,
121+ myStateMachine3 : {
122+ name : 'stateMachineBeta3' ,
123+ definition : {
124+ StartAt : 'Foo' ,
125+ States : {
126+ Hello : {
127+ Type : 'Task' ,
128+ Resource : fooLambda ,
129+ End : true ,
130+ } ,
131+ } ,
132+ } ,
133+ } ,
120134 } ,
121135 } ;
122136
@@ -125,6 +139,6 @@ describe('#compileIamRole', () => {
125139 . provider . compiledCloudFormationTemplate . Resources . IamRoleStateMachineExecution
126140 . Properties . Policies [ 0 ] ;
127141 expect ( policy . PolicyDocument . Statement [ 0 ] . Resource )
128- . to . be . deep . equal ( [ helloLambda , worldLambda ] ) ;
142+ . to . be . deep . equal ( [ helloLambda , worldLambda , fooLambda ] ) ;
129143 } ) ;
130144} ) ;
You can’t perform that action at this time.
0 commit comments