0
0
GCPcloud~10 mins

Resource definitions for 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 define a Google Cloud Storage bucket resource.

GCP
resource "google_storage_bucket" "my_bucket" {
  name     = [1]
  location = "US"
}
Drag options to blanks, or click blank then click option'
Abucket_name
B"my-unique-bucket-123"
C"us-central1"
Dmy_bucket
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted names for the bucket
Using location value instead of name
2fill in blank
medium

Complete the code to specify the machine type for a Compute Engine instance.

GCP
resource "google_compute_instance" "vm_instance" {
  name         = "vm-1"
  machine_type = [1]
  zone         = "us-central1-a"
}
Drag options to blanks, or click blank then click option'
A"us-central1-a"
Bn1-standard-1
C"n1-standard-1"
Dstandard-1
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around machine type
Using zone value instead of machine type
3fill in blank
hard

Fix the error in the resource definition by completing the missing field for network interface.

GCP
resource "google_compute_instance" "vm_instance" {
  name         = "vm-2"
  machine_type = "e2-medium"
  zone         = "us-west1-b"

  network_interface {
    network = [1]
  }
}
Drag options to blanks, or click blank then click option'
A"default"
Bdefault
C"us-west1-b"
Dnetwork
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted network name
Using zone or other unrelated values
4fill in blank
hard

Fill both blanks to define a firewall rule allowing HTTP traffic.

GCP
resource "google_compute_firewall" "allow_http" {
  name    = "allow-http"
  network = [1]

  allow {
    protocol = [2]
    ports    = ["80"]
  }
}
Drag options to blanks, or click blank then click option'
A"default"
B"tcp"
C"udp"
D"icmp"
Attempts:
3 left
💡 Hint
Common Mistakes
Using UDP or ICMP instead of TCP
Omitting quotes around network or protocol
5fill in blank
hard

Fill all three blanks to define a Cloud SQL instance with MySQL database version and region.

GCP
resource "google_sql_database_instance" "db_instance" {
  name             = [1]
  database_version = [2]
  region           = [3]
}
Drag options to blanks, or click blank then click option'
A"my-db-instance"
B"MYSQL_8_0"
C"us-central1"
D"POSTGRES_13"
Attempts:
3 left
💡 Hint
Common Mistakes
Using PostgreSQL version instead of MySQL
Omitting quotes around strings
Using invalid region names