-
Notifications
You must be signed in to change notification settings - Fork 567
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
base: master
Are you sure you want to change the base?
Conversation
1f238b3
to
367a36e
Compare
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.244.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
367a36e
to
cadadd6
Compare
@@ -186,6 +186,33 @@ func resourceAlicloudEssScalingGroup() *schema.Resource { | |||
Optional: true, | |||
Computed: true, | |||
}, | |||
"compensate_with_on_demand": { |
There was a problem hiding this comment.
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的吗?
There was a problem hiding this comment.
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的吗?
不是,不同情况,默认值不同
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
既然没有默认值就不要加computed!将computed注释掉,多跑几次第0步不设置这5个字段的单测,哪些字段报diff就加,不报diff不加。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
和衫也确认过,存在不设置有默认值的情况,因此,加computed符合预期
@@ -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") { |
There was a problem hiding this comment.
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判断获取,改!
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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步不设置,只在更新操作设置的单测
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个资源里面有字段名字是MultiAZPolicy的吗?改成tf中的字段名,用单引号着重显示。下面几个字段都一样,改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
cadadd6
to
7df94b2
Compare
@@ -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 'multi_az_policy' to COST_OPTIMIZED. Valid values: true, false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
继续改,按照我之前说的,把文档中提到的属性名替换成tf中的字段
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
7df94b2
to
1f1469e
Compare
@@ -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 'multi_az_policy' to COST_OPTIMIZED. Valid values: true, false. | |||
* `capacity_options_on_demand_base_capacity` - (Optional, Available since v1.244.0) The minimum number of pay-as-you-go instances that must be contained in the scaling group. When the actual number of pay-as-you-go instances in the scaling group drops below the value of this parameter, Auto Scaling preferentially creates pay-as-you-go instances. Valid values: 0 to 1000. If you set 'multi_az_policy' to COMPOSABLE, the default value of this parameter is 0. | |||
* `capacity_options_on_demand_percentage_above_base_capacity` - (Optional, Available since v1.244.0) The percentage of pay-as-you-go instances in the excess instances when the minimum number of pay-as-you-go instances is reached. 'compensate_with_on_demand' specifies the minimum number of pay-as-you-go instances that must be contained in the scaling group. Valid values: 0 to 100. If you set 'multi_az_policy' to COMPOSABLE, the default value of this parameter is 100. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
再去看看国际站文档,改!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已改
ab17ea6
to
7c84aaf
Compare
…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.
7c84aaf
to
4c19f10
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved
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.