diff --git a/.changelog/3129.txt b/.changelog/3129.txt new file mode 100644 index 0000000000..fcb4b0e21d --- /dev/null +++ b/.changelog/3129.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/tencentcloud_cbs_disk_backup: update resource creation error message +``` diff --git a/tencentcloud/services/cbs/resource_tc_cbs_disk_backup.go b/tencentcloud/services/cbs/resource_tc_cbs_disk_backup.go index d0107eb32e..1a8215c11a 100644 --- a/tencentcloud/services/cbs/resource_tc_cbs_disk_backup.go +++ b/tencentcloud/services/cbs/resource_tc_cbs_disk_backup.go @@ -60,7 +60,7 @@ func resourceTencentCloudCbsDiskBackupCreate(d *schema.ResourceData, meta interf service := CbsService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} diskBackupId, err := service.CreateDiskBackup(ctx, diskId, diskBackupName) if err != nil { - return nil + return err } d.SetId(diskBackupId) err = resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { diff --git a/tencentcloud/services/cbs/resource_tc_cbs_disk_backup.md b/tencentcloud/services/cbs/resource_tc_cbs_disk_backup.md index 25d7b76c60..1500b153fe 100644 --- a/tencentcloud/services/cbs/resource_tc_cbs_disk_backup.md +++ b/tencentcloud/services/cbs/resource_tc_cbs_disk_backup.md @@ -1,22 +1,34 @@ -Provides a resource to create a cbs disk_backup. +Provides a resource to create a CBS disk backup. -~> **NOTE:** Backup quota must greater than 1. +~> **NOTE:** The parameter `disk_backup_quota` in the resource `tencentcloud_cbs_storage` must be greater than 1. Example Usage ```hcl - - resource "tencentcloud_cbs_disk_backup" "disk_backup" { - disk_id = "disk-xxx" - disk_backup_name = "xxx" - } - +resource "tencentcloud_cbs_storage" "example" { + storage_name = "tf-example" + storage_type = "CLOUD_SSD" + storage_size = 100 + availability_zone = "ap-guangzhou-6" + project_id = 0 + encrypt = false + disk_backup_quota = 3 + + tags = { + createBy = "Terraform" + } +} + +resource "tencentcloud_cbs_disk_backup" "example" { + disk_id = tencentcloud_cbs_storage.example.id + disk_backup_name = "tf-example" +} ``` Import -cbs disk_backup can be imported using the id, e.g. +CBS disk backup can be imported using the id, e.g. ``` -terraform import tencentcloud_cbs_disk_backup.disk_backup disk_backup_id +terraform import tencentcloud_cbs_disk_backup.example dbp-qax6zwvr ``` \ No newline at end of file diff --git a/website/docs/r/cbs_disk_backup.html.markdown b/website/docs/r/cbs_disk_backup.html.markdown index f2ad9395d3..a7a7516cba 100644 --- a/website/docs/r/cbs_disk_backup.html.markdown +++ b/website/docs/r/cbs_disk_backup.html.markdown @@ -4,21 +4,35 @@ layout: "tencentcloud" page_title: "TencentCloud: tencentcloud_cbs_disk_backup" sidebar_current: "docs-tencentcloud-resource-cbs_disk_backup" description: |- - Provides a resource to create a cbs disk_backup. + Provides a resource to create a CBS disk backup. --- # tencentcloud_cbs_disk_backup -Provides a resource to create a cbs disk_backup. +Provides a resource to create a CBS disk backup. -~> **NOTE:** Backup quota must greater than 1. +~> **NOTE:** The parameter `disk_backup_quota` in the resource `tencentcloud_cbs_storage` must be greater than 1. ## Example Usage ```hcl -resource "tencentcloud_cbs_disk_backup" "disk_backup" { - disk_id = "disk-xxx" - disk_backup_name = "xxx" +resource "tencentcloud_cbs_storage" "example" { + storage_name = "tf-example" + storage_type = "CLOUD_SSD" + storage_size = 100 + availability_zone = "ap-guangzhou-6" + project_id = 0 + encrypt = false + disk_backup_quota = 3 + + tags = { + createBy = "Terraform" + } +} + +resource "tencentcloud_cbs_disk_backup" "example" { + disk_id = tencentcloud_cbs_storage.example.id + disk_backup_name = "tf-example" } ``` @@ -39,9 +53,9 @@ In addition to all arguments above, the following attributes are exported: ## Import -cbs disk_backup can be imported using the id, e.g. +CBS disk backup can be imported using the id, e.g. ``` -terraform import tencentcloud_cbs_disk_backup.disk_backup disk_backup_id +terraform import tencentcloud_cbs_disk_backup.example dbp-qax6zwvr ```