@@ -186,6 +186,33 @@ func resourceAlicloudEssScalingGroup() *schema.Resource {
186
186
Optional : true ,
187
187
Computed : true ,
188
188
},
189
+ "compensate_with_on_demand" : {
190
+ Type : schema .TypeBool ,
191
+ Optional : true ,
192
+ Computed : true ,
193
+ },
194
+ "capacity_options_on_demand_base_capacity" : {
195
+ Type : schema .TypeInt ,
196
+ Optional : true ,
197
+ Computed : true ,
198
+ ValidateFunc : IntBetween (0 , 1000 ),
199
+ },
200
+ "capacity_options_on_demand_percentage_above_base_capacity" : {
201
+ Type : schema .TypeInt ,
202
+ Optional : true ,
203
+ Computed : true ,
204
+ ValidateFunc : IntBetween (0 , 100 ),
205
+ },
206
+ "capacity_options_compensate_with_on_demand" : {
207
+ Type : schema .TypeBool ,
208
+ Optional : true ,
209
+ Computed : true ,
210
+ },
211
+ "capacity_options_spot_auto_replace_on_demand" : {
212
+ Type : schema .TypeBool ,
213
+ Optional : true ,
214
+ Computed : true ,
215
+ },
189
216
"resource_group_id" : {
190
217
Type : schema .TypeString ,
191
218
Optional : true ,
@@ -331,7 +358,9 @@ func resourceAliyunEssScalingGroupRead(d *schema.ResourceData, meta interface{})
331
358
if object ["SpotInstancePools" ] != nil {
332
359
d .Set ("spot_instance_pools" , object ["SpotInstancePools" ])
333
360
}
361
+
334
362
d .Set ("spot_instance_remedy" , object ["SpotInstanceRemedy" ])
363
+ d .Set ("compensate_with_on_demand" , object ["CompensateWithOnDemand" ])
335
364
d .Set ("group_deletion_protection" , object ["GroupDeletionProtection" ])
336
365
var polices []string
337
366
if len (object ["RemovalPolicies" ].(map [string ]interface {})["RemovalPolicy" ].([]interface {})) > 0 {
@@ -393,6 +422,22 @@ func resourceAliyunEssScalingGroupRead(d *schema.ResourceData, meta interface{})
393
422
}
394
423
}
395
424
425
+ if v := object ["CapacityOptions" ]; v != nil {
426
+ m := v .(map [string ]interface {})
427
+ if m ["OnDemandBaseCapacity" ] != nil {
428
+ d .Set ("capacity_options_on_demand_base_capacity" , m ["OnDemandBaseCapacity" ])
429
+ }
430
+ if m ["OnDemandPercentageAboveBaseCapacity" ] != nil {
431
+ d .Set ("capacity_options_on_demand_percentage_above_base_capacity" , m ["OnDemandPercentageAboveBaseCapacity" ])
432
+ }
433
+ if m ["CompensateWithOnDemand" ] != nil {
434
+ d .Set ("capacity_options_compensate_with_on_demand" , m ["CompensateWithOnDemand" ])
435
+ }
436
+ if m ["SpotAutoReplaceOnDemand" ] != nil {
437
+ d .Set ("capacity_options_spot_auto_replace_on_demand" , m ["SpotAutoReplaceOnDemand" ])
438
+ }
439
+ }
440
+
396
441
if v := object ["AlbServerGroups" ]; v != nil {
397
442
result := make ([]map [string ]interface {}, 0 )
398
443
if w , ok := d .GetOk ("alb_server_group" ); ok {
@@ -540,10 +585,30 @@ func resourceAliyunEssScalingGroupUpdate(d *schema.ResourceData, meta interface{
540
585
request ["SpotInstancePools" ] = requests .NewInteger (d .Get ("spot_instance_pools" ).(int ))
541
586
}
542
587
588
+ if d .HasChange ("capacity_options_on_demand_base_capacity" ) {
589
+ request ["CapacityOptions.OnDemandBaseCapacity" ] = requests .NewInteger (d .Get ("capacity_options_on_demand_base_capacity" ).(int ))
590
+ }
591
+
592
+ if d .HasChange ("capacity_options_on_demand_base_capacity" ) {
593
+ request ["CapacityOptions.OnDemandBaseCapacity" ] = requests .NewInteger (d .Get ("capacity_options_on_demand_base_capacity" ).(int ))
594
+ }
595
+
596
+ if d .HasChange ("capacity_options_compensate_with_on_demand" ) {
597
+ request ["CapacityOptions.CompensateWithOnDemand" ] = requests .NewBoolean (d .Get ("capacity_options_compensate_with_on_demand" ).(bool ))
598
+ }
599
+
600
+ if d .HasChange ("capacity_options_spot_auto_replace_on_demand" ) {
601
+ request ["CapacityOptions.SpotAutoReplaceOnDemand" ] = requests .NewBoolean (d .Get ("capacity_options_spot_auto_replace_on_demand" ).(bool ))
602
+ }
603
+
543
604
if d .HasChange ("spot_instance_remedy" ) {
544
605
request ["SpotInstanceRemedy" ] = requests .NewBoolean (d .Get ("spot_instance_remedy" ).(bool ))
545
606
}
546
607
608
+ if d .HasChange ("compensate_with_on_demand" ) {
609
+ request ["CompensateWithOnDemand" ] = requests .NewBoolean (d .Get ("compensate_with_on_demand" ).(bool ))
610
+ }
611
+
547
612
if d .HasChange ("az_balance" ) {
548
613
request ["AzBalance" ] = requests .NewBoolean (d .Get ("az_balance" ).(bool ))
549
614
}
@@ -765,10 +830,30 @@ func buildAlicloudEssScalingGroupArgs(d *schema.ResourceData, meta interface{})
765
830
request ["SpotInstancePools" ] = v
766
831
}
767
832
833
+ if v , ok := d .GetOk ("capacity_options_on_demand_base_capacity" ); ok {
834
+ request ["CapacityOptions.OnDemandBaseCapacity" ] = v
835
+ }
836
+
837
+ if v , ok := d .GetOk ("capacity_options_on_demand_base_capacity" ); ok {
838
+ request ["CapacityOptions.OnDemandBaseCapacity" ] = v
839
+ }
840
+
841
+ if v , ok := d .GetOk ("capacity_options_compensate_with_on_demand" ); ok {
842
+ request ["CapacityOptions.CompensateWithOnDemand" ] = v
843
+ }
844
+
845
+ if v , ok := d .GetOk ("capacity_options_spot_auto_replace_on_demand" ); ok {
846
+ request ["CapacityOptions.SpotAutoReplaceOnDemand" ] = v
847
+ }
848
+
768
849
if v , ok := d .GetOk ("spot_instance_remedy" ); ok {
769
850
request ["SpotInstanceRemedy" ] = v
770
851
}
771
852
853
+ if v , ok := d .GetOk ("compensate_with_on_demand" ); ok {
854
+ request ["CompensateWithOnDemand" ] = v
855
+ }
856
+
772
857
if v , ok := d .GetOk ("health_check_type" ); ok {
773
858
request ["HealthCheckType" ] = v
774
859
}
0 commit comments