Skip to content

Commit 3c1a7a4

Browse files
tongyimingmikatong
andauthored
lighthouse support isolate_data_disk (#1879)
* lighthouse support isolate_data_disk * add changelog --------- Co-authored-by: mikatong <mikatong@tencent.com>
1 parent 3cd7fec commit 3c1a7a4

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

.changelog/1879.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_lighthouse_instance: support param `isolate_data_disk`.
3+
```

tencentcloud/resource_tc_lighthouse_instance.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ func resourceTencentCloudLighthouseInstance() *schema.Resource {
170170
ValidateFunc: validateAllowedStringValue([]string{"YES", "NO"}),
171171
Description: "Whether to allow login using the default key pair. `YES`: allow login; `NO`: disable login. Default: `YES`.",
172172
},
173+
"isolate_data_disk": {
174+
Type: schema.TypeBool,
175+
Optional: true,
176+
Default: true,
177+
Description: "Whether to return the mounted data disk. `true`: returns both the instance and the mounted data disk; `false`: returns the instance and no longer returns its mounted data disk. Default: `true`.",
178+
},
173179
"containers": {
174180
Type: schema.TypeList,
175181
Optional: true,
@@ -721,9 +727,10 @@ func resourceTencentCloudLighthouseInstanceDelete(d *schema.ResourceData, meta i
721727
ctx := context.WithValue(context.TODO(), logIdKey, logId)
722728
service := LightHouseService{client: meta.(*TencentCloudClient).apiV3Conn}
723729
id := d.Id()
730+
isolateDataDisk := d.Get("isolate_data_disk").(bool)
724731

725732
err := resource.Retry(writeRetryTimeout, func() *resource.RetryError {
726-
if err := service.IsolateLighthouseInstanceById(ctx, id); err != nil {
733+
if err := service.IsolateLighthouseInstanceById(ctx, id, isolateDataDisk); err != nil {
727734
return retryError(err)
728735
}
729736
return nil

tencentcloud/resource_tc_lighthouse_instance_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ resource "tencentcloud_lighthouse_instance" "instance" {
8181
8282
instance_name = "terraform"
8383
zone = "ap-guangzhou-3"
84-
84+
isolate_data_disk = true
8585
containers {
8686
container_image = "ccr.ccs.tencentyun.com/qcloud/nginx"
8787
container_name = "nginx"
@@ -152,6 +152,7 @@ resource "tencentcloud_lighthouse_instance" "instance" {
152152
153153
instance_name = "terraform"
154154
zone = "ap-guangzhou-3"
155+
isolate_data_disk = true
155156
156157
containers {
157158
container_image = "ccr.ccs.tencentyun.com/qcloud/nginx"

tencentcloud/service_tencentcloud_lighthouse.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,12 @@ func (me *LightHouseService) DeleteLighthouseInstanceById(ctx context.Context, i
9595
return
9696
}
9797

98-
func (me *LightHouseService) IsolateLighthouseInstanceById(ctx context.Context, id string) (errRet error) {
98+
func (me *LightHouseService) IsolateLighthouseInstanceById(ctx context.Context, id string, isolateDataDisk bool) (errRet error) {
9999
logId := getLogId(ctx)
100100

101101
request := lighthouse.NewIsolateInstancesRequest()
102102
request.InstanceIds = append(request.InstanceIds, &id)
103+
request.IsolateDataDisk = helper.Bool(isolateDataDisk)
103104

104105
defer func() {
105106
if errRet != nil {

website/docs/r/lighthouse_instance.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ The following arguments are supported:
9494
* `containers` - (Optional, List) Configuration of the containers to create.
9595
* `dry_run` - (Optional, Bool) Whether the request is a dry run only.true: dry run only. The request will not create instance(s). A dry run can check whether all the required parameters are specified, whether the request format is right, whether the request exceeds service limits, and whether the specified CVMs are available. If the dry run fails, the corresponding error code will be returned.If the dry run succeeds, the RequestId will be returned.false (default value): send a normal request and create instance(s) if all the requirements are met.
9696
* `is_update_bundle_id_auto_voucher` - (Optional, Bool) Whether the voucher is deducted automatically when update bundle id. Value range: `true`: indicates automatic deduction of vouchers, `false`: does not automatically deduct vouchers. Default value: `false`.
97+
* `isolate_data_disk` - (Optional, Bool) Whether to return the mounted data disk. `true`: returns both the instance and the mounted data disk; `false`: returns the instance and no longer returns its mounted data disk. Default: `true`.
9798
* `login_configuration` - (Optional, List) Login password of the instance. It is only available for Windows instances. If it is not specified, it means that the user choose to set the login password after the instance creation.
9899
* `permit_default_key_pair_login` - (Optional, String) Whether to allow login using the default key pair. `YES`: allow login; `NO`: disable login. Default: `YES`.
99100
* `zone` - (Optional, String) List of availability zones. A random AZ is selected by default.

0 commit comments

Comments
 (0)