Skip to content

Commit

Permalink
add changes to support additional tags for cluster and cluster instan…
Browse files Browse the repository at this point in the history
…ce (#1)

* add changes to support additional tags for cluster and cluster instance

* address comments format and use of tags in example

* fix extra space and changelog
  • Loading branch information
umotif-olascu authored May 4, 2020
1 parent b9d976c commit 13455ae
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 4 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@ All notable changes to this project will be documented in this file.
<a name="unreleased"></a>
## [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


<a name="1.0.1"></a>
## [1.0.1] - 2020-04-21

- Add changelog


<a name="1.0.0"></a>
## 1.0.0 - 2020-04-20

- Add full module configuration with example for aurora mysql
- 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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
8 changes: 8 additions & 0 deletions examples/aurora-mysql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
10 changes: 8 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
)
}

#####
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
}

0 comments on commit 13455ae

Please sign in to comment.