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

Added support for multiple log-groups for redis logs according to log_type #69

Merged
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
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ data "aws_iam_policy_document" "default" {
## Below resource will create will save logs cloudwatch_log_group resource for redis-cluster and memcached.
##----------------------------------------------------------------------------------
resource "aws_cloudwatch_log_group" "default" {
count = var.enable && length(var.log_delivery_configuration) > 0 ? 1 : 0
name = format("logs-%s", module.labels.id)
count = var.enable && length(var.log_delivery_configuration) > 0 ? length(var.log_delivery_configuration) : 0
name = format("%s-%s", module.labels.name, var.log_delivery_configuration[count.index].log_type)
retention_in_days = var.retention_in_days
tags = module.labels.tags
}
Expand Down Expand Up @@ -186,7 +186,7 @@ resource "aws_elasticache_replication_group" "cluster" {
for_each = var.log_delivery_configuration

content {
destination = lookup(log_delivery_configuration.value, "destination", join("", aws_cloudwatch_log_group.default[*].name))
destination = lookup(log_delivery_configuration.value, "destination", aws_cloudwatch_log_group.default[index(var.log_delivery_configuration, log_delivery_configuration.value)].name)
destination_type = lookup(log_delivery_configuration.value, "destination_type", null)
log_format = lookup(log_delivery_configuration.value, "log_format", null)
log_type = lookup(log_delivery_configuration.value, "log_type", null)
Expand Down
Loading