From 2cfb275039abe2d16423668fc2a7736b61f3ec34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3n=20Levy?= Date: Wed, 14 Feb 2024 14:42:04 +0000 Subject: [PATCH 1/5] fix: added enable_appautoscaling_tags variable --- variables.tf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/variables.tf b/variables.tf index 4d29776..e3a2f7d 100644 --- a/variables.tf +++ b/variables.tf @@ -717,3 +717,9 @@ variable "engine_native_audit_fields_included" { type = bool default = false } + +variable "enable_appautoscaling_tags" { + type = bool + default = true + description = "Allow disabling tags on the aws_appautoscaling_target resource. Tags cannot be used on clusters created before 2023-03-30 and causes a perpetual drift." +} From fc831162b0d9f53004aedb5f382baf949e3752f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3n=20Levy?= Date: Wed, 14 Feb 2024 14:44:49 +0000 Subject: [PATCH 2/5] fix: dynamically set aws_appautoscaling_target tags --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 68c0438..21ff780 100644 --- a/main.tf +++ b/main.tf @@ -277,7 +277,7 @@ resource "aws_appautoscaling_target" "this" { scalable_dimension = "rds:cluster:ReadReplicaCount" service_namespace = "rds" - tags = var.tags + tags = var.enable_appautoscaling_tags ? var.tags : null } resource "aws_appautoscaling_policy" "this" { From 8e3bdaaa3779bd334c4ce7d1fff17c07c7d7ee6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3n=20Levy?= Date: Wed, 14 Feb 2024 15:06:37 +0000 Subject: [PATCH 3/5] chore: revert variable changes --- variables.tf | 6 ------ 1 file changed, 6 deletions(-) diff --git a/variables.tf b/variables.tf index e3a2f7d..4d29776 100644 --- a/variables.tf +++ b/variables.tf @@ -717,9 +717,3 @@ variable "engine_native_audit_fields_included" { type = bool default = false } - -variable "enable_appautoscaling_tags" { - type = bool - default = true - description = "Allow disabling tags on the aws_appautoscaling_target resource. Tags cannot be used on clusters created before 2023-03-30 and causes a perpetual drift." -} From c0ec5f4713e0d60143d13fa0ba2afbe971d0e00f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3n=20Levy?= Date: Wed, 14 Feb 2024 15:07:38 +0000 Subject: [PATCH 4/5] fix: set lifecycle ignore_changes on tags_all --- main.tf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 21ff780..eb03ff2 100644 --- a/main.tf +++ b/main.tf @@ -277,7 +277,13 @@ resource "aws_appautoscaling_target" "this" { scalable_dimension = "rds:cluster:ReadReplicaCount" service_namespace = "rds" - tags = var.enable_appautoscaling_tags ? var.tags : null + tags = var.tags + + lifecycle { + ignore_changes = [ + tags_all, + ] + } } resource "aws_appautoscaling_policy" "this" { From 5cc4b67322774dd64f20449bb2a1948650bf6a99 Mon Sep 17 00:00:00 2001 From: Bryant Biggs Date: Thu, 15 Feb 2024 18:43:35 -0500 Subject: [PATCH 5/5] fix: Correct pre-commit checks --- .pre-commit-config.yaml | 3 ++- CHANGELOG.md | 4 ++-- main.tf | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1995474..93900a8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.83.6 + rev: v1.86.0 hooks: - id: terraform_fmt - id: terraform_validate @@ -27,3 +27,4 @@ repos: hooks: - id: check-merge-conflict - id: end-of-file-fixer + - id: trailing-whitespace diff --git a/CHANGELOG.md b/CHANGELOG.md index 84fab86..63fd685 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -531,7 +531,7 @@ All notable changes to this project will be documented in this file - Add cluster ARN output as 'this_rds_cluster_arn' ([#48](https://github.com/terraform-aws-modules/terraform-aws-rds-aurora/issues/48)) - Upgraded module to support Terraform 0.12 ([#45](https://github.com/terraform-aws-modules/terraform-aws-rds-aurora/issues/45)) -### +### on ../../modules/aws-rds-aurora/main.tf line 4, in locals: @@ -579,7 +579,7 @@ when calling import with this module in the configuration. - Add cluster ARN output as 'this_rds_cluster_arn' ([#48](https://github.com/terraform-aws-modules/terraform-aws-rds-aurora/issues/48)) - Upgraded module to support Terraform 0.12 ([#45](https://github.com/terraform-aws-modules/terraform-aws-rds-aurora/issues/45)) -### +### on ../../modules/aws-rds-aurora/main.tf line 4, in locals: diff --git a/main.tf b/main.tf index eb03ff2..ff17cba 100644 --- a/main.tf +++ b/main.tf @@ -278,7 +278,7 @@ resource "aws_appautoscaling_target" "this" { service_namespace = "rds" tags = var.tags - + lifecycle { ignore_changes = [ tags_all,