Skip to content

Commit 505b8eb

Browse files
authored
Merge pull request #11 from egarbi/develop
Miscellaneous Improvements
2 parents 82ff8ca + 4e47176 commit 505b8eb

3 files changed

Lines changed: 160 additions & 78 deletions

File tree

main.tf

Lines changed: 5 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,3 @@
1-
// Required
2-
variable "name" {}
3-
4-
variable "vpc_id" {}
5-
6-
variable "subnet_ids" {
7-
type = "list"
8-
}
9-
10-
variable "zone_id" {}
11-
12-
// Optional
13-
variable "elasticsearch_version" {
14-
default = "5.5"
15-
}
16-
17-
variable "itype" {
18-
default = "m4.large.elasticsearch"
19-
}
20-
21-
variable "icount" {
22-
default = 1
23-
}
24-
25-
variable "dedicated_master" {
26-
default = false
27-
}
28-
29-
variable "mtype" {
30-
default = ""
31-
}
32-
33-
variable "mcount" {
34-
default = 0
35-
}
36-
37-
variable "zone_awareness" {
38-
default = false
39-
}
40-
41-
variable "ingress_allow_security_groups" {
42-
default = []
43-
}
44-
45-
variable "ingress_allow_cidr_blocks" {
46-
default = []
47-
}
48-
49-
variable "rest_action_multi_allow_explicit_index" {
50-
default = "true"
51-
}
52-
53-
variable "indices_fielddata_cache_size" {
54-
default = ""
55-
}
56-
57-
variable "indices_query_bool_max_clause_count" {
58-
default = 1024
59-
}
60-
61-
variable "snapshot_start" {
62-
default = 0
63-
}
64-
65-
variable "volume_size" {
66-
default = "35"
67-
}
68-
69-
variable "access_policies" {
70-
description = "IAM policy document specifying the access policies for the domain"
71-
default = ""
72-
}
73-
741
resource "aws_security_group" "elasticsearch" {
752
name = "${var.name}"
763
description = "Security Group to allow traffic to ElasticSearch"
@@ -102,6 +29,10 @@ resource "aws_security_group" "elasticsearch" {
10229
resource "aws_elasticsearch_domain" "es" {
10330
domain_name = "${var.name}"
10431
elasticsearch_version = "${var.elasticsearch_version}"
32+
encrypt_at_rest {
33+
enabled = "${var.encryption_enabled}"
34+
kms_key_id = "${var.encryption_kms_key_id}"
35+
}
10536

10637
cluster_config {
10738
instance_type = "${var.itype}"
@@ -127,7 +58,7 @@ resource "aws_elasticsearch_domain" "es" {
12758

12859
ebs_options {
12960
ebs_enabled = true
130-
volume_type = "gp2"
61+
volume_type = "${var.volume_type}"
13162
volume_size = "${var.volume_size}"
13263
}
13364

@@ -149,7 +80,3 @@ resource "aws_route53_record" "main" {
14980

15081
records = ["${aws_elasticsearch_domain.es.endpoint}"]
15182
}
152-
153-
output "es_endpoint" {
154-
value = "${aws_elasticsearch_domain.es.endpoint}"
155-
}

outputs.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
output "es_endpoint" {
2+
value = "${aws_elasticsearch_domain.es.endpoint}"
3+
}
4+
5+
output "es_arn" {
6+
value ="${aws_elasticsearch_domain.es.arn}"
7+
}
8+
9+
output "es_domain_id" {
10+
value = "${aws_elasticsearch_domain.es.domain_id}"
11+
}
12+
13+
output "es_kibana_endpoint" {
14+
value = "${aws_elasticsearch_domain.es.kibana_endpoint}"
15+
}
16+
17+
output "es_availability_zones_ids" {
18+
value = "${aws_elasticsearch_domain.es.vpc_options.0.availability_zones}"
19+
}
20+
21+
output "es_vpc_ids" {
22+
value = "${aws_elasticsearch_domain.es.vpc_options.0.vpc_id}"
23+
}

variables.tf

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
// Required
2+
variable "name" {
3+
default = ""
4+
description = "Elastic Search Service cluster name."
5+
type = "string"
6+
}
7+
8+
variable "subnet_ids" {
9+
description = "List of VPC Subnet IDs for the Elastic Search Service EndPoints will be created."
10+
type = "list"
11+
}
12+
13+
variable "vpc_id" {
14+
default = ""
15+
description = "Vpc id where the Elastic Search Service cluster will be launched."
16+
type = "string"
17+
}
18+
19+
variable "zone_id" {
20+
default = "Route 53 zone id where our "
21+
description = ""
22+
type = "string"
23+
}
24+
25+
// Optional
26+
variable "access_policies" {
27+
default = ""
28+
description = "IAM policy document specifying the access policies for the domain."
29+
type = "string"
30+
}
31+
32+
variable "dedicated_master" {
33+
default = false
34+
description = "Indicates whether our cluster have dedicated master nodes enabled."
35+
type = "string"
36+
}
37+
38+
variable "encryption_enabled" {
39+
default = "false"
40+
description = "Enable encription in Elastic Search."
41+
type = "string"
42+
}
43+
44+
variable "encryption_kms_key_id" {
45+
default = ""
46+
description = "Enable encription in Elastic Search."
47+
type = "string"
48+
}
49+
50+
variable "elasticsearch_version" {
51+
default = "5.5"
52+
description = "Elastic Search Service cluster version number."
53+
type = "string"
54+
}
55+
56+
variable "icount" {
57+
default = 1
58+
description = "Elastic Search Service cluster Ec2 instance number."
59+
type = "string"
60+
}
61+
62+
variable "indices_fielddata_cache_size" {
63+
default = ""
64+
description = "Percentage of Java heap space allocated to field data."
65+
type = "string"
66+
}
67+
68+
variable "indices_query_bool_max_clause_count" {
69+
default = 1024
70+
description = "Maximum number of clauses allowed in a Lucene boolean query."
71+
type = "string"
72+
}
73+
74+
variable "ingress_allow_cidr_blocks" {
75+
default = []
76+
description = "Specifies the ingress CIDR blocks allowed."
77+
type = "list"
78+
}
79+
80+
variable "ingress_allow_security_groups" {
81+
default = []
82+
description = "Specifies the ingress security groups allowed."
83+
type = "list"
84+
}
85+
86+
variable "itype" {
87+
default = "m4.large.elasticsearch"
88+
description = "Elastic Search Service cluster Ec2 instance type."
89+
type = "string"
90+
}
91+
92+
variable "mcount" {
93+
default = 0
94+
description = "Elastic Search Service cluster dedicated master Ec2 instance number."
95+
type = "string"
96+
}
97+
98+
variable "mtype" {
99+
default = ""
100+
description = "Elastic Search Service cluster dedicated master Ec2 instance type."
101+
type = "string"
102+
}
103+
104+
variable "zone_awareness" {
105+
default = false
106+
description = "Indicates whether zone awareness is enabled."
107+
type = "string"
108+
}
109+
110+
variable "rest_action_multi_allow_explicit_index" {
111+
default = "true"
112+
description = "Specifies whether explicit references to indices are allowed inside the body of HTTP requests."
113+
type = "string"
114+
}
115+
116+
variable "snapshot_start" {
117+
default = 0
118+
description = "Elastic Search Service maintenance/snapshot start time."
119+
type = "string"
120+
}
121+
122+
variable "volume_size" {
123+
default = "35"
124+
description = "Default size of the EBS volumes."
125+
type = "string"
126+
}
127+
128+
variable "volume_type" {
129+
default = "gp2"
130+
description = "Default type of the EBS volumes."
131+
type = "string"
132+
}

0 commit comments

Comments
 (0)