provider/alicloud: Fix create PrePaid instance (#13661) (#13662)

Fixes: #13661
This commit is contained in:
Kent Wang 2017-04-17 06:26:06 +08:00 committed by Paul Stack
parent acb5684052
commit 4c25e1e269
1 changed files with 9 additions and 6 deletions

View File

@ -6,10 +6,11 @@ import (
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"strings"
"github.com/denverdino/aliyungo/common" "github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs" "github.com/denverdino/aliyungo/ecs"
"github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/schema"
"strings"
) )
func resourceAliyunInstance() *schema.Resource { func resourceAliyunInstance() *schema.Resource {
@ -226,6 +227,12 @@ func resourceAliyunRunInstance(d *schema.ResourceData, meta interface{}) error {
return err return err
} }
if args.IoOptimized == "optimized" {
args.IoOptimized = ecs.IoOptimized("true")
} else {
args.IoOptimized = ecs.IoOptimized("false")
}
runArgs, err := buildAliyunRunInstancesArgs(d, meta) runArgs, err := buildAliyunRunInstancesArgs(d, meta)
if err != nil { if err != nil {
return err return err
@ -578,11 +585,7 @@ func buildAliyunInstanceArgs(d *schema.ResourceData, meta interface{}) (*ecs.Cre
} }
if v := d.Get("io_optimized").(string); v != "" { if v := d.Get("io_optimized").(string); v != "" {
if v == "optimized" { args.IoOptimized = ecs.IoOptimized(v)
args.IoOptimized = ecs.IoOptimized("true")
} else {
args.IoOptimized = ecs.IoOptimized("false")
}
} }
vswitchValue := d.Get("subnet_id").(string) vswitchValue := d.Get("subnet_id").(string)