Complete the code to create a Cloud VPN gateway in GCP.
resource "google_compute_ha_vpn_gateway" "vpn_gateway" { name = "my-vpn-gateway" network = "[1]" region = "us-central1" }
The network field specifies the VPC network to attach the VPN gateway to. It must be the name of an existing network, such as my-network.
Complete the code to define a VPN tunnel with the correct peer IP address.
resource "google_compute_vpn_tunnel" "vpn_tunnel" { name = "my-vpn-tunnel" region = "us-central1" vpn_gateway = google_compute_ha_vpn_gateway.vpn_gateway.id peer_ip = "[1]" shared_secret = "my-secret" }
The peer_ip is the public IP address of the remote VPN gateway. It must be a valid external IP, such as 35.192.0.1.
Fix the error in the firewall rule to allow VPN traffic.
resource "google_compute_firewall" "vpn_firewall" { name = "allow-vpn-traffic" network = "my-network" direction = "INGRESS" priority = 1000 [1] = [ { protocol = "udp" }, { protocol = "esp" }, { protocol = "ah" } ] source_ranges = ["0.0.0.0/0"] }
The correct field to specify allowed protocols and ports in a firewall rule is allowed. It expects a list of protocol names or port ranges.
Fill both blanks to configure the VPN tunnel with correct IKE version and routing options.
resource "google_compute_vpn_tunnel" "vpn_tunnel" { name = "my-vpn-tunnel" region = "us-central1" vpn_gateway = google_compute_ha_vpn_gateway.vpn_gateway.id peer_ip = "35.192.0.1" shared_secret = "my-secret" ike_version = [1] routing_type = [2] }
The ike_version should be set to 2 for modern VPNs. The routing_type can be "STATIC" for static routing.
Fill all three blanks to create a VPN tunnel with correct fields for peer IP, shared secret, and local traffic selector.
resource "google_compute_vpn_tunnel" "vpn_tunnel" { name = "my-vpn-tunnel" region = "us-central1" vpn_gateway = google_compute_ha_vpn_gateway.vpn_gateway.id peer_ip = "[1]" shared_secret = "[2]" local_traffic_selector = ["[3]"] }
The peer_ip is the remote VPN gateway's public IP. The shared_secret is the pre-shared key for authentication. The local_traffic_selector defines the IP ranges to route through the VPN, such as 10.0.0.0/16.