From 3d249ed051e1b735b25694c475bbf554b983dc25 Mon Sep 17 00:00:00 2001 From: Mike Crowe Date: Sun, 17 Jul 2022 08:00:02 -0400 Subject: [PATCH] feat: add log retention and fix log group naming --- main.tf | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index a0aa90e..cb9da16 100644 --- a/main.tf +++ b/main.tf @@ -72,6 +72,11 @@ resource "aws_lambda_function" "lambda" { last_modified, ] } + + depends_on = [ + aws_iam_role_policy.logs_role_policy, + aws_cloudwatch_log_group.log_group, + ] } /** @@ -140,9 +145,10 @@ resource "aws_iam_role_policy" "logs_role_policy" { * of the CloudFront edge location handling the request. */ resource "aws_cloudwatch_log_group" "log_group" { - name = "/aws/lambda/${var.name}" - tags = var.tags - kms_key_id = var.cloudwatch_log_groups_kms_arn + name = "/aws/lambda/us-east-1.${var.name}" + tags = var.tags + kms_key_id = var.cloudwatch_log_groups_kms_arn + retention_in_days = 14 } /**