Closed ryanpeach closed 5 years ago
Same for some other functions like Fn::Join
Many of the intrinsics are not currently supported and this is a duplicate of #528
Closing
@ryanpeach How did you even get !Ref
to work? I am receiving this error:
Invalid value in Template for key: MY_ENV_VAR: expected string
When I try this in my template.yml
:
Parameters:
SomeTestParam:
Type: String
Default: foobar
...
Environment:
Variables:
MY_ENV_VAR: !Ref SomeTestParam
I am on SAM CLI v0.19.0.
Use !Sub when you want to combine/concatenate 'parameter' with some other string e.g. !Sub "this-is-${parameter}"
When you want to use the parameter only, use it as !Ref e.g. !Ref environment
In above, 'environment' is declared as 'parameter' and passed with '--parameter-overrides'
Description
When using !Sub, or Fn::Sub, when declaring the environment variables of a lambda function, you get an empty environment variable.
Steps to reproduce
Given a template at
/template.yaml
And a python function
/hello-world/lambda.py
And an empty requirements.txt file at
/hello-world/requirements.txt
And a simple events file at
/event.json
containing just{}
Run from root:
Observed result
sam deploy --use-container --debug
sam local invoke HelloWorldFunction --event event.json --debug
The important part:
Expected result
DOES_NOT_WORK did not have a value, but it did exist in the environment variables.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
macOS High Sierra Version 10.13.6
sam --version
:SAM CLI, version 0.12.0