From db58c7dd33ae83263dd1650afe64547fe2907e04 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 9 Apr 2015 09:49:03 -0700 Subject: [PATCH] providers/docker: default cert_path to non-nil so input isn't asked --- builtin/providers/docker/provider.go | 2 +- helper/schema/schema_test.go | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/builtin/providers/docker/provider.go b/builtin/providers/docker/provider.go index 2fe456e93cd0..fdc8b771949f 100644 --- a/builtin/providers/docker/provider.go +++ b/builtin/providers/docker/provider.go @@ -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", }, }, diff --git a/helper/schema/schema_test.go b/helper/schema/schema_test.go index 2c9e89f63edf..c1233ae50bab 100644 --- a/helper/schema/schema_test.go +++ b/helper/schema/schema_test.go @@ -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{