Copilot commented on code in PR #325:
URL:
https://github.com/apache/cloudstack-terraform-provider/pull/325#discussion_r3796055290
##########
cloudstack/resource_cloudstack_instance.go:
##########
@@ -685,8 +685,8 @@ func resourceCloudStackInstanceUpdate(d
*schema.ResourceData, meta interface{})
if d.HasChange("service_offering") {
log.Printf("[DEBUG] Service offering changed for %s,
starting update", name)
- // Retrieve the service_offering ID
- serviceofferingid, e := retrieveID(cs,
"service_offering", d.Get("service_offering").(string))
+ // Retrieve the service_offering ID (filtered by zone)
+ serviceofferingid, e := retrieveServiceOfferingID(cs,
d.Get("zone").(string), d.Get("service_offering").(string))
if e != nil {
return e.Error()
}
Review Comment:
In Update, `retrieveServiceOfferingID` expects a *zone ID* (it sets
`p.SetZoneid(zoneid)`), but this call passes `d.Get("zone")` directly. The
`zone` attribute can be a zone name (and the state intentionally preserves name
vs ID), so the service offering lookup can fail or return the wrong results
during resize updates. Retrieve the zone ID via `retrieveID` first, like the
Create path does, and pass that ID into `retrieveServiceOfferingID`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]