<commit_before>data "aws_region" "current" {}

data "aws_caller_identity" "current" {}

# toggle this section based on whether service-linked role exists or not
#resource "aws_iam_service_linked_role" "es" {
#  aws_service_name = "es.amazonaws.com"
#}

resource "aws_elasticsearch_domain" "es-live" {
  domain_name           = "${var.domain}"
  elasticsearch_version = "6.3"
  cluster_config {
    instance_type = "m4.large.elasticsearch"
    instance_count = "2"
    dedicated_master_enabled = "true"
    dedicated_master_count = "3"
    dedicated_master_type = "m3.medium.elasticsearch"
    zone_awareness_enabled = "true"  
  }

  vpc_options {
      subnet_ids = ["${element(split(",", module.vars.private_subnets), 0)}", "${element(split(",", module.vars.private_subnets), 1)}"]
      security_group_ids = ["${aws_security_group.conductor-aes-sg.id}"]
  }
  ebs_options {
      ebs_enabled = "${var.EBSS}"
      volume_type = "io1"
      volume_size = "35"
      iops = "1000"
    }

  advanced_options {
    "rest.action.multi.allow_explicit_index" = "true"
    "indices.fielddata.cache.size" = "10"
    "indices.query.bool.max_clause_count" = "1024"
  }

  access_policies = <<CONFIG
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Action": "es:*",
      "Resource": "arn:aws:es:us-west-2:${module.vars.account-id}:domain/${var.domain}/*"
    }
  ]
}
CONFIG

  snapshot_options {
    automated_snapshot_start_hour = 23
  }

  tags {
    Domain = "${var.D_TAG}"
  }<commit_msg>upgraded live aes<commit_after>data "aws_region" "current" {}

data "aws_caller_identity" "current" {}

# toggle this section based on whether service-linked role exists or not
#resource "aws_iam_service_linked_role" "es" {
#  aws_service_name = "es.amazonaws.com"
#}

resource "aws_elasticsearch_domain" "es-live" {
  domain_name           = "${var.domain}"
  elasticsearch_version = "6.3"
  cluster_config {
    instance_type = "m4.2xlarge.elasticsearch"
    instance_count = "4"
    dedicated_master_enabled = "true"
    dedicated_master_count = "3"
    dedicated_master_type = "m3.medium.elasticsearch"
    zone_awareness_enabled = "true"  
  }

  vpc_options {
      subnet_ids = ["${element(split(",", module.vars.private_subnets), 0)}", "${element(split(",", module.vars.private_subnets), 1)}"]
      security_group_ids = ["${aws_security_group.conductor-aes-sg.id}"]
  }
  ebs_options {
      ebs_enabled = "${var.EBSS}"
      volume_type = "io1"
      volume_size = "250"
      iops = "3000"
    }

  advanced_options {
    "rest.action.multi.allow_explicit_index" = "true"
    "indices.fielddata.cache.size" = "10"
    "indices.query.bool.max_clause_count" = "1024"
  }

  access_policies = <<CONFIG
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Action": "es:*",
      "Resource": "arn:aws:es:us-west-2:${module.vars.account-id}:domain/${var.domain}/*"
    }
  ]
}
CONFIG

  snapshot_options {
    automated_snapshot_start_hour = 23
  }

  tags {
    Domain = "${var.D_TAG}"
  }
{'fraction_non_alphanumeric': 0.15844734330257715, 'fraction_numerical': 0.020999045497931912, 'mean_word_length': 3.3485477178423237, 'pattern_counts': {'":': 14, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2438355', 'n_tokens_mistral': 1170, 'n_tokens_neox': 1137, 'n_words': 178}