Skip to content

Commit 3390fdb

Browse files
adding dynamic lifecycle rule to ignore username/password changes if var.password is declared
1 parent 4481ddd commit 3390fdb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

modules/db_instance/main.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ resource "aws_db_instance" "this" {
145145
update = lookup(var.timeouts, "update", null)
146146
}
147147

148+
dynamic "lifecycle" {
149+
for_each = var.password != null ? toset([1]) : toset([0])
150+
151+
content {
152+
ignore_changes = [
153+
password,
154+
username,
155+
]
156+
}
157+
}
158+
148159
# Note: do not add `latest_restorable_time` to `ignore_changes`
149160
# https://github.com/terraform-aws-modules/terraform-aws-rds/issues/478
150161
}

0 commit comments

Comments
 (0)