You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(aws/savingsplans): add USD currency + region filter and deterministic sort to findOfferingID #1066
findOfferingID in providers/aws/services/savingsplans/client.go calls DescribeSavingsPlansOfferings without narrowing by currency or region, and
then returns the first result from an unordered API response. AWS does not
guarantee ordering of DescribeSavingsPlansOfferings results, so when
multiple offerings match (e.g. USD vs CNY, or global vs region-scoped) the
chosen offering ID is nondeterministic and may be non-USD or off-target.
Source: finding 08-L1 (SP portion) from the code-review series (report 08).
Currencies []types.CurrencyCode — lets us pin to USD server-side.
Filters []types.SavingsPlanOfferingFilterElement with SavingsPlanOfferingFilterAttributeRegion — lets us pin to the client
region for EC2Instance SPs (Compute/SageMaker/Database SPs are
region-agnostic; filter is omitted for them).
Currently neither filter is set, so any currency or region variant can
land in position 0 of the response.
Fix
Set Currencies: []types.CurrencyCode{types.CurrencyCodeUsd} on the
input before calling DescribeSavingsPlansOfferings.
For EC2Instance SPs, add a region filter element (the only SP type that
has region-specific offerings). Compute, SageMaker, and Database SPs are
global.
Sort SearchResults by OfferingId (lexicographically) before returning
the first match, so the tie-break is stable if multiple offerings still
match after filtering.
Activity
fix(aws/savingsplans): add USD filter, EC2Instance region filter, and…
fix(aws/savingsplans): paginate GetExistingCommitments via NextToken …