Complete the code to create a VPC network with automatic subnet creation.
resource "google_compute_network" "vpc_network" { name = "auto-subnet-network" auto_create_subnetworks = [1] }
Setting auto_create_subnetworks to true enables automatic subnet creation in all regions.
Complete the code to create a custom subnet in a VPC network.
resource "google_compute_subnetwork" "custom_subnet" { name = "custom-subnet" ip_cidr_range = "10.0.0.0/24" network = google_compute_network.vpc_network.[1] region = "us-central1" }
The network field expects the network's self_link to link the subnet to the VPC.
Fix the error in the network creation code to specify a custom subnet mode.
resource "google_compute_network" "custom_network" { name = "custom-network" auto_create_subnetworks = [1] }
For custom subnet mode, auto_create_subnetworks must be set to false to disable automatic subnet creation.
Fill both blanks to create a custom subnet with the correct network reference and IP range.
resource "google_compute_subnetwork" "custom_subnet" { name = "custom-subnet" ip_cidr_range = [1] network = google_compute_network.custom_network.[2] region = "europe-west1" }
The ip_cidr_range must be a valid CIDR block string, and network must reference the network's ID.
Fill all three blanks to define a VPC network in custom mode and create a subnet with a specific IP range and region.
resource "google_compute_network" "custom_network" { name = [1] auto_create_subnetworks = [2] } resource "google_compute_subnetwork" "custom_subnet" { name = "custom-subnet" ip_cidr_range = [3] network = google_compute_network.custom_network.id region = "asia-east1" }
The network name is a string, auto_create_subnetworks is false for custom mode, and the subnet IP range is a valid CIDR string.