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