Merge pull request #11523 from 2uinc/vault-init-fix

Use vault api.DefaultConfig()
This commit is contained in:
Jake Champlin 2017-02-09 15:18:49 -05:00 committed by GitHub
commit 8618973c5c
1 changed files with 6 additions and 4 deletions

View File

@ -93,9 +93,8 @@ func Provider() terraform.ResourceProvider {
}
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
config := &api.Config{
Address: d.Get("address").(string),
}
config := api.DefaultConfig()
config.Address = d.Get("address").(string)
clientAuthI := d.Get("client_auth").([]interface{})
if len(clientAuthI) > 1 {
@ -110,7 +109,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
clientAuthKey = clientAuth["key_file"].(string)
}
config.ConfigureTLS(&api.TLSConfig{
err := config.ConfigureTLS(&api.TLSConfig{
CACert: d.Get("ca_cert_file").(string),
CAPath: d.Get("ca_cert_dir").(string),
Insecure: d.Get("skip_tls_verify").(bool),
@ -118,6 +117,9 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
ClientCert: clientAuthCert,
ClientKey: clientAuthKey,
})
if err != nil {
return nil, fmt.Errorf("failed to configure TLS for Vault API: %s", err)
}
client, err := api.NewClient(config)
if err != nil {