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:
commit
61509fd96a
|
@ -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,
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue