Skip to content

Commit

Permalink
Update log group count and name in aws_cloudwatch_log_group resource (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
soumik-avoma authored Mar 13, 2024
1 parent 653e4d6 commit 6e9c57e
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 6e9c57e

Please sign in to comment.