From 2798944a209b5a4303ab357f585de6a11489c620 Mon Sep 17 00:00:00 2001 From: Lloyd Philbrook Date: Sat, 18 Nov 2017 18:05:33 -0600 Subject: [PATCH 1/2] ADD rds parameter group provided test --- rds/example/parameter_group_provided.tf | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 rds/example/parameter_group_provided.tf diff --git a/rds/example/parameter_group_provided.tf b/rds/example/parameter_group_provided.tf new file mode 100644 index 0000000..c2187a6 --- /dev/null +++ b/rds/example/parameter_group_provided.tf @@ -0,0 +1,16 @@ +module "rds-parameter-group-provided" { + source = "../" + + engine = "postgres" + name = "rds-parameter-group-provided" + parameter_group_name = "${aws_db_parameter_group.parameter-group-provided.id}" + 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" +} From 2f37d8cacfface5d62f100ec37e79aae9bf647b4 Mon Sep 17 00:00:00 2001 From: Lloyd Philbrook Date: Sat, 18 Nov 2017 18:08:31 -0600 Subject: [PATCH 2/2] ADD rds parameter group provided var --- rds/example/parameter_group_provided.tf | 1 + rds/main.tf | 2 +- rds/variables.tf | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rds/example/parameter_group_provided.tf b/rds/example/parameter_group_provided.tf index c2187a6..6f22f70 100644 --- a/rds/example/parameter_group_provided.tf +++ b/rds/example/parameter_group_provided.tf @@ -4,6 +4,7 @@ module "rds-parameter-group-provided" { 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" 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 = ""