Skip to content

Commit 89a5763

Browse files
fix: Separate db_instance_tags from merged tags sub-module input (#544)
Co-authored-by: Bryant Biggs <[email protected]>
1 parent 4ceaf27 commit 89a5763

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.88.0
3+
rev: v1.88.2
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_docs

main.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ module "db_instance" {
151151
restore_to_point_in_time = var.restore_to_point_in_time
152152
s3_import = var.s3_import
153153

154-
tags = merge(var.tags, var.db_instance_tags)
154+
db_instance_tags = var.db_instance_tags
155+
tags = var.tags
155156
}
156157

157158
module "db_instance_role_association" {

modules/db_instance/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ No modules.
5454
| <a name="input_create_cloudwatch_log_group"></a> [create\_cloudwatch\_log\_group](#input\_create\_cloudwatch\_log\_group) | Determines whether a CloudWatch log group is created for each `enabled_cloudwatch_logs_exports` | `bool` | `false` | no |
5555
| <a name="input_create_monitoring_role"></a> [create\_monitoring\_role](#input\_create\_monitoring\_role) | Create IAM role with a defined name that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. | `bool` | `false` | no |
5656
| <a name="input_custom_iam_instance_profile"></a> [custom\_iam\_instance\_profile](#input\_custom\_iam\_instance\_profile) | RDS custom iam instance profile | `string` | `null` | no |
57+
| <a name="input_db_instance_tags"></a> [db\_instance\_tags](#input\_db\_instance\_tags) | A map of additional tags for the DB instance | `map(string)` | `{}` | no |
5758
| <a name="input_db_name"></a> [db\_name](#input\_db\_name) | The DB name to create. If omitted, no database is created initially | `string` | `null` | no |
5859
| <a name="input_db_subnet_group_name"></a> [db\_subnet\_group\_name](#input\_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 |
5960
| <a name="input_delete_automated_backups"></a> [delete\_automated\_backups](#input\_delete\_automated\_backups) | Specifies whether to remove automated backups immediately after the DB instance is deleted | `bool` | `true` | no |

modules/db_instance/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ resource "aws_db_instance" "this" {
132132
}
133133
}
134134

135-
tags = var.tags
135+
tags = merge(var.tags, var.db_instance_tags)
136136

137137
depends_on = [aws_cloudwatch_log_group.this]
138138

modules/db_instance/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,12 @@ variable "tags" {
323323
default = {}
324324
}
325325

326+
variable "db_instance_tags" {
327+
description = "A map of additional tags for the DB instance"
328+
type = map(string)
329+
default = {}
330+
}
331+
326332
variable "option_group_name" {
327333
description = "Name of the DB option group to associate."
328334
type = string

0 commit comments

Comments
 (0)