-
Notifications
You must be signed in to change notification settings - Fork 25
/
secgroup_public-web2.tf
33 lines (28 loc) · 1.04 KB
/
secgroup_public-web2.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
resource "openstack_networking_secgroup_v2" "public-web2" {
name = "public-web2"
description = "[tf] Allow public HTTP + HTTPS connections (fixed)"
delete_default_rules = "true"
}
variable "web-ports" {
description = "Web ports"
type = list(string)
default = ["80", "443", "8080"]
}
resource "openstack_networking_secgroup_rule_v2" "public-web2-ports4" {
direction = "ingress"
ethertype = "IPv4"
protocol = "tcp"
security_group_id = openstack_networking_secgroup_v2.public-web2.id
count = 3
port_range_min = element(var.web-ports, count.index)
port_range_max = element(var.web-ports, count.index)
}
resource "openstack_networking_secgroup_rule_v2" "public-web2-ports6" {
direction = "ingress"
ethertype = "IPv6"
protocol = "tcp"
security_group_id = openstack_networking_secgroup_v2.public-web2.id
count = 3
port_range_min = element(var.web-ports, count.index)
port_range_max = element(var.web-ports, count.index)
}