Skip to content

Commit

Permalink
fix: Allow Dynamic Reference in CodeUri Property if no / used
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinZZ committed Dec 15, 2023
1 parent a6caeeb commit 8219d82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions samtranslator/model/s3_utils/uri_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ def construct_s3_location_object(
else:
# SSM Pattern found here https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html
ssm_pattern = r"{{resolve:(ssm|ssm-secure|secretsmanager):[a-zA-Z0-9_.\-/]+(:\d+)?}}"
if search(ssm_pattern, location_uri):
match = search(ssm_pattern, location_uri)
if match and match.group(0) and "/" in match.group(0):
raise InvalidResourceException(
logical_id,
f"Dynamic reference detected in '{property_name}'. Please "
f"Unsupported dynamic reference detected in '{property_name}'. Please "
"consider using alternative 'FunctionCode' object format.",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [MinimalFunction] is invalid. Dynamic reference detected in 'CodeUri'. Please consider using alternative 'FunctionCode' object format.",
"errors": [
{
"errorMessage": "Resource with id [MinimalFunction] is invalid. Dynamic reference detected in 'CodeUri'. Please consider using alternative 'FunctionCode' object format."
"errorMessage": "Resource with id [MinimalFunction] is invalid. Unsupported dynamic reference detected in 'CodeUri'. Please consider using alternative 'FunctionCode' object format."
}
]
}

0 comments on commit 8219d82

Please sign in to comment.