diff --git a/infra/buckets/gs_buckets.tf b/infra/buckets/gs.tf similarity index 100% rename from infra/buckets/gs_buckets.tf rename to infra/buckets/gs.tf diff --git a/infra/buckets/s3_buckets.tf b/infra/buckets/s3.tf similarity index 100% rename from infra/buckets/s3_buckets.tf rename to infra/buckets/s3.tf diff --git a/infra/elasticsearch/elasticsearch.tf b/infra/elasticsearch/main.tf similarity index 69% rename from infra/elasticsearch/elasticsearch.tf rename to infra/elasticsearch/main.tf index b240522123..665e907442 100644 --- a/infra/elasticsearch/elasticsearch.tf +++ b/infra/elasticsearch/main.tf @@ -5,15 +5,18 @@ locals { account_id = "${data.aws_caller_identity.current.account_id}" } - -resource "aws_cloudwatch_log_group" "dss_index_log" { - name = "/aws/aes/domains/${var.DSS_ES_DOMAIN}/index-logs" +resource "aws_cloudwatch_log_group" "es_index_log" { + name = "/aws/aes/domains/${var.DSS_ES_DOMAIN}/es-index-${var.DSS_DEPLOYMENT_STAGE}-logs" retention_in_days = 90 } +resource "aws_cloudwatch_log_group" "es_search_log" { + name = "/aws/aes/domains/${var.DSS_ES_DOMAIN}/es-search-${var.DSS_DEPLOYMENT_STAGE}-logs" + retention_in_days = 90 +} -resource "aws_cloudwatch_log_group" "dss_search_log" { - name = "/aws/aes/domains/${var.DSS_ES_DOMAIN}/search-logs" +resource "aws_cloudwatch_log_group" "es_application_log" { + name = "/aws/aes/domains/${var.DSS_ES_DOMAIN}/es-application-${var.DSS_DEPLOYMENT_STAGE}-logs" retention_in_days = 90 } @@ -28,8 +31,9 @@ data "aws_iam_policy_document" "dss_es_cloudwatch_policy_document" { "logs:CreateLogStream" ] resources = [ - "${aws_cloudwatch_log_group.dss_index_log.arn}", - "${aws_cloudwatch_log_group.dss_search_log.arn}" + "${aws_cloudwatch_log_group.es_index_log.arn}", + "${aws_cloudwatch_log_group.es_search_log.arn}", + "${aws_cloudwatch_log_group.es_application_log.arn}" ] } } @@ -39,7 +43,6 @@ resource "aws_cloudwatch_log_resource_policy" "dss_es_cloudwatch_policy" { policy_document = "${data.aws_iam_policy_document.dss_es_cloudwatch_policy_document.json}" } - data "aws_iam_policy_document" "dss_es_access_policy_documennt" { statement { principals { @@ -86,17 +89,23 @@ resource aws_elasticsearch_domain elasticsearch { } log_publishing_options = { - cloudwatch_log_group_arn = "${aws_cloudwatch_log_group.dss_index_log.arn}" + cloudwatch_log_group_arn = "${aws_cloudwatch_log_group.es_index_log.arn}" log_type = "INDEX_SLOW_LOGS" enabled = "true" } log_publishing_options = { - cloudwatch_log_group_arn = "${aws_cloudwatch_log_group.dss_search_log.arn}" + cloudwatch_log_group_arn = "${aws_cloudwatch_log_group.es_search_log.arn}" log_type = "SEARCH_SLOW_LOGS" enabled = "true" } + log_publishing_options = { + cloudwatch_log_group_arn = "${aws_cloudwatch_log_group.es_application_log.arn}" + log_type = "ES_APPLICATION_LOGS" + enabled = "true" + } + snapshot_options = { automated_snapshot_start_hour = 23 }