Skip to content

fix(cos): [118298226] tencentcloud_cos_bucket fix the issue where acl_body a cannot be modified #2868

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
Sep 30, 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/2868.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_cos_bucket: fix the issue where acl_body a cannot be modified
```
13 changes: 11 additions & 2 deletions tencentcloud/services/cos/resource_tc_cos_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -1887,7 +1887,14 @@ func ACLBodyDiffFunc(olds, news string, d *schema.ResourceData) (result bool) {
}

// diff: ACL element
for _, oldGrantee := range oldRoot.FindElements("//Grantee") {
oldGrantees := oldRoot.FindElements("//Grantee")
newGrantees := newRoot.FindElements("//Grantee")
// check count
if len(oldGrantees) != len(newGrantees) {
return false
}
// check content
for _, oldGrantee := range oldGrantees {
for _, attr := range oldGrantee.Attr {
if attr.Key != "type" {
// only need to handle the type attribute
Expand Down Expand Up @@ -1959,7 +1966,9 @@ func ACLBodyDiffFunc(olds, news string, d *schema.ResourceData) (result bool) {
uid = oldGranteeURI.Text()
}
log.Printf("[DEBUG] diff verification passed for grantee:[%s:%s]\n", oldGranteeType, uid)
break
}
if !result {
return false
}
}
}
Expand Down
Loading