From 0eb3d51ecee0b2d91de12c7a7d45b9a767afcdfb Mon Sep 17 00:00:00 2001 From: Paul Crooks Date: Mon, 12 Aug 2024 13:27:32 +0000 Subject: [PATCH] feat(logging): Add log retention configuration Ref: #24 --- README.md | 1 + main.tf | 1 + variables.tf | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 90443fb..6145080 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ No modules. | [agent\_log\_level](#input\_agent\_log\_level) | Orchestrator agent log level | `string` | `"info"` | no | | [cpu](#input\_cpu) | Task CPU allocation | `string` | `"2048"` | no | | [cpu](#input\_memory) | Task memory allocation | `string` | `"8192"` | no | +| [log\_retention\_days](#input\_log\_retention\_days) | Task log retention period in days | `string` | `"0"` | no | ## Outputs diff --git a/main.tf b/main.tf index 15668a8..ef62d7f 100644 --- a/main.tf +++ b/main.tf @@ -6,6 +6,7 @@ resource "aws_ecs_cluster" "orchestrator_agent" { resource "aws_cloudwatch_log_group" "orchestrator_agent" { name = "${var.name}-logs" + retention_in_days = var.log_retention_days tags = merge(var.tags, var.default_tags) } diff --git a/variables.tf b/variables.tf index c630dbc..8715d17 100644 --- a/variables.tf +++ b/variables.tf @@ -204,3 +204,9 @@ variable "memory" { type = string default = "8192" } + +variable "log_retention_days" { + description = "Cloudwatch log group retention in days. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group#retention_in_days for acceptable values" + type = string + default = "0" +}