Skip to content

Commit d678b79

Browse files
author
Sander van Harmelen
committed
Adding docs for the new resource...
1 parent 852e7a3 commit d678b79

3 files changed

Lines changed: 83 additions & 2 deletions

File tree

builtin/providers/cloudstack/resource_cloudstack_template.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ func resourceCloudStackTemplateCreate(d *schema.ResourceData, meta interface{})
167167

168168
// Wait until the template is ready to use, or timeout with an error...
169169
currentTime := time.Now().Unix()
170-
timeout := int64(d.Get("is_ready_timeout").(int))
171170
for {
172171
err := resourceCloudStackTemplateRead(d, meta)
173172
if err != nil {
@@ -178,7 +177,7 @@ func resourceCloudStackTemplateCreate(d *schema.ResourceData, meta interface{})
178177
return nil
179178
}
180179

181-
if time.Now().Unix()-currentTime > timeout {
180+
if time.Now().Unix()-currentTime > d.Get("is_ready_timeout").(int) {
182181
return fmt.Errorf("Timeout while waiting for template to become ready")
183182
}
184183
time.Sleep(5 * time.Second)
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
layout: "cloudstack"
3+
page_title: "CloudStack: cloudstack_template"
4+
sidebar_current: "docs-cloudstack-resource-template"
5+
description: |-
6+
Registers an existing template into the CloudStack cloud.
7+
---
8+
9+
# cloudstack\_template
10+
11+
Registers an existing template into the CloudStack cloud.
12+
13+
## Example Usage
14+
15+
```
16+
resource "cloudstack_template" "centos64" {
17+
name = "CentOS 6.4 x64"
18+
format= "VHD"
19+
hypervisor = "XenServer"
20+
os_type = "CentOS 6.4 (64bit)"
21+
url = "http://someurl.com/template.vhd"
22+
zone = "zone-1"
23+
}
24+
```
25+
26+
## Argument Reference
27+
28+
The following arguments are supported:
29+
30+
* `name` - (Required) The name of the template.
31+
32+
* `display_text` - (Optional) The display name of the template.
33+
34+
* `format` - (Required) The format of the template. Valid values are "QCOW2",
35+
"RAW", and "VHD".
36+
37+
* `hypervisor` - (Required) The target hypervisor for the template. Changing
38+
this forces a new resource to be created.
39+
40+
* `os_type` - (Required) The OS Type that best represents the OS of this
41+
template.
42+
43+
* `url` - (Required) The URL of where the template is hosted. Changing this
44+
forces a new resource to be created.
45+
46+
* `zone` - (Required) The name of the zone where this template will be created.
47+
Changing this forces a new resource to be created.
48+
49+
* `is_dynamically_scalable` - (Optional) Set to indicate if the template contains
50+
tools to support dynamic scaling of VM cpu/memory.
51+
52+
* `is_extractable` - (Optional) Set to indicate if the template is extractable
53+
(defaults false)
54+
55+
* `is_featured` - (Optional) Set to indicate if the template is featured
56+
(defaults false)
57+
58+
* `is_public` - (Optional) Set to indicate if the template is available for
59+
all accounts (defaults true)
60+
61+
* `password_enabled` - (Optional) Set to indicate if the template should be
62+
password enabled (defaults false)
63+
64+
* `is_ready_timeout` - (Optional) The maximum time in seconds to wait until the
65+
template is ready for use (defaults 300 seconds)
66+
67+
## Attributes Reference
68+
69+
The following attributes are exported:
70+
71+
* `id` - The template ID.
72+
* `display_text` - The display text of the template.
73+
* `is_dynamically_scalable` - Set to "true" if the template is dynamically scalable.
74+
* `is_extractable` - Set to "true" if the template is extractable.
75+
* `is_featured` - Set to "true" if the template is featured.
76+
* `is_public` - Set to "true" if the template is public.
77+
* `password_enabled` - Set to "true" if the template is password enabled.
78+
* `is_ready` - Set to "true" once the template is ready for use.

website/source/layouts/cloudstack.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@
5353
<a href="/docs/providers/cloudstack/r/port_forward.html">cloudstack_port_forward</a>
5454
</li>
5555

56+
<li<%= sidebar_current("docs-cloudstack-resource-template") %>>
57+
<a href="/docs/providers/cloudstack/r/template.html">cloudstack_template</a>
58+
</li>
59+
5660
<li<%= sidebar_current("docs-cloudstack-resource-vpc") %>>
5761
<a href="/docs/providers/cloudstack/r/vpc.html">cloudstack_vpc</a>
5862
</li>

0 commit comments

Comments
 (0)