Skip to content

fix(cbs): [136915341]fix prepaid_period update #3187

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

Merged
merged 2 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3187.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_cbs_storage: fix prepaid_period update
```
5 changes: 3 additions & 2 deletions tencentcloud/services/cbs/resource_tc_cbs_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ func resourceTencentCloudCbsStorageUpdate(d *schema.ResourceData, meta interface
cbsService = CbsService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()}
)

d.Partial(true)

//only support update prepaid_period when upgrade chargeType
if d.HasChange("prepaid_period") && (!d.HasChange("charge_type") && d.Get("charge_type").(string) == CBS_CHARGE_TYPE_PREPAID) {
return fmt.Errorf("tencentcloud_cbs_storage renew is not support yet")
Expand All @@ -336,7 +338,6 @@ func resourceTencentCloudCbsStorageUpdate(d *schema.ResourceData, meta interface
return fmt.Errorf("tencentcloud_cbs_storage do not support downgrade instance")
}

d.Partial(true)
storageId := d.Id()
storageName := ""
projectId := -1
Expand Down Expand Up @@ -553,7 +554,7 @@ func resourceTencentCloudCbsStorageUpdate(d *schema.ResourceData, meta interface

d.Partial(false)

return nil
return resourceTencentCloudCbsStorageRead(d, meta)
}

func resourceTencentCloudCbsStorageDelete(d *schema.ResourceData, meta interface{}) error {
Expand Down
Loading