Commit e22d6e61 authored by Ruben Jimenez's avatar Ruben Jimenez Committed by GitHub

feat: Support different tags per resource (#319)

parent 0060e609
...@@ -258,8 +258,12 @@ Users have the ability to: ...@@ -258,8 +258,12 @@ Users have the ability to:
| create\_db\_subnet\_group | Whether to create a database subnet group | `bool` | `true` | no | | create\_db\_subnet\_group | Whether to create a database subnet group | `bool` | `true` | no |
| create\_monitoring\_role | Create IAM role with a defined name that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. | `bool` | `false` | no | | create\_monitoring\_role | Create IAM role with a defined name that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. | `bool` | `false` | no |
| create\_random\_password | Whether to create random password for RDS primary cluster | `bool` | `false` | no | | create\_random\_password | Whether to create random password for RDS primary cluster | `bool` | `false` | no |
| db\_instance\_tags | Additional tags for the DB instance | `map(string)` | `{}` | no |
| db\_option\_group\_tags | Additional tags for the DB option group | `map(string)` | `{}` | no |
| db\_parameter\_group\_tags | Additional tags for the DB parameter group | `map(string)` | `{}` | no |
| db\_subnet\_group\_description | Description of the DB subnet group to create | `string` | `""` | no | | db\_subnet\_group\_description | Description of the DB subnet group to create | `string` | `""` | no |
| db\_subnet\_group\_name | 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 | `string` | `null` | no | | db\_subnet\_group\_name | 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 | `string` | `null` | no |
| db\_subnet\_group\_tags | Additional tags for the DB subnet group | `map(string)` | `{}` | no |
| db\_subnet\_group\_use\_name\_prefix | Determines whether to use `subnet_group_name` as is or create a unique name beginning with the `subnet_group_name` as the prefix | `bool` | `true` | no | | db\_subnet\_group\_use\_name\_prefix | Determines whether to use `subnet_group_name` as is or create a unique name beginning with the `subnet_group_name` as the prefix | `bool` | `true` | no |
| delete\_automated\_backups | Specifies whether to remove automated backups immediately after the DB instance is deleted | `bool` | `true` | no | | delete\_automated\_backups | Specifies whether to remove automated backups immediately after the DB instance is deleted | `bool` | `true` | no |
| deletion\_protection | The database can't be deleted when this value is set to true. | `bool` | `false` | no | | deletion\_protection | The database can't be deleted when this value is set to true. | `bool` | `false` | no |
......
...@@ -108,6 +108,18 @@ module "db" { ...@@ -108,6 +108,18 @@ module "db" {
] ]
tags = local.tags tags = local.tags
db_instance_tags = {
"Sensitive" = "high"
}
db_option_group_tags = {
"Sensitive" = "low"
}
db_parameter_group_tags = {
"Sensitive" = "low"
}
db_subnet_group_tags = {
"Sensitive" = "high"
}
} }
module "db_default" { module "db_default" {
......
...@@ -111,6 +111,15 @@ module "db" { ...@@ -111,6 +111,15 @@ module "db" {
] ]
tags = local.tags tags = local.tags
db_option_group_tags = {
"Sensitive" = "low"
}
db_parameter_group_tags = {
"Sensitive" = "low"
}
db_subnet_group_tags = {
"Sensitive" = "high"
}
} }
......
...@@ -26,7 +26,7 @@ module "db_subnet_group" { ...@@ -26,7 +26,7 @@ module "db_subnet_group" {
description = var.db_subnet_group_description description = var.db_subnet_group_description
subnet_ids = var.subnet_ids subnet_ids = var.subnet_ids
tags = var.tags tags = merge(var.tags, var.db_subnet_group_tags)
} }
module "db_parameter_group" { module "db_parameter_group" {
...@@ -41,7 +41,7 @@ module "db_parameter_group" { ...@@ -41,7 +41,7 @@ module "db_parameter_group" {
parameters = var.parameters parameters = var.parameters
tags = var.tags tags = merge(var.tags, var.db_parameter_group_tags)
} }
module "db_option_group" { module "db_option_group" {
...@@ -59,7 +59,7 @@ module "db_option_group" { ...@@ -59,7 +59,7 @@ module "db_option_group" {
timeouts = var.option_group_timeouts timeouts = var.option_group_timeouts
tags = var.tags tags = merge(var.tags, var.db_option_group_tags)
} }
module "db_instance" { module "db_instance" {
...@@ -131,5 +131,5 @@ module "db_instance" { ...@@ -131,5 +131,5 @@ module "db_instance" {
s3_import = var.s3_import s3_import = var.s3_import
tags = var.tags tags = merge(var.tags, var.db_instance_tags)
} }
...@@ -223,6 +223,30 @@ variable "tags" { ...@@ -223,6 +223,30 @@ variable "tags" {
default = {} default = {}
} }
variable "db_instance_tags" {
description = "Additional tags for the DB instance"
type = map(string)
default = {}
}
variable "db_option_group_tags" {
description = "Additional tags for the DB option group"
type = map(string)
default = {}
}
variable "db_parameter_group_tags" {
description = "Additional tags for the DB parameter group"
type = map(string)
default = {}
}
variable "db_subnet_group_tags" {
description = "Additional tags for the DB subnet group"
type = map(string)
default = {}
}
# DB subnet group # DB subnet group
variable "create_db_subnet_group" { variable "create_db_subnet_group" {
description = "Whether to create a database subnet group" description = "Whether to create a database subnet group"
......
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