Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update a Google Cloud Function's Runtime environment variables without redeploying it?

Looks like I have to redeploy my google function if I want to change the "Runtime environment variables".

Is there a way to update without redeploying?


2 Answers

No, there is no way to update the environment variable without redeploying. The principle is to keep a version consistent. Like this, in case of issue in the new version, you can go back to the previous one. It's the principle for a quick rollback.

Sadly, Cloud Functions not yet allow to go back to a previous version (but it should be in the roadmap, I discussed this months ago with a PM). Cloud Run and App Engine allow this rollback, based on this principle, it's a good practice.

At a DevOps perspective, a change in the Env var is a push in your repo, a new CI/CD job and thus a new deployment.

like image 60
guillaume blaquiere Avatar answered Sep 23 '25 07:09

guillaume blaquiere


To update a variable using the Google Cloud CLI, use the --update-env-vars flag at deploy time:

gcloud functions deploy FUNCTION_NAME --update-env-vars FOO=bar

Learn more about it here

like image 30
kooskoos Avatar answered Sep 23 '25 07:09

kooskoos