aws-sam-cli: DockerTag does not accept !Ref
Description:
DockerTag does not accept !Ref
Steps to reproduce:
Init a serverless template with lambda using an Image. Set Metadata:
Parameters: GitShaHash: Type: String Default: TEST
Metadata: Dockerfile: Dockerfile DockerContext: ./<function_code> DockerTag: !Ref GitShaHash
Observed result:
In cdk.out template: Metadata: DockerContext: <path_to_lambda_code> DockerTag: GitShaHash Dockerfile: Dockerfile SamResourceId: <resource_id>
Expected result:
Metadata: DockerContext: <path_to_lambda_code> DockerTag: Ref: GitShaHash Dockerfile: Dockerfile SamResourceId: <resource_id> I am using the same parameter to tag the lambda function itself and it works.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: Windows 11
sam --version: 1.66.0- AWS region: eu-west-2
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (7 by maintainers)
@sachahu1
samconfig.tomlis based on commands, sodeployconfiguration is not read duringbuild. You can either usetest.globals.parametersor define properties fortest.build.parameters.Docs: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-config.html
In case this ever ends up helping someone else: I figured out my mistake, the
[test.build.parameters]section of thesamconfig.tomlalso allows forparameter_overrides. So to correct the minimal example above, thissamconfig.tomlworks: