forked from guangie88/terraform-aws-emr-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
83 lines (74 loc) · 2.73 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
data "aws_subnet" "emr_subnet" {
id = "${var.subnet_id}"
}
#
# EMR resources
#
# uses custom AMI
#resource "aws_emr_cluster" "cluster-ami" {
# count = "${var.use_custom_ami ? 1 : 0}"
# name = "${var.name}"
# custom_ami_id = "${var.custom_ami_id}"
# release_label = "${var.release_label}"
# applications = "${var.applications}"
# configurations = "${var.configurations}"
#
# ec2_attributes {
# key_name = "${var.key_name}"
# subnet_id = "${var.subnet_id}"
# emr_managed_master_security_group = "${aws_security_group.emr_master.id}"
# emr_managed_slave_security_group = "${aws_security_group.emr_slave.id}"
# additional_master_security_groups = "${var.additional_master_security_groups}"
# service_access_security_group = "${data.aws_subnet.emr_subnet.map_public_ip_on_launch ? "" : aws_security_group.service_access.id}"
# instance_profile = "${aws_iam_instance_profile.emr_ec2_instance_profile.arn}"
# }
#
# instance_group = "${var.instance_groups}"
#
# autoscaling_role = "${aws_iam_role.emr_autoscaling_role.arn}"
#
# bootstrap_action {
# path = "${var.bootstrap_uri}"
# name = "${var.bootstrap_name}"
# args = "${var.bootstrap_args}"
# }
#
# log_uri = "${var.log_uri}"
# service_role = "${aws_iam_role.emr_service_role.arn}"
#
# tags {
# Name = "${var.name}"
# Project = "${var.project}"
# Environment = "${var.environment}"
# }
#}
# does not use custom AMI
resource "aws_emr_cluster" "cluster" {
name = "${var.name}"
release_label = "${var.release_label}"
applications = "${var.applications}"
configurations = "${var.configurations}"
ec2_attributes {
key_name = "${var.key_name}"
subnet_id = "${var.subnet_id}"
emr_managed_master_security_group = "${aws_security_group.emr_master.id}"
emr_managed_slave_security_group = "${aws_security_group.emr_slave.id}"
additional_master_security_groups = "${var.additional_master_security_groups}"
service_access_security_group = "${data.aws_subnet.emr_subnet.map_public_ip_on_launch ? "" : aws_security_group.service_access.id}"
instance_profile = "${aws_iam_instance_profile.emr_ec2_instance_profile.arn}"
}
instance_group = "${var.instance_groups}"
autoscaling_role = "${aws_iam_role.emr_autoscaling_role.arn}"
bootstrap_action {
path = "${var.bootstrap_uri}"
name = "${var.bootstrap_name}"
args = "${var.bootstrap_args}"
}
log_uri = "${var.log_uri}"
service_role = "${aws_iam_role.emr_service_role.arn}"
tags {
Name = "${var.name}"
Project = "${var.project}"
Environment = "${var.environment}"
}
}