Revert "Feature: Allow getting credentials via EC2 role (#3343)" (#3985)

This reverts commit 808f79f00a.
pull/3967/merge
Jeeyoung Kim 7 years ago committed by Brian Brazil
parent 58e2a31db8
commit 5b962c5748

@ -22,7 +22,6 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
@ -186,16 +185,6 @@ func (d *Discovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
}
}
func (d *Discovery) ec2MetadataAvailable(sess *session.Session) (isAvailable bool) {
svc := ec2metadata.New(sess, &aws.Config{
MaxRetries: aws.Int(0),
})
isAvailable = svc.Available()
return isAvailable
}
func (d *Discovery) refresh() (tg *targetgroup.Group, err error) {
t0 := time.Now()
defer func() {
@ -218,12 +207,7 @@ func (d *Discovery) refresh() (tg *targetgroup.Group, err error) {
creds := stscreds.NewCredentials(sess, d.roleARN)
ec2s = ec2.New(sess, &aws.Config{Credentials: creds})
} else {
if d.aws.Credentials == nil && d.ec2MetadataAvailable(sess) {
creds := ec2rolecreds.NewCredentials(sess)
ec2s = ec2.New(sess, &aws.Config{Credentials: creds})
} else {
ec2s = ec2.New(sess)
}
ec2s = ec2.New(sess)
}
tg = &targetgroup.Group{
Source: *d.aws.Region,

Loading…
Cancel
Save