Skip to content

Commit cb3c123

Browse files
fix: Do not create a separate KMS key for Performance Insights if it … (#12)
* fix: Do not create a separate KMS key for Performance Insights if it is not used at all * terraform-docs: automated action --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 0230060 commit cb3c123

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

modules/rds_cluster_instance/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838
## Resources
3939

4040
- resource.aws_rds_cluster_instance.main (modules/rds_cluster_instance/main.tf#1)
41-
- resource.random_password.master_password (modules/rds_cluster_instance/main.tf#64)
42-
- resource.random_string.master_username (modules/rds_cluster_instance/main.tf#59)
41+
- resource.random_password.master_password (modules/rds_cluster_instance/main.tf#66)
42+
- resource.random_string.master_username (modules/rds_cluster_instance/main.tf#61)
4343
<!-- END_TF_DOCS -->

modules/rds_cluster_instance/main.tf

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ resource "aws_rds_cluster_instance" "main" {
1919

2020
# Performance Insights
2121
performance_insights_enabled = var.performance_insights_enabled
22-
performance_insights_kms_key_id = module.kms.key_arn
22+
performance_insights_kms_key_id = var.performance_insights_enabled ? module.kms[0].key_arn : null
2323
performance_insights_retention_period = var.performance_insights_retention_period
2424

2525
# Network
@@ -49,6 +49,8 @@ module "db_enhanced_monitoring" {
4949
}
5050

5151
module "kms" {
52+
count = var.performance_insights_enabled ? 1 : 0
53+
5254
source = "geekcell/kms/aws"
5355
version = ">= 1.0.0, < 2.0.0"
5456

0 commit comments

Comments
 (0)