Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/database/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Create an RDS database.
|------|-------------|------|---------|:--------:|
| allowed\_security\_group\_id | The security group to allow access | `any` | n/a | yes |
| database\_engine | Which database engine to use, currently supports `postgres` or `mysql` | `any` | n/a | yes |
| db\_subnet\_group | The subnet group to create dbs in. The default is to use the one created by the vpc module | `string` | `""` | no |
| environment | The environment (stage/prod) | `any` | n/a | yes |
| instance\_class | The AWS instance class of the db | `any` | n/a | yes |
| password\_secret\_suffix | Suffix to add to the secret that will be generated containing the database credentials | `any` | n/a | yes |
Expand Down
4 changes: 2 additions & 2 deletions modules/database/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module "rds_postgres" {

# Subnet is created by the vpc module
create_db_subnet_group = false
db_subnet_group_name = "${var.project}-${var.environment}-vpc"
db_subnet_group_name = var.db_subnet_group != "" ? var.db_subnet_group : "${var.project}-${var.environment}-vpc"

# DB parameter and option group
family = "postgres11"
Expand Down Expand Up @@ -123,7 +123,7 @@ module "rds_mysql" {

# Subnet is created by the vpc module
create_db_subnet_group = false
db_subnet_group_name = "${var.project}-${var.environment}-vpc"
db_subnet_group_name = var.db_subnet_group != "" ? var.db_subnet_group : "${var.project}-${var.environment}-vpc"

# DB parameter and option group
family = "mysql5.7"
Expand Down
5 changes: 5 additions & 0 deletions modules/database/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ variable "allowed_security_group_id" {
description = "The security group to allow access"
}

variable "db_subnet_group" {
description = "The subnet group to create dbs in. The default is to use the one created by the vpc module"
default = ""
}

variable "instance_class" {
description = "The AWS instance class of the db"
}
Expand Down