Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dynamic block for log_publishing_options #103

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -177,28 +177,40 @@ resource "aws_elasticsearch_domain" "default" {
}
}

log_publishing_options {
enabled = var.log_publishing_index_enabled
log_type = "INDEX_SLOW_LOGS"
cloudwatch_log_group_arn = var.log_publishing_index_cloudwatch_log_group_arn
dynamic "log_publishing_options" {
for_each = var.log_publishing_index_enabled ? [true] : []
content {
enabled = var.log_publishing_index_enabled
log_type = "INDEX_SLOW_LOGS"
cloudwatch_log_group_arn = var.log_publishing_index_cloudwatch_log_group_arn
}
}

log_publishing_options {
enabled = var.log_publishing_search_enabled
log_type = "SEARCH_SLOW_LOGS"
cloudwatch_log_group_arn = var.log_publishing_search_cloudwatch_log_group_arn
dynamic "log_publishing_options" {
for_each = var.log_publishing_search_enabled ? [true] : []
content {
enabled = var.log_publishing_search_enabled
log_type = "SEARCH_SLOW_LOGS"
cloudwatch_log_group_arn = var.log_publishing_search_cloudwatch_log_group_arn
}
}

log_publishing_options {
enabled = var.log_publishing_audit_enabled
log_type = "AUDIT_LOGS"
cloudwatch_log_group_arn = var.log_publishing_audit_cloudwatch_log_group_arn
dynamic "log_publishing_options" {
for_each = var.log_publishing_audit_enabled ? [true] : []
content {
enabled = var.log_publishing_audit_enabled
log_type = "AUDIT_LOGS"
cloudwatch_log_group_arn = var.log_publishing_audit_cloudwatch_log_group_arn
}
}

log_publishing_options {
enabled = var.log_publishing_application_enabled
log_type = "ES_APPLICATION_LOGS"
cloudwatch_log_group_arn = var.log_publishing_application_cloudwatch_log_group_arn
dynamic "log_publishing_options" {
for_each = var.log_publishing_application_enabled ? [true] : []
content {
enabled = var.log_publishing_application_enabled
log_type = "ES_APPLICATION_LOGS"
cloudwatch_log_group_arn = var.log_publishing_application_cloudwatch_log_group_arn
}
}

tags = module.this.tags
Expand Down