Skip to content

Commit

Permalink
Merge pull request #1456 from hashicorp/b-docker-input
Browse files Browse the repository at this point in the history
providers/docker: default cert_path to non-nil so input isn't asked [GH-1432]
  • Loading branch information
mitchellh committed Apr 9, 2015
2 parents 146f76e + db58c7d commit d7e8192
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion builtin/providers/docker/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
Expand Down
18 changes: 18 additions & 0 deletions helper/schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit d7e8192

Please sign in to comment.