Skip to content

Commit 7f039b9

Browse files
author
yuanhaojin
committed
fix set partial in resource cnn
1 parent 50d5c2c commit 7f039b9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tencentcloud/resource_tc_ccn.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,11 @@ func resourceTencentCloudCcnUpdate(d *schema.ResourceData, meta interface{}) err
175175
name = ""
176176
description = ""
177177
change = false
178+
changeList = []string{}
178179
)
179180
if d.HasChange("name") {
180181
name = d.Get("name").(string)
182+
changeList = append(changeList, "name")
181183
change = true
182184
}
183185

@@ -188,15 +190,20 @@ func resourceTencentCloudCcnUpdate(d *schema.ResourceData, meta interface{}) err
188190
if description == "" {
189191
return fmt.Errorf("can not set description='' ")
190192
}
193+
changeList = append(changeList, "description")
191194
change = true
192195
}
193196

197+
d.Partial(true)
194198
if change {
195199
if err := service.ModifyCcnAttribute(ctx, d.Id(), name, description); err != nil {
196200
return err
197201
}
202+
for _, val := range changeList {
203+
d.SetPartial(val)
204+
}
198205
}
199-
d.Partial(true)
206+
200207
if d.HasChange("tags") {
201208

202209
oldValue, newValue := d.GetChange("tags")

0 commit comments

Comments
 (0)