diff --git a/builtin/providers/openstack/resource_openstack_compute_instance_v2.go b/builtin/providers/openstack/resource_openstack_compute_instance_v2.go index 63944a684794..e30295e44602 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)