From ca9a5daf29e66d873b9653e2b3c6186db031e4d6 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Fri, 1 Mar 2019 14:28:16 -0800 Subject: [PATCH] fix proxy and tls --- builder/amazon/common/access_config.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/builder/amazon/common/access_config.go b/builder/amazon/common/access_config.go index ed6910b34..adf0e053e 100644 --- a/builder/amazon/common/access_config.go +++ b/builder/amazon/common/access_config.go @@ -14,7 +14,6 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ec2/ec2iface" cleanhttp "github.com/hashicorp/go-cleanhttp" - commonhelper "github.com/hashicorp/packer/helper/common" "github.com/hashicorp/packer/template/interpolate" vaultapi "github.com/hashicorp/vault/api" ) @@ -72,13 +71,14 @@ func (c *AccessConfig) Session() (*session.Session, error) { config = config.WithEndpoint(c.CustomEndpointEc2) } + config = config.WithHTTPClient(cleanhttp.DefaultClient()) + transport := config.HTTPClient.Transport.(*http.Transport) if c.InsecureSkipTLSVerify { - config := config.WithHTTPClient(cleanhttp.DefaultClient()) - transport := config.HTTPClient.Transport.(*http.Transport) transport.TLSClientConfig = &tls.Config{ InsecureSkipVerify: true, } } + transport.Proxy = http.ProxyFromEnvironment opts := session.Options{ SharedConfigState: session.SharedConfigEnable, @@ -210,9 +210,7 @@ func (c *AccessConfig) NewEC2Connection() (ec2iface.EC2API, error) { return nil, err } - ec2conn := ec2.New(sess, &aws.Config{ - HTTPClient: commonhelper.HttpClientWithEnvironmentProxy(), - }) + ec2conn := ec2.New(sess) return ec2conn, nil }