From 7c593ff14192678da9d33d1ed508b32b18983f86 Mon Sep 17 00:00:00 2001 From: Camal Cakar Date: Thu, 29 Apr 2021 10:14:37 +0200 Subject: [PATCH 1/3] feat: add AWS SSO support To support AWS SSO we need to Bump the AWS SDK which is providing support recently. Also we need to adjust our creation of sessins to include the `SharedConfigState` field. See https://aws.amazon.com/blogs/developer/aws-sso-support-in-the-aws-sdk-for-go/ for more information. --- go.mod | 4 ++-- go.sum | 7 +++++++ modules/aws/auth.go | 9 ++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6bbdd82fd..eb5c30b11 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/Azure/go-autorest/autorest/azure/auth v0.5.1 github.com/Azure/go-autorest/autorest/validation v0.3.0 // indirect github.com/aws/aws-lambda-go v1.13.3 - github.com/aws/aws-sdk-go v1.27.1 + github.com/aws/aws-sdk-go v1.38.28 github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect github.com/docker/cli v0.0.0-20200109221225-a4f60165b7a3 // indirect github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect @@ -38,7 +38,7 @@ require ( github.com/urfave/cli v1.22.2 github.com/zclconf/go-cty v1.2.1 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 - golang.org/x/net v0.0.0-20201021035429-f5854403a974 + golang.org/x/net v0.0.0-20201110031124-69a78807bb2b golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d golang.org/x/tools v0.0.0-20201110201400-7099162a900a // indirect google.golang.org/api v0.15.0 diff --git a/go.sum b/go.sum index 06c34b174..c7288882a 100644 --- a/go.sum +++ b/go.sum @@ -87,6 +87,8 @@ github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQ github.com/aws/aws-sdk-go v1.16.26/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.27.1 h1:MXnqY6SlWySaZAqNnXThOvjRFdiiOuKtC6i7baFdNdU= github.com/aws/aws-sdk-go v1.27.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.38.28 h1:2ZzgEupSluR18ClxUnHwXKyuADheZpMblXRAsHqF0tI= +github.com/aws/aws-sdk-go v1.38.28/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= @@ -275,6 +277,9 @@ github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a h1:zPPuIq2jAWWPTrGt7 github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a/go.mod h1:yL958EeXv8Ylng6IfnvG4oflryUi3vgA3xPs9hmII1s= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -501,6 +506,8 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= diff --git a/modules/aws/auth.go b/modules/aws/auth.go index 2a0a0f6c9..510e8d5b6 100644 --- a/modules/aws/auth.go +++ b/modules/aws/auth.go @@ -30,7 +30,14 @@ func NewAuthenticatedSession(region string) (*session.Session, error) { // NewAuthenticatedSessionFromDefaultCredentials gets an AWS Session, checking that the user has credentials properly configured in their environment. func NewAuthenticatedSessionFromDefaultCredentials(region string) (*session.Session, error) { - sess, err := session.NewSession(aws.NewConfig().WithRegion(region)) + awsConfig := aws.NewConfig().WithRegion(region) + + sessionOptions := session.Options { + Config: *awsConfig, + SharedConfigState: session.SharedConfigEnable, + } + + sess, err := session.NewSessionWithOptions(sessionOptions) if err != nil { return nil, err } From 082d0bc25dcb1bf0ab46e2609b7e941a6e41731d Mon Sep 17 00:00:00 2001 From: Camal Cakar Date: Fri, 30 Apr 2021 09:37:23 +0200 Subject: [PATCH 2/3] fix: gofmt --- modules/aws/auth.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/aws/auth.go b/modules/aws/auth.go index 510e8d5b6..f2aa6f78c 100644 --- a/modules/aws/auth.go +++ b/modules/aws/auth.go @@ -32,8 +32,8 @@ func NewAuthenticatedSession(region string) (*session.Session, error) { func NewAuthenticatedSessionFromDefaultCredentials(region string) (*session.Session, error) { awsConfig := aws.NewConfig().WithRegion(region) - sessionOptions := session.Options { - Config: *awsConfig, + sessionOptions := session.Options{ + Config: *awsConfig, SharedConfigState: session.SharedConfigEnable, } From 52d6c1d891ee20555d38bded83b1a08ca08d3a66 Mon Sep 17 00:00:00 2001 From: Yoriyasu Yano <430092+yorinasub17@users.noreply.github.com> Date: Mon, 10 May 2021 13:21:20 -0500 Subject: [PATCH 3/3] Limit parallelism due to aws-sdk-go failing --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index d39f7b6a6..d6b54559f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -114,6 +114,7 @@ jobs: --ld-flags "-X main.VERSION=$CIRCLE_TAG -extldflags '-static'" GO_ENABLED=0 build-go-binaries \ + --parallel 3 \ --app-name pick-instance-type \ --src-path ./cmd/pick-instance-type \ --dest-path ./cmd/bin \