allow disabling AutoMTLS with env var

This commit is contained in:
Katy Moe 2019-12-04 19:59:51 +00:00
parent 4e5a18c621
commit dae1efe62a
No known key found for this signature in database
GPG Key ID: 8C3780F6DCDDA885
1 changed files with 6 additions and 1 deletions

View File

@ -9,6 +9,11 @@ import (
"github.com/hashicorp/terraform/plugin/discovery"
)
// The TF_DISABLE_PLUGIN_TLS environment variable is intended only for use by
// the plugin SDK test framework. We do not recommend Terraform CLI end-users
// set this variable.
var enableAutoMTLS = os.Getenv("TF_DISABLE_PLUGIN_TLS") == ""
// ClientConfig returns a configuration object that can be used to instantiate
// a client for the plugin described by the given metadata.
func ClientConfig(m discovery.PluginMeta) *plugin.ClientConfig {
@ -25,7 +30,7 @@ func ClientConfig(m discovery.PluginMeta) *plugin.ClientConfig {
Managed: true,
Logger: logger,
AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC},
AutoMTLS: true,
AutoMTLS: enableAutoMTLS,
}
}