Merge pull request #1804 from svanharmelen/b-fix-after-aws-sdk-changes

Small fix needed to be inline with the updated AWS SDK again...
This commit is contained in:
Sander van Harmelen 2015-05-05 12:29:52 +02:00
commit 61509fd96a
3 changed files with 7 additions and 5 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/hashicorp/terraform/helper/multierror"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/aws/credentials"
"github.com/awslabs/aws-sdk-go/service/autoscaling"
"github.com/awslabs/aws-sdk-go/service/ec2"
"github.com/awslabs/aws-sdk-go/service/elasticache"
@ -61,7 +62,7 @@ func (c *Config) Client() (interface{}, error) {
client.region = c.Region
log.Println("[INFO] Building AWS auth structure")
creds := aws.DetectCreds(c.AccessKey, c.SecretKey, c.Token)
creds := credentials.NewStaticCredentials(c.AccessKey, c.SecretKey, c.Token)
awsConfig := &aws.Config{
Credentials: creds,
Region: c.Region,

View File

@ -7,6 +7,7 @@ import (
"os"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/aws/credentials"
"github.com/awslabs/aws-sdk-go/service/s3"
)
@ -32,10 +33,10 @@ func s3Factory(conf map[string]string) (Client, error) {
accessKeyId := conf["access_key"]
secretAccessKey := conf["secret_key"]
credentialsProvider := aws.DetectCreds(accessKeyId, secretAccessKey, "")
credentialsProvider := credentials.NewStaticCredentials(accessKeyId, secretAccessKey, "")
// Make sure we got some sort of working credentials.
_, err := credentialsProvider.Credentials()
_, err := credentialsProvider.Get()
if err != nil {
return nil, fmt.Errorf("Unable to determine AWS credentials. Set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.\n(error was: %s)", err)
}

View File

@ -51,7 +51,7 @@ func TestS3Factory(t *testing.T) {
t.Fatalf("Incorrect keyName was populated")
}
credentials, err := s3Client.nativeClient.Config.Credentials.Credentials()
credentials, err := s3Client.nativeClient.Config.Credentials.Get()
if err != nil {
t.Fatalf("Error when requesting credentials")
}