diff --git a/pkg/blockstorage/awsebs/awsebs.go b/pkg/blockstorage/awsebs/awsebs.go index dc937f1a38..c117b86bf8 100644 --- a/pkg/blockstorage/awsebs/awsebs.go +++ b/pkg/blockstorage/awsebs/awsebs.go @@ -599,8 +599,8 @@ func (s *ebsStorage) FromRegion(ctx context.Context, region string) ([]string, e return staticRegionToZones(region) } -func queryRegionToZones(ctx context.Context, region string) ([]string, error) { - ec2Cli, err := newEC2Client(region, nil, "") +func (s *ebsStorage) queryRegionToZones(ctx context.Context, region string) ([]string, error) { + ec2Cli, err := newEC2Client(region, nil, s.role) if err != nil { return nil, errors.Wrapf(err, "Could not get EC2 client") } diff --git a/pkg/blockstorage/awsebs/awsebs_test.go b/pkg/blockstorage/awsebs/awsebs_test.go index 5c08589d4e..eacf95e8e6 100644 --- a/pkg/blockstorage/awsebs/awsebs_test.go +++ b/pkg/blockstorage/awsebs/awsebs_test.go @@ -32,7 +32,10 @@ func (s AWSEBSSuite) TestQueryRegionToZones(c *C) { c.Skip("Only works on AWS") ctx := context.Background() region := "us-east-1" - zs, err := queryRegionToZones(ctx, region) + ec2Cli, err := newEC2Client(region, nil, "") + c.Assert(err, IsNil) + provider := &ebsStorage{ec2Cli: ec2Cli} + zs, err := provider.queryRegionToZones(ctx, region) c.Assert(err, IsNil) c.Assert(zs, DeepEquals, []string{"us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d", "us-east-1e", "us-east-1f"}) }