From 7274de3c1db064f28473b142bedf4804e2d1be08 Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Tue, 5 May 2015 12:26:26 +0200 Subject: [PATCH] Small fix needed to be inline with the updated AWS SDK again... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Executed a couple of AWS ACC test as well to make sure everything works properly again after this fix… --- builtin/providers/aws/config.go | 3 ++- state/remote/s3.go | 5 +++-- state/remote/s3_test.go | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/builtin/providers/aws/config.go b/builtin/providers/aws/config.go index 355e60e77..328a355ff 100644 --- a/builtin/providers/aws/config.go +++ b/builtin/providers/aws/config.go @@ -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, diff --git a/state/remote/s3.go b/state/remote/s3.go index cd72a941a..efe131be1 100644 --- a/state/remote/s3.go +++ b/state/remote/s3.go @@ -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) } diff --git a/state/remote/s3_test.go b/state/remote/s3_test.go index 35d06ec4f..ca7ec4879 100644 --- a/state/remote/s3_test.go +++ b/state/remote/s3_test.go @@ -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") } @@ -105,7 +105,7 @@ func TestS3Client(t *testing.T) { if err != nil { t.Skipf("Failed to create test S3 bucket, so skipping") } - defer func () { + defer func() { deleteBucketReq := &s3.DeleteBucketInput{ Bucket: &bucketName, }