aws / aws/aws-sam-cli

Repository options for `--resolve-image-repos`

Open
#3,503 6 comments 6 reactions 1 assignee Claimed by @CoshUS View on GitHub
area/deploy maintainer/need-followup type/feature
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Describe your idea/feature/enhancement

I have a lambda function that runs dockerized. I would like to programmatically set up and manage the corresponding `ECR` repository.

Maybe I'm missing something, but it looks like `sam` does not allow an `AWS::ECR::Repository` resource in the same template that defines the lambda function. You have to either create the repository outside or use the `--resolve-image-repos` flag.

If I create the repository elsewhere I have to manually provide the `URI` to the sam configuration. If I use the `--resolve-image-repos` I can't specify any details of the repository (e.g. lifecycle policy).

### Proposal

I'd be happy with either solution:

1) allow configuration of additional repository options when using the `--resolve-image-repos` flag (lifecycle policies etc)

or

2) extend sam to allow inline definitions and reference of an ECR repository, e.g.

```yaml
Resources:
LambdaECR:
Type: AWS::ECR::Repository
[...]

LambdaFunction:
Type: AWS::Serverless::Function
Properties:
PackageType: Image
Architectures:
- x86_64
ImageUri: !GetAtt LambdaECR.RepositoryUri
[...]
```

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.