Moved project block down
This commit is contained in:
parent
fc89f576ca
commit
7852248f0e
|
@ -130,17 +130,6 @@ func resourceCloudStackTemplateCreate(d *schema.ResourceData, meta interface{})
|
||||||
return e.Error()
|
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
|
// Retrieve the zone UUID
|
||||||
zoneid, e := retrieveUUID(cs, "zone", d.Get("zone").(string))
|
zoneid, e := retrieveUUID(cs, "zone", d.Get("zone").(string))
|
||||||
if e != nil {
|
if e != nil {
|
||||||
|
@ -178,6 +167,17 @@ func resourceCloudStackTemplateCreate(d *schema.ResourceData, meta interface{})
|
||||||
p.SetPasswordenabled(v.(bool))
|
p.SetPasswordenabled(v.(bool))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
}
|
||||||
|
|
||||||
// Create the new template
|
// Create the new template
|
||||||
r, err := cs.Template.RegisterTemplate(p)
|
r, err := cs.Template.RegisterTemplate(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue