Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- provider "aws" {}
- terraform {}
- data "aws_iam_policy_document" "domain_access_policy" {
- statement {
- sid = "allow_access_from_specific_ips"
- actions = ["es:*"]
- condition {
- test = "IpAddress"
- variable = "aws:SourceIp"
- values = "${var.allowed_ipaddresses}"
- }
- }
- }
- resource "aws_elasticsearch_domain" "takeaway" {
- domain_name = "${var.domain_name}"
- elasticsearch_version = "5.5"
- cluster_config {
- instance_type = "${var.node_size}.elasticsearch"
- instance_count = "${var.node_count}"
- }
- advanced_options {
- "rest.action.multi.allow_explicit_index" = "true"
- }
- ebs_options {
- ebs_enabled = true
- volume_size = "${var.node_volume_size}"
- }
- access_policies = "${data.aws_iam_policy_document.domain_access_policy.json}"
- snapshot_options {
- automated_snapshot_start_hour = 23
- }
- tags {
- Domain = "${var.domain_name}"
- Name = "${var.domain_name}"
- }
- }
Add Comment
Please, Sign In to add comment