forked from vmware-archive/terraforming-gcp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tcp_router.tf
46 lines (39 loc) · 1.15 KB
/
tcp_router.tf
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
// Allow access to TCP router
resource "google_compute_firewall" "cf-tcp" {
name = "${var.env_name}-cf-tcp"
network = "${google_compute_network.pcf-network.name}"
allow {
protocol = "tcp"
ports = ["1024-65535"]
}
target_tags = ["${var.env_name}-cf-tcp"]
}
// Static IP address for forwarding rule
resource "google_compute_address" "cf-tcp" {
name = "${var.env_name}-cf-tcp"
}
// Health check
resource "google_compute_http_health_check" "cf-tcp" {
name = "${var.env_name}-cf-tcp"
port = 80
request_path = "/health"
check_interval_sec = 30
timeout_sec = 5
healthy_threshold = 10
unhealthy_threshold = 2
}
// TCP target pool
resource "google_compute_target_pool" "cf-tcp" {
name = "${var.env_name}-cf-tcp"
health_checks = [
"${google_compute_http_health_check.cf-tcp.name}",
]
}
// TCP forwarding rule
resource "google_compute_forwarding_rule" "cf-tcp" {
name = "${var.env_name}-cf-tcp"
target = "${google_compute_target_pool.cf-tcp.self_link}"
port_range = "1024-1123"
ip_protocol = "TCP"
ip_address = "${google_compute_address.cf-tcp.address}"
}