Skip to content

fix(providers/aws): fail loud on unrecognized RI term in EC2 getDurationValue #1260

Description

@cristim

Discovered while reviewing #1207 (ARCH-04 fail-loud on unrecognized RI terms). getDurationValue at providers/aws/services/ec2/client.go:630 still returns OneYearSeconds for any unrecognized term with no error -- the same silent-fallback pattern #1207 fixed for RDS/ElastiCache/MemoryDB/OpenSearch/Redshift. EC2 was not in #1192's scope so it was correctly left out of #1207.

Fix: change getDurationValue to return (int64, error), error on unrecognized terms, and propagate from buildEC2QueryFromRec. Add a regression test asserting the error on a DB-null/garbage term.

Activity

cristim commented on Jul 27, 2026

@cristim
MemberAuthor

Verification sweep against main (101f099fb) on 2026-07-27 finds this already resolved.
EC2's getDurationValue now fails loud on an unrecognized term rather than defaulting silently.
Evidence: commit c59c116.
Recommending close. This is the EC2 half of #1266; consider closing both together, or this one as a duplicate of #1266.

cristim commented on Sep 2, 2026

@cristim
MemberAuthor

Verified resolved at 3c0f8ac: EC2's getDurationValue now returns (int64, error) and rejects any term other than 1yr/1/3yr/3 with an explicit unsupported-term error that the purchase query builder propagates before any API call. Evidence: providers/aws/services/ec2/client.go:672-679 and :464 (#1481). Residual axes checked: the duration defaults at client.go:787 and :865 apply to an unset numeric Duration filter on target-offering listing, not to a term string; the RDS/ElastiCache getDurationString variants are tracked separately in #1266. Closing as completed; reopen if the behaviour recurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions