From 77c868328123b7f874a3eea04d922aeb7bb9dc63 Mon Sep 17 00:00:00 2001 From: Conor Mongey Date: Tue, 17 Jan 2017 12:06:55 +0000 Subject: [PATCH] provider/vault: Remove user input for optional vault provider fields (#11082) * Remove the need to input vault optional settings * Allow TypeList to skip input * Remove conflicts on vault ca_cert_* fields --- builtin/providers/vault/provider.go | 24 +++++++++++------------- helper/schema/schema.go | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/builtin/providers/vault/provider.go b/builtin/providers/vault/provider.go index 69ae4c8cd..9e1d153f8 100644 --- a/builtin/providers/vault/provider.go +++ b/builtin/providers/vault/provider.go @@ -26,18 +26,16 @@ func Provider() terraform.ResourceProvider { Description: "Token to use to authenticate to Vault.", }, "ca_cert_file": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ConflictsWith: []string{"ca_cert_dir"}, - DefaultFunc: schema.EnvDefaultFunc("VAULT_CACERT", nil), - Description: "Path to a CA certificate file to validate the server's certificate.", + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("VAULT_CACERT", ""), + Description: "Path to a CA certificate file to validate the server's certificate.", }, "ca_cert_dir": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ConflictsWith: []string{"ca_cert_file"}, - DefaultFunc: schema.EnvDefaultFunc("VAULT_CAPATH", nil), - Description: "Path to directory containing CA certificate files to validate the server's certificate.", + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("VAULT_CAPATH", ""), + Description: "Path to directory containing CA certificate files to validate the server's certificate.", }, "client_auth": &schema.Schema{ Type: schema.TypeList, @@ -48,13 +46,13 @@ func Provider() terraform.ResourceProvider { "cert_file": &schema.Schema{ Type: schema.TypeString, Required: true, - DefaultFunc: schema.EnvDefaultFunc("VAULT_CLIENT_CERT", nil), + DefaultFunc: schema.EnvDefaultFunc("VAULT_CLIENT_CERT", ""), Description: "Path to a file containing the client certificate.", }, "key_file": &schema.Schema{ Type: schema.TypeString, Required: true, - DefaultFunc: schema.EnvDefaultFunc("VAULT_CLIENT_KEY", nil), + DefaultFunc: schema.EnvDefaultFunc("VAULT_CLIENT_KEY", ""), Description: "Path to a file containing the private key that the certificate was issued for.", }, }, @@ -63,7 +61,7 @@ func Provider() terraform.ResourceProvider { "skip_tls_verify": &schema.Schema{ Type: schema.TypeBool, Optional: true, - DefaultFunc: schema.EnvDefaultFunc("VAULT_SKIP_VERIFY", nil), + DefaultFunc: schema.EnvDefaultFunc("VAULT_SKIP_VERIFY", ""), Description: "Set this to true only if the target Vault server is an insecure development instance.", }, "max_lease_ttl_seconds": &schema.Schema{ diff --git a/helper/schema/schema.go b/helper/schema/schema.go index e9fcd8235..25ef5e169 100644 --- a/helper/schema/schema.go +++ b/helper/schema/schema.go @@ -495,7 +495,7 @@ func (m schemaMap) Input( var value interface{} switch v.Type { - case TypeBool, TypeInt, TypeFloat, TypeSet: + case TypeBool, TypeInt, TypeFloat, TypeSet, TypeList: continue case TypeString: value, err = m.inputString(input, k, v)