diff --git a/ecs/run_config.go b/ecs/run_config.go index e36a338..ce4eda5 100644 --- a/ecs/run_config.go +++ b/ecs/run_config.go @@ -14,7 +14,7 @@ import ( type RunConfig struct { AssociatePublicIpAddress bool `mapstructure:"associate_public_ip_address"` ZoneId string `mapstructure:"zone_id"` - IOOptimized bool `mapstructure:"io_optimized"` + IOOptimized *bool `mapstructure:"io_optimized"` InstanceType string `mapstructure:"instance_type"` Description string `mapstructure:"description"` AlicloudSourceImage string `mapstructure:"source_image"` diff --git a/ecs/step_create_instance.go b/ecs/step_create_instance.go index 512ea5c..ad38547 100644 --- a/ecs/step_create_instance.go +++ b/ecs/step_create_instance.go @@ -17,7 +17,7 @@ import ( ) type stepCreateAlicloudInstance struct { - IOOptimized bool + IOOptimized *bool InstanceType string UserData string UserDataFile string @@ -142,11 +142,13 @@ func (s *stepCreateAlicloudInstance) buildCreateInstanceRequest(state multistep. request.InternetChargeType = s.InternetChargeType request.InternetMaxBandwidthOut = requests.Integer(convertNumber(s.InternetMaxBandwidthOut)) - ioOptimized := IOOptimizedNone - if s.IOOptimized { - ioOptimized = IOOptimizedOptimized + if s.IOOptimized != nil { + if *s.IOOptimized { + request.IoOptimized = IOOptimizedOptimized + } else { + request.IoOptimized = IOOptimizedNone + } } - request.IoOptimized = ioOptimized config := state.Get("config").(*Config) password := config.Comm.SSHPassword