File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ Create an RDS database.
2323| ------| -------------| ------| ---------| :--------:|
2424| allowed\_ security\_ group\_ id | The security group to allow access | ` any ` | n/a | yes |
2525| database\_ engine | Which database engine to use, currently supports ` postgres ` or ` mysql ` | ` any ` | n/a | yes |
26+ | db\_ subnet\_ group | The subnet group to create dbs in. The default is to use the one created by the vpc module | ` string ` | ` "" ` | no |
2627| environment | The environment (stage/prod) | ` any ` | n/a | yes |
2728| instance\_ class | The AWS instance class of the db | ` any ` | n/a | yes |
2829| password\_ secret\_ suffix | Suffix to add to the secret that will be generated containing the database credentials | ` any ` | n/a | yes |
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ module "rds_postgres" {
7373
7474 # Subnet is created by the vpc module
7575 create_db_subnet_group = false
76- db_subnet_group_name = " ${ var . project } -${ var . environment } -vpc"
76+ db_subnet_group_name = var . db_subnet_group != " " ? var . db_subnet_group : " ${ var . project } -${ var . environment } -vpc"
7777
7878 # DB parameter and option group
7979 family = " postgres11"
@@ -123,7 +123,7 @@ module "rds_mysql" {
123123
124124 # Subnet is created by the vpc module
125125 create_db_subnet_group = false
126- db_subnet_group_name = " ${ var . project } -${ var . environment } -vpc"
126+ db_subnet_group_name = var . db_subnet_group != " " ? var . db_subnet_group : " ${ var . project } -${ var . environment } -vpc"
127127
128128 # DB parameter and option group
129129 family = " mysql5.7"
Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ variable "allowed_security_group_id" {
1919 description = " The security group to allow access"
2020}
2121
22+ variable "db_subnet_group" {
23+ description = " The subnet group to create dbs in. The default is to use the one created by the vpc module"
24+ default = " "
25+ }
26+
2227variable "instance_class" {
2328 description = " The AWS instance class of the db"
2429}
You can’t perform that action at this time.
0 commit comments