diff --git a/modules/db_instance/main.tf b/modules/db_instance/main.tf index 8a9dd257..35b8060f 100644 --- a/modules/db_instance/main.tf +++ b/modules/db_instance/main.tf @@ -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