Drift on warm throughput #113
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Added support for ignoring AWS-managed warm throughput drift in DynamoDB tables using PAY_PER_REQUEST billing mode. This change introduces a new
ignore_warm_throughput_changesvariable and a fourth resource variant (warm_throughput_ignore) that uses lifecycle rules to ignore only warm throughput attribute changes while still detecting other configuration drift.Closes #112
Motivation and Context
When using PAY_PER_REQUEST billing mode, AWS automatically adjusts warm throughput values (
read_units_per_secondandwrite_units_per_second) for tables and GSIs based on usage patterns at no additional cost. This causes perpetual Terraform drift where the module detects changes even though no intentional modifications were made to the configuration.According to AWS documentation: "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."
This change addresses the issue by:
ignore_changes_global_secondary_index)ignore_warm_throughput_changes = false(default)Related issue: [Link to issue if created]
Breaking Changes
No breaking changes. This is a new opt-in feature with
ignore_warm_throughput_changesdefaulting tofalse, maintaining backward compatibility.Note: Enabling
ignore_warm_throughput_changeson an existing table requires a state move operation:terraform state mv module.dynamodb_table.aws_dynamodb_table.this module.dynamodb_table.aws_dynamodb_table.warm_throughput_ignoreHow Has This Been Tested?
I wanted to avoid the effort of testing, in case i oversaw something and my request is not applicable or wanted in the context of the module. Let me know if i shall proceed and happy to go through below
examples/*to demonstrate and validate my change(s)examples/*projectsignore_warm_throughput_changes = trueeliminates driftpre-commit run -aon my pull requestChanges Made
main.tf:
locals.dynamodb_table_arnto include newwarm_throughput_ignoreresourceignore_warm_throughput_changes = trueaws_dynamodb_table.warm_throughput_ignoreresource with lifecycle block that ignores only thewarm_throughputattribute changes in global secondary indexes and at the table level, while still detecting changes to other GSI properties. The lifecycle block includes indices [0] through [19] to cover all possible GSIs, as AWS allows a maximum of 20 global secondary indexes per DynamoDB table.variables.tf:
ignore_warm_throughput_changesvariable (default:false)README.md: