Skip to content

Commit 462ad4b

Browse files
authored
fix(cbs): [124497595] tencentcloud_cbs_storage support encrypt_type (#3395)
* add * add
1 parent b7f3719 commit 462ad4b

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

.changelog/3395.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_cbs_storage: support `encrypt_type`
3+
```

tencentcloud/services/cbs/resource_tc_cbs_storage.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ func ResourceTencentCloudCbsStorage() *schema.Resource {
137137
Computed: true,
138138
Description: "Whether to enable performance burst when creating a cloud disk.",
139139
},
140+
"encrypt_type": {
141+
Type: schema.TypeString,
142+
Optional: true,
143+
ForceNew: true,
144+
Computed: true,
145+
Description: "Specifies the cloud disk encryption type. The values are `ENCRYPT_V1` and `ENCRYPT_V2`, which represent the first-generation and second-generation encryption technologies respectively. The two encryption technologies are incompatible with each other. It is recommended to use the second-generation encryption technology `ENCRYPT_V2` first. The first-generation encryption technology is only supported on some older models. This parameter is only valid when creating an encrypted cloud disk.",
146+
},
140147
// computed
141148
"storage_status": {
142149
Type: schema.TypeString,
@@ -227,6 +234,10 @@ func resourceTencentCloudCbsStorageCreate(d *schema.ResourceData, meta interface
227234
request.BurstPerformance = helper.Bool(v.(bool))
228235
}
229236

237+
if v, ok := d.GetOkExists("encrypt_type"); ok {
238+
request.EncryptType = helper.String(v.(string))
239+
}
240+
230241
storageId := ""
231242
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
232243
response, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseCbsClient().CreateDisks(request)
@@ -336,6 +347,10 @@ func resourceTencentCloudCbsStorageRead(d *schema.ResourceData, meta interface{}
336347
_ = d.Set("throughput_performance", storage.ThroughputPerformance)
337348
_ = d.Set("burst_performance", storage.BurstPerformance)
338349

350+
if storage.EncryptType != nil {
351+
_ = d.Set("encrypt_type", storage.EncryptType)
352+
}
353+
339354
if storage.KmsKeyId != nil {
340355
_ = d.Set("kms_key_id", storage.KmsKeyId)
341356
}

tencentcloud/services/cbs/resource_tc_cbs_storage.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,24 @@ resource "tencentcloud_cbs_storage" "example" {
5858
}
5959
```
6060

61+
Create an encrypted CBS storage with encrypt_type
62+
63+
```hcl
64+
resource "tencentcloud_cbs_storage" "example" {
65+
storage_name = "tf-example"
66+
storage_type = "CLOUD_SSD"
67+
storage_size = 100
68+
availability_zone = "ap-guangzhou-3"
69+
project_id = 0
70+
encrypt = true
71+
encrypt_type = "ENCRYPT_V2"
72+
73+
tags = {
74+
createBy = "Terraform"
75+
}
76+
}
77+
```
78+
6179
Create a dedicated cluster CBS storage
6280

6381
```hcl

website/docs/r/cbs_storage.html.markdown

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,24 @@ resource "tencentcloud_cbs_storage" "example" {
6969
}
7070
```
7171

72+
### Create an encrypted CBS storage with encrypt_type
73+
74+
```hcl
75+
resource "tencentcloud_cbs_storage" "example" {
76+
storage_name = "tf-example"
77+
storage_type = "CLOUD_SSD"
78+
storage_size = 100
79+
availability_zone = "ap-guangzhou-3"
80+
project_id = 0
81+
encrypt = true
82+
encrypt_type = "ENCRYPT_V2"
83+
84+
tags = {
85+
createBy = "Terraform"
86+
}
87+
}
88+
```
89+
7290
### Create a dedicated cluster CBS storage
7391

7492
```hcl
@@ -100,6 +118,7 @@ The following arguments are supported:
100118
* `charge_type` - (Optional, String) The charge type of CBS instance. Valid values are `PREPAID`, `POSTPAID_BY_HOUR`, `CDCPAID` and `DEDICATED_CLUSTER_PAID`. The default is `POSTPAID_BY_HOUR`.
101119
* `dedicated_cluster_id` - (Optional, String, ForceNew) Exclusive cluster id.
102120
* `disk_backup_quota` - (Optional, Int) The quota of backup points of cloud disk.
121+
* `encrypt_type` - (Optional, String, ForceNew) Specifies the cloud disk encryption type. The values are `ENCRYPT_V1` and `ENCRYPT_V2`, which represent the first-generation and second-generation encryption technologies respectively. The two encryption technologies are incompatible with each other. It is recommended to use the second-generation encryption technology `ENCRYPT_V2` first. The first-generation encryption technology is only supported on some older models. This parameter is only valid when creating an encrypted cloud disk.
103122
* `encrypt` - (Optional, Bool, ForceNew) Pass in this parameter to create an encrypted cloud disk.
104123
* `force_delete` - (Optional, Bool) Indicate whether to delete CBS instance directly or not. Default is false. If set true, the instance will be deleted instead of staying recycle bin.
105124
* `kms_key_id` - (Optional, String, ForceNew) Optional parameters. When purchasing an encryption disk, customize the key. When this parameter is passed in, the `encrypt` parameter need be set.

0 commit comments

Comments
 (0)