@@ -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,40 @@ 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
+ if v , ok := d .GetOkExists ("capacity_options_on_demand_base_capacity" ); ok {
590
+ request ["CapacityOptions.OnDemandBaseCapacity" ] = requests .NewInteger (v .(int ))
591
+ }
592
+ }
593
+
594
+ if d .HasChange ("capacity_options_on_demand_base_capacity" ) {
595
+ if v , ok := d .GetOkExists ("capacity_options_on_demand_base_capacity" ); ok {
596
+ request ["CapacityOptions.OnDemandBaseCapacity" ] = requests .NewInteger (v .(int ))
597
+ }
598
+ }
599
+
600
+ if d .HasChange ("capacity_options_compensate_with_on_demand" ) {
601
+ if v , ok := d .GetOkExists ("capacity_options_compensate_with_on_demand" ); ok {
602
+ request ["CapacityOptions.CompensateWithOnDemand" ] = requests .NewBoolean (v .(bool ))
603
+ }
604
+ }
605
+
606
+ if d .HasChange ("capacity_options_spot_auto_replace_on_demand" ) {
607
+ if v , ok := d .GetOkExists ("capacity_options_spot_auto_replace_on_demand" ); ok {
608
+ request ["CapacityOptions.SpotAutoReplaceOnDemand" ] = requests .NewBoolean (v .(bool ))
609
+ }
610
+ }
611
+
543
612
if d .HasChange ("spot_instance_remedy" ) {
544
613
request ["SpotInstanceRemedy" ] = requests .NewBoolean (d .Get ("spot_instance_remedy" ).(bool ))
545
614
}
546
615
616
+ if d .HasChange ("compensate_with_on_demand" ) {
617
+ if v , ok := d .GetOkExists ("compensate_with_on_demand" ); ok {
618
+ request ["CompensateWithOnDemand" ] = requests .NewBoolean (v .(bool ))
619
+ }
620
+ }
621
+
547
622
if d .HasChange ("az_balance" ) {
548
623
request ["AzBalance" ] = requests .NewBoolean (d .Get ("az_balance" ).(bool ))
549
624
}
@@ -765,10 +840,30 @@ func buildAlicloudEssScalingGroupArgs(d *schema.ResourceData, meta interface{})
765
840
request ["SpotInstancePools" ] = v
766
841
}
767
842
843
+ if v , ok := d .GetOkExists ("capacity_options_on_demand_base_capacity" ); ok {
844
+ request ["CapacityOptions.OnDemandBaseCapacity" ] = v
845
+ }
846
+
847
+ if v , ok := d .GetOkExists ("capacity_options_on_demand_base_capacity" ); ok {
848
+ request ["CapacityOptions.OnDemandBaseCapacity" ] = v
849
+ }
850
+
851
+ if v , ok := d .GetOkExists ("capacity_options_compensate_with_on_demand" ); ok {
852
+ request ["CapacityOptions.CompensateWithOnDemand" ] = v
853
+ }
854
+
855
+ if v , ok := d .GetOkExists ("capacity_options_spot_auto_replace_on_demand" ); ok {
856
+ request ["CapacityOptions.SpotAutoReplaceOnDemand" ] = v
857
+ }
858
+
768
859
if v , ok := d .GetOk ("spot_instance_remedy" ); ok {
769
860
request ["SpotInstanceRemedy" ] = v
770
861
}
771
862
863
+ if v , ok := d .GetOkExists ("compensate_with_on_demand" ); ok {
864
+ request ["CompensateWithOnDemand" ] = v
865
+ }
866
+
772
867
if v , ok := d .GetOk ("health_check_type" ); ok {
773
868
request ["HealthCheckType" ] = v
774
869
}
0 commit comments