Environment variables and secrets
📖 Scenario: You are deploying a simple web application on Google Cloud Platform (GCP). The app needs to use environment variables to store configuration values and secrets to keep sensitive data safe.Using environment variables and secrets helps keep your app secure and flexible, just like keeping your house keys safe and only sharing them with trusted people.
🎯 Goal: Set up environment variables and secrets for a GCP Cloud Run service. You will create environment variables for non-sensitive data and use Google Secret Manager to securely provide sensitive data to the service.
📋 What You'll Learn
Create a Cloud Run service configuration dictionary named
cloud_run_service with a container named webapp.Add an environment variable
APP_MODE with value production to the container.Create a secret environment variable
DB_PASSWORD referencing the secret named db_password_secret from Google Secret Manager.Add the secret environment variable to the container's environment variables.
💡 Why This Matters
🌍 Real World
Using environment variables and secrets is a common practice to keep configuration and sensitive data secure and separate from code in cloud deployments.
💼 Career
Cloud engineers and developers often configure environment variables and secrets to manage app settings and credentials securely in production environments.
Progress0 / 4 steps