Skip to content

Commit

Permalink
fix: Separate db_instance_tags from merged tags sub-module input (#…
Browse files Browse the repository at this point in the history
…544)

Co-authored-by: Bryant Biggs <bryantbiggs@gmail.com>
  • Loading branch information
winthropgutmann-ef and bryantbiggs authored Mar 19, 2024
1 parent 4ceaf27 commit 89a5763
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.88.0
rev: v1.88.2
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand Down
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ module "db_instance" {
restore_to_point_in_time = var.restore_to_point_in_time
s3_import = var.s3_import

tags = merge(var.tags, var.db_instance_tags)
db_instance_tags = var.db_instance_tags
tags = var.tags
}

module "db_instance_role_association" {
Expand Down
1 change: 1 addition & 0 deletions modules/db_instance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ No modules.
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
Expand Down
2 changes: 1 addition & 1 deletion modules/db_instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ resource "aws_db_instance" "this" {
}
}

tags = var.tags
tags = merge(var.tags, var.db_instance_tags)

depends_on = [aws_cloudwatch_log_group.this]

Expand Down
6 changes: 6 additions & 0 deletions modules/db_instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,12 @@ variable "tags" {
default = {}
}

variable "db_instance_tags" {
description = "A map of additional tags for the DB instance"
type = map(string)
default = {}
}

variable "option_group_name" {
description = "Name of the DB option group to associate."
type = string
Expand Down

0 comments on commit 89a5763

Please sign in to comment.