Commit f681318e authored by Mohammad Ali Alfarra's avatar Mohammad Ali Alfarra Committed by Anton Babenko

Enable db_subnet_group_name variable (#38)

*  Enable db_subnet_group_name variable

If the variable not specify then use the db_subnet_group module

* Disable create_db_subnet_group if db_subnet_group_name is defined
parent 8a5af3e0
locals {
db_subnet_group_name = "${coalesce(var.db_subnet_group_name, module.db_subnet_group.this_db_subnet_group_id)}"
enable_create_db_subnet_group = "${var.db_subnet_group_name == "" ? var.create_db_subnet_group : 0}"
}
##################
# DB subnet group
##################
module "db_subnet_group" {
source = "./modules/db_subnet_group"
count = "${var.create_db_subnet_group}"
count = "${local.enable_create_db_subnet_group}"
identifier = "${var.identifier}"
name_prefix = "${var.identifier}-"
subnet_ids = ["${var.subnet_ids}"]
......@@ -56,7 +61,7 @@ module "db_instance" {
snapshot_identifier = "${var.snapshot_identifier}"
vpc_security_group_ids = ["${var.vpc_security_group_ids}"]
db_subnet_group_name = "${module.db_subnet_group.this_db_subnet_group_id}"
db_subnet_group_name = "${local.db_subnet_group_name}"
parameter_group_name = "${module.db_parameter_group.this_db_parameter_group_id}"
multi_az = "${var.multi_az}"
......
......@@ -80,11 +80,11 @@ variable "vpc_security_group_ids" {
default = []
}
//variable "db_subnet_group_name" {
// description = "Name of DB subnet group. DB instance will be created in the VPC associated with the DB subnet group. If unspecified, will be created in the default VPC"
// default = ""
//}
//
variable "db_subnet_group_name" {
description = "Name of DB subnet group. DB instance will be created in the VPC associated with the DB subnet group. If unspecified, will be created in the default VPC"
default = ""
}
//variable "parameter_group_name" {
// description = "Name of the DB parameter group to associate"
// default = ""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment