Merge pull request #23563 from hashicorp/kmoe/automtls

Allow disabling plugin AutoMTLS with TF_DISABLE_AUTOMTLS env var
This commit is contained in:
kmoe 2020-01-08 15:03:11 +00:00 committed by GitHub
commit 58ef73814e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,
}
}