forked from vmware-archive/terraforming-gcp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
internetless.tf
113 lines (81 loc) · 2.25 KB
/
internetless.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Allow ingress between internal VMs for a PCF deployment
resource "google_compute_firewall" "cf-internal-ingress" {
count = "${var.internetless ? 1 : 0}"
name = "${var.env_name}-cf-internal-ingress"
network = "${google_compute_network.pcf-network.name}"
priority = 900
direction = "INGRESS"
allow {
protocol = "icmp"
}
allow {
protocol = "tcp"
}
allow {
protocol = "udp"
}
source_ranges = [
"${google_compute_subnetwork.management-subnet.ip_cidr_range}",
"${google_compute_subnetwork.pas-subnet.ip_cidr_range}",
"${google_compute_subnetwork.services-subnet.ip_cidr_range}",
]
}
// Allow egress between internal VMs for a PCF deployment
resource "google_compute_firewall" "cf-internal-egress" {
count = "${var.internetless ? 1 : 0}"
name = "${var.env_name}-cf-internal-egress"
network = "${google_compute_network.pcf-network.name}"
priority = 1000
direction = "EGRESS"
allow {
protocol = "icmp"
}
allow {
protocol = "tcp"
}
allow {
protocol = "udp"
}
destination_ranges = [
"${google_compute_subnetwork.management-subnet.ip_cidr_range}",
"${google_compute_subnetwork.pas-subnet.ip_cidr_range}",
"${google_compute_subnetwork.services-subnet.ip_cidr_range}",
]
}
// Allow OpsMgr and BOSH Director to talk to GCP APIs, e.g. googleapis.com
resource "google_compute_firewall" "cf-allow-external-egress" {
count = "${var.internetless ? 1 : 0}"
name = "${var.env_name}-cf-allow-external-egress"
network = "${google_compute_network.pcf-network.name}"
priority = 1100
direction = "EGRESS"
allow {
protocol = "icmp"
}
allow {
protocol = "tcp"
}
allow {
protocol = "udp"
}
target_service_accounts = ["${google_service_account.opsman_service_account.email}"]
destination_ranges = ["0.0.0.0/0"]
}
// Deny all outbound internet traffic
resource "google_compute_firewall" "cf-deny-external-egress" {
count = "${var.internetless ? 1 : 0}"
name = "${var.env_name}-cf-deny-external-egress"
network = "${google_compute_network.pcf-network.name}"
priority = 1200
direction = "EGRESS"
deny {
protocol = "icmp"
}
deny {
protocol = "tcp"
}
deny {
protocol = "udp"
}
destination_ranges = ["0.0.0.0/0"]
}