Skip to content

Commit

Permalink
fix: Update cloudwatch log group creation conditional (#481)
Browse files Browse the repository at this point in the history
Co-authored-by: magreenbaum <magreenbaum>
  • Loading branch information
magreenbaum committed Feb 12, 2023
1 parent 08c02ec commit 927b714
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/db_instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ resource "aws_db_instance" "this" {
# CloudWatch Log Group
################################################################################

# Log groups will not be created if using an identifier prefix
resource "aws_cloudwatch_log_group" "this" {
for_each = toset([for log in var.enabled_cloudwatch_logs_exports : log if var.create && var.create_cloudwatch_log_group])
for_each = toset([for log in var.enabled_cloudwatch_logs_exports : log if var.create && var.create_cloudwatch_log_group && !var.use_identifier_prefix])

name = "/aws/rds/instance/${var.identifier}/${each.value}"
retention_in_days = var.cloudwatch_log_group_retention_in_days
Expand Down

0 comments on commit 927b714

Please sign in to comment.