diff --git a/lib/deploy/stepFunctions/compileIamRole.js b/lib/deploy/stepFunctions/compileIamRole.js index ddcabc7..c3675c8 100644 --- a/lib/deploy/stepFunctions/compileIamRole.js +++ b/lib/deploy/stepFunctions/compileIamRole.js @@ -595,8 +595,9 @@ function getBedrockPermissions(state) { function getEventBridgePermissions(state) { const eventBuses = new Set(); + const entries = getParameterOrArgument(state, 'Entries'); - for (const entry of state.Parameters.Entries) { + for (const entry of entries) { eventBuses.add(entry.EventBusName || 'default'); } diff --git a/lib/deploy/stepFunctions/compileIamRole.test.js b/lib/deploy/stepFunctions/compileIamRole.test.js index 4b71c39..8bc28f7 100644 --- a/lib/deploy/stepFunctions/compileIamRole.test.js +++ b/lib/deploy/stepFunctions/compileIamRole.test.js @@ -4182,21 +4182,22 @@ describe('#compileIamRole', () => { ]); }); - it('should give event bridge putEvents permissions', () => { + itParam('should give event bridge putEvents permissions: ${value}', ['JSONPath', 'JSONata'], (queryLanguage) => { const genStateMachine = id => ({ id, definition: { + QueryLanguage: queryLanguage, StartAt: 'A', States: { A: { Type: 'Task', Resource: 'arn:aws:states:::events:putEvents', - Parameters: { + ...getParamsOrArgs(queryLanguage, { Entries: [{ Source: 'source', DetailType: 'DetailType', }], - }, + }), End: true, }, }, @@ -4224,16 +4225,17 @@ describe('#compileIamRole', () => { }]); }); - it('should give event bridge putEvents multiple permissions', () => { + itParam('should give event bridge putEvents multiple permissions: ${value}', ['JSONPath', 'JSONata'], (queryLanguage) => { const genStateMachine = id => ({ id, definition: { + QueryLanguage: queryLanguage, StartAt: 'A', States: { A: { Type: 'Task', Resource: 'arn:aws:states:::events:putEvents', - Parameters: { + ...getParamsOrArgs(queryLanguage, { Entries: [ { Source: 'source', @@ -4246,7 +4248,7 @@ describe('#compileIamRole', () => { EventBusName: 'custom', }, ], - }, + }), End: true, }, },