diff --git a/rds/example/parameter_group_provided.tf b/rds/example/parameter_group_provided.tf new file mode 100644 index 0000000..6f22f70 --- /dev/null +++ b/rds/example/parameter_group_provided.tf @@ -0,0 +1,17 @@ +module "rds-parameter-group-provided" { + source = "../" + + engine = "postgres" + name = "rds-parameter-group-provided" + parameter_group_name = "${aws_db_parameter_group.parameter-group-provided.id}" + parameter_group_provided = true + subnets = ["rds-parameter-group-provided"] + version = "9.6" + vpc_id = "rds-parameter-group-provided" +} + +resource "aws_db_parameter_group" "parameter-group-provided" { + name = "parameter-group-provided" + family = "parameter-group-provided" + description = "parameter-group-provided" +} diff --git a/rds/main.tf b/rds/main.tf index 442dc28..9e20ceb 100644 --- a/rds/main.tf +++ b/rds/main.tf @@ -27,7 +27,7 @@ resource "aws_db_subnet_group" "mod" { } resource "aws_db_parameter_group" "mod" { - count = "${var.parameter_group_name != "" ? 0 : 1}" + count = "${var.parameter_group_provided ? 0 : 1}" name = "${local.parameter_group_name}" family = "${local.family}" description = "${local.family} parameter group for ${var.name} ${var.env}" diff --git a/rds/variables.tf b/rds/variables.tf index 18ea7ce..0ee08d5 100644 --- a/rds/variables.tf +++ b/rds/variables.tf @@ -52,6 +52,11 @@ variable "parameter_group_name" { default = "" } +variable "parameter_group_provided" { + description = "If the parameter_group_name is provided, must be set to true." + default = false +} + variable "port" { description = "Override the default port" default = ""