11// Required
22variable "name" {}
3+
34variable "vpc_id" {}
5+
46variable "subnet_ids" {
57 type = " list"
68}
7- variable "zone_id" {}
89
10+ variable "zone_id" {}
911
1012// Optional
1113variable "elasticsearch_version" {
@@ -47,6 +49,7 @@ variable "ingress_allow_cidr_blocks" {
4749variable "rest_action_multi_allow_explicit_index" {
4850 default = " true"
4951}
52+
5053variable "indices_fielddata_cache_size" {
5154 default = " "
5255}
@@ -63,16 +66,20 @@ variable "volume_size" {
6366 default = " 35"
6467}
6568
69+ variable "access_policies" {
70+ description = " IAM policy document specifying the access policies for the domain"
71+ default = " "
72+ }
6673
6774resource "aws_security_group" "elasticsearch" {
6875 name = " ${ var . name } "
6976 description = " Security Group to allow traffic to ElasticSearch"
7077
71- ingress {
72- from_port = 443
73- to_port = 443
74- protocol = " tcp"
75- cidr_blocks = [" ${ var . ingress_allow_cidr_blocks } " ]
78+ ingress {
79+ from_port = 443
80+ to_port = 443
81+ protocol = " tcp"
82+ cidr_blocks = [" ${ var . ingress_allow_cidr_blocks } " ]
7683 }
7784
7885 ingress {
@@ -97,23 +104,25 @@ resource "aws_elasticsearch_domain" "es" {
97104 elasticsearch_version = " ${ var . elasticsearch_version } "
98105
99106 cluster_config {
100- instance_type = " ${ var . itype } "
101- instance_count = " ${ var . icount } "
107+ instance_type = " ${ var . itype } "
108+ instance_count = " ${ var . icount } "
102109 dedicated_master_enabled = " ${ var . dedicated_master } "
103- dedicated_master_type = " ${ var . mtype } "
104- dedicated_master_count = " ${ var . mcount } "
105- zone_awareness_enabled = " ${ var . zone_awareness } "
110+ dedicated_master_type = " ${ var . mtype } "
111+ dedicated_master_count = " ${ var . mcount } "
112+ zone_awareness_enabled = " ${ var . zone_awareness } "
106113 }
107114
115+ access_policies = " ${ var . access_policies } "
116+
108117 vpc_options {
109- security_group_ids = [ " ${ aws_security_group . elasticsearch . id } " ]
110- subnet_ids = [ " ${ var . subnet_ids } " ]
118+ security_group_ids = [" ${ aws_security_group . elasticsearch . id } " ]
119+ subnet_ids = [" ${ var . subnet_ids } " ]
111120 }
112121
113122 advanced_options {
114123 " rest.action.multi.allow_explicit_index" = " ${ var . rest_action_multi_allow_explicit_index } "
115- " indices.fielddata.cache.size" = " ${ var . indices_fielddata_cache_size } "
116- " indices.query.bool.max_clause_count" = " ${ var . indices_query_bool_max_clause_count } "
124+ " indices.fielddata.cache.size" = " ${ var . indices_fielddata_cache_size } "
125+ " indices.query.bool.max_clause_count" = " ${ var . indices_query_bool_max_clause_count } "
117126 }
118127
119128 ebs_options {
0 commit comments