fix: Adjust the GP3 IOPS defaults in case of modifications#47411
Draft
ZPascal wants to merge 2 commits intohashicorp:mainfrom
Draft
fix: Adjust the GP3 IOPS defaults in case of modifications#47411ZPascal wants to merge 2 commits intohashicorp:mainfrom
ZPascal wants to merge 2 commits intohashicorp:mainfrom
Conversation
Contributor
Community GuidelinesThis comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀 Voting for Prioritization
Pull Request Authors
|
Signed-off-by: Pascal Zimmermann <pascal.zimmermann@theiotstudio.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rollback Plan
If a change needs to be reverted, we will publish an updated version of the library.
Changes to Security Controls
No changes to security controls.
Description
This PR fixes two bugs in the
aws_db_instanceresource related togp3storage IOPS handling duringModifyDBInstancecalls.Bug 1: Stale IOPS sent when
allocated_storagecrosses thegp3baseline thresholdRoot cause
AWS gp3 storage automatically provisions a higher baseline IOPS once
allocated_storagereaches or exceeds a per-engine threshold (AWS docs):When
allocated_storagegrew across the threshold (e.g., 200 GB -> 400 GB for PostgreSQL) without an explicitiopschange, the provider evaluated the threshold check against the new storage value only. Because the new value was at/above the threshold, the condition fired and sent the old stale IOPS value (3000) in theModifyDBInstancecall — overriding the automatic AWS increase to 12000.Fix
Added
isGP3CrossingThresholdFromBelow, which usesd.GetChangeto compare old and new storage values. The IOPS value is now only sent when the user explicitly changed it or when the storage was already above the threshold before (and remains there):The threshold lookup was also extracted into a shared helper
gp3AllocatedStorageThresholdto avoid duplicating the per-engine switch in both functions.Bug 2: Wrong
gp3IOPS threshold for Db2 enginesThe pre-existing threshold map had
db2-ae/db2-seat 100 GB, but according to the AWS documentation, DB2 is in the same tier as MySQL, MariaDB, and PostgreSQL, with a threshold of 400 GB.Fix
Fixed by merging DB2 into the correct
casebranch.References
Findings
Why
aws_rds_clusterdoes not need the same fixThe cluster update path uses a separate
if d.HasChange/if d.HasChangeblocks, each of which only sends IOPS unconditionally for Provisioned IOPS storage types (io1/io2). Forgp3clusters, neither block sends IOPS when onlyallocated_storagechanges — AWS handles the baseline automatically. -> No bugOutput from Acceptance Testing