0
0
GCPcloud~10 mins

Shared VPC concept in GCP - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the host project for a Shared VPC.

GCP
resource "google_compute_shared_vpc_host_project" "host" {
  project = "[1]"
}
Drag options to blanks, or click blank then click option'
Amy-shared-vpc-host
Brandom-project
Cmy-service-project
Dunrelated-project
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing the host project with the service project.
Using a project that does not own the VPC network.
2fill in blank
medium

Complete the code to attach a service project to the Shared VPC host project.

GCP
resource "google_compute_shared_vpc_service_project" "service" {
  host_project = "my-shared-vpc-host"
  service_project = "[1]"
}
Drag options to blanks, or click blank then click option'
Amy-service-project
Bmy-shared-vpc-host
Canother-host-project
Drandom-project
Attempts:
3 left
💡 Hint
Common Mistakes
Using the host project name instead of the service project.
Using a project that is not linked to the Shared VPC.
3fill in blank
hard

Fix the error in the IAM binding to allow the service project to use the Shared VPC network.

GCP
resource "google_project_iam_member" "service_network_user" {
  project = "my-shared-vpc-host"
  role    = "roles/[1]"
  member  = "serviceAccount:service-123456789@compute-system.iam.gserviceaccount.com"
}
Drag options to blanks, or click blank then click option'
Aroles.viewer
Bcompute.admin
Ccompute.networkAdmin
Dcompute.networkUser
Attempts:
3 left
💡 Hint
Common Mistakes
Using roles with too many permissions like admin.
Using roles that do not allow network usage.
4fill in blank
hard

Fill both blanks to create a firewall rule in the Shared VPC host project allowing SSH from the service project.

GCP
resource "google_compute_firewall" "allow_ssh" {
  name    = "allow-ssh"
  network = "projects/my-shared-vpc-host/global/networks/[1]"
  allow {
    protocol = "tcp"
    ports    = ["22"]
  }
  source_ranges = ["[2]"]
}
Drag options to blanks, or click blank then click option'
Ashared-vpc-network
B10.0.0.0/8
Cdefault
D192.168.1.0/24
Attempts:
3 left
💡 Hint
Common Mistakes
Using the default network instead of the Shared VPC network.
Using incorrect or too narrow IP ranges.
5fill in blank
hard

Fill all three blanks to define a subnet in the Shared VPC host project with private IP Google access enabled.

GCP
resource "google_compute_subnetwork" "shared_subnet" {
  name          = "shared-subnet"
  ip_cidr_range = "[1]"
  region        = "us-central1"
  network       = "projects/my-shared-vpc-host/global/networks/[2]"
  private_ip_google_access = [3]
}
Drag options to blanks, or click blank then click option'
A10.10.0.0/16
Bshared-vpc-network
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using an incorrect network name.
Disabling private IP Google access when it is needed.