provider/openstack: Use security_groups as native set when update
This commit is contained in:
parent
d2cf45a057
commit
59828deb0f
|
@ -601,9 +601,8 @@ func resourceComputeInstanceV2Update(d *schema.ResourceData, meta interface{}) e
|
||||||
|
|
||||||
if d.HasChange("security_groups") {
|
if d.HasChange("security_groups") {
|
||||||
oldSGRaw, newSGRaw := d.GetChange("security_groups")
|
oldSGRaw, newSGRaw := d.GetChange("security_groups")
|
||||||
oldSGSlice, newSGSlice := oldSGRaw.([]interface{}), newSGRaw.([]interface{})
|
oldSGSet := oldSGRaw.(*schema.Set)
|
||||||
oldSGSet := schema.NewSet(func(v interface{}) int { return hashcode.String(v.(string)) }, oldSGSlice)
|
newSGSet := newSGRaw.(*schema.Set)
|
||||||
newSGSet := schema.NewSet(func(v interface{}) int { return hashcode.String(v.(string)) }, newSGSlice)
|
|
||||||
secgroupsToAdd := newSGSet.Difference(oldSGSet)
|
secgroupsToAdd := newSGSet.Difference(oldSGSet)
|
||||||
secgroupsToRemove := oldSGSet.Difference(newSGSet)
|
secgroupsToRemove := oldSGSet.Difference(newSGSet)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue