Skip to content

Commit

Permalink
fixed issue with OD pricing for european regions (#132)
Browse files Browse the repository at this point in the history
* fixed issue with OD pricing for european regions

* made string replacement more readable in getRegionForPricingAPI

Co-authored-by: Rodrigo Okamoto <[email protected]>
  • Loading branch information
digocorbellini and Rodrigo Okamoto authored Jun 15, 2022
1 parent de46c1f commit 69ef9dd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/ec2pricing/odpricing.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"os"
"path/filepath"
"strconv"
"strings"
"time"

"github.com/aws/aws-sdk-go/aws"
Expand Down Expand Up @@ -214,6 +215,12 @@ func (c *OnDemandPricing) getRegionForPricingAPI() string {
regionDescription = region.Description()
}
}

// endpoints package returns European regions with the word "Europe," but the pricing API expects the word "EU."
// This formatting mismatch is only present with European regions.
// So replace "Europe" with "EU" if it exists in the regionDescription string.
regionDescription = strings.ReplaceAll(regionDescription, "Europe", "EU")

return regionDescription
}

Expand Down

0 comments on commit 69ef9dd

Please sign in to comment.