From 66adad4fcc4cfda73b51a41444a22be02413ffc7 Mon Sep 17 00:00:00 2001 From: Pascal Hofmann <mail+github@pascalhofmann.de> Date: Tue, 26 Nov 2019 10:28:55 +0100 Subject: [PATCH] Don't configure proxy from env twice The proxy env vars are already taken into consideration here https://github.com/terraform-providers/terraform-provider-mysql/blob/master/mysql/provider.go#L152 Setting them as default for `proxy` leads to the proxy being set as proxy itself and as forwarder (see https://github.com/terraform-providers/terraform-provider-mysql/blob/master/mysql/provider.go#L160). This leads to the following error (with `all_proxy=socks5://127.0.0.1:1080`) Could not connect to server: socks connect tcp localhost:1080->target_host:target_port: socks connect tcp localhost: 1080->localhost: 1080 --- mysql/provider.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mysql/provider.go b/mysql/provider.go index 256b6e617..7d803e99f 100644 --- a/mysql/provider.go +++ b/mysql/provider.go @@ -61,12 +61,9 @@ func Provider() terraform.ResourceProvider { }, "proxy": { - Type: schema.TypeString, - Optional: true, - DefaultFunc: schema.MultiEnvDefaultFunc([]string{ - "ALL_PROXY", - "all_proxy", - }, nil), + Type: schema.TypeString, + Optional: true, + Default: nil, ValidateFunc: validation.StringMatch(regexp.MustCompile("^socks5h?://.*:\\d+$"), "The proxy URL is not a valid socks url."), },