Skip to content

Commit

Permalink
Merge pull request #4024 from rjeczalik/nil-deref-fix
Browse files Browse the repository at this point in the history
provider/aws: fix for aws/aws-sdk-go#452
  • Loading branch information
jen20 committed Nov 24, 2015
2 parents 0e8ef19 + 9e66e18 commit 288e568
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion builtin/providers/aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (

"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
)

// Provider returns a terraform.ResourceProvider.
Expand Down Expand Up @@ -42,7 +44,7 @@ func Provider() terraform.ResourceProvider {
conn, err := net.DialTimeout("tcp", "169.254.169.254:80", 100*time.Millisecond)
if err == nil {
conn.Close()
providers = append(providers, &ec2rolecreds.EC2RoleProvider{})
providers = append(providers, &ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(session.New())})
}

credVal, credErr = credentials.NewChainCredentials(providers).Get()
Expand Down
3 changes: 2 additions & 1 deletion state/remote/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/hashicorp/go-cleanhttp"
Expand Down Expand Up @@ -64,7 +65,7 @@ func s3Factory(conf map[string]string) (Client, error) {
}},
&credentials.EnvProvider{},
&credentials.SharedCredentialsProvider{Filename: "", Profile: ""},
&ec2rolecreds.EC2RoleProvider{},
&ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(session.New())},
})

// Make sure we got some sort of working credentials.
Expand Down

0 comments on commit 288e568

Please sign in to comment.