Skip to content

Commit

Permalink
add stop_instance_timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
fuliu-zln committed Jan 6, 2025
1 parent 982a072 commit 941c09b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions alicloud/data_source_alicloud_ess_scalinggroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ func dataSourceAlicloudEssScalingGroups() *schema.Resource {
Type: schema.TypeInt,
Computed: true,
},
"stop_instance_timeout": {
Type: schema.TypeInt,
Computed: true,
},
"cooldown_time": {
Type: schema.TypeInt,
Computed: true,
Expand Down Expand Up @@ -265,6 +269,7 @@ func scalingGroupsDescriptionAttribute(d *schema.ResourceData, scalingGroups []i
"min_size": object["MinSize"],
"max_size": object["MaxSize"],
"cooldown_time": object["DefaultCooldown"],
"stop_instance_timeout": object["StopInstanceTimeout"],
"lifecycle_state": object["LifecycleState"],
"total_capacity": object["TotalCapacity"],
"active_capacity": object["ActiveCapacity"],
Expand Down
18 changes: 10 additions & 8 deletions alicloud/data_source_alicloud_ess_scalinggroups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
)

func TestAccAlicloudEssScalingGroupsDataSource(t *testing.T) {
func TestAccAliCloudEssScalingGroupsDataSource(t *testing.T) {
rand := acctest.RandInt()
nameRegexConf := dataSourceTestAccConfig{
existConfig: testAccCheckAlicloudEssScalinggroupsDataSourceConfig(rand, map[string]string{
existConfig: testAccCheckAliCloudEssScalinggroupsDataSourceConfig(rand, map[string]string{
"name_regex": `"${alicloud_ess_scaling_group.default.scaling_group_name}"`,
}),
fakeConfig: testAccCheckAlicloudEssScalinggroupsDataSourceConfig(rand, map[string]string{
fakeConfig: testAccCheckAliCloudEssScalinggroupsDataSourceConfig(rand, map[string]string{
"name_regex": `"${alicloud_ess_scaling_group.default.scaling_group_name}_fake"`,
}),
}

idsConf := dataSourceTestAccConfig{
existConfig: testAccCheckAlicloudEssScalinggroupsDataSourceConfig(rand, map[string]string{
existConfig: testAccCheckAliCloudEssScalinggroupsDataSourceConfig(rand, map[string]string{
"ids": `["${alicloud_ess_scaling_group.default.id}"]`,
}),
fakeConfig: testAccCheckAlicloudEssScalinggroupsDataSourceConfig(rand, map[string]string{
fakeConfig: testAccCheckAliCloudEssScalinggroupsDataSourceConfig(rand, map[string]string{
"ids": `["${alicloud_ess_scaling_group.default.id}_fake"]`,
}),
}

allConf := dataSourceTestAccConfig{
existConfig: testAccCheckAlicloudEssScalinggroupsDataSourceConfig(rand, map[string]string{
existConfig: testAccCheckAliCloudEssScalinggroupsDataSourceConfig(rand, map[string]string{
"ids": `["${alicloud_ess_scaling_group.default.id}"]`,
"name_regex": `"${alicloud_ess_scaling_group.default.scaling_group_name}"`,
}),
fakeConfig: testAccCheckAlicloudEssScalinggroupsDataSourceConfig(rand, map[string]string{
fakeConfig: testAccCheckAliCloudEssScalinggroupsDataSourceConfig(rand, map[string]string{
"ids": `["${alicloud_ess_scaling_group.default.id}_fake"]`,
"name_regex": `"${alicloud_ess_scaling_group.default.scaling_group_name}"`,
}),
Expand All @@ -50,6 +50,7 @@ func TestAccAlicloudEssScalingGroupsDataSource(t *testing.T) {
"groups.0.min_size": "0",
"groups.0.max_size": "2",
"groups.0.cooldown_time": "20",
"groups.0.stop_instance_timeout": "30",
"groups.0.removal_policies.#": "2",
"groups.0.removal_policies.0": "OldestInstance",
"groups.0.removal_policies.1": "NewestInstance",
Expand Down Expand Up @@ -90,7 +91,7 @@ func TestAccAlicloudEssScalingGroupsDataSource(t *testing.T) {
essScalingGroupsCheckInfo.dataSourceTestCheck(t, rand, nameRegexConf, idsConf, allConf)
}

func testAccCheckAlicloudEssScalinggroupsDataSourceConfig(rand int, attrMap map[string]string) string {
func testAccCheckAliCloudEssScalinggroupsDataSourceConfig(rand int, attrMap map[string]string) string {
var pairs []string
for k, v := range attrMap {
pairs = append(pairs, k+" = "+v)
Expand All @@ -110,6 +111,7 @@ resource "alicloud_ess_scaling_group" "default" {
default_cooldown = 20
removal_policies = ["OldestInstance", "NewestInstance"]
vswitch_ids = ["${alicloud_vswitch.default.id}"]
stop_instance_timeout = 30
tags = {"key": "value"}
}
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/ess_scaling_groups.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,7 @@ The following attributes are exported in addition to the arguments listed above:
* `removing_capacity` - Number of removing instances in scaling group.
* `creation_time` - Creation time of scaling group.
* `tags` - A mapping of tags to assign to the resource.
* `stop_instance_timeout` - (Optional, Available since v1.241.0) The period of time required by the ECS instance to enter the Stopped state. Unit: seconds. Valid values: 30 to 240.



0 comments on commit 941c09b

Please sign in to comment.