follow up on CloudFormation template URLs S3 URI #9329
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Follow up from #9312 and following up a Community Slack issue, it seems the new validation added was missing one exception handling when the S3 key would be containing slashes.
For example:
awslocal cloudformation create-stack --stack-name vpc-us-east-1 --template-url s3://cloudformation-templates/aws-account-cfn/vpc.json
Is raising:
Because the split occurring in
convert_s3_to_local_url
was returning 3 parts so it worked.If I understood well,
s3://
-type URIs are not accepted in--template-url
parameter, is that right? So I believe if the scheme iss3
, we could trigger the validation error straight away.Weirdly, this is an accepted answer by AWS employees... https://repost.aws/questions/QUvDk684FkRW2wvFLybXoSuA/templateurl-must-be-a-supported-url
But testing shows that it's not supported?
Adding a link showing how the url should look:
https://aws.amazon.com/blo 8000 gs/infrastructure-and-automation/best-practices-for-using-amazon-s3-endpoints-in-aws-cloudformation-templates/
\cc @whummer
Changes
Added a check for the scheme, and raises the exception straight if the scheme is
s3
.Added the test to have a long key with
/
in it to trigger the issue if not fixed.