Merge pull request #3796 from jtopjian/jtopjian-openstack-secgroup-rule-fix
provider/openstack: Security Group Rules Fix
This commit is contained in:
commit
1bb26a4cc2
|
@ -131,10 +131,10 @@ func resourceComputeSecGroupV2Read(d *schema.ResourceData, meta interface{}) err
|
||||||
d.Set("description", sg.Description)
|
d.Set("description", sg.Description)
|
||||||
rtm := rulesToMap(sg.Rules)
|
rtm := rulesToMap(sg.Rules)
|
||||||
for _, v := range rtm {
|
for _, v := range rtm {
|
||||||
if v["group"] == d.Get("name") {
|
if v["from_group_id"] == d.Get("name") {
|
||||||
v["self"] = "1"
|
v["self"] = true
|
||||||
} else {
|
} else {
|
||||||
v["self"] = "0"
|
v["self"] = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Printf("[DEBUG] rulesToMap(sg.Rules): %+v", rtm)
|
log.Printf("[DEBUG] rulesToMap(sg.Rules): %+v", rtm)
|
||||||
|
@ -283,12 +283,12 @@ func rulesToMap(sgrs []secgroups.Rule) []map[string]interface{} {
|
||||||
sgrMap := make([]map[string]interface{}, len(sgrs))
|
sgrMap := make([]map[string]interface{}, len(sgrs))
|
||||||
for i, sgr := range sgrs {
|
for i, sgr := range sgrs {
|
||||||
sgrMap[i] = map[string]interface{}{
|
sgrMap[i] = map[string]interface{}{
|
||||||
"id": sgr.ID,
|
"id": sgr.ID,
|
||||||
"from_port": sgr.FromPort,
|
"from_port": sgr.FromPort,
|
||||||
"to_port": sgr.ToPort,
|
"to_port": sgr.ToPort,
|
||||||
"ip_protocol": sgr.IPProtocol,
|
"ip_protocol": sgr.IPProtocol,
|
||||||
"cidr": sgr.IPRange.CIDR,
|
"cidr": sgr.IPRange.CIDR,
|
||||||
"group": sgr.Group.Name,
|
"from_group_id": sgr.Group.Name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sgrMap
|
return sgrMap
|
||||||
|
|
Loading…
Reference in New Issue