-
Notifications
You must be signed in to change notification settings - Fork 1
/
securitygroup.tf
63 lines (57 loc) · 2.04 KB
/
securitygroup.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
data "openstack_networking_secgroup_v2" "default" {
name = "default"
}
resource "openstack_networking_secgroup_rule_v2" "ssh" {
direction = "ingress"
description = "Only allow ssh from my IP"
ethertype = "IPv4"
security_group_id = data.openstack_networking_secgroup_v2.default.id
protocol = "tcp"
port_range_min = 22
port_range_max = 22
remote_ip_prefix = var.remote_ip_prefix
}
resource "openstack_networking_secgroup_rule_v2" "http" {
direction = "ingress"
description = "Inbound HTTP traffic"
ethertype = "IPv4"
security_group_id = data.openstack_networking_secgroup_v2.default.id
protocol = "tcp"
port_range_min = 80
port_range_max = 80
remote_ip_prefix = "0.0.0.0/0"
}
resource "openstack_networking_secgroup_rule_v2" "https" {
direction = "ingress"
description = "Inbound HTTPS traffic"
ethertype = "IPv4"
security_group_id = data.openstack_networking_secgroup_v2.default.id
protocol = "tcp"
port_range_min = 443
port_range_max = 443
remote_ip_prefix = "0.0.0.0/0"
}
resource "openstack_networking_secgroup_rule_v2" "egress_tcp" {
direction = "egress"
description = "Allow list for outbound TCP"
ethertype = "IPv4"
security_group_id = data.openstack_networking_secgroup_v2.default.id
protocol = "tcp"
remote_ip_prefix = "0.0.0.0/0"
}
resource "openstack_networking_secgroup_rule_v2" "egress_udp" {
direction = "egress"
description = "Allow list for outbound udp"
ethertype = "IPv4"
security_group_id = data.openstack_networking_secgroup_v2.default.id
protocol = "udp"
remote_ip_prefix = "0.0.0.0/0"
}
resource "openstack_networking_secgroup_rule_v2" "egress_icmp" {
direction = "egress"
description = "Allow list for outbound icmp"
ethertype = "IPv4"
security_group_id = data.openstack_networking_secgroup_v2.default.id
protocol = "icmp"
remote_ip_prefix = "0.0.0.0/0"
}