Skip to content

Commit a58c7ad

Browse files
authored
fix: Deprecated force_reboot (#2054)
* fix: Deprecated force_reboot * feat: add changelog * fix: update e2e test * fix: update force_reboot
1 parent f120509 commit a58c7ad

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

.changelog/2054.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_cvm_reboot_instance: Deprecated `force_reboot`
3+
```

tencentcloud/resource_tc_cvm_reboot_instance.go

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Example Usage
55
66
```hcl
77
resource "tencentcloud_cvm_reboot_instance" "reboot_instance" {
8-
instance_id = "ins-xxxxx"
9-
force_reboot = false
8+
instance_id = "ins-f9jr4bd2"
9+
stop_type = "SOFT_FIRST"
1010
}
1111
```
1212
*/
@@ -36,17 +36,20 @@ func resourceTencentCloudCvmRebootInstance() *schema.Resource {
3636
},
3737

3838
"force_reboot": {
39-
Optional: true,
40-
ForceNew: true,
41-
Type: schema.TypeBool,
42-
Description: "This parameter has been disused. We recommend using StopType instead. Note that ForceReboot and StopType parameters cannot be specified at the same time. Whether to forcibly restart an instance after a normal restart fails. Valid values are `TRUE` and `FALSE`. Default value: FALSE.",
39+
Optional: true,
40+
ForceNew: true,
41+
Type: schema.TypeBool,
42+
ConflictsWith: []string{"stop_type"},
43+
Deprecated: "It has been deprecated from version 1.81.21. Please use `stop_type` instead.",
44+
Description: "This parameter has been disused. We recommend using StopType instead. Note that ForceReboot and StopType parameters cannot be specified at the same time. Whether to forcibly restart an instance after a normal restart fails. Valid values are `TRUE` and `FALSE`. Default value: FALSE.",
4345
},
4446

4547
"stop_type": {
46-
Optional: true,
47-
ForceNew: true,
48-
Type: schema.TypeString,
49-
Description: "Shutdown type. Valid values: `SOFT`: soft shutdown; `HARD`: hard shutdown; `SOFT_FIRST`: perform a soft shutdown first, and perform a hard shutdown if the soft shutdown fails. Default value: SOFT.",
48+
Optional: true,
49+
ForceNew: true,
50+
Type: schema.TypeString,
51+
ConflictsWith: []string{"force_reboot"},
52+
Description: "Shutdown type. Valid values: `SOFT`: soft shutdown; `HARD`: hard shutdown; `SOFT_FIRST`: perform a soft shutdown first, and perform a hard shutdown if the soft shutdown fails. Default value: SOFT.",
5053
},
5154
},
5255
}
@@ -63,7 +66,9 @@ func resourceTencentCloudCvmRebootInstanceCreate(d *schema.ResourceData, meta in
6366
request.InstanceIds = []*string{&instanceId}
6467

6568
if v, _ := d.GetOk("force_reboot"); v != nil {
66-
request.ForceReboot = helper.Bool(v.(bool))
69+
if _, ok := d.GetOk("stop_type"); !ok {
70+
request.ForceReboot = helper.Bool(v.(bool))
71+
}
6772
}
6873

6974
if v, ok := d.GetOk("stop_type"); ok {

tencentcloud/resource_tc_cvm_reboot_instance_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ const testAccCvmRebootInstance = defaultRebootCvmVariable + `
2626
2727
resource "tencentcloud_cvm_reboot_instance" "reboot_instance" {
2828
instance_id = var.cvm_id
29-
force_reboot = false
29+
stop_type = "SOFT_FIRST"
3030
}
3131
`

website/docs/r/cvm_reboot_instance.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Provides a resource to create a cvm reboot_instance
1515

1616
```hcl
1717
resource "tencentcloud_cvm_reboot_instance" "reboot_instance" {
18-
instance_id = "ins-xxxxx"
19-
force_reboot = false
18+
instance_id = "ins-f9jr4bd2"
19+
stop_type = "SOFT_FIRST"
2020
}
2121
```
2222

@@ -25,7 +25,7 @@ resource "tencentcloud_cvm_reboot_instance" "reboot_instance" {
2525
The following arguments are supported:
2626

2727
* `instance_id` - (Required, String, ForceNew) Instance ID.
28-
* `force_reboot` - (Optional, Bool, ForceNew) This parameter has been disused. We recommend using StopType instead. Note that ForceReboot and StopType parameters cannot be specified at the same time. Whether to forcibly restart an instance after a normal restart fails. Valid values are `TRUE` and `FALSE`. Default value: FALSE.
28+
* `force_reboot` - (Optional, Bool, ForceNew, **Deprecated**) It has been deprecated from version 1.81.21. Please use `stop_type` instead. This parameter has been disused. We recommend using StopType instead. Note that ForceReboot and StopType parameters cannot be specified at the same time. Whether to forcibly restart an instance after a normal restart fails. Valid values are `TRUE` and `FALSE`. Default value: FALSE.
2929
* `stop_type` - (Optional, String, ForceNew) Shutdown type. Valid values: `SOFT`: soft shutdown; `HARD`: hard shutdown; `SOFT_FIRST`: perform a soft shutdown first, and perform a hard shutdown if the soft shutdown fails. Default value: SOFT.
3030

3131
## Attributes Reference

0 commit comments

Comments
 (0)