Small fix needed to be inline with the updated AWS SDK again...

Executed a couple of AWS ACC test as well to make sure everything works
properly again after this fix…
This commit is contained in:
Sander van Harmelen 2015-05-05 12:26:26 +02:00
parent 98d34a3266
commit 7274de3c1d
3 changed files with 7 additions and 5 deletions

View File

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

View File

@ -7,6 +7,7 @@ import (
"os" "os"
"github.com/awslabs/aws-sdk-go/aws" "github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/aws/credentials"
"github.com/awslabs/aws-sdk-go/service/s3" "github.com/awslabs/aws-sdk-go/service/s3"
) )
@ -32,10 +33,10 @@ func s3Factory(conf map[string]string) (Client, error) {
accessKeyId := conf["access_key"] accessKeyId := conf["access_key"]
secretAccessKey := conf["secret_key"] secretAccessKey := conf["secret_key"]
credentialsProvider := aws.DetectCreds(accessKeyId, secretAccessKey, "") credentialsProvider := credentials.NewStaticCredentials(accessKeyId, secretAccessKey, "")
// Make sure we got some sort of working credentials. // Make sure we got some sort of working credentials.
_, err := credentialsProvider.Credentials() _, err := credentialsProvider.Get()
if err != nil { 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) 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") t.Fatalf("Incorrect keyName was populated")
} }
credentials, err := s3Client.nativeClient.Config.Credentials.Credentials() credentials, err := s3Client.nativeClient.Config.Credentials.Get()
if err != nil { if err != nil {
t.Fatalf("Error when requesting credentials") t.Fatalf("Error when requesting credentials")
} }
@ -105,7 +105,7 @@ func TestS3Client(t *testing.T) {
if err != nil { if err != nil {
t.Skipf("Failed to create test S3 bucket, so skipping") t.Skipf("Failed to create test S3 bucket, so skipping")
} }
defer func () { defer func() {
deleteBucketReq := &s3.DeleteBucketInput{ deleteBucketReq := &s3.DeleteBucketInput{
Bucket: &bucketName, Bucket: &bucketName,
} }