From acc5ef1168f94736a7379402454efb934d488c91 Mon Sep 17 00:00:00 2001 From: Mallear Date: Fri, 24 Nov 2023 11:46:52 +0100 Subject: [PATCH] fix: #38 setup ssm client with shared configuration enabled --- internal/forward.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/forward.go b/internal/forward.go index 196857a..462710a 100644 --- a/internal/forward.go +++ b/internal/forward.go @@ -21,8 +21,12 @@ func (e *App) executeForward() error { Target: aws.String(fmt.Sprintf("ecs:%s_%s_%s", e.cluster, taskID, *e.container.RuntimeId)), } - mySession := session.Must(session.NewSession()) - client := ssm.New(mySession, aws.NewConfig().WithRegion(e.region)) + mySession := session.Must(session.NewSessionWithOptions(session.Options{ + Config: aws.Config{Region: aws.String(region)}, + Profile: viper.GetString("profile"), + SharedConfigState: session.SharedConfigEnable, + })) + client := ssm.New(mySession) containerPort, err := getContainerPort(e.client, *e.task.TaskDefinitionArn, *e.container.Name) if err != nil { e.err <- err