Support insecure TLS communication to API endpoint (#163)

This commit is contained in:
Olivier Boukili authored and GitHub committed 2021-12-17 20:24:09 -08:00
1 parent af98aaa9b2
commit cfe7d47286
2 files changed
+14 -1

No files matched your search

+2 -1
View File
@@ -35,4 +35,5 @@ provider "boundary" {
- **password_auth_method_login_name** (String) The auth method login name for password-style auth methods
- **password_auth_method_password** (String) The auth method password for password-style auth methods
- **recovery_kms_hcl** (String) Can be a heredoc string or a path on disk. If set, the string/file will be parsed as HCL and used with the recovery KMS mechanism. While this is set, it will override any other authentication information; the KMS mechanism will always be used. See Boundary's KMS docs for examples: https://boundaryproject.io/docs/configuration/kms
- **token** (String) The Boundary token to use, as a string or path on disk containing just the string. If set, the token read here will be used in place of authenticating with the auth method specified in "auth_method_id", although the recovery KMS mechanism will still override this. Can also be set with the BOUNDARY_TOKEN environment variable.
- **token** (String) The Boundary token to use, as a string or path on disk containing just the string. If set, the token read here will be used in place of authenticating with the auth method specified in "auth_method_id", although the recovery KMS mechanism will still override this. Can also be set with the BOUNDARY_TOKEN environment variable.
- **tls_insecure** (Boolean) When set to true, does not validate the Boundary API endpoint certificate. Can be set through `BOUNDARY_TLS_INSECURE` environment variable. Defaults to `false`.
+12
View File
@@ -52,6 +52,12 @@ func New() *schema.Provider {
Optional: true,
Description: "The auth method password for password-style auth methods",
},
"tls_insecure": {
Type: schema.TypeBool,
Optional: true,
Description: "When set to true, does not validate the Boundary API endpoint certificate",
DefaultFunc: schema.EnvDefaultFunc("BOUNDARY_TLS_INSECURE", false),
},
},
ResourcesMap: map[string]*schema.Resource{
"boundary_account": resourceAccount(),
@@ -169,6 +175,12 @@ func providerConfigure(p *schema.Provider) schema.ConfigureContextFunc {
return nil, diag.Errorf(`"no valid address could be determined from "addr" or "BOUNDARY_ADDR" env var`)
}
if tlsInsecure, ok := d.GetOk("tls_insecure"); ok {
if client.SetTLSConfig(&api.TLSConfig{Insecure: tlsInsecure.(bool)}) != nil {
return nil, diag.Errorf("could not set insecure tls")
}
}
client.SetLimiter(5, 5)
md := &metaData{