0
0
GCPcloud~30 mins

Configuration properties in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
GCP Configuration Properties Setup
📖 Scenario: You are setting up a Google Cloud Platform (GCP) project configuration to manage environment-specific properties for a web application deployment.
🎯 Goal: Build a configuration file that holds key properties such as project ID, region, and environment type, then use these properties to define deployment settings.
📋 What You'll Learn
Create a dictionary named config with specific keys and values
Add a variable environment to select the deployment environment
Use the environment variable to set the config dictionary's project_id accordingly
Add a final property deployment_name that combines environment and region
💡 Why This Matters
🌍 Real World
Managing configuration properties is essential for deploying cloud applications in different environments like development, testing, and production.
💼 Career
Cloud engineers and DevOps professionals often create and manage configuration files to automate deployments and maintain consistency across environments.
Progress0 / 4 steps
1
Create initial configuration dictionary
Create a dictionary called config with these exact entries: 'project_id': 'my-gcp-project', 'region': 'us-central1', and 'environment': 'dev'.
GCP
Need a hint?

Use curly braces to create a dictionary and separate keys and values with colons.

2
Add environment variable
Create a variable called environment and set it to the string 'prod'.
GCP
Need a hint?

Assign the string 'prod' to the variable named environment.

3
Update project_id based on environment
Use an if statement to check if environment equals 'prod'. If true, update config['project_id'] to 'my-gcp-project-prod'. Otherwise, keep it as 'my-gcp-project'.
GCP
Need a hint?

Use an if-else block to update the project_id in the config dictionary.

4
Add deployment_name property
Add a new key 'deployment_name' to the config dictionary. Set its value to a string combining environment and config['region'] separated by a dash, like prod-us-central1.
GCP
Need a hint?

Use an f-string to combine environment and region with a dash.