provider/docker: fix regression, cert_path stop working (#10754) (#10801)

This commit is contained in:
Michael Kuzmin 2016-12-17 15:41:08 +03:00 committed by Paul Stack
parent f15efbc207
commit 7a59971777
2 changed files with 16 additions and 15 deletions

View File

@ -24,6 +24,10 @@ func (c *Config) NewClient() (*dc.Client, error) {
return nil, fmt.Errorf("ca_material, cert_material, and key_material must be specified")
}
if c.CertPath != "" {
return nil, fmt.Errorf("cert_path must not be specified")
}
return dc.NewTLSClientFromBytes(c.Host, []byte(c.Cert), []byte(c.Key), []byte(c.Ca))
}

View File

@ -21,21 +21,18 @@ func Provider() terraform.ResourceProvider {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("DOCKER_CA_MATERIAL", ""),
ConflictsWith: []string{"cert_path"},
Description: "PEM-encoded content of Docker host CA certificate",
},
"cert_material": &schema.Schema{
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("DOCKER_CERT_MATERIAL", ""),
ConflictsWith: []string{"cert_path"},
Description: "PEM-encoded content of Docker client certificate",
},
"key_material": &schema.Schema{
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("DOCKER_KEY_MATERIAL", ""),
ConflictsWith: []string{"cert_path"},
Description: "PEM-encoded content of Docker client private key",
},