From 79e5c419c3b9ffac4b328966741afb9ce5af4195 Mon Sep 17 00:00:00 2001 From: Joe Topjian Date: Fri, 13 Feb 2015 05:26:35 +0000 Subject: [PATCH] Fixing rule/rules and re-arranged order for schema consistency --- .../openstack/resource_openstack_compute_secgroup_v2.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/builtin/providers/openstack/resource_openstack_compute_secgroup_v2.go b/builtin/providers/openstack/resource_openstack_compute_secgroup_v2.go index 948bfa80b..f1ee715a2 100644 --- a/builtin/providers/openstack/resource_openstack_compute_secgroup_v2.go +++ b/builtin/providers/openstack/resource_openstack_compute_secgroup_v2.go @@ -122,7 +122,7 @@ func resourceComputeSecGroupV2Read(d *schema.ResourceData, meta interface{}) err d.Set("name", sg.Name) d.Set("description", sg.Description) log.Printf("[DEBUG] rulesToMap(sg.Rules): %+v", rulesToMap(sg.Rules)) - d.Set("rules", rulesToMap(sg.Rules)) + d.Set("rule", rulesToMap(sg.Rules)) return nil } @@ -249,12 +249,11 @@ func rulesToMap(sgrs []secgroups.Rule) []map[string]interface{} { sgrMap := make([]map[string]interface{}, len(sgrs)) for i, sgr := range sgrs { sgrMap[i] = map[string]interface{}{ - "to_port": sgr.ToPort, - "from_port": sgr.FromPort, "id": sgr.ID, - "ruleID": sgr.ID, - "cidr": sgr.IPRange.CIDR, + "from_port": sgr.FromPort, + "to_port": sgr.ToPort, "ip_protocol": sgr.IPProtocol, + "cidr": sgr.IPRange.CIDR, } } return sgrMap