-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfirewall.tf
46 lines (38 loc) · 1.57 KB
/
firewall.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
// --- Firewall Configuration --- //
// Elastic Search Traffic --- //
// Requests
resource "google_compute_firewall" "vpc_netfw_elasticsearch_requests" {
name = "${var.network_name}-${var.deployment_region}-allow-elasticsearch-requests"
description = "Firewall rule for allowing Elastic Search Requests Traffic"
network = var.network_self_link
allow {
protocol = "tcp"
ports = [local.elastic_search_port_requests]
}
target_tags = [local.fw_tag_elasticsearch_requests]
source_ranges = var.network_source_ranges
}
// Node communications
resource "google_compute_firewall" "vpc_netfw_elasticsearch_comms" {
name = "${var.network_name}-${var.deployment_region}-allow-elasticsearch-comms"
description = "Firewall rule for allowing Elastic Search Nodes Traffic in a cluster"
network = var.network_self_link
allow {
protocol = "tcp"
ports = [local.elastic_search_port_comms]
}
target_tags = [local.fw_tag_elasticsearch_comms]
source_ranges = var.network_source_ranges
}
// Health Checks Traffic --- //
resource "google_compute_firewall" "vpc_netfw_elasticsearch_healthchecks" {
name = "${var.network_name}-${var.deployment_region}-allow-elasticsearch-healthchecks"
description = "Firewall rule for allowing Health Checks traffic to Elastic Search Nodes"
network = var.network_self_link
allow {
protocol = "tcp"
ports = [local.elastic_search_port_requests]
}
target_tags = [local.fw_tag_elasticsearch_requests]
source_ranges = concat(var.network_source_ranges, var.network_sources_health_checks)
}