diff --git a/builder/osc/common/access_config_test.go b/builder/osc/common/access_config_test.go index 3af491608..7e26ad73a 100644 --- a/builder/osc/common/access_config_test.go +++ b/builder/osc/common/access_config_test.go @@ -12,19 +12,25 @@ func TestAccessConfigPrepare_Region(t *testing.T) { c := testAccessConfig() c.RawRegion = "us-east-12" - err := c.ValidateRegion(c.RawRegion) + err := c.ValidateOSCRegion(c.RawRegion) if err == nil { t.Fatalf("should have region validation err: %s", c.RawRegion) } c.RawRegion = "us-east-1" - err = c.ValidateRegion(c.RawRegion) + err := c.ValidateOSCRegion(c.RawRegion) + if err == nil { + t.Fatalf("should have region validation err: %s", c.RawRegion) + } + + c.RawRegion = "us-west-1" + err = c.ValidateOSCRegion(c.RawRegion) if err != nil { t.Fatalf("shouldn't have region validation err: %s", c.RawRegion) } c.RawRegion = "custom" - err = c.ValidateRegion(c.RawRegion) + err = c.ValidateOSCRegion(c.RawRegion) if err == nil { t.Fatalf("should have region validation err: %s", c.RawRegion) } diff --git a/builder/osc/common/regions.go b/builder/osc/common/regions.go index 6f7e81d24..9b86acbae 100644 --- a/builder/osc/common/regions.go +++ b/builder/osc/common/regions.go @@ -28,7 +28,7 @@ func listOSCRegions(oscconn *osc.RegionApiService) ([]string, error) { // ValidateRegion returns true if the supplied region is a valid Outscale // region and false if it's not. -func (c *AccessConfig) ValidateRegion(regions ...string) error { +func (c *AccessConfig) ValidateOSCRegion(regions ...string) error { oscconn := c.NewOSCClient() validRegions, err := listOSCRegions(oscconn.RegionApi)