Skip to content

Commit d98e520

Browse files
committed
provider/scaleway: expose Region as user facing configuration
1 parent a5d105d commit d98e520

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

builtin/providers/scaleway/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
type Config struct {
1515
Organization string
1616
APIKey string
17+
Region string
1718
}
1819

1920
// Client contains scaleway api clients
@@ -27,6 +28,7 @@ func (c *Config) Client() (*Client, error) {
2728
c.Organization,
2829
c.APIKey,
2930
scwversion.UserAgent(),
31+
c.Region,
3032
func(s *api.ScalewayAPI) {
3133
s.Logger = newTerraformLogger()
3234
},

builtin/providers/scaleway/provider.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ func Provider() terraform.ResourceProvider {
2121
DefaultFunc: schema.EnvDefaultFunc("SCALEWAY_ORGANIZATION", nil),
2222
Description: "The Organization ID for Scaleway API operations.",
2323
},
24+
"region": &schema.Schema{
25+
Type: schema.TypeString,
26+
Optional: true,
27+
DefaultFunc: schema.EnvDefaultFunc("SCALEWAY_REGION", "par1"),
28+
Description: "The Scaleway API region to use.",
29+
},
2430
},
2531

2632
ResourcesMap: map[string]*schema.Resource{
@@ -40,6 +46,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
4046
config := Config{
4147
Organization: d.Get("organization").(string),
4248
APIKey: d.Get("access_key").(string),
49+
Region: d.Get("region").(string),
4350
}
4451

4552
return config.Client()

0 commit comments

Comments
 (0)