diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a26a19..ca22696 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: args: ['--allow-missing-credentials'] - id: trailing-whitespace - repo: git://github.com/antonbabenko/pre-commit-terraform - rev: v1.29.0 + rev: v1.30.0 hooks: - id: terraform_fmt - id: terraform_docs diff --git a/CHANGELOG.md b/CHANGELOG.md index 54f36f0..489378f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,16 +5,13 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +- address comments format and use of tags in example +- add changes to support additional tags for cluster and cluster instance +- update CHANGELOG - update config for chglog - Add changelog - -## [1.0.1] - 2020-04-21 - -- Add changelog - - ## 1.0.0 - 2020-04-20 @@ -22,5 +19,4 @@ All notable changes to this project will be documented in this file. - Initial commit -[Unreleased]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/1.0.1...HEAD -[1.0.1]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/1.0.0...1.0.1 +[Unreleased]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/1.0.0...HEAD diff --git a/README.md b/README.md index 657a929..24f3b3f 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,8 @@ Module managed by [Marcin Cuber](https://github.com/marcincuber) [LinkedIn](http | backtrack\_window | The target backtrack window, in seconds. Only available for aurora engine currently. To disable backtracking, set this value to 0. Defaults to 0. Must be between 0 and 259200 (72 hours) | `number` | `0` | no | | backup\_retention\_period | How long to keep backups for (in days) | `number` | `7` | no | | ca\_cert\_identifier | The identifier of the CA certificate for the DB instance. | `string` | `"rds-ca-2019"` | no | +| cluster\_instance\_tags | Additional tags for the cluster instance | `map(string)` | `{}` | no | +| cluster\_tags | Additional tags for the cluster | `map(string)` | `{}` | no | | copy\_tags\_to\_snapshot | Copy all Cluster tags to snapshots. | `bool` | `false` | no | | create\_monitoring\_role | Whether to create the IAM role for RDS enhanced monitoring | `bool` | `true` | no | | create\_security\_group | Whether to create security group for RDS cluster | `bool` | `true` | no | diff --git a/examples/aurora-mysql/main.tf b/examples/aurora-mysql/main.tf index 0eceb28..415ac10 100644 --- a/examples/aurora-mysql/main.tf +++ b/examples/aurora-mysql/main.tf @@ -166,6 +166,14 @@ module "aurora" { create_security_group = true + cluster_tags = { + "cluster_tags" = "example cluster main" + } + + cluster_instance_tags = { + "cluster_instance_tags" = "example of cluster instance tags" + } + tags = { Environment = "test" } diff --git a/main.tf b/main.tf index 7638e8a..4178b23 100644 --- a/main.tf +++ b/main.tf @@ -138,7 +138,10 @@ resource "aws_rds_cluster" "main" { } } - tags = var.tags + tags = merge( + var.tags, + var.cluster_tags + ) lifecycle { ignore_changes = [master_username, master_password] @@ -173,7 +176,10 @@ resource "aws_rds_cluster_instance" "main" { performance_insights_kms_key_id = var.performance_insights_kms_key_id ca_cert_identifier = var.ca_cert_identifier - tags = var.tags + tags = merge( + var.tags, + var.cluster_instance_tags + ) } ##### diff --git a/variables.tf b/variables.tf index b2b4576..7fce839 100644 --- a/variables.tf +++ b/variables.tf @@ -349,3 +349,15 @@ variable "create_monitoring_role" { type = bool default = true } + +variable "cluster_tags" { + description = "Additional tags for the cluster" + type = map(string) + default = {} +} + +variable "cluster_instance_tags" { + description = "Additional tags for the cluster instance" + type = map(string) + default = {} +}