-
-
Notifications
You must be signed in to change notification settings - Fork 197
Description
Description
When using DynamoDB tables with Global Secondary Indexes (GSIs) in PAY_PER_REQUEST billing mode, AWS automatically adjusts the warm_throughput values (read_units_per_second and write_units_per_second) based on usage patterns as documented in AWS DynamoDB warm throughput documentation. This causes perpetual Terraform drift where the module detects changes to GSI configuration even though no intentional changes were made to the Terraform code.
According to AWS: "Warm throughput values are available by default for all tables and GSIs at no cost" and "DynamoDB will automatically adjust warm throughput values as your usage increases." These are AWS-managed default values that appear automatically without user intervention or cost.
The module correctly supports passing read_units_per_second and write_units_per_second parameters to GSIs via the warm_throughput block, but there's no way to ignore AWS-managed drift on these specific attributes while still allowing intentional changes to other GSI properties when using PAY_PER_REQUEST billing mode. If this is intentional, please close.
- ✋ I have searched the open/closed issues and my issue is not listed.
Versions
- Module version: 5.3.0
- Terraform version: 1.14.1
- Provider version(s): hashicorp/aws 6.24
Reproduction Code
Steps to reproduce
- Deploy the table with the configuration above
- Wait for AWS to automatically adjust warm throughput values (happens within hours/days based on usage)
- Run
terraform plan - Observe perpetual drift showing GSI wants to be recreated due to warm throughput differences
Expected behavior
The module should provide a way to ignore AWS-managed warm throughput adjustments while still allowing intentional changes to other GSI attributes. E.g. through:
- A variable like
ignore_warm_throughput_drift = true
Actual behavior
Terraform plan shows:
This creates a perpetual diff that requires either:
- Constantly updating Terraform code to match AWS values
- Ignoring the entire
global_secondary_indexblock with lifecycle rules (not possible in module calls) - Living with perpetual drift warnings
Proposed Solution
The module already has an ignore_changes_global_secondary_index variable that creates a separate resource (autoscaled_gsi_ignore) with lifecycle rules. However, this only works when autoscaling_enabled = true and ignores ALL GSI changes (too broad).
Suggested approach:
- Add a new variable:
ignore_warm_throughput_changes = false - Create a fourth resource variant (similar to
autoscaled_gsi_ignore) that:- Works with
autoscaling_enabled = false(PAY_PER_REQUEST mode) - Has a lifecycle block that specifically ignores only the warm_throughput attribute changes in global secondary indexes and at the table level, while still detecting changes to other GSI properties.
- Works with