|
|
|
|
@ -51,6 +51,12 @@ func resourceCloudStackTemplate() *schema.Resource {
|
|
|
|
|
ForceNew: true,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
"project": &schema.Schema{
|
|
|
|
|
Type: schema.TypeString,
|
|
|
|
|
Optional: true,
|
|
|
|
|
ForceNew: true,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
"zone": &schema.Schema{
|
|
|
|
|
Type: schema.TypeString,
|
|
|
|
|
Required: true,
|
|
|
|
|
@ -124,6 +130,17 @@ func resourceCloudStackTemplateCreate(d *schema.ResourceData, meta interface{})
|
|
|
|
|
return e.Error()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If there is a project supplied, we retrieve and set the project id
|
|
|
|
|
if project, ok := d.GetOk("project"); ok {
|
|
|
|
|
// Retrieve the project UUID
|
|
|
|
|
projectid, e := retrieveUUID(cs, "project", project.(string))
|
|
|
|
|
if e != nil {
|
|
|
|
|
return e.Error()
|
|
|
|
|
}
|
|
|
|
|
// Set the default project ID
|
|
|
|
|
p.SetProjectid(projectid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Retrieve the zone UUID
|
|
|
|
|
zoneid, e := retrieveUUID(cs, "zone", d.Get("zone").(string))
|
|
|
|
|
if e != nil {
|
|
|
|
|
@ -219,6 +236,8 @@ func resourceCloudStackTemplateRead(d *schema.ResourceData, meta interface{}) er
|
|
|
|
|
d.Set("password_enabled", t.Passwordenabled)
|
|
|
|
|
d.Set("is_ready", t.Isready)
|
|
|
|
|
|
|
|
|
|
setValueOrUUID(d, "project", t.Project, t.Projectid)
|
|
|
|
|
|
|
|
|
|
if t.Zoneid == IS_GLOBAL_RESOURCE {
|
|
|
|
|
setValueOrUUID(d, "zone", t.Zonename, IS_GLOBAL_RESOURCE)
|
|
|
|
|
} else {
|
|
|
|
|
|