From c824b05c56709d71e79f68afef3ef801bc985e66 Mon Sep 17 00:00:00 2001 From: Anton Babenko Date: Mon, 28 Jun 2021 12:41:13 +0300 Subject: [PATCH] feat: Added database_subnet_group_name variable --- README.md | 1 + main.tf | 4 ++-- variables.tf | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5c9476632..6e2f31375 100644 --- a/README.md +++ b/README.md @@ -312,6 +312,7 @@ No modules. | [database\_outbound\_acl\_rules](#input\_database\_outbound\_acl\_rules) | Database subnets outbound network ACL rules | `list(map(string))` |
[
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
| no | | [database\_route\_table\_tags](#input\_database\_route\_table\_tags) | Additional tags for the database route tables | `map(string)` | `{}` | no | | [database\_subnet\_assign\_ipv6\_address\_on\_creation](#input\_database\_subnet\_assign\_ipv6\_address\_on\_creation) | Assign IPv6 address on database subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\_public\_ip\_on\_launch | `bool` | `null` | no | +| [database\_subnet\_group\_name](#input\_database\_subnet\_group\_name) | Name of database subnet group | `string` | `null` | no | | [database\_subnet\_group\_tags](#input\_database\_subnet\_group\_tags) | Additional tags for the database subnet group | `map(string)` | `{}` | no | | [database\_subnet\_ipv6\_prefixes](#input\_database\_subnet\_ipv6\_prefixes) | Assigns IPv6 database subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no | | [database\_subnet\_suffix](#input\_database\_subnet\_suffix) | Suffix to append to database subnets name | `string` | `"db"` | no | diff --git a/main.tf b/main.tf index a6d75a83f..2cf550bd4 100644 --- a/main.tf +++ b/main.tf @@ -481,13 +481,13 @@ resource "aws_subnet" "database" { resource "aws_db_subnet_group" "database" { count = var.create_vpc && length(var.database_subnets) > 0 && var.create_database_subnet_group ? 1 : 0 - name = lower(var.name) + name = lower(coalesce(var.database_subnet_group_name, var.name)) description = "Database subnet group for ${var.name}" subnet_ids = aws_subnet.database.*.id tags = merge( { - "Name" = format("%s", var.name) + "Name" = format("%s", lower(coalesce(var.database_subnet_group_name, var.name))) }, var.tags, var.database_subnet_group_tags, diff --git a/variables.tf b/variables.tf index 9754193ca..52c68b1ed 100644 --- a/variables.tf +++ b/variables.tf @@ -478,6 +478,12 @@ variable "intra_route_table_tags" { default = {} } +variable "database_subnet_group_name" { + description = "Name of database subnet group" + type = string + default = null +} + variable "database_subnet_tags" { description = "Additional tags for the database subnets" type = map(string)