diff --git a/src/cluster-regional.tf b/src/cluster-regional.tf index d24a335..f73fc2a 100644 --- a/src/cluster-regional.tf +++ b/src/cluster-regional.tf @@ -34,7 +34,7 @@ module "aurora_postgres_cluster" { storage_encrypted = var.storage_encrypted storage_type = var.storage_type kms_key_arn = var.storage_encrypted ? module.kms_key_rds.key_arn : null - performance_insights_kms_key_id = var.performance_insights_enabled ? module.kms_key_rds.key_arn : null + performance_insights_kms_key_id = var.performance_insights_enabled ? coalesce(var.performance_insights_kms_key_arn, module.kms_key_rds.key_arn) : null maintenance_window = var.maintenance_window enabled_cloudwatch_logs_exports = var.enabled_cloudwatch_logs_exports enhanced_monitoring_role_enabled = var.enhanced_monitoring_role_enabled diff --git a/src/variables.tf b/src/variables.tf index 92d9f4b..c8649f4 100644 --- a/src/variables.tf +++ b/src/variables.tf @@ -200,6 +200,12 @@ variable "performance_insights_enabled" { description = "Whether to enable Performance Insights" } +variable "performance_insights_kms_key_arn" { + type = string + default = null + description = "ARN of the KMS key for Performance Insights encryption. If null, defaults to the RDS CMK." +} + variable "database_insights_mode" { type = string description = "The database insights mode for the RDS cluster. Valid values are `standard`, `advanced`. See https://registry.terraform.io/providers/hashicorp/aws/6.16.0/docs/resources/rds_cluster#database_insights_mode-1"