Skip to content

Commit

Permalink
fix nat
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyblasczyk committed Dec 9, 2024
1 parent c7ccb44 commit e082fdf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/networking/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
5 changes: 5 additions & 0 deletions modules/networking/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit e082fdf

Please sign in to comment.