diff --git a/README.md b/README.md index a3d33fc..8c34712 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ Terraform module which creates RDS Postgres on AWS. * ```var.instance_tags``` - assigned to the DB instance and each of it's replicas * ```var.tags``` - assigned to the DB instance * ```var.replica_tags``` - assigned to every DB replica instance +* ```var.db_subnet_group_tags``` - assigned to the DB subnet group +* ```var.parameter_group_tags``` - assigned to the DB parameter group ## Replication The module allows to create replica instance(s) in three different ways: @@ -125,6 +127,7 @@ No modules. | [custom\_replicas](#input\_custom\_replicas) | A map of replica instances. Allows to set different settings for each one. |
map(object({| `{}` | no | | [db\_name](#input\_db\_name) | The database name. | `string` | `"defaultdb"` | no | | [db\_subnet\_group\_name](#input\_db\_subnet\_group\_name) | The name of DB subnet group. | `string` | `null` | no | +| [db\_subnet\_group\_tags](#input\_db\_subnet\_group\_tags) | A map of the DB subnet group tags. | `map(string)` | `{}` | no | | [dedicated\_log\_volume](#input\_dedicated\_log\_volume) | Use a dedicated log volume (DLV) for the DB instance. | `bool` | `false` | no | | [delete\_automated\_backups](#input\_delete\_automated\_backups) | Specifies whether to remove automated backups immediately after the DB instance is deleted. | `bool` | `true` | no | | [deletion\_protection](#input\_deletion\_protection) | The database can't be deleted when this value is set to true. | `bool` | `false` | no | @@ -148,6 +151,7 @@ No modules. | [parameter\_group\_family](#input\_parameter\_group\_family) | The family of the DB parameter group. | `string` | `"postgres16"` | no | | [parameter\_group\_list](#input\_parameter\_group\_list) | A list of parameters included in the database parameter group. | `list(map(string))` | `[]` | no | | [parameter\_group\_name](#input\_parameter\_group\_name) | The name of the database parameter group. | `string` | `null` | no | +| [parameter\_group\_tags](#input\_parameter\_group\_tags) | A map of the parameter group tags. | `map(string)` | `{}` | no | | [password](#input\_password) | Password for the master DB user. | `string` | `null` | no | | [performance\_insights\_enabled](#input\_performance\_insights\_enabled) | Specifies whether Performance Insights are enabled. | `bool` | `false` | no | | [performance\_insights\_kms\_key\_id](#input\_performance\_insights\_kms\_key\_id) | The ARN for the KMS key to encrypt Performance Insights data. | `string` | `null` | no | diff --git a/main.tf b/main.tf index 60c0413..87a1e8d 100644 --- a/main.tf +++ b/main.tf @@ -19,7 +19,7 @@ resource "aws_db_parameter_group" "main" { name = local.parameter_group_name family = var.parameter_group_family - tags = var.common_tags + tags = merge(var.common_tags, var.parameter_group_tags) dynamic "parameter" { for_each = var.parameter_group_list @@ -40,7 +40,7 @@ resource "aws_db_subnet_group" "main" { name = local.db_subnet_group_name subnet_ids = var.subnet_ids - tags = var.common_tags + tags = merge(var.common_tags, var.db_subnet_group_tags) } resource "aws_db_instance" "main" { diff --git a/variables.tf b/variables.tf index 6c43592..0b4ead8 100644 --- a/variables.tf +++ b/variables.tf @@ -70,6 +70,12 @@ variable "db_subnet_group_name" { default = null } +variable "db_subnet_group_tags" { + description = "A map of the DB subnet group tags." + type = map(string) + default = {} +} + variable "dedicated_log_volume" { description = "Use a dedicated log volume (DLV) for the DB instance." type = bool @@ -201,6 +207,12 @@ variable "parameter_group_list" { default = [] } +variable "parameter_group_tags" { + description = "A map of the parameter group tags." + type = map(string) + default = {} +} + variable "password" { description = "Password for the master DB user." type = string
availability_zone = optional(string),
instance_class = optional(string, "db.t4g.micro"),
tags = optional(map(string))
}))