-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsg.tf
More file actions
57 lines (52 loc) · 1.5 KB
/
sg.tf
File metadata and controls
57 lines (52 loc) · 1.5 KB
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
resource "exoscale_security_group" "autoscaling" {
name = "autoscaling"
description = "Managed by Terraform!"
}
resource "exoscale_security_group_rule" "grafana" {
security_group_id = exoscale_security_group.autoscaling.id
type = "INGRESS"
cidr = var.admin_ip
start_port = "3000"
end_port = "3000"
protocol = "TCP"
description = "Managed by Terraform!"
count = var.admin_ip==""?0:1
}
resource "exoscale_security_group_rule" "http" {
security_group_id = exoscale_security_group.autoscaling.id
type = "INGRESS"
cidr = "0.0.0.0/0"
start_port = "8080"
end_port = "8080"
protocol = "TCP"
description = "Managed by Terraform!"
}
resource "exoscale_security_group_rule" "prometheus" {
security_group_id = exoscale_security_group.autoscaling.id
type = "INGRESS"
cidr = var.admin_ip
start_port = "9090"
end_port = "9090"
protocol = "TCP"
description = "Managed by Terraform!"
count = var.admin_ip==""?0:1
}
resource "exoscale_security_group_rule" "internal" {
security_group_id = exoscale_security_group.autoscaling.id
user_security_group_id = exoscale_security_group.autoscaling.id
type = "INGRESS"
start_port = "1"
end_port = "65535"
protocol = "TCP"
description = "Managed by Terraform!"
}
resource "exoscale_security_group_rule" "ssh" {
security_group_id = exoscale_security_group.autoscaling.id
type = "INGRESS"
cidr = var.admin_ip
start_port = "22"
end_port = "22"
protocol = "TCP"
description = "Managed by Terraform!"
count = var.admin_ip==""?0:1
}