Skip to content

Commit

Permalink
added retention_in_days
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamraj Yadav committed Aug 29, 2022
1 parent 8c430f0 commit 93a2d36
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions _example/redis/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ module "redis" {
availability_zones = ["eu-west-1a", "eu-west-1b"]
auto_minor_version_upgrade = true
number_cache_clusters = 2
retention_in_days = 0

log_delivery_configuration = [
{
Expand Down
7 changes: 4 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ module "labels" {
}

resource "aws_cloudwatch_log_group" "default" {
count = var.enable && length(var.log_delivery_configuration) > 0 ? 1 : 0
name = format("logs-%s", module.labels.id)
tags = module.labels.tags
count = var.enable && length(var.log_delivery_configuration) > 0 ? 1 : 0
name = format("logs-%s", module.labels.id)
retention_in_days = var.retention_in_days
tags = module.labels.tags
}

# Module : Elasticache Subnet Group
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,9 @@ variable "log_delivery_configuration" {
default = []
description = "The log_delivery_configuration block allows the streaming of Redis SLOWLOG or Redis Engine Log to CloudWatch Logs or Kinesis Data Firehose. Max of 2 blocks."
}

variable "retention_in_days" {
type = number
default = 0
description = "Specifies the number of days you want to retain log events in the specified log group."
}

0 comments on commit 93a2d36

Please sign in to comment.