-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvpc.tf
More file actions
executable file
·49 lines (43 loc) · 1.58 KB
/
vpc.tf
File metadata and controls
executable file
·49 lines (43 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
resource "google_compute_network" "workflows_network" {
name = "workflows-network"
auto_create_subnetworks = false
routing_mode = "REGIONAL"
}
resource "google_compute_subnetwork" "workflows_subnet" {
name = "workflows-subnet"
ip_cidr_range = "10.2.0.0/16"
network = google_compute_network.workflows_network.id
}
resource "google_compute_firewall" "ssh" {
name = "allow-ssh"
description = "Enable SSHing into VM instances"
allow {
ports = ["22"]
protocol = "tcp"
}
direction = "INGRESS"
network = google_compute_network.workflows_network.id
priority = 1000
source_ranges = ["0.0.0.0/0"]
}
resource "google_compute_router" "router" {
name = "router"
network = google_compute_network.workflows_network.id
bgp {
asn = 64514
}
}
resource "google_compute_router_nat" "nat" {
name = "router-nat"
router = google_compute_router.router.name
nat_ip_allocate_option = "AUTO_ONLY"
source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES"
# Allow the ports assigned to each VM scale up and down as needed
# https://cloud.google.com/nat/docs/ports-and-addresses#dynamic-port
enable_dynamic_port_allocation = true
# Must be disabled when dynamic port allocation is enabled (default is true)
enable_endpoint_independent_mapping = false
# The min number of ports can be tuned by monitoring port usage:
# https://cloud.google.com/nat/docs/tune-nat-configuration#choose-minimum
min_ports_per_vm = 32
}