Skip to content

Commit caed057

Browse files
committed
fix to normalize naming for cloudformation, etc
1 parent dd14520 commit caed057

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

merle/functions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ def normalize_model_name(model_name: str) -> str:
4040

4141
def 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

0 commit comments

Comments
 (0)