Skip to content

Commit

Permalink
Merge pull request #11 from egarbi/develop
Browse files Browse the repository at this point in the history
Miscellaneous Improvements
  • Loading branch information
egarbi authored Apr 9, 2018
2 parents 82ff8ca + 4e47176 commit 505b8eb
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 78 deletions.
83 changes: 5 additions & 78 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,76 +1,3 @@
// Required
variable "name" {}

variable "vpc_id" {}

variable "subnet_ids" {
type = "list"
}

variable "zone_id" {}

// Optional
variable "elasticsearch_version" {
default = "5.5"
}

variable "itype" {
default = "m4.large.elasticsearch"
}

variable "icount" {
default = 1
}

variable "dedicated_master" {
default = false
}

variable "mtype" {
default = ""
}

variable "mcount" {
default = 0
}

variable "zone_awareness" {
default = false
}

variable "ingress_allow_security_groups" {
default = []
}

variable "ingress_allow_cidr_blocks" {
default = []
}

variable "rest_action_multi_allow_explicit_index" {
default = "true"
}

variable "indices_fielddata_cache_size" {
default = ""
}

variable "indices_query_bool_max_clause_count" {
default = 1024
}

variable "snapshot_start" {
default = 0
}

variable "volume_size" {
default = "35"
}

variable "access_policies" {
description = "IAM policy document specifying the access policies for the domain"
default = ""
}

resource "aws_security_group" "elasticsearch" {
name = "${var.name}"
description = "Security Group to allow traffic to ElasticSearch"
Expand Down Expand Up @@ -102,6 +29,10 @@ resource "aws_security_group" "elasticsearch" {
resource "aws_elasticsearch_domain" "es" {
domain_name = "${var.name}"
elasticsearch_version = "${var.elasticsearch_version}"
encrypt_at_rest {
enabled = "${var.encryption_enabled}"
kms_key_id = "${var.encryption_kms_key_id}"
}

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

ebs_options {
ebs_enabled = true
volume_type = "gp2"
volume_type = "${var.volume_type}"
volume_size = "${var.volume_size}"
}

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

records = ["${aws_elasticsearch_domain.es.endpoint}"]
}

output "es_endpoint" {
value = "${aws_elasticsearch_domain.es.endpoint}"
}
23 changes: 23 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
output "es_endpoint" {
value = "${aws_elasticsearch_domain.es.endpoint}"
}

output "es_arn" {
value ="${aws_elasticsearch_domain.es.arn}"
}

output "es_domain_id" {
value = "${aws_elasticsearch_domain.es.domain_id}"
}

output "es_kibana_endpoint" {
value = "${aws_elasticsearch_domain.es.kibana_endpoint}"
}

output "es_availability_zones_ids" {
value = "${aws_elasticsearch_domain.es.vpc_options.0.availability_zones}"
}

output "es_vpc_ids" {
value = "${aws_elasticsearch_domain.es.vpc_options.0.vpc_id}"
}
132 changes: 132 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
// Required
variable "name" {
default = ""
description = "Elastic Search Service cluster name."
type = "string"
}

variable "subnet_ids" {
description = "List of VPC Subnet IDs for the Elastic Search Service EndPoints will be created."
type = "list"
}

variable "vpc_id" {
default = ""
description = "Vpc id where the Elastic Search Service cluster will be launched."
type = "string"
}

variable "zone_id" {
default = "Route 53 zone id where our "
description = ""
type = "string"
}

// Optional
variable "access_policies" {
default = ""
description = "IAM policy document specifying the access policies for the domain."
type = "string"
}

variable "dedicated_master" {
default = false
description = "Indicates whether our cluster have dedicated master nodes enabled."
type = "string"
}

variable "encryption_enabled" {
default = "false"
description = "Enable encription in Elastic Search."
type = "string"
}

variable "encryption_kms_key_id" {
default = ""
description = "Enable encription in Elastic Search."
type = "string"
}

variable "elasticsearch_version" {
default = "5.5"
description = "Elastic Search Service cluster version number."
type = "string"
}

variable "icount" {
default = 1
description = "Elastic Search Service cluster Ec2 instance number."
type = "string"
}

variable "indices_fielddata_cache_size" {
default = ""
description = "Percentage of Java heap space allocated to field data."
type = "string"
}

variable "indices_query_bool_max_clause_count" {
default = 1024
description = "Maximum number of clauses allowed in a Lucene boolean query."
type = "string"
}

variable "ingress_allow_cidr_blocks" {
default = []
description = "Specifies the ingress CIDR blocks allowed."
type = "list"
}

variable "ingress_allow_security_groups" {
default = []
description = "Specifies the ingress security groups allowed."
type = "list"
}

variable "itype" {
default = "m4.large.elasticsearch"
description = "Elastic Search Service cluster Ec2 instance type."
type = "string"
}

variable "mcount" {
default = 0
description = "Elastic Search Service cluster dedicated master Ec2 instance number."
type = "string"
}

variable "mtype" {
default = ""
description = "Elastic Search Service cluster dedicated master Ec2 instance type."
type = "string"
}

variable "zone_awareness" {
default = false
description = "Indicates whether zone awareness is enabled."
type = "string"
}

variable "rest_action_multi_allow_explicit_index" {
default = "true"
description = "Specifies whether explicit references to indices are allowed inside the body of HTTP requests."
type = "string"
}

variable "snapshot_start" {
default = 0
description = "Elastic Search Service maintenance/snapshot start time."
type = "string"
}

variable "volume_size" {
default = "35"
description = "Default size of the EBS volumes."
type = "string"
}

variable "volume_type" {
default = "gp2"
description = "Default type of the EBS volumes."
type = "string"
}

0 comments on commit 505b8eb

Please sign in to comment.