Fixing rule/rules and re-arranged order for schema consistency

This commit is contained in:
Joe Topjian 2015-02-13 05:26:35 +00:00 committed by Jon Perritt
parent 4c9a44b69f
commit 79e5c419c3
1 changed files with 4 additions and 5 deletions

View File

@ -122,7 +122,7 @@ func resourceComputeSecGroupV2Read(d *schema.ResourceData, meta interface{}) err
d.Set("name", sg.Name) d.Set("name", sg.Name)
d.Set("description", sg.Description) d.Set("description", sg.Description)
log.Printf("[DEBUG] rulesToMap(sg.Rules): %+v", rulesToMap(sg.Rules)) log.Printf("[DEBUG] rulesToMap(sg.Rules): %+v", rulesToMap(sg.Rules))
d.Set("rules", rulesToMap(sg.Rules)) d.Set("rule", rulesToMap(sg.Rules))
return nil return nil
} }
@ -249,12 +249,11 @@ 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{}{
"to_port": sgr.ToPort,
"from_port": sgr.FromPort,
"id": sgr.ID, "id": sgr.ID,
"ruleID": sgr.ID, "from_port": sgr.FromPort,
"cidr": sgr.IPRange.CIDR, "to_port": sgr.ToPort,
"ip_protocol": sgr.IPProtocol, "ip_protocol": sgr.IPProtocol,
"cidr": sgr.IPRange.CIDR,
} }
} }
return sgrMap return sgrMap