providers/docker: default cert_path to non-nil so input isn't asked

This commit is contained in:
Mitchell Hashimoto 2015-04-09 09:49:03 -07:00
parent 146f76e147
commit db58c7dd33
2 changed files with 19 additions and 1 deletions

View File

@ -20,7 +20,7 @@ func Provider() terraform.ResourceProvider {
"cert_path": &schema.Schema{
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("DOCKER_CERT_PATH", nil),
DefaultFunc: schema.EnvDefaultFunc("DOCKER_CERT_PATH", ""),
Description: "Path to directory with Docker TLS config",
},
},

View File

@ -2322,6 +2322,24 @@ func TestSchemaMap_Input(t *testing.T) {
Err: false,
},
"input ignored when default function returns an empty string": {
Schema: map[string]*Schema{
"availability_zone": &Schema{
Type: TypeString,
Default: "",
Optional: true,
},
},
Input: map[string]string{
"availability_zone": "bar",
},
Result: map[string]interface{}{},
Err: false,
},
"input used when default function returns nil": {
Schema: map[string]*Schema{
"availability_zone": &Schema{