Skip to content

Commit

Permalink
fix: Support performance insights existing kms key arn (#115)
Browse files Browse the repository at this point in the history
* chore: Add support for out of band Performance Insight's being added

* null check on performance_insights_kms_key_arn
  • Loading branch information
zacharyblasczyk authored Jul 28, 2023
1 parent 0a6665e commit 9385c01
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/database/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions modules/database/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 9385c01

Please sign in to comment.