Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add insecure option to test with self-signed TLS/SSL certificate #397

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion outscale/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Config struct {
Endpoints map[string]interface{}
X509cert string
X509key string
Insecure bool
}

// OutscaleClient client
Expand All @@ -28,7 +29,7 @@ type OutscaleClient struct {

// Client ...
func (c *Config) Client() (*OutscaleClient, error) {
tlsconfig := &tls.Config{InsecureSkipVerify: false}
tlsconfig := &tls.Config{InsecureSkipVerify: c.Insecure}
cert, err := tls.LoadX509KeyPair(c.X509cert, c.X509key)
if err == nil {
tlsconfig = &tls.Config{
Expand Down
7 changes: 7 additions & 0 deletions outscale/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ func Provider() terraform.ResourceProvider {
DefaultFunc: schema.EnvDefaultFunc("OUTSCALE_X509KEY", nil),
Description: "The path to your x509 key",
},
"insecure": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Description: "tls insecure connection",
},
},

ResourcesMap: map[string]*schema.Resource{
Expand Down Expand Up @@ -193,6 +199,7 @@ func providerConfigureClient(d *schema.ResourceData) (interface{}, error) {
Endpoints: make(map[string]interface{}),
X509cert: d.Get("x509_cert_path").(string),
X509key: d.Get("x509_key_path").(string),
Insecure: d.Get("insecure").(bool),
}

endpointsSet := d.Get("endpoints").(*schema.Set)
Expand Down
Loading