Open felipegenef opened 1 year ago
something like ${self:provider.ecr.images.imageName.uri} to get the deployed container URI or simply have imageName as the URI value as default (Similar behaviour from lambda images). This way we would be able to "!Ref" it on the resources tab.
!Ref
is for addressing other resources in same CF template, and as this image is not part of a template it's out of question.
Anyway, something that you've proposed below, could work, via e.g. aws
variable source extension, e.g. as:
${aws:ecrImage/<imageName>.uri}
For that we can generalize image uri that's currently implemented here: https://github.com/serverless/serverless/blob/17d64e6c94b88a5daf36f28a4fa192c231052cfb/lib/plugins/aws/provider.js#L2348-L2463
And reuse it in context of aws
variable resolver: https://github.com/serverless/serverless/blob/17d64e6c94b88a5daf36f28a4fa192c231052cfb/lib/configuration/variables/sources/instance-dependent/get-aws.js
WDYT?
I'm interested in this as well.
WDYT?
${aws:ecrImage/<imageName>.uri}
Looks Awesome ! That would solve a huge problem when you want to deploy fargate images from serverless framework!
Is there an existing issue for this?
Use case description
Hey guys, I have a project where I created an ECR and a TaskDefinition for AWS FARGATE on my resources tab, but I had to deploy an aws function with my container image to have access to my URI. It would be nice if we could deploy and access ecr uris from within the template... something like
${self:provider.ecr.images.imageName.uri}
to get the deployed container URI or simply have imageName as the URI value as default (Similar behaviour from lambda images). This way we would be able to "!Ref" it on the resources tab.My Code
If you look at it you will see that I use
${ssm:/account-id}.dkr.ecr.${self:provider.region}.amazonaws.com/serverless-${self:service}-${opt:stage,"dev"}:javascriptScriptTaskDefinition
instead of a simple${self:provider.ecr.images.imageName.uri}
. I also needed to use the same container as a lambda image to deploy it.Proposed solution (optional)
EX1:
EX2: