diff --git a/modules/networking/main.tf b/modules/networking/main.tf index e0770dc..5652219 100644 --- a/modules/networking/main.tf +++ b/modules/networking/main.tf @@ -23,3 +23,15 @@ resource "google_service_networking_connection" "this" { service = "servicenetworking.googleapis.com" reserved_peering_ranges = [google_compute_global_address.this.name] } + +resource "google_compute_router" "this" { + name = "${var.namespace}-router" + network = google_compute_network.this.id +} + +resource "google_compute_router_nat" "this" { + name = "${var.namespace}-nat" + router = google_compute_router.this.name + nat_ip_allocate_option = "AUTO_ONLY" + source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES" +} diff --git a/modules/networking/variables.tf b/modules/networking/variables.tf index 3c02d91..a85249f 100644 --- a/modules/networking/variables.tf +++ b/modules/networking/variables.tf @@ -2,3 +2,8 @@ variable "namespace" { type = string description = "The name prefix for all resources created." } + +variable "region" { + type = string + description = "The region where the router and NAT gateway will be created" +}