Skip to content

Commit 007fba1

Browse files
authored
fix(cfs): [138737195] tencentcloud_cfs_auto_snapshot_policy update doc (#3176)
* add * add * add
1 parent 4a5f6fa commit 007fba1

File tree

4 files changed

+48
-37
lines changed

4 files changed

+48
-37
lines changed

.changelog/3176.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_cfs_auto_snapshot_policy: update doc
3+
```

tencentcloud/services/cfs/resource_tc_cfs_auto_snapshot_policy.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func ResourceTencentCloudCfsAutoSnapshotPolicy() *schema.Resource {
3232

3333
"policy_name": {
3434
Optional: true,
35+
Computed: true,
3536
Type: schema.TypeString,
3637
Description: "Policy name.",
3738
},
@@ -105,6 +106,11 @@ func resourceTencentCloudCfsAutoSnapshotPolicyCreate(d *schema.ResourceData, met
105106
} else {
106107
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
107108
}
109+
110+
if result == nil || result.Response == nil {
111+
return resource.NonRetryableError(fmt.Errorf("Create cfs autoSnapshotPolicy failed, Response is nil."))
112+
}
113+
108114
response = result
109115
return nil
110116
})
@@ -113,6 +119,10 @@ func resourceTencentCloudCfsAutoSnapshotPolicyCreate(d *schema.ResourceData, met
113119
return err
114120
}
115121

122+
if response.Response.AutoSnapshotPolicyId == nil {
123+
return fmt.Errorf("AutoSnapshotPolicyId is nil.")
124+
}
125+
116126
autoSnapshotPolicyId = *response.Response.AutoSnapshotPolicyId
117127
d.SetId(autoSnapshotPolicyId)
118128

@@ -191,10 +201,8 @@ func resourceTencentCloudCfsAutoSnapshotPolicyUpdate(d *schema.ResourceData, met
191201
}
192202
}
193203

194-
if d.HasChange("policy_name") {
195-
if v, ok := d.GetOk("policy_name"); ok {
196-
request.PolicyName = helper.String(v.(string))
197-
}
204+
if v, ok := d.GetOk("policy_name"); ok {
205+
request.PolicyName = helper.String(v.(string))
198206
}
199207

200208
if d.HasChange("alive_days") {
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
Provides a resource to create a cfs auto_snapshot_policy
1+
Provides a resource to create a cfs auto snapshot policy
22

33
Example Usage
44

5-
use day of week
5+
Use day of week
66

77
```hcl
8-
resource "tencentcloud_cfs_auto_snapshot_policy" "auto_snapshot_policy" {
8+
resource "tencentcloud_cfs_auto_snapshot_policy" "example" {
9+
policy_name = "tf-example"
910
day_of_week = "1,2"
10-
hour = "2,3"
11-
policy_name = "policy_name"
12-
alive_days = 7
11+
hour = "2,3"
12+
alive_days = 7
1313
}
1414
```
1515

16-
use day of month
16+
Use day of month
1717

1818
```hcl
19-
resource "tencentcloud_cfs_auto_snapshot_policy" "auto_snapshot_policy" {
20-
hour = "2,3"
21-
policy_name = "policy_name"
22-
alive_days = 7
19+
resource "tencentcloud_cfs_auto_snapshot_policy" "example" {
20+
policy_name = "tf-example"
2321
day_of_month = "2,3,4"
22+
hour = "2,3"
23+
alive_days = 7
2424
}
2525
```
2626

27-
use interval days
27+
Use interval days
2828

2929
```hcl
30-
resource "tencentcloud_cfs_auto_snapshot_policy" "auto_snapshot_policy" {
31-
hour = "2,3"
32-
policy_name = "policy_name"
33-
alive_days = 7
30+
resource "tencentcloud_cfs_auto_snapshot_policy" "example" {
31+
policy_name = "policy_name"
3432
interval_days = 1
33+
hour = "2,3"
34+
alive_days = 7
3535
}
3636
```
3737

3838
Import
3939

40-
cfs auto_snapshot_policy can be imported using the id, e.g.
40+
cfs auto snapshot policy can be imported using the id, e.g.
4141

4242
```
43-
terraform import tencentcloud_cfs_auto_snapshot_policy.auto_snapshot_policy auto_snapshot_policy_id
43+
terraform import tencentcloud_cfs_auto_snapshot_policy.example asp-f8q793kj
4444
```

website/docs/r/cfs_auto_snapshot_policy.html.markdown

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,45 @@ layout: "tencentcloud"
44
page_title: "TencentCloud: tencentcloud_cfs_auto_snapshot_policy"
55
sidebar_current: "docs-tencentcloud-resource-cfs_auto_snapshot_policy"
66
description: |-
7-
Provides a resource to create a cfs auto_snapshot_policy
7+
Provides a resource to create a cfs auto snapshot policy
88
---
99

1010
# tencentcloud_cfs_auto_snapshot_policy
1111

12-
Provides a resource to create a cfs auto_snapshot_policy
12+
Provides a resource to create a cfs auto snapshot policy
1313

1414
## Example Usage
1515

16-
### use day of week
16+
### Use day of week
1717

1818
```hcl
19-
resource "tencentcloud_cfs_auto_snapshot_policy" "auto_snapshot_policy" {
19+
resource "tencentcloud_cfs_auto_snapshot_policy" "example" {
20+
policy_name = "tf-example"
2021
day_of_week = "1,2"
2122
hour = "2,3"
22-
policy_name = "policy_name"
2323
alive_days = 7
2424
}
2525
```
2626

27-
### use day of month
27+
### Use day of month
2828

2929
```hcl
30-
resource "tencentcloud_cfs_auto_snapshot_policy" "auto_snapshot_policy" {
30+
resource "tencentcloud_cfs_auto_snapshot_policy" "example" {
31+
policy_name = "tf-example"
32+
day_of_month = "2,3,4"
3133
hour = "2,3"
32-
policy_name = "policy_name"
3334
alive_days = 7
34-
day_of_month = "2,3,4"
3535
}
3636
```
3737

38-
### use interval days
38+
### Use interval days
3939

4040
```hcl
41-
resource "tencentcloud_cfs_auto_snapshot_policy" "auto_snapshot_policy" {
42-
hour = "2,3"
41+
resource "tencentcloud_cfs_auto_snapshot_policy" "example" {
4342
policy_name = "policy_name"
44-
alive_days = 7
4543
interval_days = 1
44+
hour = "2,3"
45+
alive_days = 7
4646
}
4747
```
4848

@@ -67,9 +67,9 @@ In addition to all arguments above, the following attributes are exported:
6767

6868
## Import
6969

70-
cfs auto_snapshot_policy can be imported using the id, e.g.
70+
cfs auto snapshot policy can be imported using the id, e.g.
7171

7272
```
73-
terraform import tencentcloud_cfs_auto_snapshot_policy.auto_snapshot_policy auto_snapshot_policy_id
73+
terraform import tencentcloud_cfs_auto_snapshot_policy.example asp-f8q793kj
7474
```
7575

0 commit comments

Comments
 (0)