Skip to content

Commit c912b9a

Browse files
authored
fix(tat): [137296521] tencentcloud_tat_command Optimize code logic (#3276)
* add * add
1 parent 0841a80 commit c912b9a

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

.changelog/3276.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_tat_command: Optimize code logic
3+
```

tencentcloud/services/tat/resource_tc_tat_command.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,17 @@ func resourceTencentCloudTatCommandCreate(d *schema.ResourceData, meta interface
182182

183183
if v, ok := d.GetOk("tags"); ok {
184184
for _, item := range v.([]interface{}) {
185-
dMap := item.(map[string]interface{})
186-
tag := tat.Tag{}
187-
if v, ok := dMap["key"]; ok {
188-
tag.Key = helper.String(v.(string))
185+
if dMap, ok := item.(map[string]interface{}); ok && dMap != nil {
186+
tag := tat.Tag{}
187+
if v, ok := dMap["key"]; ok {
188+
tag.Key = helper.String(v.(string))
189+
}
190+
if v, ok := dMap["value"]; ok {
191+
tag.Value = helper.String(v.(string))
192+
}
193+
194+
request.Tags = append(request.Tags, &tag)
189195
}
190-
if v, ok := dMap["value"]; ok {
191-
tag.Value = helper.String(v.(string))
192-
}
193-
194-
request.Tags = append(request.Tags, &tag)
195196
}
196197
}
197198

0 commit comments

Comments
 (0)