Skip to content

Commit

Permalink
Merge pull request #71 from xiaozhu36/token
Browse files Browse the repository at this point in the history
modify security_token to Optional
  • Loading branch information
zhuzhih2017 authored Jan 5, 2018
2 parents 0e5a67e + cc50bb4 commit 594c966
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## 1.6.0 (Unreleased)

## 1.5.1 (January 5, 2018)

BUG FIXES:
* modify security_token to Optional ([#69](https://github.com/alibaba/terraform-provider/pull/69))

## 1.5.0 (January 4, 2018)

IMPROVEMENTS:
Expand Down
13 changes: 8 additions & 5 deletions alicloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func Provider() terraform.ResourceProvider {
},
"security_token": &schema.Schema{
Type: schema.TypeString,
Required: true,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("ALICLOUD_SECURITY_TOKEN", os.Getenv("SECURITY_TOKEN")),
Description: descriptions["security_token"],
},
Expand Down Expand Up @@ -126,10 +126,13 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
}
}
config := Config{
AccessKey: d.Get("access_key").(string),
SecretKey: d.Get("secret_key").(string),
Region: common.Region(region.(string)),
SecurityToken: d.Get("security_token").(string),
AccessKey: d.Get("access_key").(string),
SecretKey: d.Get("secret_key").(string),
Region: common.Region(region.(string)),
}

if token, ok := d.GetOk("security_token"); ok && token.(string) != "" {
config.SecurityToken = token.(string)
}

client, err := config.Client()
Expand Down

0 comments on commit 594c966

Please sign in to comment.