You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Environment variables ignored/don't get set with referenced Parameters default values. #450
When sam local 3.0 runs my template that has !Ref as values to Parameters for ENV variables, the default value is not used if the ENV variable is not set by the shell. I believe this worked previously because all my templates are setup this way and I was using sam local before the 3.0 update. Although I cannot confirm at this time.
Transform: AWS::Serverless-2016-10-31
Parameters:
ENV:
Type: String
Default: "dev"
Description: Target Environment
Description: My Test Project
Resources:
SomeCode:
Type: AWS::Serverless::Function
Properties:
Runtime: go1.x
Handler: main
CodeUri: ./
Environment:
Variables:
DEPLOY_ENV: !Ref ENV
Events:
MyCode:
Type: Api
Properties:
Path: /gettest
Method: GET
I would expect the !Ref to resolve to the Parameter default value, and then later be overridden by the ENV variable. As if sam local deployed the template the same way Cloudformation builds the lambda/stack
We would very much like to use something newer than 0.2.0 (we stayed there because of all the .3 breaking changes), but we make heavy use of !Sub and !Ref with parameters in our sam file. I don't see a good reason to trade up to .4 until we don't have to make heavy hardcoding changes to a local yaml file. It would be really nice if we had one sam.yaml to rule them all really.
@MRODG This is not related to this issue at all. --TargetEnv is not a valid option. You can find docs here but you should use the --parameter-overrides option for what you are trying to do.
Also in the future, please use other support channels for questions like this, such as our slack channel (#samdev) or stackoverflow. Github is for bugs and feature requests.
Activity
sanathkr commentedon Jun 1, 2018
This is a regression. We will get it fixed
bnegrao commentedon Jun 12, 2018
I am having that problem too.
sbates commentedon Jul 3, 2018
We would very much like to use something newer than 0.2.0 (we stayed there because of all the .3 breaking changes), but we make heavy use of !Sub and !Ref with parameters in our sam file. I don't see a good reason to trade up to .4 until we don't have to make heavy hardcoding changes to a local yaml file. It would be really nice if we had one sam.yaml to rule them all really.
MRODG commentedon Aug 17, 2018
Hi do you know how parse this parameter for sam deploy commad?
I tried this:
sam deploy --template-file ./serverless-output.yaml --stack-name TextFileGenStack --capabilities CAPABILITY_IAM --TargetEnv dev2
TargetEnv is the Parameter that would take in my target environment from command but I am getting this error:
usage: aws [options] [ ...] [parameters]
To see help text, you can run:
aws help
aws help
aws help
aws: error: argument subcommand: Invalid choice, valid choices are:
push | register
deregister | install
uninstall
jfuss commentedon Aug 17, 2018
@MRODG This is not related to this issue at all.
--TargetEnvis not a valid option. You can find docs here but you should use the--parameter-overridesoption for what you are trying to do.Also in the future, please use other support channels for questions like this, such as our slack channel (#samdev) or stackoverflow. Github is for bugs and feature requests.
RohitRox commentedon Oct 3, 2018
I am waiting for the fix too
jfuss commentedon Oct 3, 2018
This was addressed in #657 but is waiting for a release.
Updating labels to reflect current state.
jfuss commentedon Oct 24, 2018
Closing. Was released with 0.6.1
feat: add ruby3.2 support (aws#450) (aws#470)
feat: add ruby3.2 support (#450) (#470) (#5186)