From c701abd5b9ff5e0ebdd62b16e52826e962a2b8c8 Mon Sep 17 00:00:00 2001 From: Tony Sherman Date: Wed, 27 Dec 2023 16:30:19 -0500 Subject: [PATCH] add ability to customize the prefix of the statemachine name --- README-SAR.md | 1 + template.yml | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/README-SAR.md b/README-SAR.md index a7850d8e..f7247673 100644 --- a/README-SAR.md +++ b/README-SAR.md @@ -72,6 +72,7 @@ The CloudFormation template accepts the following parameters: * **logGroupRetentionInDays** (number, default=7): the number of days to retain log events in the Lambda log groups. Before this parameter existed, log events were retained indefinitely * **securityGroupIds** (list of SecurityGroup IDs): List of Security Groups to use in every Lambda function's VPC Configuration (optional); please note that your VPC should be configured to allow public internet access (via NAT Gateway) or include VPC Endpoints to the Lambda service * **subnetIds** (list of Subnet IDs): List of Subnets to use in every Lambda function's VPC Configuration (optional); please note that your VPC should be configured to allow public internet access (via NAT Gateway) or include VPC Endpoints to the Lambda service +* **stateMachineNamePrefix** (string, default=`powerTuningStateMachine`) Allows you to customize the name of the statemachine. The last portion of the `AWS::StackId` will be appended to this value: `powerTuningStateMachine-89549da0-a4f9-11ee-844d-12a2895ed91f` (The `StateMachineName` has a maximum of 80 characters and 36 from the `StackId` are appended, allowing 44 for a custom prefix.) Please note that the total execution time should stay below 300 seconds (5 min), which is the default timeout. You can easily estimate the total execution timeout based on the average duration of your functions. For example, if your function's average execution time is 5 seconds and you haven't enabled `parallelInvocation`, you should set `totalExecutionTimeout` to at least `num * 5`: 50 seconds if `num=10`, 500 seconds if `num=100`, and so on. If you have enabled `parallelInvocation`, usually you don't need to tune the value of `totalExecutionTimeout` unless your average execution time is above 5 min. diff --git a/template.yml b/template.yml index aa6a3393..d757156d 100644 --- a/template.yml +++ b/template.yml @@ -62,6 +62,10 @@ Parameters: Type: CommaDelimitedList Default: '' Description: List of Subnets to use in every Lambda function's VPC Configuration (optional). + stateMachineNamePrefix: + Type: String + Default: "powerTuningStateMachine" + Description: Prefix to the name of the StateMachine. The StackId will be appended to this value (optional). Conditions: UsePermissionsBoundary: !Not [!Equals [!Ref permissionsBoundary, '']] @@ -262,6 +266,11 @@ Resources: powerTuningStateMachine: Type: AWS::StepFunctions::StateMachine Properties: + StateMachineName: + Fn::Join: + - '-' + - - !Ref stateMachineNamePrefix + - !Select [2, !Split ['/', !Ref AWS::StackId]] RoleArn: !GetAtt statemachineRole.Arn DefinitionString: !Sub