-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
61 lines (50 loc) · 1.63 KB
/
main.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
terraform {
required_version = ">= 0.11.6"
}
resource "aws_security_group" "nomad_spark" {
count = "${var.create ? 1 : 0}"
name_prefix = "${var.name}-"
description = "Security Group for ${var.name} Nomad Spark"
vpc_id = "${var.vpc_id}"
tags = "${merge(var.tags, map("Name", format("%s", var.name)))}"
}
# HDFS NameNode UI
resource "aws_security_group_rule" "hdfs_namenode_ui" {
count = "${var.create ? 1 : 0}"
security_group_id = "${aws_security_group.nomad_spark.id}"
type = "ingress"
protocol = "tcp"
from_port = 50070
to_port = 50070
cidr_blocks = ["${var.cidr_blocks}"]
}
# HDFS DataNode UI
resource "aws_security_group_rule" "hdfs_datanode_ui" {
count = "${var.create ? 1 : 0}"
security_group_id = "${aws_security_group.nomad_spark.id}"
type = "ingress"
protocol = "tcp"
from_port = 50075
to_port = 50075
cidr_blocks = ["${var.cidr_blocks}"]
}
# Spark history server UI
resource "aws_security_group_rule" "history_server_ui" {
count = "${var.create ? 1 : 0}"
security_group_id = "${aws_security_group.nomad_spark.id}"
type = "ingress"
protocol = "tcp"
from_port = 18080
to_port = 18080
cidr_blocks = ["${var.cidr_blocks}"]
}
# Inter communication between HDFS
resource "aws_security_group_rule" "outbound_tcp" {
count = "${var.create ? 1 : 0}"
security_group_id = "${aws_security_group.nomad_spark.id}"
type = "ingress"
protocol = "-1"
from_port = 0
to_port = 0
cidr_blocks = ["0.0.0.0/0"]
}