Resolves grafana/grafana:#9309

This commit is contained in:
Ben Whaley 2017-12-07 03:41:45 +00:00
parent c80eadcdf4
commit fe88658bdd

View File

@ -12,6 +12,7 @@ import (
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/credentials/endpointcreds"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/aws/aws-sdk-go/service/sts"
@ -128,10 +129,10 @@ func remoteCredProvider(sess *session.Session) credentials.Provider {
func ecsCredProvider(sess *session.Session, uri string) credentials.Provider {
const host = `169.254.170.2`
c := ec2metadata.New(sess)
d := defaults.Get()
return endpointcreds.NewProviderClient(
c.Client.Config,
c.Client.Handlers,
*d.Config,
d.Handlers,
fmt.Sprintf("http://%s%s", host, uri),
func(p *endpointcreds.Provider) { p.ExpiryWindow = 5 * time.Minute })
}