Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/alicloud_ess_scaling_group: add attributes of compensate_with_on_demand, capacity_options_on_demand_base_capacity, capacity_options_on_demand_percentage_above_base_capacity, capacity_options_compensate_with_on_demand and capacity_options_spot_auto_replace_on_demand. #8320

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fuliu-zln
Copy link
Contributor

resource/alicloud_ess_scaling_group: add attributes of compensate_with_on_demand, capacity_options_on_demand_base_capacity, capacity_options_on_demand_percentage_above_base_capacity, capacity_options_compensate_with_on_demand and capacity_options_spot_auto_replace_on_demand.

@@ -140,6 +140,11 @@ The following arguments are supported:
* `spot_allocation_strategy` - (Optional, Available since v1.225.1) The allocation policy of preemptible instances. You can use this parameter to individually specify the allocation policy for preemptible instances. This parameter takes effect only if you set MultiAZPolicy to COMPOSABLE.
* `allocation_strategy` - (Optional, Available since v1.225.1) The allocation policy of instances. Auto Scaling selects instance types based on the allocation policy to create instances. The policy can be applied to pay-as-you-go instances and preemptible instances. This parameter takes effect only if you set MultiAZPolicy to COMPOSABLE.
* `on_demand_base_capacity` - (Optional, Available since v1.54.0) The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as your group scales.
* `compensate_with_on_demand` - (Optional, Available since v1.243.0) Specifies whether to automatically create pay-as-you-go instances to meet the requirement on the number of ECS instances when the expected capacity of preemptible instances cannot be provided due to reasons such as cost-related issues and insufficient resources. This parameter is supported only if you set MultiAZPolicy to COST_OPTIMIZED. Valid values: true, false.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.244.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -186,6 +186,33 @@ func resourceAlicloudEssScalingGroup() *schema.Resource {
Optional: true,
Computed: true,
},
"compensate_with_on_demand": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compensate_with_on_demand,capacity_options_compensate_with_on_demand,capacity_options_spot_auto_replace_on_demand这三个bool类型的字段默认值都是true吗?capacity_options_on_demand_base_capacity和capacity_options_on_demand_percentage_above_base_capacity的默认值是非0的吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ompensate_with_on_demand,capacity_options_compensate_with_on_demand,capacity_options_spot_auto_replace_on_demand这三个bool类型的字段默认值都是true吗? 不是 某些情况用户没有设置,对应的属性,在后端服务是不会被设置上值的

capacity_options_on_demand_base_capacity和capacity_options_on_demand_percentage_above_base_capacity的默认值是非0的吗?
不是,不同情况,默认值不同

@@ -540,10 +585,30 @@ func resourceAliyunEssScalingGroupUpdate(d *schema.ResourceData, meta interface{
request["SpotInstancePools"] = requests.NewInteger(d.Get("spot_instance_pools").(int))
}

if d.HasChange("capacity_options_on_demand_base_capacity") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前说过很多次,针对bool和int类型的字段,不要用d.Get直接获取,要用d.GetOkExists判断获取,改!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -765,10 +830,30 @@ func buildAlicloudEssScalingGroupArgs(d *schema.ResourceData, meta interface{})
request["SpotInstancePools"] = v
}

if v, ok := d.GetOk("capacity_options_on_demand_base_capacity"); ok {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -984,6 +992,227 @@ func TestAccAliCloudEssScalingGroup_costoptimized(t *testing.T) {

}

func TestAccAliCloudEssScalingGroup_costoptimized_capacityOptions(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compensate_with_on_demand缺少第0步,也就是只有创建操作设置的单测。capacity_options_compensate_with_on_demand,capacity_options_spot_auto_replace_on_demand,capacity_options_on_demand_base_capacity和capacity_options_on_demand_percentage_above_base_capacity缺少第0步不设置,只在更新操作设置的单测

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -140,6 +140,11 @@ The following arguments are supported:
* `spot_allocation_strategy` - (Optional, Available since v1.225.1) The allocation policy of preemptible instances. You can use this parameter to individually specify the allocation policy for preemptible instances. This parameter takes effect only if you set MultiAZPolicy to COMPOSABLE.
* `allocation_strategy` - (Optional, Available since v1.225.1) The allocation policy of instances. Auto Scaling selects instance types based on the allocation policy to create instances. The policy can be applied to pay-as-you-go instances and preemptible instances. This parameter takes effect only if you set MultiAZPolicy to COMPOSABLE.
* `on_demand_base_capacity` - (Optional, Available since v1.54.0) The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as your group scales.
* `compensate_with_on_demand` - (Optional, Available since v1.244.0) Specifies whether to automatically create pay-as-you-go instances to meet the requirement on the number of ECS instances when the expected capacity of preemptible instances cannot be provided due to reasons such as cost-related issues and insufficient resources. This parameter is supported only if you set MultiAZPolicy to COST_OPTIMIZED. Valid values: true, false.
Copy link
Collaborator

@MrWolong MrWolong Feb 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个资源里面有字段名字是MultiAZPolicy的吗?改成tf中的字段名,用单引号着重显示。下面几个字段都一样,改

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

…h_on_demand, capacity_options_on_demand_base_capacity, capacity_options_on_demand_percentage_above_base_capacity, capacity_options_compensate_with_on_demand and capacity_options_spot_auto_replace_on_demand.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants