Skip to content

Commit

Permalink
feat: add ssl_root_ca_file provider config option
Browse files Browse the repository at this point in the history
  • Loading branch information
angel-manuel authored and Ángel Manuel Martín committed Oct 10, 2023
1 parent ec5ae73 commit a9671f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions connect/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"gopkg.in/resty.v1"

kc "github.com/ricardo-ch/go-kafka-connect/v3/lib/connectors"
)
Expand All @@ -29,6 +30,11 @@ func Provider() *schema.Provider {
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("KAFKA_CONNECT_BASIC_AUTH_PASSWORD", ""),
},
"ssl_root_ca_file": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("KAFKA_CONNECT_SSL_ROOT_CA_FILE", ""),
},
"headers": {
Type: schema.TypeMap,
Elem: &schema.Schema{
Expand Down Expand Up @@ -58,6 +64,11 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}
c.SetBasicAuth(user, pass)
}

ssl_root_ca_file := d.Get("ssl_root_ca_file").(string)
if ssl_root_ca_file != "" {
resty.SetRootCertificate(ssl_root_ca_file)
}

headers := d.Get("headers").(map[string]interface{})
if headers != nil {
for k, v := range headers {
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
bou.ke/monkey v1.0.2 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1
github.com/ricardo-ch/go-kafka-connect/v3 v3.0.0-20220613085032-a69a6c33b847
gopkg.in/resty.v1 v1.11.0 // indirect
)

replace git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999

0 comments on commit a9671f5

Please sign in to comment.