@mbc-cqrs-serverless/cli 0.1.52-beta.0 → 0.1.54-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mbc-cqrs-serverless/cli",
3
- "version": "0.1.52-beta.0",
3
+ "version": "0.1.54-beta.0",
4
4
  "description": "a CLI to get started with MBC CQRS serverless framework",
5
5
  "keywords": [
6
6
  "mbc",
@@ -58,5 +58,5 @@
58
58
  "@faker-js/faker": "^8.3.1",
59
59
  "copyfiles": "^2.4.1"
60
60
  },
61
- "gitHead": "b394c87cfdcaeb92a6c09e364e5cdfd9937c0e02"
61
+ "gitHead": "3a3878b294b0608e3b85f14029f402f6b5622a73"
62
62
  }
@@ -26,6 +26,7 @@ S3_BUCKET_NAME=local-bucket
26
26
  SFN_ENDPOINT=http://localhost:8083
27
27
  SFN_REGION=ap-northeast-1
28
28
  SFN_COMMAND_ARN=arn:aws:states:ap-northeast-1:101010101010:stateMachine:command
29
+ SFN_TASK_ARN=arn:aws:states:ap-northeast-1:101010101010:stateMachine:sfn-task
29
30
  # SNS endpoint, useful for local development
30
31
  SNS_ENDPOINT=http://localhost:4002
31
32
  SNS_REGION=ap-northeast-1
@@ -33,6 +33,7 @@ export class InfraStack extends cdk.Stack {
33
33
  public readonly httpApiUrl: cdk.CfnOutput
34
34
  public readonly stateMachineArn: cdk.CfnOutput
35
35
  public readonly httpDistributionDomain: cdk.CfnOutput
36
+ public readonly sfnTaskStateMachineArn: cdk.CfnOutput
36
37
 
37
38
  constructor(scope: Construct, id: string, props: InfraStackProps) {
38
39
  super(scope, id, props)
@@ -114,6 +115,14 @@ export class InfraStack extends cdk.Stack {
114
115
  },
115
116
  })
116
117
 
118
+ const subTaskStatusSqs = new cdk.aws_sqs.Queue(
119
+ this,
120
+ 'sub-task-status-sqs',
121
+ {
122
+ queueName: prefix + 'sub-task-status-queue',
123
+ },
124
+ )
125
+
117
126
  alarmSns.addSubscription(
118
127
  new cdk.aws_sns_subscriptions.SqsSubscription(taskDlSqs, {
119
128
  rawMessageDelivery: true,
@@ -143,6 +152,17 @@ export class InfraStack extends cdk.Stack {
143
152
  },
144
153
  }),
145
154
  )
155
+
156
+ mainSns.addSubscription(
157
+ new cdk.aws_sns_subscriptions.SqsSubscription(subTaskStatusSqs, {
158
+ rawMessageDelivery: true,
159
+ filterPolicy: {
160
+ action: cdk.aws_sns.SubscriptionFilter.stringFilter({
161
+ allowlist: ['sub-task-status'],
162
+ }),
163
+ },
164
+ }),
165
+ )
146
166
  // host zone
147
167
  const hostedZone = cdk.aws_route53.HostedZone.fromHostedZoneAttributes(
148
168
  this,
@@ -322,6 +342,17 @@ export class InfraStack extends cdk.Stack {
322
342
  arnFormat: cdk.ArnFormat.COLON_RESOURCE_NAME,
323
343
  })
324
344
 
345
+ const taskStateMachineName = prefix + 'sfn-task-handler'
346
+ const taskSfnArn = cdk.Arn.format({
347
+ partition: 'aws',
348
+ region: this.region,
349
+ account: this.account,
350
+ service: 'states',
351
+ resource: 'stateMachine',
352
+ resourceName: taskStateMachineName,
353
+ arnFormat: cdk.ArnFormat.COLON_RESOURCE_NAME,
354
+ })
355
+
325
356
  // Lambda api ( arm64 )
326
357
  const execEnv = {
327
358
  NODE_OPTIONS: '--enable-source-maps',
@@ -333,6 +364,7 @@ export class InfraStack extends cdk.Stack {
333
364
  ATTRIBUTE_LIMIT_SIZE: '389120',
334
365
  S3_BUCKET_NAME: ddbBucket.bucketName,
335
366
  SFN_COMMAND_ARN: commandSfnArn,
367
+ SFN_TASK_ARN: taskSfnArn,
336
368
  SNS_TOPIC_ARN: mainSns.topicArn,
337
369
  SNS_ALARM_TOPIC_ARN: alarmSns.topicArn,
338
370
  COGNITO_USER_POOL_ID: userPool.userPoolId,
@@ -735,7 +767,7 @@ export class InfraStack extends cdk.Stack {
735
767
  cdk.aws_stepfunctions.IntegrationPattern.REQUEST_RESPONSE,
736
768
  )
737
769
 
738
- const sfnLogGroup = new cdk.aws_logs.LogGroup(
770
+ const commandSfnLogGroup = new cdk.aws_logs.LogGroup(
739
771
  this,
740
772
  'command-handler-sfn-log',
741
773
  {
@@ -756,7 +788,7 @@ export class InfraStack extends cdk.Stack {
756
788
  cdk.aws_stepfunctions.DefinitionBody.fromChainable(sfnDefinition),
757
789
  tracingEnabled: true,
758
790
  logs: {
759
- destination: sfnLogGroup,
791
+ destination: commandSfnLogGroup,
760
792
  level: cdk.aws_stepfunctions.LogLevel.ALL, // Log level (ALL, ERROR, or FATAL)
761
793
  },
762
794
  },
@@ -767,6 +799,58 @@ export class InfraStack extends cdk.Stack {
767
799
  value: stateMachine.stateMachineArn,
768
800
  })
769
801
 
802
+ //
803
+ const invokeLambdaSfnTask = lambdaInvoke(
804
+ 'iterator',
805
+ null,
806
+ cdk.aws_stepfunctions.IntegrationPattern.REQUEST_RESPONSE,
807
+ )
808
+
809
+ const sfnTaskMapState = new cdk.aws_stepfunctions.Map(
810
+ this,
811
+ 'TaskMapState',
812
+ {
813
+ stateName: 'map_state',
814
+ maxConcurrency: 2,
815
+ inputPath: '$',
816
+ itemsPath: cdk.aws_stepfunctions.JsonPath.stringAt('$'),
817
+ },
818
+ ).itemProcessor(invokeLambdaSfnTask)
819
+
820
+ const taskSfnLogGroup = new cdk.aws_logs.LogGroup(
821
+ this,
822
+ 'task-handler-sfn-log',
823
+ {
824
+ logGroupName: `/aws/vendedlogs/states/${prefix}task-handler-state-machine-Logs`, // Specify a log group name
825
+ removalPolicy: cdk.RemovalPolicy.DESTROY, // Policy for log group removal
826
+ retention: cdk.aws_logs.RetentionDays.SIX_MONTHS,
827
+ },
828
+ )
829
+
830
+ const taskStateMachine = new cdk.aws_stepfunctions.StateMachine(
831
+ this,
832
+ 'task-handler-state-machine',
833
+ {
834
+ stateMachineName: taskStateMachineName,
835
+ comment: 'A state machine for task handler',
836
+ definition: sfnTaskMapState,
837
+ timeout: cdk.Duration.minutes(15), // Define overall state machine timeout if needed
838
+ tracingEnabled: true,
839
+ logs: {
840
+ destination: taskSfnLogGroup,
841
+ level: cdk.aws_stepfunctions.LogLevel.ALL, // Log level (ALL, ERROR, or FATAL)
842
+ },
843
+ },
844
+ )
845
+
846
+ this.sfnTaskStateMachineArn = new cdk.CfnOutput(
847
+ this,
848
+ 'sfnTaskStateMachineArn',
849
+ {
850
+ value: taskStateMachine.stateMachineArn,
851
+ },
852
+ )
853
+
770
854
  // add event sources to lambda event
771
855
  lambdaApi.addEventSource(
772
856
  new cdk.aws_lambda_event_sources.SqsEventSource(taskSqs, {
@@ -778,6 +862,11 @@ export class InfraStack extends cdk.Stack {
778
862
  batchSize: 1,
779
863
  }),
780
864
  )
865
+ lambdaApi.addEventSource(
866
+ new cdk.aws_lambda_event_sources.SqsEventSource(subTaskStatusSqs, {
867
+ batchSize: 1,
868
+ }),
869
+ )
781
870
  // dynamodb event source
782
871
  const tableNames = ['tasks', 'sample-command']
783
872
  for (const tableName of tableNames) {
@@ -879,6 +968,11 @@ export class InfraStack extends cdk.Stack {
879
968
  resources: [commandSfnArn],
880
969
  })
881
970
 
971
+ const taskSfnPolicy = new cdk.aws_iam.PolicyStatement({
972
+ actions: ['states:*'],
973
+ resources: [taskSfnArn], // Access to all resources
974
+ })
975
+
882
976
  // Attach the policy to the Lambda function's execution role
883
977
  lambdaApi.role?.attachInlinePolicy(
884
978
  new cdk.aws_iam.Policy(this, 'lambda-event-sfn-policy', {
@@ -891,6 +985,12 @@ export class InfraStack extends cdk.Stack {
891
985
  resources: ['*'],
892
986
  })
893
987
 
988
+ lambdaApi.role?.attachInlinePolicy(
989
+ new cdk.aws_iam.Policy(this, 'lambda-task-sfn-step-function-policy', {
990
+ statements: [taskSfnPolicy.copy()],
991
+ }),
992
+ )
993
+
894
994
  // Attach the policy to the Lambda function's execution role
895
995
  lambdaApi.role?.attachInlinePolicy(
896
996
  new cdk.aws_iam.Policy(this, 'lambda-ses-policy', {
@@ -48,7 +48,7 @@ exports[`snapshot test for InfraStack 1`] = `
48
48
  },
49
49
  },
50
50
  "UserPoolId": {
51
- "Value": "ap-northeast-1_xlQVMPxtx",
51
+ "Value": "ap-northeast-1_NfyqKTjPS",
52
52
  },
53
53
  "httpdistributiondomain": {
54
54
  "Value": {
@@ -58,6 +58,11 @@ exports[`snapshot test for InfraStack 1`] = `
58
58
  ],
59
59
  },
60
60
  },
61
+ "sfnTaskStateMachineArn": {
62
+ "Value": {
63
+ "Ref": "taskhandlerstatemachineA6256F18",
64
+ },
65
+ },
61
66
  },
62
67
  "Parameters": {
63
68
  "BootstrapVersion": {
@@ -91,7 +96,7 @@ exports[`snapshot test for InfraStack 1`] = `
91
96
  },
92
97
  {
93
98
  "Key": "name",
94
- "Value": "cdk-test-deploy",
99
+ "Value": "task-sfn-interation-map",
95
100
  },
96
101
  ],
97
102
  "Timeout": 120,
@@ -133,7 +138,7 @@ exports[`snapshot test for InfraStack 1`] = `
133
138
  },
134
139
  {
135
140
  "Key": "name",
136
- "Value": "cdk-test-deploy",
141
+ "Value": "task-sfn-interation-map",
137
142
  },
138
143
  ],
139
144
  },
@@ -141,8 +146,8 @@ exports[`snapshot test for InfraStack 1`] = `
141
146
  },
142
147
  "AppSyncCnameRecord408D9525": {
143
148
  "Properties": {
144
- "HostedZoneId": "Z083753814XLAICIY5OHU",
145
- "Name": "dev-appsync-cdk.mbc-cqrs-serverless.mbc-net.com.",
149
+ "HostedZoneId": "Z07014542L73WTE1YO27B",
150
+ "Name": "task-sfn-infra-appsync.developer-pionero.mbc-dev.com.",
146
151
  "ResourceRecords": [
147
152
  {
148
153
  "Fn::GetAtt": [
@@ -165,10 +170,10 @@ exports[`snapshot test for InfraStack 1`] = `
165
170
  },
166
171
  {
167
172
  "Key": "name",
168
- "Value": "cdk-test-deploy",
173
+ "Value": "task-sfn-interation-map",
169
174
  },
170
175
  ],
171
- "TopicName": "dev-cdk-test-deploy-alarm-sns",
176
+ "TopicName": "dev-task-sfn-interation-map-alarm-sns",
172
177
  },
173
178
  "Type": "AWS::SNS::Topic",
174
179
  },
@@ -197,14 +202,14 @@ exports[`snapshot test for InfraStack 1`] = `
197
202
  "SupportedIdentityProviders": [
198
203
  "COGNITO",
199
204
  ],
200
- "UserPoolId": "ap-northeast-1_xlQVMPxtx",
205
+ "UserPoolId": "ap-northeast-1_NfyqKTjPS",
201
206
  },
202
207
  "Type": "AWS::Cognito::UserPoolClient",
203
208
  },
204
209
  "commandhandlersfnlog9072E963": {
205
210
  "DeletionPolicy": "Delete",
206
211
  "Properties": {
207
- "LogGroupName": "/aws/vendedlogs/states/dev-cdk-test-deploy--command-handler-state-machine-Logs",
212
+ "LogGroupName": "/aws/vendedlogs/states/dev-task-sfn-interation-map--command-handler-state-machine-Logs",
208
213
  "RetentionInDays": 180,
209
214
  "Tags": [
210
215
  {
@@ -213,7 +218,7 @@ exports[`snapshot test for InfraStack 1`] = `
213
218
  },
214
219
  {
215
220
  "Key": "name",
216
- "Value": "cdk-test-deploy",
221
+ "Value": "task-sfn-interation-map",
217
222
  },
218
223
  ],
219
224
  },
@@ -333,7 +338,7 @@ exports[`snapshot test for InfraStack 1`] = `
333
338
  "Arn",
334
339
  ],
335
340
  },
336
- "StateMachineName": "dev-cdk-test-deploy-command-handler",
341
+ "StateMachineName": "dev-task-sfn-interation-map-command-handler",
337
342
  "Tags": [
338
343
  {
339
344
  "Key": "env",
@@ -341,7 +346,7 @@ exports[`snapshot test for InfraStack 1`] = `
341
346
  },
342
347
  {
343
348
  "Key": "name",
344
- "Value": "cdk-test-deploy",
349
+ "Value": "task-sfn-interation-map",
345
350
  },
346
351
  ],
347
352
  "TracingConfiguration": {
@@ -372,7 +377,7 @@ exports[`snapshot test for InfraStack 1`] = `
372
377
  },
373
378
  {
374
379
  "Key": "name",
375
- "Value": "cdk-test-deploy",
380
+ "Value": "task-sfn-interation-map",
376
381
  },
377
382
  ],
378
383
  },
@@ -447,7 +452,7 @@ exports[`snapshot test for InfraStack 1`] = `
447
452
  "ddbattributes95C63151": {
448
453
  "DeletionPolicy": "Delete",
449
454
  "Properties": {
450
- "BucketName": "dev-cdk-test-deploy-ddb-attributes",
455
+ "BucketName": "dev-task-sfn-interation-map-ddb-attributes",
451
456
  "CorsConfiguration": {
452
457
  "CorsRules": [
453
458
  {
@@ -479,7 +484,7 @@ exports[`snapshot test for InfraStack 1`] = `
479
484
  },
480
485
  {
481
486
  "Key": "name",
482
- "Value": "cdk-test-deploy",
487
+ "Value": "task-sfn-interation-map",
483
488
  },
484
489
  ],
485
490
  },
@@ -497,7 +502,7 @@ exports[`snapshot test for InfraStack 1`] = `
497
502
  },
498
503
  {
499
504
  "Key": "name",
500
- "Value": "cdk-test-deploy",
505
+ "Value": "task-sfn-interation-map",
501
506
  },
502
507
  ],
503
508
  },
@@ -508,7 +513,7 @@ exports[`snapshot test for InfraStack 1`] = `
508
513
  "Properties": {
509
514
  "DistributionConfig": {
510
515
  "Aliases": [
511
- "dev-api-cdk.mbc-cqrs-serverless.mbc-net.com",
516
+ "task-sfn-infra.developer-pionero.mbc-dev.com",
512
517
  ],
513
518
  "DefaultCacheBehavior": {
514
519
  "AllowedMethods": [
@@ -553,7 +558,7 @@ exports[`snapshot test for InfraStack 1`] = `
553
558
  "OriginCustomHeaders": [
554
559
  {
555
560
  "HeaderName": "X-Origin-Verify",
556
- "HeaderValue": "dev-cdk-test-deploy-653338303031343731376464613638663933303936316338666463646537",
561
+ "HeaderValue": "dev-task-sfn-interation-map-653338303031343731376464613638663933303936316338666463646537",
557
562
  },
558
563
  ],
559
564
  },
@@ -569,7 +574,7 @@ exports[`snapshot test for InfraStack 1`] = `
569
574
  },
570
575
  },
571
576
  "ViewerCertificate": {
572
- "AcmCertificateArn": "arn:aws:acm:us-east-1:058264278704:certificate/668eb08d-b92f-488c-9e32-56854d487315",
577
+ "AcmCertificateArn": "arn:aws:acm:us-east-1:465316005105:certificate/495946ea-1231-47cb-b09d-0ae7305866fb",
573
578
  "MinimumProtocolVersion": "TLSv1.2_2021",
574
579
  "SslSupportMethod": "sni-only",
575
580
  },
@@ -581,7 +586,7 @@ exports[`snapshot test for InfraStack 1`] = `
581
586
  },
582
587
  {
583
588
  "Key": "name",
584
- "Value": "cdk-test-deploy",
589
+ "Value": "task-sfn-interation-map",
585
590
  },
586
591
  ],
587
592
  },
@@ -589,8 +594,8 @@ exports[`snapshot test for InfraStack 1`] = `
589
594
  },
590
595
  "httpdistributionarecord0FBAAC08": {
591
596
  "Properties": {
592
- "HostedZoneId": "Z083753814XLAICIY5OHU",
593
- "Name": "dev-api-cdk.mbc-cqrs-serverless.mbc-net.com.",
597
+ "HostedZoneId": "Z07014542L73WTE1YO27B",
598
+ "Name": "task-sfn-infra.developer-pionero.mbc-dev.com.",
594
599
  "ResourceRecords": [
595
600
  {
596
601
  "Fn::GetAtt": [
@@ -625,12 +630,12 @@ exports[`snapshot test for InfraStack 1`] = `
625
630
  "GraphQLUrl",
626
631
  ],
627
632
  },
628
- "APP_NAME": "cdk-test-deploy",
633
+ "APP_NAME": "task-sfn-interation-map",
629
634
  "ATTRIBUTE_LIMIT_SIZE": "389120",
630
- "COGNITO_USER_POOL_ID": "ap-northeast-1_xlQVMPxtx",
631
- "DATABASE_URL": "postgresql:///mbc/cqrs/rds-account@http://db.mbc-net.com/dev_cdk_infra?schema=public",
635
+ "COGNITO_USER_POOL_ID": "ap-northeast-1_NfyqKTjPS",
636
+ "DATABASE_URL": "postgresql:///mbc/cqrs/rds-account@db.mbc-net.com/dev_cdk_infra?schema=public",
632
637
  "EVENT_SOURCE_DISABLED": "false",
633
- "FRONT_BASE_URL": "https://dev-front.mbc-cqrs-serverless.mbc-net.com",
638
+ "FRONT_BASE_URL": "test-cqrs.developer-pionero.mbc-dev.com",
634
639
  "LOG_LEVEL": "verbose",
635
640
  "NODE_ENV": "dev",
636
641
  "NODE_OPTIONS": "--enable-source-maps",
@@ -640,8 +645,9 @@ exports[`snapshot test for InfraStack 1`] = `
640
645
  "S3_PUBLIC_BUCKET_NAME": {
641
646
  "Ref": "publicbucket0D82CFFB",
642
647
  },
643
- "SES_FROM_EMAIL": "noreply@mbc-cqrs-serverless.mbc-net.com",
644
- "SFN_COMMAND_ARN": "arn:aws:states:ap-northeast-1:101010101010:stateMachine:dev-cdk-test-deploy-command-handler",
648
+ "SES_FROM_EMAIL": "noreply@developer-pionero.mbc-dev.com",
649
+ "SFN_COMMAND_ARN": "arn:aws:states:ap-northeast-1:101010101010:stateMachine:dev-task-sfn-interation-map-command-handler",
650
+ "SFN_TASK_ARN": "arn:aws:states:ap-northeast-1:101010101010:stateMachine:dev-task-sfn-interation-map-sfn-task-handler",
645
651
  "SNS_ALARM_TOPIC_ARN": {
646
652
  "Ref": "alarmsnsFB7BBC3B",
647
653
  },
@@ -651,7 +657,7 @@ exports[`snapshot test for InfraStack 1`] = `
651
657
  "TZ": "Asia/Tokyo",
652
658
  },
653
659
  },
654
- "FunctionName": "dev-cdk-test-deploy-lambda-api",
660
+ "FunctionName": "dev-task-sfn-interation-map-lambda-api",
655
661
  "Handler": "main.handler",
656
662
  "Layers": [
657
663
  {
@@ -678,7 +684,7 @@ exports[`snapshot test for InfraStack 1`] = `
678
684
  },
679
685
  {
680
686
  "Key": "name",
681
- "Value": "cdk-test-deploy",
687
+ "Value": "task-sfn-interation-map",
682
688
  },
683
689
  ],
684
690
  "Timeout": 31536000,
@@ -687,19 +693,19 @@ exports[`snapshot test for InfraStack 1`] = `
687
693
  },
688
694
  "VpcConfig": {
689
695
  "SecurityGroupIds": [
690
- "sg-0913ccd0827f688f4",
696
+ "sg-06d0f5fc2d4225f50",
691
697
  ],
692
698
  "SubnetIds": [],
693
699
  },
694
700
  },
695
701
  "Type": "AWS::Lambda::Function",
696
702
  },
697
- "lambdaapiDynamoDBEventSourceTestInfraStackmastercommandtableE6C83C78574B619C": {
703
+ "lambdaapiDynamoDBEventSourceTestInfraStacksamplecommandtable0EA54DEAC580030B": {
698
704
  "Properties": {
699
705
  "BatchSize": 1,
700
706
  "EventSourceArn": {
701
707
  "Fn::GetAtt": [
702
- "mastercommanddecsC637D29D",
708
+ "samplecommanddecs4793A4CC",
703
709
  "Table.LatestStreamArn",
704
710
  ],
705
711
  },
@@ -721,7 +727,7 @@ exports[`snapshot test for InfraStack 1`] = `
721
727
  },
722
728
  {
723
729
  "Key": "name",
724
- "Value": "cdk-test-deploy",
730
+ "Value": "task-sfn-interation-map",
725
731
  },
726
732
  ],
727
733
  },
@@ -754,7 +760,7 @@ exports[`snapshot test for InfraStack 1`] = `
754
760
  },
755
761
  {
756
762
  "Key": "name",
757
- "Value": "cdk-test-deploy",
763
+ "Value": "task-sfn-interation-map",
758
764
  },
759
765
  ],
760
766
  },
@@ -807,7 +813,7 @@ exports[`snapshot test for InfraStack 1`] = `
807
813
  },
808
814
  {
809
815
  "Key": "name",
810
- "Value": "cdk-test-deploy",
816
+ "Value": "task-sfn-interation-map",
811
817
  },
812
818
  ],
813
819
  },
@@ -857,6 +863,22 @@ exports[`snapshot test for InfraStack 1`] = `
857
863
  ],
858
864
  },
859
865
  },
866
+ {
867
+ "Action": [
868
+ "sqs:ReceiveMessage",
869
+ "sqs:ChangeMessageVisibility",
870
+ "sqs:GetQueueUrl",
871
+ "sqs:DeleteMessage",
872
+ "sqs:GetQueueAttributes",
873
+ ],
874
+ "Effect": "Allow",
875
+ "Resource": {
876
+ "Fn::GetAtt": [
877
+ "subtaskstatussqs337C4C1A",
878
+ "Arn",
879
+ ],
880
+ },
881
+ },
860
882
  {
861
883
  "Action": "dynamodb:ListStreams",
862
884
  "Effect": "Allow",
@@ -885,7 +907,7 @@ exports[`snapshot test for InfraStack 1`] = `
885
907
  "Effect": "Allow",
886
908
  "Resource": {
887
909
  "Fn::GetAtt": [
888
- "mastercommanddecsC637D29D",
910
+ "samplecommanddecs4793A4CC",
889
911
  "Table.LatestStreamArn",
890
912
  ],
891
913
  },
@@ -911,7 +933,7 @@ exports[`snapshot test for InfraStack 1`] = `
911
933
  {
912
934
  "Ref": "AWS::Partition",
913
935
  },
914
- ":cognito-idp:ap-northeast-1:101010101010:userpool/ap-northeast-1_xlQVMPxtx",
936
+ ":cognito-idp:ap-northeast-1:101010101010:userpool/ap-northeast-1_NfyqKTjPS",
915
937
  ],
916
938
  ],
917
939
  },
@@ -1086,7 +1108,32 @@ exports[`snapshot test for InfraStack 1`] = `
1086
1108
  },
1087
1109
  {
1088
1110
  "Key": "name",
1089
- "Value": "cdk-test-deploy",
1111
+ "Value": "task-sfn-interation-map",
1112
+ },
1113
+ ],
1114
+ },
1115
+ "Type": "AWS::Lambda::EventSourceMapping",
1116
+ },
1117
+ "lambdaapiSqsEventSourceTestInfraStacksubtaskstatussqs6A461140CF17FDD8": {
1118
+ "Properties": {
1119
+ "BatchSize": 1,
1120
+ "EventSourceArn": {
1121
+ "Fn::GetAtt": [
1122
+ "subtaskstatussqs337C4C1A",
1123
+ "Arn",
1124
+ ],
1125
+ },
1126
+ "FunctionName": {
1127
+ "Ref": "lambdaapi893CD94E",
1128
+ },
1129
+ "Tags": [
1130
+ {
1131
+ "Key": "env",
1132
+ "Value": "dev",
1133
+ },
1134
+ {
1135
+ "Key": "name",
1136
+ "Value": "task-sfn-interation-map",
1090
1137
  },
1091
1138
  ],
1092
1139
  },
@@ -1111,7 +1158,7 @@ exports[`snapshot test for InfraStack 1`] = `
1111
1158
  },
1112
1159
  {
1113
1160
  "Key": "name",
1114
- "Value": "cdk-test-deploy",
1161
+ "Value": "task-sfn-interation-map",
1115
1162
  },
1116
1163
  ],
1117
1164
  },
@@ -1129,7 +1176,7 @@ exports[`snapshot test for InfraStack 1`] = `
1129
1176
  "dynamodb:Query",
1130
1177
  ],
1131
1178
  "Effect": "Allow",
1132
- "Resource": "arn:aws:dynamodb:ap-northeast-1:101010101010:table/dev-cdk-test-deploy-*",
1179
+ "Resource": "arn:aws:dynamodb:ap-northeast-1:101010101010:table/dev-task-sfn-interation-map-*",
1133
1180
  },
1134
1181
  ],
1135
1182
  "Version": "2012-10-17",
@@ -1178,7 +1225,7 @@ exports[`snapshot test for InfraStack 1`] = `
1178
1225
  "states:DescribeExecution",
1179
1226
  ],
1180
1227
  "Effect": "Allow",
1181
- "Resource": "arn:aws:states:ap-northeast-1:101010101010:stateMachine:dev-cdk-test-deploy-command-handler",
1228
+ "Resource": "arn:aws:states:ap-northeast-1:101010101010:stateMachine:dev-task-sfn-interation-map-command-handler",
1182
1229
  },
1183
1230
  ],
1184
1231
  "Version": "2012-10-17",
@@ -1213,6 +1260,27 @@ exports[`snapshot test for InfraStack 1`] = `
1213
1260
  },
1214
1261
  "Type": "AWS::IAM::Policy",
1215
1262
  },
1263
+ "lambdatasksfnstepfunctionpolicy762E8B6E": {
1264
+ "Properties": {
1265
+ "PolicyDocument": {
1266
+ "Statement": [
1267
+ {
1268
+ "Action": "states:*",
1269
+ "Effect": "Allow",
1270
+ "Resource": "arn:aws:states:ap-northeast-1:101010101010:stateMachine:dev-task-sfn-interation-map-sfn-task-handler",
1271
+ },
1272
+ ],
1273
+ "Version": "2012-10-17",
1274
+ },
1275
+ "PolicyName": "lambdatasksfnstepfunctionpolicy762E8B6E",
1276
+ "Roles": [
1277
+ {
1278
+ "Ref": "lambdaapiServiceRole7E4263EE",
1279
+ },
1280
+ ],
1281
+ },
1282
+ "Type": "AWS::IAM::Policy",
1283
+ },
1216
1284
  "mainapiANYeventproxy80A3496A": {
1217
1285
  "Properties": {
1218
1286
  "ApiId": {
@@ -1295,11 +1363,11 @@ exports[`snapshot test for InfraStack 1`] = `
1295
1363
  "MaxAge": 31536000,
1296
1364
  },
1297
1365
  "Description": "HTTP API for Lambda integration",
1298
- "Name": "dev-cdk-test-deploy-api",
1366
+ "Name": "dev-task-sfn-interation-map-api",
1299
1367
  "ProtocolType": "HTTP",
1300
1368
  "Tags": {
1301
1369
  "env": "dev",
1302
- "name": "cdk-test-deploy",
1370
+ "name": "task-sfn-interation-map",
1303
1371
  },
1304
1372
  },
1305
1373
  "Type": "AWS::ApiGatewayV2::Api",
@@ -1319,7 +1387,7 @@ exports[`snapshot test for InfraStack 1`] = `
1319
1387
  "Ref": "apigwclientE7D084A5",
1320
1388
  },
1321
1389
  ],
1322
- "Issuer": "https://cognito-idp.ap-northeast-1.amazonaws.com/ap-northeast-1_xlQVMPxtx",
1390
+ "Issuer": "https://cognito-idp.ap-northeast-1.amazonaws.com/ap-northeast-1_NfyqKTjPS",
1323
1391
  },
1324
1392
  "Name": "CognitoAuthorizer",
1325
1393
  },
@@ -1399,7 +1467,7 @@ exports[`snapshot test for InfraStack 1`] = `
1399
1467
  "StageName": "$default",
1400
1468
  "Tags": {
1401
1469
  "env": "dev",
1402
- "name": "cdk-test-deploy",
1470
+ "name": "task-sfn-interation-map",
1403
1471
  },
1404
1472
  },
1405
1473
  "Type": "AWS::ApiGatewayV2::Stage",
@@ -1731,7 +1799,7 @@ exports[`snapshot test for InfraStack 1`] = `
1731
1799
  "S3Bucket": "cdk-hnb659fds-assets-101010101010-ap-northeast-1",
1732
1800
  "S3Key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.zip",
1733
1801
  },
1734
- "LayerName": "dev-cdk-test-deploy-main-layer",
1802
+ "LayerName": "dev-task-sfn-interation-map-main-layer",
1735
1803
  },
1736
1804
  "Type": "AWS::Lambda::LayerVersion",
1737
1805
  },
@@ -1744,56 +1812,17 @@ exports[`snapshot test for InfraStack 1`] = `
1744
1812
  },
1745
1813
  {
1746
1814
  "Key": "name",
1747
- "Value": "cdk-test-deploy",
1815
+ "Value": "task-sfn-interation-map",
1748
1816
  },
1749
1817
  ],
1750
- "TopicName": "dev-cdk-test-deploy-main-sns",
1818
+ "TopicName": "dev-task-sfn-interation-map-main-sns",
1751
1819
  },
1752
1820
  "Type": "AWS::SNS::Topic",
1753
1821
  },
1754
- "mastercommanddecsC637D29D": {
1755
- "DeletionPolicy": "Delete",
1756
- "DependsOn": [
1757
- "mastercommanddecsCustomResourcePolicyE2063016",
1758
- ],
1759
- "Properties": {
1760
- "Create": "{"service":"DynamoDB","action":"describeTable","parameters":{"TableName":"dev-cdk-test-deploy-master-command"},"physicalResourceId":{"responsePath":"Table.TableArn"}}",
1761
- "InstallLatestAwsSdk": true,
1762
- "ServiceToken": {
1763
- "Fn::GetAtt": [
1764
- "AWS679f53fac002430cb0da5b7982bd22872D164C4C",
1765
- "Arn",
1766
- ],
1767
- },
1768
- },
1769
- "Type": "Custom::AWS",
1770
- "UpdateReplacePolicy": "Delete",
1771
- },
1772
- "mastercommanddecsCustomResourcePolicyE2063016": {
1773
- "Properties": {
1774
- "PolicyDocument": {
1775
- "Statement": [
1776
- {
1777
- "Action": "dynamodb:DescribeTable",
1778
- "Effect": "Allow",
1779
- "Resource": "*",
1780
- },
1781
- ],
1782
- "Version": "2012-10-17",
1783
- },
1784
- "PolicyName": "mastercommanddecsCustomResourcePolicyE2063016",
1785
- "Roles": [
1786
- {
1787
- "Ref": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2",
1788
- },
1789
- ],
1790
- },
1791
- "Type": "AWS::IAM::Policy",
1792
- },
1793
1822
  "notifysqsEC095A61": {
1794
1823
  "DeletionPolicy": "Delete",
1795
1824
  "Properties": {
1796
- "QueueName": "dev-cdk-test-deploy-notification-queue",
1825
+ "QueueName": "dev-task-sfn-interation-map-notification-queue",
1797
1826
  "Tags": [
1798
1827
  {
1799
1828
  "Key": "env",
@@ -1801,7 +1830,7 @@ exports[`snapshot test for InfraStack 1`] = `
1801
1830
  },
1802
1831
  {
1803
1832
  "Key": "name",
1804
- "Value": "cdk-test-deploy",
1833
+ "Value": "task-sfn-interation-map",
1805
1834
  },
1806
1835
  ],
1807
1836
  },
@@ -1871,7 +1900,7 @@ exports[`snapshot test for InfraStack 1`] = `
1871
1900
  "publicbucket0D82CFFB": {
1872
1901
  "DeletionPolicy": "Delete",
1873
1902
  "Properties": {
1874
- "BucketName": "dev-cdk-test-deploy-public",
1903
+ "BucketName": "dev-task-sfn-interation-map-public",
1875
1904
  "CorsConfiguration": {
1876
1905
  "CorsRules": [
1877
1906
  {
@@ -1903,7 +1932,7 @@ exports[`snapshot test for InfraStack 1`] = `
1903
1932
  },
1904
1933
  {
1905
1934
  "Key": "name",
1906
- "Value": "cdk-test-deploy",
1935
+ "Value": "task-sfn-interation-map",
1907
1936
  },
1908
1937
  ],
1909
1938
  },
@@ -2019,7 +2048,7 @@ exports[`snapshot test for InfraStack 1`] = `
2019
2048
  },
2020
2049
  {
2021
2050
  "Key": "name",
2022
- "Value": "cdk-test-deploy",
2051
+ "Value": "task-sfn-interation-map",
2023
2052
  },
2024
2053
  ],
2025
2054
  },
@@ -2035,12 +2064,12 @@ exports[`snapshot test for InfraStack 1`] = `
2035
2064
  "AuthenticationType": "AMAZON_COGNITO_USER_POOLS",
2036
2065
  "UserPoolConfig": {
2037
2066
  "AwsRegion": "ap-northeast-1",
2038
- "UserPoolId": "ap-northeast-1_xlQVMPxtx",
2067
+ "UserPoolId": "ap-northeast-1_NfyqKTjPS",
2039
2068
  },
2040
2069
  },
2041
2070
  ],
2042
2071
  "AuthenticationType": "API_KEY",
2043
- "Name": "dev-cdk-test-deploy-realtime",
2072
+ "Name": "dev-task-sfn-interation-map-realtime",
2044
2073
  "Tags": [
2045
2074
  {
2046
2075
  "Key": "env",
@@ -2048,7 +2077,7 @@ exports[`snapshot test for InfraStack 1`] = `
2048
2077
  },
2049
2078
  {
2050
2079
  "Key": "name",
2051
- "Value": "cdk-test-deploy",
2080
+ "Value": "task-sfn-interation-map",
2052
2081
  },
2053
2082
  ],
2054
2083
  "XrayEnabled": true,
@@ -2081,18 +2110,18 @@ exports[`snapshot test for InfraStack 1`] = `
2081
2110
  "ApiId",
2082
2111
  ],
2083
2112
  },
2084
- "DomainName": "dev-appsync-cdk.mbc-cqrs-serverless.mbc-net.com",
2113
+ "DomainName": "task-sfn-infra-appsync.developer-pionero.mbc-dev.com",
2085
2114
  },
2086
2115
  "Type": "AWS::AppSync::DomainNameApiAssociation",
2087
2116
  },
2088
2117
  "realtimeDomainName01674B94": {
2089
2118
  "Properties": {
2090
- "CertificateArn": "arn:aws:acm:us-east-1:058264278704:certificate/668eb08d-b92f-488c-9e32-56854d487315",
2119
+ "CertificateArn": "arn:aws:acm:us-east-1:465316005105:certificate/495946ea-1231-47cb-b09d-0ae7305866fb",
2091
2120
  "Description": {
2092
2121
  "Fn::Join": [
2093
2122
  "",
2094
2123
  [
2095
- "domain for dev-cdk-test-deploy-realtime at ",
2124
+ "domain for dev-task-sfn-interation-map-realtime at ",
2096
2125
  {
2097
2126
  "Fn::GetAtt": [
2098
2127
  "realtime0CF38FF2",
@@ -2102,7 +2131,7 @@ exports[`snapshot test for InfraStack 1`] = `
2102
2131
  ],
2103
2132
  ],
2104
2133
  },
2105
- "DomainName": "dev-appsync-cdk.mbc-cqrs-serverless.mbc-net.com",
2134
+ "DomainName": "task-sfn-infra-appsync.developer-pionero.mbc-dev.com",
2106
2135
  },
2107
2136
  "Type": "AWS::AppSync::DomainName",
2108
2137
  },
@@ -2184,10 +2213,126 @@ schema {
2184
2213
  },
2185
2214
  "Type": "AWS::AppSync::Resolver",
2186
2215
  },
2216
+ "samplecommanddecs4793A4CC": {
2217
+ "DeletionPolicy": "Delete",
2218
+ "DependsOn": [
2219
+ "samplecommanddecsCustomResourcePolicyE6F75ED3",
2220
+ ],
2221
+ "Properties": {
2222
+ "Create": "{"service":"DynamoDB","action":"describeTable","parameters":{"TableName":"dev-task-sfn-interation-map-sample-command"},"physicalResourceId":{"responsePath":"Table.TableArn"}}",
2223
+ "InstallLatestAwsSdk": true,
2224
+ "ServiceToken": {
2225
+ "Fn::GetAtt": [
2226
+ "AWS679f53fac002430cb0da5b7982bd22872D164C4C",
2227
+ "Arn",
2228
+ ],
2229
+ },
2230
+ },
2231
+ "Type": "Custom::AWS",
2232
+ "UpdateReplacePolicy": "Delete",
2233
+ },
2234
+ "samplecommanddecsCustomResourcePolicyE6F75ED3": {
2235
+ "Properties": {
2236
+ "PolicyDocument": {
2237
+ "Statement": [
2238
+ {
2239
+ "Action": "dynamodb:DescribeTable",
2240
+ "Effect": "Allow",
2241
+ "Resource": "*",
2242
+ },
2243
+ ],
2244
+ "Version": "2012-10-17",
2245
+ },
2246
+ "PolicyName": "samplecommanddecsCustomResourcePolicyE6F75ED3",
2247
+ "Roles": [
2248
+ {
2249
+ "Ref": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2",
2250
+ },
2251
+ ],
2252
+ },
2253
+ "Type": "AWS::IAM::Policy",
2254
+ },
2255
+ "subtaskstatussqs337C4C1A": {
2256
+ "DeletionPolicy": "Delete",
2257
+ "Properties": {
2258
+ "QueueName": "dev-task-sfn-interation-map-sub-task-status-queue",
2259
+ "Tags": [
2260
+ {
2261
+ "Key": "env",
2262
+ "Value": "dev",
2263
+ },
2264
+ {
2265
+ "Key": "name",
2266
+ "Value": "task-sfn-interation-map",
2267
+ },
2268
+ ],
2269
+ },
2270
+ "Type": "AWS::SQS::Queue",
2271
+ "UpdateReplacePolicy": "Delete",
2272
+ },
2273
+ "subtaskstatussqsPolicy727EA743": {
2274
+ "Properties": {
2275
+ "PolicyDocument": {
2276
+ "Statement": [
2277
+ {
2278
+ "Action": "sqs:SendMessage",
2279
+ "Condition": {
2280
+ "ArnEquals": {
2281
+ "aws:SourceArn": {
2282
+ "Ref": "mainsnsC0381B34",
2283
+ },
2284
+ },
2285
+ },
2286
+ "Effect": "Allow",
2287
+ "Principal": {
2288
+ "Service": "sns.amazonaws.com",
2289
+ },
2290
+ "Resource": {
2291
+ "Fn::GetAtt": [
2292
+ "subtaskstatussqs337C4C1A",
2293
+ "Arn",
2294
+ ],
2295
+ },
2296
+ },
2297
+ ],
2298
+ "Version": "2012-10-17",
2299
+ },
2300
+ "Queues": [
2301
+ {
2302
+ "Ref": "subtaskstatussqs337C4C1A",
2303
+ },
2304
+ ],
2305
+ },
2306
+ "Type": "AWS::SQS::QueuePolicy",
2307
+ },
2308
+ "subtaskstatussqsTestInfraStackmainsnsA010224C101218D4": {
2309
+ "DependsOn": [
2310
+ "subtaskstatussqsPolicy727EA743",
2311
+ ],
2312
+ "Properties": {
2313
+ "Endpoint": {
2314
+ "Fn::GetAtt": [
2315
+ "subtaskstatussqs337C4C1A",
2316
+ "Arn",
2317
+ ],
2318
+ },
2319
+ "FilterPolicy": {
2320
+ "action": [
2321
+ "sub-task-status",
2322
+ ],
2323
+ },
2324
+ "Protocol": "sqs",
2325
+ "RawMessageDelivery": true,
2326
+ "TopicArn": {
2327
+ "Ref": "mainsnsC0381B34",
2328
+ },
2329
+ },
2330
+ "Type": "AWS::SNS::Subscription",
2331
+ },
2187
2332
  "taskdeadlettersqs91D16094": {
2188
2333
  "DeletionPolicy": "Delete",
2189
2334
  "Properties": {
2190
- "QueueName": "dev-cdk-test-deploy-task-dead-letter-queue",
2335
+ "QueueName": "dev-task-sfn-interation-map-task-dead-letter-queue",
2191
2336
  "Tags": [
2192
2337
  {
2193
2338
  "Key": "env",
@@ -2195,7 +2340,7 @@ schema {
2195
2340
  },
2196
2341
  {
2197
2342
  "Key": "name",
2198
- "Value": "cdk-test-deploy",
2343
+ "Value": "task-sfn-interation-map",
2199
2344
  },
2200
2345
  ],
2201
2346
  },
@@ -2256,13 +2401,190 @@ schema {
2256
2401
  },
2257
2402
  "Type": "AWS::SNS::Subscription",
2258
2403
  },
2404
+ "taskhandlersfnlogB2666A7A": {
2405
+ "DeletionPolicy": "Delete",
2406
+ "Properties": {
2407
+ "LogGroupName": "/aws/vendedlogs/states/dev-task-sfn-interation-map-task-handler-state-machine-Logs",
2408
+ "RetentionInDays": 180,
2409
+ "Tags": [
2410
+ {
2411
+ "Key": "env",
2412
+ "Value": "dev",
2413
+ },
2414
+ {
2415
+ "Key": "name",
2416
+ "Value": "task-sfn-interation-map",
2417
+ },
2418
+ ],
2419
+ },
2420
+ "Type": "AWS::Logs::LogGroup",
2421
+ "UpdateReplacePolicy": "Delete",
2422
+ },
2423
+ "taskhandlerstatemachineA6256F18": {
2424
+ "DeletionPolicy": "Delete",
2425
+ "DependsOn": [
2426
+ "taskhandlerstatemachineRoleDefaultPolicy2FC1F09A",
2427
+ "taskhandlerstatemachineRole2CA8BAB5",
2428
+ ],
2429
+ "Properties": {
2430
+ "DefinitionString": {
2431
+ "Fn::Join": [
2432
+ "",
2433
+ [
2434
+ "{"StartAt":"map_state","States":{"map_state":{"Type":"Map","End":true,"InputPath":"$","ItemsPath":"$","ItemProcessor":{"ProcessorConfig":{"Mode":"INLINE"},"StartAt":"iterator","States":{"iterator":{"End":true,"Retry":[{"ErrorEquals":["Lambda.ClientExecutionTimeoutException","Lambda.ServiceException","Lambda.AWSLambdaException","Lambda.SdkClientException"],"IntervalSeconds":2,"MaxAttempts":6,"BackoffRate":2}],"Type":"Task","OutputPath":"$.Payload[0][0]","Resource":"arn:",
2435
+ {
2436
+ "Ref": "AWS::Partition",
2437
+ },
2438
+ ":states:::lambda:invoke","Parameters":{"FunctionName":"",
2439
+ {
2440
+ "Fn::GetAtt": [
2441
+ "lambdaapi893CD94E",
2442
+ "Arn",
2443
+ ],
2444
+ },
2445
+ "","Payload":{"input.$":"$","context.$":"$$"}}}}},"MaxConcurrency":2}},"TimeoutSeconds":525600,"Comment":"A state machine for task handler"}",
2446
+ ],
2447
+ ],
2448
+ },
2449
+ "LoggingConfiguration": {
2450
+ "Destinations": [
2451
+ {
2452
+ "CloudWatchLogsLogGroup": {
2453
+ "LogGroupArn": {
2454
+ "Fn::GetAtt": [
2455
+ "taskhandlersfnlogB2666A7A",
2456
+ "Arn",
2457
+ ],
2458
+ },
2459
+ },
2460
+ },
2461
+ ],
2462
+ "Level": "ALL",
2463
+ },
2464
+ "RoleArn": {
2465
+ "Fn::GetAtt": [
2466
+ "taskhandlerstatemachineRole2CA8BAB5",
2467
+ "Arn",
2468
+ ],
2469
+ },
2470
+ "StateMachineName": "dev-task-sfn-interation-map-sfn-task-handler",
2471
+ "Tags": [
2472
+ {
2473
+ "Key": "env",
2474
+ "Value": "dev",
2475
+ },
2476
+ {
2477
+ "Key": "name",
2478
+ "Value": "task-sfn-interation-map",
2479
+ },
2480
+ ],
2481
+ "TracingConfiguration": {
2482
+ "Enabled": true,
2483
+ },
2484
+ },
2485
+ "Type": "AWS::StepFunctions::StateMachine",
2486
+ "UpdateReplacePolicy": "Delete",
2487
+ },
2488
+ "taskhandlerstatemachineRole2CA8BAB5": {
2489
+ "Properties": {
2490
+ "AssumeRolePolicyDocument": {
2491
+ "Statement": [
2492
+ {
2493
+ "Action": "sts:AssumeRole",
2494
+ "Effect": "Allow",
2495
+ "Principal": {
2496
+ "Service": "states.amazonaws.com",
2497
+ },
2498
+ },
2499
+ ],
2500
+ "Version": "2012-10-17",
2501
+ },
2502
+ "Tags": [
2503
+ {
2504
+ "Key": "env",
2505
+ "Value": "dev",
2506
+ },
2507
+ {
2508
+ "Key": "name",
2509
+ "Value": "task-sfn-interation-map",
2510
+ },
2511
+ ],
2512
+ },
2513
+ "Type": "AWS::IAM::Role",
2514
+ },
2515
+ "taskhandlerstatemachineRoleDefaultPolicy2FC1F09A": {
2516
+ "Properties": {
2517
+ "PolicyDocument": {
2518
+ "Statement": [
2519
+ {
2520
+ "Action": "lambda:InvokeFunction",
2521
+ "Effect": "Allow",
2522
+ "Resource": [
2523
+ {
2524
+ "Fn::GetAtt": [
2525
+ "lambdaapi893CD94E",
2526
+ "Arn",
2527
+ ],
2528
+ },
2529
+ {
2530
+ "Fn::Join": [
2531
+ "",
2532
+ [
2533
+ {
2534
+ "Fn::GetAtt": [
2535
+ "lambdaapi893CD94E",
2536
+ "Arn",
2537
+ ],
2538
+ },
2539
+ ":*",
2540
+ ],
2541
+ ],
2542
+ },
2543
+ ],
2544
+ },
2545
+ {
2546
+ "Action": [
2547
+ "logs:CreateLogDelivery",
2548
+ "logs:GetLogDelivery",
2549
+ "logs:UpdateLogDelivery",
2550
+ "logs:DeleteLogDelivery",
2551
+ "logs:ListLogDeliveries",
2552
+ "logs:PutResourcePolicy",
2553
+ "logs:DescribeResourcePolicies",
2554
+ "logs:DescribeLogGroups",
2555
+ ],
2556
+ "Effect": "Allow",
2557
+ "Resource": "*",
2558
+ },
2559
+ {
2560
+ "Action": [
2561
+ "xray:PutTraceSegments",
2562
+ "xray:PutTelemetryRecords",
2563
+ "xray:GetSamplingRules",
2564
+ "xray:GetSamplingTargets",
2565
+ ],
2566
+ "Effect": "Allow",
2567
+ "Resource": "*",
2568
+ },
2569
+ ],
2570
+ "Version": "2012-10-17",
2571
+ },
2572
+ "PolicyName": "taskhandlerstatemachineRoleDefaultPolicy2FC1F09A",
2573
+ "Roles": [
2574
+ {
2575
+ "Ref": "taskhandlerstatemachineRole2CA8BAB5",
2576
+ },
2577
+ ],
2578
+ },
2579
+ "Type": "AWS::IAM::Policy",
2580
+ },
2259
2581
  "tasksdecs1B0120D7": {
2260
2582
  "DeletionPolicy": "Delete",
2261
2583
  "DependsOn": [
2262
2584
  "tasksdecsCustomResourcePolicy766680A1",
2263
2585
  ],
2264
2586
  "Properties": {
2265
- "Create": "{"service":"DynamoDB","action":"describeTable","parameters":{"TableName":"dev-cdk-test-deploy-tasks"},"physicalResourceId":{"responsePath":"Table.TableArn"}}",
2587
+ "Create": "{"service":"DynamoDB","action":"describeTable","parameters":{"TableName":"dev-task-sfn-interation-map-tasks"},"physicalResourceId":{"responsePath":"Table.TableArn"}}",
2266
2588
  "InstallLatestAwsSdk": true,
2267
2589
  "ServiceToken": {
2268
2590
  "Fn::GetAtt": [
@@ -2298,7 +2620,7 @@ schema {
2298
2620
  "tasksqs12D9B615": {
2299
2621
  "DeletionPolicy": "Delete",
2300
2622
  "Properties": {
2301
- "QueueName": "dev-cdk-test-deploy-task-action-queue",
2623
+ "QueueName": "dev-task-sfn-interation-map-task-action-queue",
2302
2624
  "RedrivePolicy": {
2303
2625
  "deadLetterTargetArn": {
2304
2626
  "Fn::GetAtt": [
@@ -2315,7 +2637,7 @@ schema {
2315
2637
  },
2316
2638
  {
2317
2639
  "Key": "name",
2318
- "Value": "cdk-test-deploy",
2640
+ "Value": "task-sfn-interation-map",
2319
2641
  },
2320
2642
  ],
2321
2643
  },
@@ -10,6 +10,11 @@ queues {
10
10
  delay = 5 seconds
11
11
  receiveMessageWait = 0 seconds
12
12
  }
13
+ sub-task-status-queue {
14
+ defaultVisibilityTimeout = 60 seconds
15
+ delay = 5 seconds
16
+ receiveMessageWait = 0 seconds
17
+ }
13
18
  notification-queue {
14
19
  defaultVisibilityTimeout = 60 seconds
15
20
  delay = 5 seconds
@@ -29,13 +29,22 @@ custom:
29
29
  - topic:
30
30
  topicName: CqrsSnsTopic
31
31
  rawMessageDelivery: 'true'
32
- filterPolicy: { 'action': [ 'task-execute' ] }
32
+ filterPolicy: { 'action': ['task-execute'] }
33
33
  queue: http://localhost:9324/101010101010/task-action-queue
34
34
  - topic:
35
35
  topicName: CqrsSnsTopic
36
36
  rawMessageDelivery: 'true'
37
- filterPolicy: { 'action': [ 'notification-action', 'command-status', 'task-status' ] }
37
+ filterPolicy:
38
+ {
39
+ 'action':
40
+ ['notification-action', 'command-status', 'task-status'],
41
+ }
38
42
  queue: http://localhost:9324/101010101010/notification-queue
43
+ - topic:
44
+ topicName: CqrsSnsTopic
45
+ rawMessageDelivery: 'true'
46
+ filterPolicy: { 'action': ['sub-task-status'] }
47
+ queue: http://localhost:9324/101010101010/sub-task-status-queue
39
48
  - topic:
40
49
  topicName: AlarmSnsTopic
41
50
  rawMessageDelivery: 'true'
@@ -138,6 +147,11 @@ functions:
138
147
  Fn::GetAtt:
139
148
  - TaskActionQueue
140
149
  - Arn
150
+ - sqs:
151
+ arn:
152
+ Fn::GetAtt:
153
+ - SubTaskActionQueue
154
+ - Arn
141
155
  - sqs:
142
156
  arn:
143
157
  Fn::GetAtt:
@@ -148,7 +162,13 @@ functions:
148
162
  maximumRetryAttempts: 10
149
163
  arn: ${env:LOCAL_DDB_SAMPLE_STREAM}
150
164
  filterPatterns:
151
- - eventName: [ INSERT ]
165
+ - eventName: [INSERT]
166
+ - stream:
167
+ type: dynamodb
168
+ maximumRetryAttempts: 10
169
+ arn: ${env:LOCAL_DDB_TASKS_STREAM}
170
+ filterPatterns:
171
+ - eventName: [INSERT]
152
172
 
153
173
  stepFunctions:
154
174
  # https://goessner.net/articles/JsonPath/index.html
@@ -314,13 +334,48 @@ stepFunctions:
314
334
  BackoffRate: 2
315
335
  OutputPath: $.Payload[0][0]
316
336
  Next: success
317
-
337
+ sfn-task:
338
+ name: sfn-task
339
+ definition:
340
+ Comment: 'Step function for sub task'
341
+ StartAt: map
342
+ States:
343
+ map:
344
+ Type: Map
345
+ MaxConcurrency: 2
346
+ ItemsPath: $
347
+ Iterator:
348
+ StartAt: iteration
349
+ States:
350
+ iteration:
351
+ Type: Task
352
+ Resource: arn:aws:states:::lambda:invoke
353
+ Parameters:
354
+ FunctionName: arn:aws:lambda:ap-northeast-1:101010101010:function:serverless-example-dev-main
355
+ Payload:
356
+ input.$: $
357
+ context.$: $$
358
+ Retry:
359
+ - ErrorEquals:
360
+ - Lambda.ServiceException
361
+ - Lambda.AWSLambdaException
362
+ - Lambda.SdkClientException
363
+ IntervalSeconds: 2
364
+ MaxAttempts: 5
365
+ BackoffRate: 2
366
+ End: true
367
+ End: true
368
+ # MaxConcurrency: 2
318
369
  resources:
319
370
  Resources:
320
371
  TaskActionQueue:
321
372
  Type: AWS::SQS::Queue
322
373
  Properties:
323
374
  QueueName: task-action-queue
375
+ SubTaskActionQueue:
376
+ Type: AWS::SQS::Queue
377
+ Properties:
378
+ QueueName: sub-task-status-queue
324
379
  NotificationQueue:
325
380
  Type: AWS::SQS::Queue
326
381
  Properties: