Skip to content

Commit 90edc1f

Browse files
committed
Adding logs
1 parent 146bb7a commit 90edc1f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

main.tf

+12
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,21 @@ resource "aws_elasticsearch_domain" "this" {
125125
automated_snapshot_start_hour = 1
126126
}
127127

128+
log_publishing_options {
129+
log_type = "INDEX_SLOW_LOGS"
130+
cloudwatch_log_group_arn = "${aws_cloudwatch_log_group.this.arn}"
131+
enabled = "${var.enable_logs}"
132+
}
133+
128134
tags = "${merge(var.tags, map("Name", var.name))}"
129135
}
130136

137+
resource "aws_cloudwatch_log_group" "this" {
138+
count = "${var.enable_logs ? 1 : 0}"
139+
name = "${local.id}-ElasticSearch"
140+
retention_in_days = 0
141+
tags = "${merge(var.tags, map("Name", var.name))}"
142+
}
131143

132144
resource "aws_elasticsearch_domain_policy" "this" {
133145
domain_name = "${aws_elasticsearch_domain.this.domain_name}"

variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,8 @@ variable "instances" {
5959
description = "Instance count"
6060
default = 1
6161
}
62+
63+
variable "enable_logs" {
64+
description = "Enalbe CloudWatch Logs"
65+
default = false
66+
}

0 commit comments

Comments
 (0)