aws / aws/aws-cli

`CodeUri` defined in Globals section is ignored when packaging

Open
#3,376 8 comments 11 reactions 0 assignees View on GitHub
cloudformation package-deploy community customization feature-request p3
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

When executing `aws cloudformation package` to upload Lambda function ZIP's to S3, the `CodeUri` property is not inherited from the Globals section.

The [SAM documentation](https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst#supported-resources) makes it appear that it should be possible to specify `CodeUri` in the Globals section and have it inherited by all `AWS::Serverless::Function` resources. However, because the current `package` implementation does not do any kind of transformation involving the globals, this is ignored and the `CodeUri` property appears to lack a value. The behavior in this case is to zip up the current directory which can lead to all kinds of unexpected behavior (large archives [described here](https://github.com/awslabs/serverless-application-model/issues/383), Lambda errors due to incorrect relative paths, etc.).

Would it be acceptable to add something like a `dict.update()` in the [resource export function](https://github.com/aws/aws-cli/blob/c7a22bcc3f437b3e25318c9133af23a687572c92/awscli/customizations/cloudformation/artifact_exporter.py#L435) to make sure that global values for `CodeUri` are inherited? I can take a whack at it and submit a pull request.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.