Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow Dynamic Reference in CodeUri Property if no / used #3472

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -3,13 +3,13 @@
"Invalid Serverless Application Specification document. ",
"Number of errors found: 1. ",
"Resource with id [MinimalFunction] is invalid. ",
"Dynamic reference detected in 'CodeUri'. ",
"Unsupported dynamic reference detected in 'CodeUri'. ",
"Please consider using alternative 'FunctionCode' object format."
],
"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.",
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [MinimalFunction] is invalid. Unsupported 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."
}
]
}