Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Separate db_instance_tags from merged tags sub-module input #544

Merged
merged 5 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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