Skip to content

Commit e1a5f08

Browse files
committed
feat: Allow ignoring GSI changes
1 parent 97a8950 commit e1a5f08

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

main.tf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ locals {
2121
from_index = length(var.range_key) > 0 ? 0 : 1
2222

2323
attributes_final = slice(local.attributes, local.from_index, length(local.attributes))
24+
25+
ignore_changes_list = var.ignore_gsi_changes ? [
26+
"read_capacity",
27+
"write_capacity",
28+
"global_secondary_index"
29+
] : [
30+
"read_capacity",
31+
"write_capacity"
32+
]
2433
}
2534

2635
resource "null_resource" "global_secondary_index_names" {
@@ -68,10 +77,7 @@ resource "aws_dynamodb_table" "default" {
6877
}
6978

7079
lifecycle {
71-
ignore_changes = [
72-
read_capacity,
73-
write_capacity
74-
]
80+
ignore_changes = local.ignore_changes_list
7581
}
7682

7783
dynamic "attribute" {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,9 @@ variable "import_table" {
208208
default = null
209209
description = "Import Amazon S3 data into a new table."
210210
}
211+
212+
variable "ignore_gsi_changes" {
213+
description = "Whether to ignore changes to global_secondary_index"
214+
type = bool
215+
default = false
216+
}

0 commit comments

Comments
 (0)