From f03582599da5dd04a3fd8b9b3a2b95e7fe4caaa6 Mon Sep 17 00:00:00 2001 From: Chris Dobbyn <8264498+cdobbyn@users.noreply.github.com> Date: Fri, 30 May 2025 16:07:56 +0000 Subject: [PATCH 1/3] feat(rds): add database_insights_mode --- main.tf | 1 + variables.tf | 14 ++++++++++++++ versions.tf | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 08e5d30..482283d 100644 --- a/main.tf +++ b/main.tf @@ -84,6 +84,7 @@ resource "aws_db_instance" "default" { performance_insights_enabled = var.performance_insights_enabled performance_insights_kms_key_id = var.performance_insights_enabled ? var.performance_insights_kms_key_id : null performance_insights_retention_period = var.performance_insights_enabled ? var.performance_insights_retention_period : null + database_insights_mode = var.database_insights_mode monitoring_interval = var.monitoring_interval monitoring_role_arn = var.monitoring_role_arn diff --git a/variables.tf b/variables.tf index 75f3b3c..17449a1 100644 --- a/variables.tf +++ b/variables.tf @@ -315,6 +315,20 @@ variable "performance_insights_retention_period" { description = "The amount of time in days to retain Performance Insights data. Either 7 (7 days) or 731 (2 years)." } +variable "database_insights_mode" { + type = string + default = null + description = "The mode for CloudWatch Database Insights. Valid values: 'standard', 'advanced', or null." + validation { + condition = ( + var.database_insights_mode == null || ( + contains(["standard", "advanced"], var.database_insights_mode) + ) + ) + error_message = "database_insights_mode must be one of: 'standard', 'advanced', or null." + } +} + variable "enabled_cloudwatch_logs_exports" { type = list(string) default = [] diff --git a/versions.tf b/versions.tf index 4b7301c..93ba8ab 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.0" + version = ">= 5.92.0" } } } \ No newline at end of file From 4da60d8dd34b0858239a0f59a8524b14e894b53e Mon Sep 17 00:00:00 2001 From: Chris Dobbyn <8264498+cdobbyn@users.noreply.github.com> Date: Fri, 30 May 2025 10:30:46 -0700 Subject: [PATCH 2/3] fix: invalid null value The value for `database_insights_mode` can only be one of: "standard" or "advanced" --- variables.tf | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/variables.tf b/variables.tf index 17449a1..7183e58 100644 --- a/variables.tf +++ b/variables.tf @@ -317,15 +317,12 @@ variable "performance_insights_retention_period" { variable "database_insights_mode" { type = string - default = null + default = "standard" + nullable = false description = "The mode for CloudWatch Database Insights. Valid values: 'standard', 'advanced', or null." validation { - condition = ( - var.database_insights_mode == null || ( - contains(["standard", "advanced"], var.database_insights_mode) - ) - ) - error_message = "database_insights_mode must be one of: 'standard', 'advanced', or null." + condition = contains(["standard", "advanced"], var.database_insights_mode) + error_message = "database_insights_mode must be one of: 'standard' (free) or 'advanced'." } } From 84c41aef79a1bdfb26a729dc3e441389a61a3888 Mon Sep 17 00:00:00 2001 From: Chris Dobbyn <8264498+cdobbyn@users.noreply.github.com> Date: Fri, 30 May 2025 10:57:37 -0700 Subject: [PATCH 3/3] docs: updated database_insights_mode description The description still identified null as a valid value when it is not. --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index 7183e58..3e61a2b 100644 --- a/variables.tf +++ b/variables.tf @@ -319,7 +319,7 @@ variable "database_insights_mode" { type = string default = "standard" nullable = false - description = "The mode for CloudWatch Database Insights. Valid values: 'standard', 'advanced', or null." + description = "The mode for CloudWatch Database Insights. Valid values: 'standard' or 'advanced'." validation { condition = contains(["standard", "advanced"], var.database_insights_mode) error_message = "database_insights_mode must be one of: 'standard' (free) or 'advanced'."