From 7a599717771c5113a36a22c9037ef66be756c3fb Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Sat, 17 Dec 2016 15:41:08 +0300 Subject: [PATCH] provider/docker: fix regression, cert_path stop working (#10754) (#10801) --- builtin/providers/docker/config.go | 4 ++++ builtin/providers/docker/provider.go | 27 ++++++++++++--------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/builtin/providers/docker/config.go b/builtin/providers/docker/config.go index d3a6cb1212..ad05d5409d 100644 --- a/builtin/providers/docker/config.go +++ b/builtin/providers/docker/config.go @@ -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)) } diff --git a/builtin/providers/docker/provider.go b/builtin/providers/docker/provider.go index 6148653073..1da7ffbeab 100644 --- a/builtin/providers/docker/provider.go +++ b/builtin/providers/docker/provider.go @@ -18,25 +18,22 @@ func Provider() terraform.ResourceProvider { }, "ca_material": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - DefaultFunc: schema.EnvDefaultFunc("DOCKER_CA_MATERIAL", ""), - ConflictsWith: []string{"cert_path"}, - Description: "PEM-encoded content of Docker host CA certificate", + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("DOCKER_CA_MATERIAL", ""), + 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", + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("DOCKER_CERT_MATERIAL", ""), + 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", + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("DOCKER_KEY_MATERIAL", ""), + Description: "PEM-encoded content of Docker client private key", }, "cert_path": &schema.Schema{