-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsg.tf
53 lines (48 loc) · 1.7 KB
/
sg.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
resource "aws_security_group" "solr" {
name = "${var.solr-name-prefix}"
description = "Allow Solr inbound traffic"
vpc_id = "${var.vpc-id}"
tags = "${merge(var.tags,
map("Name", "${var.solr-name-prefix}"))}"
}
resource "aws_security_group_rule" "solr-egress" {
type = "egress"
from_port = 0
to_port = 0
protocol = -1
cidr_blocks = ["0.0.0.0/0"]
security_group_id = "${aws_security_group.solr.id}"
}
resource "aws_security_group_rule" "solr-ingress" {
type = "ingress"
from_port = "${local.solr-http-port}"
to_port = "${local.solr-http-port}"
protocol = "tcp"
cidr_blocks = ["${var.allowed-networks}"]
security_group_id = "${aws_security_group.solr.id}"
}
resource "aws_security_group_rule" "solr-https-ingress" {
count = "${var.load-balancer-enable-ssl}"
type = "ingress"
from_port = "${local.solr-https-port}"
to_port = "${local.solr-https-port}"
protocol = "tcp"
cidr_blocks = ["${var.allowed-networks}"]
security_group_id = "${aws_security_group.solr.id}"
}
resource "aws_security_group_rule" "solr-ingress-self" {
type = "ingress"
from_port = 0
to_port = 0
protocol = -1
security_group_id = "${aws_security_group.solr.id}"
self = true
}
resource "aws_security_group_rule" "solr-ssh-ingress" {
type = "ingress"
from_port = "${local.ssh-port}"
to_port = "${local.ssh-port}"
protocol = "tcp"
cidr_blocks = ["${var.allowed-networks}"]
security_group_id = "${aws_security_group.solr.id}"
}