Skip to content

Commit 1598212

Browse files
author
Nam Nguyen
committed
fix: ignore tags for aws_appautoscaling_target
Scalable targets created before 2023-03-20 may not have an assigned arn. These resource cannot use tags or participate in default_tags. To prevent terraform plan showing differences that can never be reconciled, use the lifecycle.ignore_changes meta-argument Reference: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appautoscaling_target
1 parent e6b5d79 commit 1598212

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,10 @@ resource "aws_appautoscaling_target" "this" {
290290
tags = var.tags
291291

292292
lifecycle {
293-
ignore_changes = [
293+
ignore_changes = var.autoscaling_tags_ignore ? [
294+
tags,
294295
tags_all,
295-
]
296+
] : []
296297
}
297298
}
298299

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,12 @@ variable "autoscaling_target_connections" {
590590
default = 700
591591
}
592592

593+
variable "autoscaling_tags_ignore" {
594+
description = "Scalable targets created before 2023-03-20 cannot use tags or default_tags. To prevent terraform plan showing differences that can never be reconciled, set this flag to true"
595+
type = bool
596+
default = false
597+
}
598+
593599
################################################################################
594600
# Security Group
595601
################################################################################

0 commit comments

Comments
 (0)