0
0
GCPcloud~30 mins

Why IaC matters in GCP - See It in Action

Choose your learning style9 modes available
Why IaC matters
📖 Scenario: You work as a cloud engineer for a small company. Your team wants to manage cloud resources in a way that is easy, fast, and reliable. You will learn how to use Infrastructure as Code (IaC) to create and manage cloud resources automatically.
🎯 Goal: Build a simple Google Cloud Platform (GCP) configuration using IaC to create a virtual machine instance. This will show why IaC matters by making resource setup repeatable and consistent.
📋 What You'll Learn
Create a dictionary called vm_config with keys name, machine_type, and zone with exact values.
Add a variable called project_id with the exact string value.
Write a function called create_instance_config that returns a dictionary combining project_id and vm_config.
Add a final dictionary called deployment_config that includes the instance configuration under the key resources.
💡 Why This Matters
🌍 Real World
IaC is used by cloud engineers to automate and manage cloud resources reliably without manual clicks.
💼 Career
Understanding IaC is essential for cloud jobs to improve speed, reduce errors, and enable collaboration.
Progress0 / 4 steps
1
Create the VM configuration dictionary
Create a dictionary called vm_config with these exact entries: 'name': 'test-vm', 'machine_type': 'e2-medium', and 'zone': 'us-central1-a'.
GCP
Need a hint?

Use curly braces to create a dictionary with the exact keys and values.

2
Add the project ID variable
Add a variable called project_id and set it to the string 'my-gcp-project'.
GCP
Need a hint?

Assign the exact string to the variable project_id.

3
Write a function to create instance config
Write a function called create_instance_config that returns a dictionary with keys project set to project_id and instance set to vm_config.
GCP
Need a hint?

Define a function that returns a dictionary combining the project ID and VM config.

4
Create the final deployment configuration
Create a dictionary called deployment_config with a key resources set to a list containing the result of calling create_instance_config().
GCP
Need a hint?

Create a dictionary with a list of resources using the function result.