tutorials/e2e-gke/terraform-config/networking.tf (41 lines of code) (raw):

/** * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ resource "google_compute_network" "network" { name = "app-network" auto_create_subnetworks = false } resource "google_compute_subnetwork" "subnetwork" { name = "app-subnetwork" network = google_compute_network.network.id region = var.region ip_cidr_range = "10.0.0.0/16" } resource "google_compute_router" "router" { name = "app-router" region = var.region network = google_compute_network.network.id } resource "google_compute_router_nat" "nat" { name = "app-router-nat" router = google_compute_router.router.name region = google_compute_router.router.region nat_ip_allocate_option = "AUTO_ONLY" source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES" log_config { enable = true filter = "ERRORS_ONLY" } }