Skip to content

Commit

Permalink
Merge pull request #1601 from bitglue/sts_token
Browse files Browse the repository at this point in the history
provider/aws: support session token in AWS credentials
  • Loading branch information
mitchellh committed Apr 20, 2015
2 parents 70a026d + d4c8c52 commit c8a8f05
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions builtin/providers/aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ func Provider() terraform.ResourceProvider {
Description: descriptions["secret_key"],
},

"token": &schema.Schema{
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"AWS_SESSION_TOKEN",
}, ""),
Description: descriptions["token"],
},

"region": &schema.Schema{
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -87,13 +96,17 @@ func init() {

"secret_key": "The secret key for API operations. You can retrieve this\n" +
"from the 'Security & Credentials' section of the AWS console.",

"token": "session token. A session token is only required if you are\n" +
"using temporary security credentials.",
}
}

func providerConfigure(d *schema.ResourceData) (interface{}, error) {
config := Config{
AccessKey: d.Get("access_key").(string),
SecretKey: d.Get("secret_key").(string),
Token: d.Get("token").(string),
Region: d.Get("region").(string),
}

Expand Down

0 comments on commit c8a8f05

Please sign in to comment.