Skip to content

Commit 32735b8

Browse files
committed
Fix reading template in autoscale vm profile resource
If a template is available on multiple zones cloudstack will return the same template ID multiple times for each zone on a call to listTemplates. This behavior causes `GetTemplateByID` function to fail when the template is in multiple zones because it ensures that the list contains a single entry. This behavior caused autoscale vm profile read step to fail when the template was in multiple zones. The fix here is setting the zoneID alongside with the templateID on calls to `GetTemplateByID`.
1 parent f900a63 commit 32735b8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cloudstack/resource_cloudstack_autoscale_vm_profile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func resourceCloudStackAutoScaleVMProfileRead(d *schema.ResourceData, meta inter
136136
return err
137137
}
138138

139-
template, _, err := cs.Template.GetTemplateByID(p.Templateid, "executable")
139+
template, _, err := cs.Template.GetTemplateByID(p.Templateid, "executable", cloudstack.WithZone(p.Zoneid))
140140
if err != nil {
141141
return err
142142
}

0 commit comments

Comments
 (0)