Allow for -1 for Zone ID, which is valid in CloudStack

This commit is contained in:
Hany Fahim 2015-09-24 15:57:25 -04:00
parent 4502c32840
commit 03d7c1fa7d
2 changed files with 10 additions and 2 deletions

View File

@ -219,9 +219,14 @@ func resourceCloudStackTemplateRead(d *schema.ResourceData, meta interface{}) er
d.Set("password_enabled", t.Passwordenabled) d.Set("password_enabled", t.Passwordenabled)
d.Set("is_ready", t.Isready) d.Set("is_ready", t.Isready)
if t.Zoneid == "" {
d.Set("zone", "-1")
} else {
setValueOrUUID(d, "zone", t.Zonename, t.Zoneid)
}
setValueOrUUID(d, "os_type", t.Ostypename, t.Ostypeid) setValueOrUUID(d, "os_type", t.Ostypename, t.Ostypeid)
setValueOrUUID(d, "zone", t.Zonename, t.Zoneid)
return nil return nil
} }

View File

@ -53,6 +53,9 @@ func retrieveUUID(cs *cloudstack.CloudStackClient, name, value string) (uuid str
case "network": case "network":
uuid, err = cs.Network.GetNetworkID(value) uuid, err = cs.Network.GetNetworkID(value)
case "zone": case "zone":
if value == "-1" {
return value, nil
}
uuid, err = cs.Zone.GetZoneID(value) uuid, err = cs.Zone.GetZoneID(value)
case "ipaddress": case "ipaddress":
p := cs.Address.NewListPublicIpAddressesParams() p := cs.Address.NewListPublicIpAddressesParams()