provider/scaleway: fix provider configuration (#11234)
properly fetch configuration from env - leftover from #10874
This commit is contained in:
parent
b054e627fe
commit
8183d4667a
|
@ -12,16 +12,18 @@ func Provider() terraform.ResourceProvider {
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"access_key": &schema.Schema{
|
"access_key": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Optional: true,
|
||||||
DefaultFunc: schema.EnvDefaultFunc("SCALEWAY_ACCESS_KEY", nil),
|
DefaultFunc: schema.EnvDefaultFunc("SCALEWAY_ACCESS_KEY", nil),
|
||||||
Deprecated: "Use `token` instead.",
|
Deprecated: "Use `token` instead.",
|
||||||
Description: "The API key for Scaleway API operations.",
|
Description: "The API key for Scaleway API operations.",
|
||||||
},
|
},
|
||||||
|
|
||||||
"token": &schema.Schema{
|
"token": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
DefaultFunc: schema.EnvDefaultFunc("SCALEWAY_TOKEN", nil),
|
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
|
||||||
|
"SCALEWAY_TOKEN",
|
||||||
|
"SCALEWAY_ACCESS_KEY",
|
||||||
|
}, nil),
|
||||||
Description: "The API key for Scaleway API operations.",
|
Description: "The API key for Scaleway API operations.",
|
||||||
},
|
},
|
||||||
"organization": &schema.Schema{
|
"organization": &schema.Schema{
|
||||||
|
|
|
@ -32,7 +32,9 @@ func testAccPreCheck(t *testing.T) {
|
||||||
if v := os.Getenv("SCALEWAY_ORGANIZATION"); v == "" {
|
if v := os.Getenv("SCALEWAY_ORGANIZATION"); v == "" {
|
||||||
t.Fatal("SCALEWAY_ORGANIZATION must be set for acceptance tests")
|
t.Fatal("SCALEWAY_ORGANIZATION must be set for acceptance tests")
|
||||||
}
|
}
|
||||||
if v := os.Getenv("SCALEWAY_TOKEN"); v == "" {
|
tokenFromAccessKey := os.Getenv("SCALEWAY_ACCESS_KEY")
|
||||||
|
token := os.Getenv("SCALEWAY_TOKEN")
|
||||||
|
if token == "" && tokenFromAccessKey == "" {
|
||||||
t.Fatal("SCALEWAY_TOKEN must be set for acceptance tests")
|
t.Fatal("SCALEWAY_TOKEN must be set for acceptance tests")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue