AWS ElasticSearch terraform Module

Terraform module to provision an Elasticsearch.

Usage

Simple setup

If you want to create a ElasticSearch Domain with simple configuration and endpoints in a single Aavailability Zone, use the module like this:

module "elasticsearch" {
  source                   = "app.terraform.io/ncodelibrary/elasticsearch/aws"
  version                  = "0.1.2"
  identifier               = "dummy-es-domain"
  instance_type            = "c5.large.elasticsearch"
  elasticsearch_version    = "7.9"
  dedicated_master_enabled = false
  dedicated_master_type    = "m5.large.elasticsearch"
  ebs_enabled              = true
  subnets_ids              = ["subnet-xxxxxxxxxxx"]
}

For more details on a working example, please visit examples/simple

Advanced Setup

If you want to create a ElasticSearch Domain with an advanced configuration like Multi-AZ, you can use the module like this:

module "elasticsearch" {
  source                        = "app.terraform.io/ncodelibrary/elasticsearch/aws"
  version                       = "0.1.2"
  identifier                    = "dummy-es-domain"
  instance_type                 = "m5.large.elasticsearch"
  elasticsearch_version         = "7.9"
  dedicated_master_enabled      = true
  ebs_enabled                   = true
  subnets_ids                   = ["subnet-xxxxxxx", "subnet-xxxxxxx"] # Pass minimum two subnets for Multi-AZ
  automated_snapshot_start_hour = 23
  zone_awareness_enabled        = true  # Multi-AZ enabled
  dedicated_master_count        = 3
  dedicated_master_type         = "m5.large.elasticsearch"
  instance_count                = 2
  volume_size                   = 20
  volume_type                   = "gp2"
  iops                          = 0
  tags = {
    Owner = "sysops"
    env   = "dev"
  }
}

For more options refer to a working example at examples/advanced

Examples

Here are some working examples of using this module:

Requirements

Name Version
terraform >= 0.12

Providers

Name Version
aws n/a

Modules

No Modules.

Resources

Name
aws_elasticsearch_domain

Inputs

Name Description Type Default Required
append_workspace Appends the terraform workspace at the end of resource names, - bool true no
automated_snapshot_start_hour Hour during which the service takes an automated daily snapshot of the indices in the domain. number 0 no
dedicated_master_count Number of dedicated master nodes in the cluster. number 1 no
dedicated_master_enabled Indicates whether dedicated master nodes are enabled for the cluster. bool false no
dedicated_master_type Instance type of the dedicated master nodes in the cluster. string n/a yes
ebs_enabled Whether EBS volumes are attached to data nodes in the domain. bool true no
elasticsearch_version The version of Elasticsearch to use. string n/a yes
identifier A name identifier for the ElasticSearch domain. string "" no
instance_count The number of data nodes (instances) to use in the Amazon ES domain number 1 no
instance_type Instance type of data nodes in the cluster. string "" no
iops The baseline input/output (I/O) performance of EBS volumes attached to data nodes number 0 no
security_group_ids List of security group ids. list(string) [] no
subnets_ids List of all the subnets list(string) [] no
tags Tags to be applied to the resource map {} no
volume_size The size of EBS volumes attached to data nodes (in GB). number 20 no
volume_type The type of EBS volumes attached to data nodes. string "" no
zone_awareness_enabled Configuration block containing zone awareness settings. Documented below. bool false no

Outputs

Name Description
output n/a

Contributing

If you want to contribute to this repository check all the guidelines specified here before submitting a new PR.