daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Nov 22nd, 2017 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. provider "aws" {}
  2.  
  3.  
  4. terraform {}
  5.  
  6. data "aws_iam_policy_document" "domain_access_policy" {
  7.     statement {
  8.         sid = "allow_access_from_specific_ips"
  9.         actions = ["es:*"]
  10.         condition {
  11.             test = "IpAddress"
  12.             variable = "aws:SourceIp"
  13.             values = "${var.allowed_ipaddresses}"
  14.         }
  15.     }
  16. }
  17.  
  18. resource "aws_elasticsearch_domain" "takeaway" {
  19.     domain_name           = "${var.domain_name}"
  20.     elasticsearch_version = "5.5"
  21.     cluster_config {
  22.         instance_type = "${var.node_size}.elasticsearch"
  23.         instance_count = "${var.node_count}"
  24.     }
  25.  
  26.     advanced_options {
  27.         "rest.action.multi.allow_explicit_index" = "true"
  28.     }
  29.  
  30.     ebs_options {
  31.         ebs_enabled = true
  32.         volume_size = "${var.node_volume_size}"
  33.     }
  34.  
  35.     access_policies = "${data.aws_iam_policy_document.domain_access_policy.json}"
  36.  
  37.     snapshot_options {
  38.         automated_snapshot_start_hour = 23
  39.     }
  40.  
  41.     tags {
  42.         Domain = "${var.domain_name}"
  43.         Name = "${var.domain_name}"
  44.     }
  45. }
RAW Paste Data
Top