File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 1
1
package provider
2
2
3
3
import (
4
+ "crypto/tls"
4
5
"fmt"
5
6
"net/http"
6
7
@@ -24,6 +25,12 @@ func Provider() *schema.Provider {
24
25
DefaultFunc : schema .EnvDefaultFunc ("ELASTICSEARCH_API_KEY" , nil ),
25
26
Description : "The token for API authentication." ,
26
27
},
28
+ "insecure" : {
29
+ Type : schema .TypeBool ,
30
+ Optional : true ,
31
+ Default : false ,
32
+ Description : "Skip server certificate verification" ,
33
+ },
27
34
},
28
35
ResourcesMap : map [string ]* schema.Resource {
29
36
"elkaliases_index" : resourceelkAliasesIndex (),
@@ -35,11 +42,15 @@ func Provider() *schema.Provider {
35
42
func providerConfigure (d * schema.ResourceData ) (interface {}, error ) {
36
43
url := d .Get ("url" ).(string )
37
44
token := d .Get ("token" ).(string )
45
+ insecure := d .Get ("insecure" ).(bool )
38
46
39
47
cfg := elasticsearch.Config {
40
48
Addresses : []string {url },
41
49
Transport : & http.Transport {
42
50
Proxy : http .ProxyFromEnvironment ,
51
+ TLSClientConfig : & tls.Config {
52
+ InsecureSkipVerify : insecure ,
53
+ },
43
54
},
44
55
Header : http.Header {
45
56
"Authorization" : []string {fmt .Sprintf ("ApiKey %s" , token )},
Original file line number Diff line number Diff line change @@ -35,3 +35,4 @@ The following arguments are supported:
35
35
36
36
* ` url ` - (Required) Url to the ElasticSsearch API
37
37
* ` token ` - (Required) Authentication token to the ElasticSearch API
38
+ * ` insecure ` - (Optional) Skip server certification verification
You can’t perform that action at this time.
0 commit comments