From 9385c013cecbe9c3520b717e8386a4a0948aeba8 Mon Sep 17 00:00:00 2001 From: Zachary Blasczyk <77289967+wandb-zacharyblasczyk@users.noreply.github.com> Date: Fri, 28 Jul 2023 12:46:59 -0500 Subject: [PATCH] fix: Support performance insights existing kms key arn (#115) * chore: Add support for out of band Performance Insight's being added * null check on performance_insights_kms_key_arn --- main.tf | 2 +- modules/database/main.tf | 2 +- modules/database/variables.tf | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 9e8c634c..fbca9f41 100644 --- a/main.tf +++ b/main.tf @@ -75,7 +75,7 @@ module "database" { namespace = var.namespace kms_key_arn = local.kms_key_arn - performance_insights_kms_key_arn = var.database_performance_insights_kms_key_arn_kms_key_arn + performance_insights_kms_key_arn = var.database_performance_insights_kms_key_arn database_name = var.database_name master_username = var.database_master_username diff --git a/modules/database/main.tf b/modules/database/main.tf index 2f29fd46..13b152eb 100644 --- a/modules/database/main.tf +++ b/modules/database/main.tf @@ -130,7 +130,7 @@ module "aurora" { // incurs a per-vcpu cost. so we can keep them for 7 days and they're free //////////////////////////////////////////////////////////////////////////////////////// performance_insights_enabled = true - performance_insights_kms_key_id = var.performance_insights_kms_key_arn == "" ? var.kms_key_arn : var.database_performance_insights_kms_key_arn + performance_insights_kms_key_id = (var.performance_insights_kms_key_arn == "" || var.performance_insights_kms_key_arn == null) ? var.kms_key_arn : var.performance_insights_kms_key_arn performance_insights_retention_period = 7 preferred_backup_window = var.preferred_backup_window preferred_maintenance_window = var.preferred_maintenance_window diff --git a/modules/database/variables.tf b/modules/database/variables.tf index 86044c43..d6b74261 100644 --- a/modules/database/variables.tf +++ b/modules/database/variables.tf @@ -3,6 +3,11 @@ variable "kms_key_arn" { type = string } +variable "performance_insights_kms_key_arn" { + description = "Specifies an existing KMS key ARN to encrypt the performance insights data if performance_insights_enabled is was enabled out of band" + type = string +} + variable "namespace" { type = string description = "The name prefix for all resources created."