Finished first version of network, network-peering and linux-vm modules.

This commit is contained in:
2025-03-31 10:10:39 +02:00
parent 6924f75c86
commit 93537e5da5
6 changed files with 145 additions and 61 deletions
+10 -10
View File
@@ -1,5 +1,5 @@
# VPC
resource "google_compute_network" "vpc_network" {
resource "google_compute_network" "network" {
name = var.name
auto_create_subnetworks = false
}
@@ -10,21 +10,21 @@ resource "google_compute_subnetwork" "subnet" {
name = var.subnets[count.index].name
ip_cidr_range = var.subnets[count.index].cidr
region = var.subnets[count.index].region != null ? var.subnets[count.index].region : var.subnets[0].region
network = google_compute_network.vpc_network.id
network = google_compute_network.network.id
}
# Cloud NAT
resource "google_compute_router" "cr" {
name = "${var.name}-router"
network = google_compute_network.vpc_network.id
region = var.subnets[0].region
network = var.name
depends_on = [google_compute_network.network]
}
resource "google_compute_router_nat" "name" {
name = "${var.name}-nat"
region = var.subnets[0].region
router = google_compute_router.cr.name
nat_ip_allocate_option = "AUTO_ONLY"
resource "google_compute_router_nat" "nat" {
name = "${var.name}-nat"
router = google_compute_router.cr.name
nat_ip_allocate_option = "AUTO_ONLY"
source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES"
enable_dynamic_port_allocation = true
enable_dynamic_port_allocation = true
}