Skip to content

Commit db58c7d

Browse files
committed
providers/docker: default cert_path to non-nil so input isn't asked
1 parent 146f76e commit db58c7d

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

builtin/providers/docker/provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func Provider() terraform.ResourceProvider {
2020
"cert_path": &schema.Schema{
2121
Type: schema.TypeString,
2222
Optional: true,
23-
DefaultFunc: schema.EnvDefaultFunc("DOCKER_CERT_PATH", nil),
23+
DefaultFunc: schema.EnvDefaultFunc("DOCKER_CERT_PATH", ""),
2424
Description: "Path to directory with Docker TLS config",
2525
},
2626
},

helper/schema/schema_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,6 +2322,24 @@ func TestSchemaMap_Input(t *testing.T) {
23222322
Err: false,
23232323
},
23242324

2325+
"input ignored when default function returns an empty string": {
2326+
Schema: map[string]*Schema{
2327+
"availability_zone": &Schema{
2328+
Type: TypeString,
2329+
Default: "",
2330+
Optional: true,
2331+
},
2332+
},
2333+
2334+
Input: map[string]string{
2335+
"availability_zone": "bar",
2336+
},
2337+
2338+
Result: map[string]interface{}{},
2339+
2340+
Err: false,
2341+
},
2342+
23252343
"input used when default function returns nil": {
23262344
Schema: map[string]*Schema{
23272345
"availability_zone": &Schema{

0 commit comments

Comments
 (0)