UPDATED to use NewSessionWithConfig instead of NewSession (#230)

NewSession is being deprecated, NewSessionWithConfig handles things
such as role arns. This fixes permissions issues for users using
role arns for service accounts.

Signed-off-by: Ewan Valentine <ewan.valentine89@gmail.com>
This commit is contained in:
Ewan Valentine
2020-11-21 18:49:49 +00:00
committed by GitHub
parent b5fbb1beae
commit 7f84bc75f4

View File

@@ -229,7 +229,11 @@ func (o AdapterServerOptions) RunCustomMetricsAdapterServer(stopCh <-chan struct
awsSessions := make(map[string]*session.Session, len(o.AWSRegions))
for _, region := range o.AWSRegions {
awsSessions[region], err = session.NewSession(&aws.Config{Region: aws.String(region)})
awsSessions[region], err = session.NewSessionWithOptions(session.Options{
Config: aws.Config{
Region: aws.String(region),
},
})
if err != nil {
return fmt.Errorf("unabled to create aws session for region: %s", region)
}