From 59828deb0ff42ef4e6eb7e825c118701b07172a6 Mon Sep 17 00:00:00 2001 From: Yo Takezawa Date: Wed, 28 Oct 2015 10:11:32 +0900 Subject: [PATCH] provider/openstack: Use security_groups as native set when update --- .../openstack/resource_openstack_compute_instance_v2.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/builtin/providers/openstack/resource_openstack_compute_instance_v2.go b/builtin/providers/openstack/resource_openstack_compute_instance_v2.go index 63944a684..e30295e44 100644 --- a/builtin/providers/openstack/resource_openstack_compute_instance_v2.go +++ b/builtin/providers/openstack/resource_openstack_compute_instance_v2.go @@ -601,9 +601,8 @@ func resourceComputeInstanceV2Update(d *schema.ResourceData, meta interface{}) e if d.HasChange("security_groups") { oldSGRaw, newSGRaw := d.GetChange("security_groups") - oldSGSlice, newSGSlice := oldSGRaw.([]interface{}), newSGRaw.([]interface{}) - oldSGSet := schema.NewSet(func(v interface{}) int { return hashcode.String(v.(string)) }, oldSGSlice) - newSGSet := schema.NewSet(func(v interface{}) int { return hashcode.String(v.(string)) }, newSGSlice) + oldSGSet := oldSGRaw.(*schema.Set) + newSGSet := newSGRaw.(*schema.Set) secgroupsToAdd := newSGSet.Difference(oldSGSet) secgroupsToRemove := oldSGSet.Difference(newSGSet)