Skip to content

fix(cfs): [138737195] tencentcloud_cfs_auto_snapshot_policy update doc #3176

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 3 commits into from
Mar 4, 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/3176.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_cfs_auto_snapshot_policy: update doc
```
16 changes: 12 additions & 4 deletions tencentcloud/services/cfs/resource_tc_cfs_auto_snapshot_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func ResourceTencentCloudCfsAutoSnapshotPolicy() *schema.Resource {

"policy_name": {
Optional: true,
Computed: true,
Type: schema.TypeString,
Description: "Policy name.",
},
Expand Down Expand Up @@ -105,6 +106,11 @@ func resourceTencentCloudCfsAutoSnapshotPolicyCreate(d *schema.ResourceData, met
} else {
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
}

if result == nil || result.Response == nil {
return resource.NonRetryableError(fmt.Errorf("Create cfs autoSnapshotPolicy failed, Response is nil."))
}

response = result
return nil
})
Expand All @@ -113,6 +119,10 @@ func resourceTencentCloudCfsAutoSnapshotPolicyCreate(d *schema.ResourceData, met
return err
}

if response.Response.AutoSnapshotPolicyId == nil {
return fmt.Errorf("AutoSnapshotPolicyId is nil.")
}

autoSnapshotPolicyId = *response.Response.AutoSnapshotPolicyId
d.SetId(autoSnapshotPolicyId)

Expand Down Expand Up @@ -191,10 +201,8 @@ func resourceTencentCloudCfsAutoSnapshotPolicyUpdate(d *schema.ResourceData, met
}
}

if d.HasChange("policy_name") {
if v, ok := d.GetOk("policy_name"); ok {
request.PolicyName = helper.String(v.(string))
}
if v, ok := d.GetOk("policy_name"); ok {
request.PolicyName = helper.String(v.(string))
}

if d.HasChange("alive_days") {
Expand Down
36 changes: 18 additions & 18 deletions tencentcloud/services/cfs/resource_tc_cfs_auto_snapshot_policy.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
Provides a resource to create a cfs auto_snapshot_policy
Provides a resource to create a cfs auto snapshot policy

Example Usage

use day of week
Use day of week

```hcl
resource "tencentcloud_cfs_auto_snapshot_policy" "auto_snapshot_policy" {
resource "tencentcloud_cfs_auto_snapshot_policy" "example" {
policy_name = "tf-example"
day_of_week = "1,2"
hour = "2,3"
policy_name = "policy_name"
alive_days = 7
hour = "2,3"
alive_days = 7
}
```

use day of month
Use day of month

```hcl
resource "tencentcloud_cfs_auto_snapshot_policy" "auto_snapshot_policy" {
hour = "2,3"
policy_name = "policy_name"
alive_days = 7
resource "tencentcloud_cfs_auto_snapshot_policy" "example" {
policy_name = "tf-example"
day_of_month = "2,3,4"
hour = "2,3"
alive_days = 7
}
```

use interval days
Use interval days

```hcl
resource "tencentcloud_cfs_auto_snapshot_policy" "auto_snapshot_policy" {
hour = "2,3"
policy_name = "policy_name"
alive_days = 7
resource "tencentcloud_cfs_auto_snapshot_policy" "example" {
policy_name = "policy_name"
interval_days = 1
hour = "2,3"
alive_days = 7
}
```

Import

cfs auto_snapshot_policy can be imported using the id, e.g.
cfs auto snapshot policy can be imported using the id, e.g.

```
terraform import tencentcloud_cfs_auto_snapshot_policy.auto_snapshot_policy auto_snapshot_policy_id
terraform import tencentcloud_cfs_auto_snapshot_policy.example asp-f8q793kj
```
30 changes: 15 additions & 15 deletions website/docs/r/cfs_auto_snapshot_policy.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,45 @@ layout: "tencentcloud"
page_title: "TencentCloud: tencentcloud_cfs_auto_snapshot_policy"
sidebar_current: "docs-tencentcloud-resource-cfs_auto_snapshot_policy"
description: |-
Provides a resource to create a cfs auto_snapshot_policy
Provides a resource to create a cfs auto snapshot policy
---

# tencentcloud_cfs_auto_snapshot_policy

Provides a resource to create a cfs auto_snapshot_policy
Provides a resource to create a cfs auto snapshot policy

## Example Usage

### use day of week
### Use day of week

```hcl
resource "tencentcloud_cfs_auto_snapshot_policy" "auto_snapshot_policy" {
resource "tencentcloud_cfs_auto_snapshot_policy" "example" {
policy_name = "tf-example"
day_of_week = "1,2"
hour = "2,3"
policy_name = "policy_name"
alive_days = 7
}
```

### use day of month
### Use day of month

```hcl
resource "tencentcloud_cfs_auto_snapshot_policy" "auto_snapshot_policy" {
resource "tencentcloud_cfs_auto_snapshot_policy" "example" {
policy_name = "tf-example"
day_of_month = "2,3,4"
hour = "2,3"
policy_name = "policy_name"
alive_days = 7
day_of_month = "2,3,4"
}
```

### use interval days
### Use interval days

```hcl
resource "tencentcloud_cfs_auto_snapshot_policy" "auto_snapshot_policy" {
hour = "2,3"
resource "tencentcloud_cfs_auto_snapshot_policy" "example" {
policy_name = "policy_name"
alive_days = 7
interval_days = 1
hour = "2,3"
alive_days = 7
}
```

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

## Import

cfs auto_snapshot_policy can be imported using the id, e.g.
cfs auto snapshot policy can be imported using the id, e.g.

```
terraform import tencentcloud_cfs_auto_snapshot_policy.auto_snapshot_policy auto_snapshot_policy_id
terraform import tencentcloud_cfs_auto_snapshot_policy.example asp-f8q793kj
```

Loading