@@ -130,17 +130,6 @@ func resourceCloudStackTemplateCreate(d *schema.ResourceData, meta interface{})
130130 return e .Error ()
131131 }
132132
133- // If there is a project supplied, we retrieve and set the project id
134- if project , ok := d .GetOk ("project" ); ok {
135- // Retrieve the project UUID
136- projectid , e := retrieveUUID (cs , "project" , project .(string ))
137- if e != nil {
138- return e .Error ()
139- }
140- // Set the default project ID
141- p .SetProjectid (projectid )
142- }
143-
144133 // Retrieve the zone UUID
145134 zoneid , e := retrieveUUID (cs , "zone" , d .Get ("zone" ).(string ))
146135 if e != nil {
@@ -178,6 +167,17 @@ func resourceCloudStackTemplateCreate(d *schema.ResourceData, meta interface{})
178167 p .SetPasswordenabled (v .(bool ))
179168 }
180169
170+ // If there is a project supplied, we retrieve and set the project id
171+ if project , ok := d .GetOk ("project" ); ok {
172+ // Retrieve the project UUID
173+ projectid , e := retrieveUUID (cs , "project" , project .(string ))
174+ if e != nil {
175+ return e .Error ()
176+ }
177+ // Set the default project ID
178+ p .SetProjectid (projectid )
179+ }
180+
181181 // Create the new template
182182 r , err := cs .Template .RegisterTemplate (p )
183183 if err != nil {
0 commit comments