File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -40,19 +40,19 @@ def normalize_model_name(model_name: str) -> str:
4040
4141def sanitize_for_cloudformation (name : str ) -> str :
4242 """
43- Sanitize a name for use as a CloudFormation stack name.
43+ Sanitize a name for use as a CloudFormation stack name and Lambda function name .
4444
4545 CloudFormation stack names must match: [a-zA-Z][-a-zA-Z0-9]*
46- This means only letters, numbers, and hyphens are allowed (no underscores).
46+ Lambda function names can only contain: a-z, A-Z, 0-9, _ and -
4747
4848 Args:
4949 name: Input name (may contain underscores or other invalid characters)
5050
5151 Returns:
52- Sanitized name safe for CloudFormation (underscores replaced with hyphens, lowercased )
52+ Sanitized name safe for CloudFormation and Lambda (invalid chars replaced with hyphens)
5353 """
54- # Replace underscores and other invalid characters with hyphens
55- sanitized = re .sub (r"[_/\\:*?\"<>|]" , "-" , name )
54+ # Replace underscores, periods, and other invalid characters with hyphens
55+ sanitized = re .sub (r"[_. /\\:*?\"<>|]" , "-" , name )
5656 # Remove any duplicate hyphens
5757 sanitized = re .sub (r"-+" , "-" , sanitized )
5858 # Remove leading/trailing hyphens
You can’t perform that action at this time.
0 commit comments