Skip to content

Commit 4f1eb6c

Browse files
authored
fix(cos): [118298226] tencentcloud_cos_bucket fix the issue where acl_body a cannot be modified (#2868)
* add * add
1 parent 29b150c commit 4f1eb6c

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.changelog/2868.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_cos_bucket: fix the issue where acl_body a cannot be modified
3+
```

tencentcloud/services/cos/resource_tc_cos_bucket.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,14 @@ func ACLBodyDiffFunc(olds, news string, d *schema.ResourceData) (result bool) {
18871887
}
18881888

18891889
// diff: ACL element
1890-
for _, oldGrantee := range oldRoot.FindElements("//Grantee") {
1890+
oldGrantees := oldRoot.FindElements("//Grantee")
1891+
newGrantees := newRoot.FindElements("//Grantee")
1892+
// check count
1893+
if len(oldGrantees) != len(newGrantees) {
1894+
return false
1895+
}
1896+
// check content
1897+
for _, oldGrantee := range oldGrantees {
18911898
for _, attr := range oldGrantee.Attr {
18921899
if attr.Key != "type" {
18931900
// only need to handle the type attribute
@@ -1959,7 +1966,9 @@ func ACLBodyDiffFunc(olds, news string, d *schema.ResourceData) (result bool) {
19591966
uid = oldGranteeURI.Text()
19601967
}
19611968
log.Printf("[DEBUG] diff verification passed for grantee:[%s:%s]\n", oldGranteeType, uid)
1962-
break
1969+
}
1970+
if !result {
1971+
return false
19631972
}
19641973
}
19651974
}

0 commit comments

Comments
 (0)