Skip to content

Commit 638eb19

Browse files
committed
changed from type list to type set due to the need to re-create after order of virtualmachineids changed
1 parent 07d8294 commit 638eb19

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cloudstack/resource_cloudstack_loadbalancer.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func resourceCloudStackLoadBalancer() *schema.Resource {
9696

9797
"virtualmachineids": {
9898
Description: "the list of IDs of the virtual machine that are being assigned to the load balancer rule(i.e. virtualMachineIds=1,2,3)",
99-
Type: schema.TypeList,
99+
Type: schema.TypeSet,
100100
Optional: true,
101101
ForceNew: true,
102102
Elem: &schema.Schema{
@@ -132,11 +132,11 @@ func resourceCloudStackLoadBalancerCreate(d *schema.ResourceData, meta interface
132132
}
133133

134134
if v, ok := d.GetOk("virtualmachineids"); ok {
135-
vmIds := v.([]interface{})
135+
vmIds := v.(*schema.Set).List()
136136
for _, vmId := range vmIds {
137-
assignParams := cs.LoadBalancer.NewAssignToLoadBalancerRuleParams(r.Id)
138-
assignParams.SetVirtualmachineids([]string{vmId.(string)})
139-
_, err := cs.LoadBalancer.AssignToLoadBalancerRule(assignParams)
137+
p_update := cs.LoadBalancer.NewAssignToLoadBalancerRuleParams(r.Id)
138+
p_update.SetVirtualmachineids([]string{vmId.(string)})
139+
_, err := cs.LoadBalancer.AssignToLoadBalancerRule(p_update)
140140
if err != nil {
141141
return err
142142
}

0 commit comments

Comments
 (0)