Skip to content

Commit

Permalink
Merge pull request #51 from schubergphilis/optional-cluster-parameters
Browse files Browse the repository at this point in the history
bug: do not create cluster parameter group if no cluster parameters are specified
  • Loading branch information
marwinbaumannsbp authored Sep 21, 2023
2 parents 1c69729 + ad2aef9 commit 718040d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ resource "aws_rds_cluster" "default" {
cluster_identifier = var.name
copy_tags_to_snapshot = true
database_name = var.database
db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.default.name
db_cluster_parameter_group_name = try(aws_rds_cluster_parameter_group.default[0].name, null)
db_subnet_group_name = aws_db_subnet_group.default.name
db_cluster_instance_class = var.db_cluster_instance_class
deletion_protection = var.deletion_protection
Expand Down Expand Up @@ -183,6 +183,8 @@ module "rds_enhanced_monitoring_role" {
################################################################################

resource "aws_rds_cluster_parameter_group" "default" {
count = var.cluster_parameters != null ? 1 : 0

name = var.name
description = "RDS default cluster parameter group"
family = var.cluster_family
Expand Down

0 comments on commit 718040d

Please sign in to comment.