Skip to content

Commit

Permalink
🐛 use configured region to fetch regions list (aws)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeffrey committed Jan 7, 2025
1 parent fe27e2e commit f5a1322
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions providers/aws/connection/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,17 +376,12 @@ func (h *AwsConnection) Regions() ([]string, error) {
// if no cache, get regions using ec2 client (using the ssm list global regions does not give the same list)
log.Debug().Msg("no region cache or region limits found. fetching regions")
regions := []string{}
svc := h.Ec2("us-east-1")
svc := h.Ec2(h.cfg.Region)
ctx := context.Background()

res, err := svc.DescribeRegions(ctx, &ec2.DescribeRegionsInput{})
if err != nil {
// try with govcloud region
svc := h.Ec2("us-gov-west-1")
res, err = svc.DescribeRegions(ctx, &ec2.DescribeRegionsInput{})
if err != nil {
return regions, err
}
return regions, err
}
for _, region := range res.Regions {
// ensure excluded regions are discarded
Expand Down

0 comments on commit f5a1322

Please sign in to comment.