-
Notifications
You must be signed in to change notification settings - Fork 0
/
default-secgroup.tf
64 lines (52 loc) · 1.92 KB
/
default-secgroup.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
resource "openstack_networking_secgroup_v2" "default" {
name = "${var.resource_prefix}-default"
description = "Managed by Terraform; locally-managed default group"
delete_default_rules = true
}
resource "openstack_networking_secgroup_rule_v2" "default-egress" {
for_each = { IPv4 = "0.0.0.0/0", IPv6 = "::/0" }
direction = "egress"
ethertype = each.key
remote_ip_prefix = each.value
description = "Outbound to internet"
security_group_id = openstack_networking_secgroup_v2.default.id
}
resource "openstack_networking_secgroup_rule_v2" "default-icmp" {
direction = "ingress"
ethertype = "IPv4"
protocol = "icmp"
remote_ip_prefix = "172.16.0.0/21"
description = "WMCS ICMP"
security_group_id = openstack_networking_secgroup_v2.default.id
}
resource "openstack_networking_secgroup_rule_v2" "default-ssh" {
direction = "ingress"
ethertype = "IPv4"
protocol = "tcp"
port_range_min = 22
port_range_max = 22
remote_ip_prefix = "172.16.0.0/21"
description = "WMCS SSH"
security_group_id = openstack_networking_secgroup_v2.default.id
}
resource "openstack_networking_secgroup_rule_v2" "default-nagios" {
direction = "ingress"
ethertype = "IPv4"
protocol = "tcp"
port_range_min = 5666
port_range_max = 5666
remote_ip_prefix = "172.16.0.0/21"
description = "WMCS Nagios monitoring"
security_group_id = openstack_networking_secgroup_v2.default.id
}
resource "openstack_networking_secgroup_rule_v2" "default-prometheus" {
for_each = toset(["172.16.6.65/32", "172.16.0.229/32"])
direction = "ingress"
ethertype = "IPv4"
protocol = "tcp"
port_range_min = 9100
port_range_max = 9100
remote_ip_prefix = each.value
description = "WMCS Prometheus monitoring"
security_group_id = openstack_networking_secgroup_v2.default.id
}