Skip to content

feat(tcr): [111111111] adjust modify logic of tencentcloud_tcr_tag_retention_rule #2905

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
Oct 23, 2024
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/2905.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_tcr_tag_retention_rule: adjust modify logic
```
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func ResourceTencentCloudTcrTagRetentionRule() *schema.Resource {

"cron_setting": {
Required: true,
ForceNew: true,
Type: schema.TypeString,
Description: "Execution cycle, currently only available selections are: manual; daily; weekly; monthly.",
},
Expand Down Expand Up @@ -267,7 +268,7 @@ func resourceTencentCloudTcrTagRetentionRuleUpdate(d *schema.ResourceData, meta
}
}

if d.HasChange("retention_rule") {
if d.HasChange("retention_rule") || d.HasChange("disabled") {
if dMap, ok := helper.InterfacesHeadMap(d, "retention_rule"); ok {
retentionRule := tcr.RetentionRule{}
if v, ok := dMap["key"]; ok {
Expand All @@ -278,9 +279,7 @@ func resourceTencentCloudTcrTagRetentionRuleUpdate(d *schema.ResourceData, meta
}
request.RetentionRule = &retentionRule
}
}

if d.HasChange("disabled") {
if v, ok := d.GetOkExists("disabled"); ok {
request.Disabled = helper.Bool(v.(bool))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Provides a resource to create a tcr tag retention rule.

Example Usage

Create a tcr tag retention rule instance
Create and enable a tcr tag retention rule instance

```hcl
resource "tencentcloud_tcr_instance" "example" {
Expand Down Expand Up @@ -34,6 +34,5 @@ resource "tencentcloud_tcr_tag_retention_rule" "my_rule" {
value = 2
}
cron_setting = "daily"
disabled = true
}
```
5 changes: 2 additions & 3 deletions website/docs/r/tcr_tag_retention_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Provides a resource to create a tcr tag retention rule.

## Example Usage

### Create a tcr tag retention rule instance
### Create and enable a tcr tag retention rule instance

```hcl
resource "tencentcloud_tcr_instance" "example" {
Expand Down Expand Up @@ -45,15 +45,14 @@ resource "tencentcloud_tcr_tag_retention_rule" "my_rule" {
value = 2
}
cron_setting = "daily"
disabled = true
}
```

## Argument Reference

The following arguments are supported:

* `cron_setting` - (Required, String) Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
* `cron_setting` - (Required, String, ForceNew) Execution cycle, currently only available selections are: manual; daily; weekly; monthly.
* `namespace_name` - (Required, String) The Name of the namespace.
* `registry_id` - (Required, String) The main instance ID.
* `retention_rule` - (Required, List) Retention Policy.
Expand Down
Loading