Skip to content

Commit

Permalink
fix(target): Fix step function target policy
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelManke committed Apr 22, 2023
1 parent 43cbb8f commit e99d193
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .projenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const project = new awscdk.AwsCdkConstructLibrary({
'cdk:deploy:target:eventbus:dynamo-stream': "cdk deploy --app 'npx ts-node --prefer-ts-exts e2e/targets/EventBus/DynamoStreamEventBus.ts'",
'cdk:deploy:target:eventbus:sqs': "cdk deploy --app 'npx ts-node --prefer-ts-exts e2e/targets/EventBus/SqsEventBus.ts'",
'cdk:deploy:target:eventbus:kinesis-stream': "cdk deploy --app 'npx ts-node --prefer-ts-exts e2e/targets/EventBus/KinesisStreamEventBus.ts'",
'cdk:deploy:target:stepfunction:sqs': "cdk deploy --app 'npx ts-node --prefer-ts-exts e2e/targets/StepFunction/SqsStepFunction.ts'",
'cdk:deploy:all:sqs:sfn:eventbus': "cdk deploy --app 'npx ts-node --prefer-ts-exts e2e/SqsSfnEventBus.ts'",
},
deps: [
Expand Down
6 changes: 3 additions & 3 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fileignoreconfig:
- filename: e2e/SqsSfnEventBus.ts
checksum: 5f1ecebc35cd23f2b7b05239a2f17795e18936ce5bd08c5b5e761fa746d94c0c
- filename: e2e/targets/StepFunction/SqsStepFunction.ts
checksum: 08ee1494a9bab2ff12f3075469db17734b4a407bd5335e56012c296ff36d7b3b
version: ""
cksum: 3ad06860bbaaa3b41e9e3dfe665ede1564446fa7052a4ed7fdf609af7ce5bcc1
41e9e3dfe665ede1564446fa7052a4ed7fdf609af7ce5bcc1
- filename: e2e/sources/kafkaProducer.ts
checksum: d8518b18d16551a7ffc49b7c0683b5fdf4c82a9d1709ca3330eada84c0993183
- filename: src/PipeInputTransformation.test.ts
Expand Down
31 changes: 31 additions & 0 deletions e2e/targets/StepFunction/SqsStepFunction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { App, Stack } from 'aws-cdk-lib';
import { LogGroup } from 'aws-cdk-lib/aws-logs';
import { Queue } from 'aws-cdk-lib/aws-sqs';
import { Pass, StateMachine, StateMachineType, LogLevel } from 'aws-cdk-lib/aws-stepfunctions';
import { Pipe, SqsSource, StepFunctionTarget } from '../../../src';

const app = new App();
const stack = new Stack(app, 'E2EPipesSqsStepFunction', {});

const sourceQueue = new Queue(stack, 'SourceQueue');
const source = new SqsSource(sourceQueue);
const sfnDefinition = new Pass(stack, 'Pass');
const sfnLoggroup = new LogGroup(stack, 'SfnLogGroup');

const stateMachine = new StateMachine(stack, 'QueueHandlerStateMachine', {
definition: sfnDefinition,
stateMachineType: StateMachineType.EXPRESS,
logs: {
destination: sfnLoggroup,
level: LogLevel.ALL,
includeExecutionData: true,
},
});

const target = new StepFunctionTarget(stateMachine);
new Pipe(stack, 'Pipe', {
source,
target,
});

// DEBUG: add a rule to the event bus to see what messages are being sent
1 change: 1 addition & 0 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/targets/StepFunctionTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ export class StepFunctionTarget implements IPipeTarget {
}

grantPush(grantee: IRole): void {
this.stateMachine.grantExecution(grantee);
this.stateMachine.grantExecution(grantee, 'states:StartSyncExecution', 'states:StartExecution');
}
}

0 comments on commit e99d193

Please sign in to comment.