@@ -51,9 +51,6 @@ Parameters:
5151    Type : String 
5252    Description : " ARNs of KMS Keys for data buckets and/or Glue Catalog. Comma separated list, no spaces. Keep empty if data Buckets and Glue Catalog are not Encrypted with KMS. You can also set it to '*' to grant decrypt permission for all the keys." 
5353    Default : " " 
54-   DetailStepFunctionTemplate :
55-     Type : String 
56-     Description : JSON representation of the detail retrieval StepFunction template 
5754
5855Conditions :
5956  NeedDataBucketsKms : !Not [ !Equals [ !Ref DataBucketsKmsKeysArns, "" ] ] 
@@ -482,7 +479,6 @@ Resources:
482479        DeployRegion : !Ref AWS::Region 
483480        Account : !Ref AWS::AccountId 
484481        Prefix : !Ref ResourcePrefix 
485-         Bucket : !Ref DestinationBucket 
486482
487483  ModuleRefreshSchedule :
488484    Type : ' AWS::Scheduler::Schedule' 
@@ -501,12 +497,84 @@ Resources:
501497  StepFunctionDetail :
502498    Type : AWS::StepFunctions::StateMachine 
503499    Properties :
504-       StateMachineName : !Sub '${ResourcePrefix}${CFDataName}-StateMachine' 
500+       StateMachineName : !Sub '${ResourcePrefix}${CFDataName}-detail- StateMachine' 
505501      StateMachineType : STANDARD 
506502      RoleArn : !Ref StepFunctionExecutionRoleARN 
507-       DefinitionS3Location :
508-         Bucket : !Ref CodeBucket 
509-         Key : !Ref DetailStepFunctionTemplate 
503+       DefinitionString : | 
504+         { 
505+           "Comment": "Collects Health Events", 
506+           "StartAt": "DetailProcessor Map", 
507+           "States": { 
508+             "DetailProcessor Map": { 
509+               "Type": "Map", 
510+               "ItemProcessor": { 
511+                 "ProcessorConfig": { 
512+                   "Mode": "DISTRIBUTED", 
513+                   "ExecutionType": "STANDARD" 
514+                 }, 
515+                 "StartAt": "DetailLambda Invoke", 
516+                 "States": { 
517+                   "DetailLambda Invoke": { 
518+                     "Type": "Task", 
519+                     "Resource": "arn:${Partition}:states:::lambda:invoke", 
520+                     "OutputPath": "$.Payload", 
521+                     "Parameters": { 
522+                       "Payload.$": "$", 
523+                       "FunctionName": "${ModuleLambdaARN}" 
524+                     }, 
525+                     "Retry": [ 
526+                       { 
527+                         "ErrorEquals": [ 
528+                           "Lambda.ServiceException", 
529+                           "Lambda.AWSLambdaException", 
530+                           "Lambda.SdkClientException", 
531+                           "Lambda.TooManyRequestsException" 
532+                         ], 
533+                         "IntervalSeconds": 1, 
534+                         "MaxAttempts": 3, 
535+                         "BackoffRate": 2 
536+                       } 
537+                     ], 
538+                     "End": true  
539+                   } 
540+                 } 
541+               }, 
542+               "Label": "DetailProcessorMap", 
543+               "MaxConcurrency": ${MaxConcurrentBatches}, 
544+               "ItemReader": { 
545+                 "Resource": "arn:${Partition}:states:::s3:getObject", 
546+                 "ReaderConfig": { 
547+                   "InputType": "CSV", 
548+                   "CSVHeaderLocation": "FIRST_ROW" 
549+                 }, 
550+                 "Parameters": { 
551+                   "Bucket.$": "$.bucket", 
552+                   "Key.$": "$.file" 
553+                 } 
554+               }, 
555+               "ItemBatcher": { 
556+                 "MaxItemsPerBatch": ${ItemsPerBatch}, 
557+                 "BatchInput": { 
558+                   "account.$": "$.account", 
559+                   "ingestion_time.$": "$.ingestion_time" 
560+                 } 
561+               }, 
562+               "Next": "CrawlerStepFunctionStartExecution" 
563+             }, 
564+             "CrawlerStepFunctionStartExecution": { 
565+               "Type": "Task", 
566+               "Resource": "arn:${Partition}:states:::states:startExecution.sync:2", 
567+               "Parameters": { 
568+                 "StateMachineArn": "arn:${Partition}:states:${DeployRegion}:${Account}:stateMachine:${Prefix}CrawlerExecution-StateMachine", 
569+                 "Input": { 
570+                   "crawlers": ${Crawlers} 
571+                 } 
572+               }, 
573+               "End": true  
574+             } 
575+           }, 
576+           "TimeoutSeconds": 14400 
577+         } 
510578       DefinitionSubstitutions :
511579        ModuleLambdaARN : !GetAtt LambdaFunction.Arn 
512580        Crawlers : !Sub '["${ResourcePrefix}${CFDataName}-detail-Crawler"]' 
@@ -519,7 +587,6 @@ Resources:
519587        ItemsPerBatch : 50 
520588        MaxConcurrentBatches : 1 
521589        Partition : !Ref AWS::Partition 
522-         Bucket : !Ref DestinationBucket 
523590    Metadata :
524591      cfn-lint :
525592        config :
@@ -529,4 +596,4 @@ Resources:
529596    Type : Custom::LambdaAnalyticsExecutor 
530597    Properties :
531598      ServiceToken : !Ref LambdaAnalyticsARN 
532-       Name : !Ref CFDataName 
599+       Name : !Ref CFDataName 
0 commit comments