Skip to content

Commit 3ce26b7

Browse files
authored
feat:update the key_ids of cvm smoothly (#1403)
* feat:update the key_ids of cvm smoothly * changelog
1 parent a2cba44 commit 3ce26b7

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

.changelog/1403.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_instance: update the `key_ids` of cvm smoothly
3+
```

tencentcloud/resource_tc_instance.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,13 +1016,11 @@ func resourceTencentCloudInstanceRead(d *schema.ResourceData, meta interface{})
10161016
_ = d.Set("public_ip", instance.PublicIpAddresses[0])
10171017
}
10181018
if len(instance.LoginSettings.KeyIds) > 0 {
1019-
if _, ok := d.GetOk("key_name"); ok {
1020-
_ = d.Set("key_name", instance.LoginSettings.KeyIds[0])
1021-
} else {
1022-
_ = d.Set("key_ids", instance.LoginSettings.KeyIds)
1023-
}
1019+
_ = d.Set("key_name", instance.LoginSettings.KeyIds[0])
1020+
_ = d.Set("key_ids", instance.LoginSettings.KeyIds)
10241021
} else {
10251022
_ = d.Set("key_name", "")
1023+
_ = d.Set("key_ids", []*string{helper.String("")})
10261024
}
10271025
if instance.LoginSettings.KeepImageLogin != nil {
10281026
_ = d.Set("keep_image_login", *instance.LoginSettings.KeepImageLogin == CVM_IMAGE_LOGIN)

0 commit comments

Comments
 (0)