Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Commit c9cc3f4

Browse files
committed
gcore_securitygroup read protocol fixed
1 parent ca2867f commit c9cc3f4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

gcore/resource_gcore_securitygroup.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ func resourceSecurityGroupRead(ctx context.Context, d *schema.ResourceData, m in
276276

277277
if sgr.Protocol != nil {
278278
r["protocol"] = sgr.Protocol.String()
279+
} else {
280+
r["protocol"] = types.ProtocolAny
279281
}
280282

281283
r["port_range_max"] = 0

gcore/utils.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,9 +581,10 @@ func volumeUniqueID(i interface{}) int {
581581
func secGroupUniqueID(i interface{}) int {
582582
e := i.(map[string]interface{})
583583
h := md5.New()
584+
proto, _ := e["protocol"].(string)
584585
io.WriteString(h, e["direction"].(string))
585586
io.WriteString(h, e["ethertype"].(string))
586-
io.WriteString(h, e["protocol"].(string))
587+
io.WriteString(h, proto)
587588
io.WriteString(h, strconv.Itoa(e["port_range_min"].(int)))
588589
io.WriteString(h, strconv.Itoa(e["port_range_max"].(int)))
589590
io.WriteString(h, e["description"].(string))

0 commit comments

Comments
 (0)