aws / aws/aws-toolkit-visual-studio
Can't use "Ref" or "Fn::Sub" in Metadata DockerTag
- Dominant language
- No language data
- Stars
- 135
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
### Description:
I am trying to deploy a serverless application by using AWS Toolkit ("Publish to AWS" button) with Visual Studio 2019
It seems that "Ref" function does not work in "Metadata" attribute. (It works well on other parts of the serverless)
### Steps to reproduce:
Example template :
```
{
"AWSTemplateFormatVersion": "2010-09-09",
"Transform": "AWS::Serverless-2016-10-31",
"Description": "An AWS Serverless Application.",
"Parameters": {
"DockerTag": {
"Type": "String",
"Default": "tag:9.9.9",
"Description": "The value the docker image will be tagged with."
}
},
"Resources": {
"Foo": {
"Type": "AWS::Serverless::Function",
"Properties": {
"PackageType": "Image",
"ImageConfig": {
"Command": ["Project::Namespace.Class::FunctionHandler"]
}
},
"Metadata": {
"DockerTag": {"Ref": "DockerTag"}
}
}
}
}
```
Exactly the same behavior if I try to use "Fn::Sub" instead of "Ref"
```
"Metadata": {
"DockerTag": { "Fn::Sub": [ "proxy-.${DockerTag}", { "DockerTag": {"Ref" : "DockerTag" }} ]}
}
```
### Observed result:
... docker build -f "C:\Workspace\C-Next\evs-cnext-monitoring\EVS.CNext.Monitoring\.\Dockerfile" -t **jsondata object:latest** .
### Expected result:
... docker build -f "C:\Workspace\C-Next\evs-cnext-monitoring\EVS.CNext.Monitoring\.\Dockerfile" -t **tag:9.9.9** .
### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
1. OS: Windows 10
2. AWS Toolkit for Visual Studio 2017 and 2019 version : 1.21.2.0
3. Visual Studio

Contributor guide
Research direction
Reproduce the issue using the provided serverless application template, the AWS Toolkit for Visual Studio "Publish to AWS" button, and the referenced Dockerfile. Start by tracing how the Metadata DockerTag value is handled during publishing; done means Ref and Fn::Sub resolve to the parameter value so docker build uses tag:9.9.9 instead of a JSON object.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, docker
- Domain
- cloud, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100