Merge pull request #1601 from bitglue/sts_token

provider/aws: support session token in AWS credentials
This commit is contained in:
Mitchell Hashimoto 2015-04-20 15:01:29 -07:00
commit c8a8f05935
1 changed files with 13 additions and 0 deletions

View File

@ -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,
@ -87,6 +96,9 @@ 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.",
}
}
@ -94,6 +106,7 @@ 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),
}