Skip to content

Commit e082fdf

Browse files
fix nat
1 parent c7ccb44 commit e082fdf

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

modules/networking/main.tf

+12
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,15 @@ resource "google_service_networking_connection" "this" {
2323
service = "servicenetworking.googleapis.com"
2424
reserved_peering_ranges = [google_compute_global_address.this.name]
2525
}
26+
27+
resource "google_compute_router" "this" {
28+
name = "${var.namespace}-router"
29+
network = google_compute_network.this.id
30+
}
31+
32+
resource "google_compute_router_nat" "this" {
33+
name = "${var.namespace}-nat"
34+
router = google_compute_router.this.name
35+
nat_ip_allocate_option = "AUTO_ONLY"
36+
source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES"
37+
}

modules/networking/variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ variable "namespace" {
22
type = string
33
description = "The name prefix for all resources created."
44
}
5+
6+
variable "region" {
7+
type = string
8+
description = "The region where the router and NAT gateway will be created"
9+
}

0 commit comments

Comments
 (0)