provider/atlas: fix required token
This commit is contained in:
parent
0ff62016ee
commit
edc4a277d6
|
@ -18,19 +18,19 @@ const (
|
|||
func Provider() terraform.ResourceProvider {
|
||||
return &schema.Provider{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"token": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
DefaultFunc: envDefaultFunc("ATLAS_TOKEN", nil),
|
||||
Description: descriptions["token"],
|
||||
},
|
||||
|
||||
"address": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: envDefaultFunc("ATLAS_ADDRESS", defaultAtlasServer),
|
||||
Description: descriptions["address"],
|
||||
},
|
||||
|
||||
"token": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: envDefaultFunc("ATLAS_TOKEN", ""),
|
||||
Description: descriptions["token"],
|
||||
},
|
||||
},
|
||||
|
||||
ResourcesMap: map[string]*schema.Resource{
|
||||
|
@ -55,7 +55,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
|||
return client, nil
|
||||
}
|
||||
|
||||
func envDefaultFunc(k, alt string) schema.SchemaDefaultFunc {
|
||||
func envDefaultFunc(k string, alt interface{}) schema.SchemaDefaultFunc {
|
||||
return func() (interface{}, error) {
|
||||
if v := os.Getenv(k); v != "" {
|
||||
return v, nil
|
||||
|
|
Loading…
Reference in New Issue