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
This commit is contained in:
Conor Mongey 2017-01-17 12:06:55 +00:00 committed by Paul Stack
parent 619abeea9e
commit 77c8683281
2 changed files with 12 additions and 14 deletions

View File

@ -28,15 +28,13 @@ func Provider() terraform.ResourceProvider {
"ca_cert_file": &schema.Schema{ "ca_cert_file": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
ConflictsWith: []string{"ca_cert_dir"}, DefaultFunc: schema.EnvDefaultFunc("VAULT_CACERT", ""),
DefaultFunc: schema.EnvDefaultFunc("VAULT_CACERT", nil),
Description: "Path to a CA certificate file to validate the server's certificate.", Description: "Path to a CA certificate file to validate the server's certificate.",
}, },
"ca_cert_dir": &schema.Schema{ "ca_cert_dir": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
ConflictsWith: []string{"ca_cert_file"}, DefaultFunc: schema.EnvDefaultFunc("VAULT_CAPATH", ""),
DefaultFunc: schema.EnvDefaultFunc("VAULT_CAPATH", nil),
Description: "Path to directory containing CA certificate files to validate the server's certificate.", Description: "Path to directory containing CA certificate files to validate the server's certificate.",
}, },
"client_auth": &schema.Schema{ "client_auth": &schema.Schema{
@ -48,13 +46,13 @@ func Provider() terraform.ResourceProvider {
"cert_file": &schema.Schema{ "cert_file": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
DefaultFunc: schema.EnvDefaultFunc("VAULT_CLIENT_CERT", nil), DefaultFunc: schema.EnvDefaultFunc("VAULT_CLIENT_CERT", ""),
Description: "Path to a file containing the client certificate.", Description: "Path to a file containing the client certificate.",
}, },
"key_file": &schema.Schema{ "key_file": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, 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.", 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{ "skip_tls_verify": &schema.Schema{
Type: schema.TypeBool, Type: schema.TypeBool,
Optional: true, 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.", Description: "Set this to true only if the target Vault server is an insecure development instance.",
}, },
"max_lease_ttl_seconds": &schema.Schema{ "max_lease_ttl_seconds": &schema.Schema{

View File

@ -495,7 +495,7 @@ func (m schemaMap) Input(
var value interface{} var value interface{}
switch v.Type { switch v.Type {
case TypeBool, TypeInt, TypeFloat, TypeSet: case TypeBool, TypeInt, TypeFloat, TypeSet, TypeList:
continue continue
case TypeString: case TypeString:
value, err = m.inputString(input, k, v) value, err = m.inputString(input, k, v)