Environment variables removed when deploying
See original GitHub issueDescription
Deploying clears a previously set environment variable.
- I am using an
env.yml
but it does not contain a section for environment variables
I have tried:
- specifying the env var on the create step using
--envvar
, but this seems to have no effect, no env var is made - adding an env var to
env.yml
and then trying to get it overridden during create using--envvar
, again, the parameter has no effect, and the value inenv.yml
gets set
Why don’t I simply just put my env var details into env.yml
if that is working?
Because I create and deploy both a staging and a production environment for each module, and I need to set a different value for the env var.
Why don’t I simply script a deploy
followed by a setenv
and call it a day?
Because this results in downtime!
Steps to reproduce
eb create --modules priority-score-calculator --env-group-suffix staging
cd priority-score-calculator
eb setenv NODE_ENV=staging -e priority-score-staging
cd ..
eb deploy --modules priority-score-calculator --env-group-suffix staging
Observed result
The env var set through setenv
gets blitzed by the deploy
command.
Expected result
Tthe env var set through setenv
is not modified by the deploy
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: Mac
- EB CLI - installed via brew:
EB CLI 3.17.0 (Python 3.8.1)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Why are my environment variables replaced during Serverless ...
CloudFormation doesn't provide a way to indicate which: existing variables should be removed. existing variables should be replace.
Read more >Environmental Variables are getting removed on each app ...
Hey, so I'm having some issues keeping my env variables. When I update my app.yaml file: doctl apps update $APPID --spec .do/app.yaml.
Read more >Environment variable is not removing during uninstall - ITNinja
Hi, When you are adding Environment variable in package or if it is already there in vendor MSI, check in Name column of...
Read more >Solved: Deployment of environment variables
Solved: Hello, I'm trying the usage of the new environment variables and ... I created the current value within the solution and did...
Read more >Remove environment variables from a deployment when they ...
OpenShift (and probably k8s, too) updates a deployment's existing environment variables and creates new ones when they were changed ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, I was able to reproduce the issue. If I am understanding correctly, you do not define any environment properties in your env.yml, but you do define option settings. It appears that the Elastic Beanstalk service is removing your environment variables, which means this is not an EB CLI bug. I would recommend reporting this on the AWS Elastic Beanstalk forum.
You should be able to reproduce the issue with the awscli by running the following command instead of
eb deploy
in your repro steps:A workaround you could try in the meantime is to define your option settings in
.ebextensions
instead of in yourenv.yml
. More info on that here.Closing this issue as it isn’t specific to EB CLI.
Correct - thanks for narrowing it down, I’ll submit an issue on the other forum.
Also thanks for the option settings in
.ebextensions
tip, I’ll try that.