Added option to enable or disable Cloud NAT.
This commit is contained in:
@@ -15,6 +15,7 @@ resource "google_compute_subnetwork" "subnet" {
|
||||
|
||||
# Cloud NAT
|
||||
resource "google_compute_router" "cr" {
|
||||
count = var.nat ? 1 : 0
|
||||
name = "${var.name}-router"
|
||||
network = var.name
|
||||
|
||||
@@ -22,8 +23,9 @@ resource "google_compute_router" "cr" {
|
||||
}
|
||||
|
||||
resource "google_compute_router_nat" "nat" {
|
||||
count = var.nat ? 1 : 0
|
||||
name = "${var.name}-nat"
|
||||
router = google_compute_router.cr.name
|
||||
router = google_compute_router.cr[0].name
|
||||
nat_ip_allocate_option = "AUTO_ONLY"
|
||||
source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES"
|
||||
enable_dynamic_port_allocation = true
|
||||
|
||||
Reference in New Issue
Block a user