Skip to content

Commit

Permalink
feat: add log retention and fix log group naming
Browse files Browse the repository at this point in the history
  • Loading branch information
drmikecrowe committed Jul 17, 2022
1 parent aa5efcc commit 3d249ed
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]
}

/**
Expand Down Expand Up @@ -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
}

/**
Expand Down

0 comments on commit 3d249ed

Please sign in to comment.