Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providers/docker: default cert_path to non-nil so input isn't asked [GH-1432] #1456

Merged
merged 1 commit into from
Apr 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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