Skip to content

Commit 5aba15e

Browse files
committed
updating website docs
1 parent 9a89e1e commit 5aba15e

12 files changed

+418
-40
lines changed

cloudstack/resource_cloudstack_cluster.go

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
package cloudstack
2121

2222
import (
23-
"errors"
24-
"fmt"
25-
2623
"github.com/apache/cloudstack-go/v2/cloudstack"
2724
"github.com/hashicorp/terraform/helper/schema"
2825
)
@@ -53,12 +50,12 @@ func resourceCloudStackCluster() *schema.Resource {
5350
"guest_vswitch_name": {
5451
Type: schema.TypeString,
5552
Optional: true,
56-
Computed: true,
53+
ForceNew: true,
5754
},
5855
"guest_vswitch_type": {
5956
Type: schema.TypeString,
6057
Optional: true,
61-
Computed: true,
58+
ForceNew: true,
6259
},
6360
"hypervisor": {
6461
Type: schema.TypeString,
@@ -67,32 +64,32 @@ func resourceCloudStackCluster() *schema.Resource {
6764
"ovm3_cluster": {
6865
Type: schema.TypeString,
6966
Optional: true,
70-
Computed: true,
67+
ForceNew: true,
7168
},
7269
"ovm3_pool": {
7370
Type: schema.TypeString,
7471
Optional: true,
75-
Computed: true,
72+
ForceNew: true,
7673
},
7774
"ovm3_vip": {
7875
Type: schema.TypeString,
7976
Optional: true,
80-
Computed: true,
77+
ForceNew: true,
8178
},
8279
"password": {
8380
Type: schema.TypeString,
8481
Optional: true,
85-
Computed: true,
82+
ForceNew: true,
8683
},
8784
"public_vswitch_name": {
8885
Type: schema.TypeString,
8986
Optional: true,
90-
Computed: true,
87+
ForceNew: true,
9188
},
9289
"public_vswitch_type": {
9390
Type: schema.TypeString,
9491
Optional: true,
95-
Computed: true,
92+
ForceNew: true,
9693
},
9794
"pod_id": {
9895
Type: schema.TypeString,
@@ -101,27 +98,27 @@ func resourceCloudStackCluster() *schema.Resource {
10198
"url": {
10299
Type: schema.TypeString,
103100
Optional: true,
104-
Computed: true,
101+
ForceNew: true,
105102
},
106103
"username": {
107104
Type: schema.TypeString,
108105
Optional: true,
109-
Computed: true,
106+
ForceNew: true,
110107
},
111108
"vsm_ip_address": {
112109
Type: schema.TypeString,
113110
Optional: true,
114-
Computed: true,
111+
ForceNew: true,
115112
},
116113
"vsm_password": {
117114
Type: schema.TypeString,
118115
Optional: true,
119-
Computed: true,
116+
ForceNew: true,
120117
},
121118
"vsm_username": {
122119
Type: schema.TypeString,
123120
Optional: true,
124-
Computed: true,
121+
ForceNew: true,
125122
},
126123
"zone_id": {
127124
Type: schema.TypeString,
@@ -133,6 +130,7 @@ func resourceCloudStackCluster() *schema.Resource {
133130

134131
func resourceCloudStackClusterCreate(d *schema.ResourceData, meta interface{}) error {
135132
cs := meta.(*cloudstack.CloudStackClient)
133+
136134
p := cs.Cluster.NewAddClusterParams(d.Get("cluster_name").(string), d.Get("cluster_type").(string), d.Get("hypervisor").(string), d.Get("pod_id").(string), d.Get("zone_id").(string))
137135
if v, ok := d.GetOk("allocation_state"); ok {
138136
p.SetAllocationstate(v.(string))
@@ -192,13 +190,10 @@ func resourceCloudStackClusterCreate(d *schema.ResourceData, meta interface{}) e
192190
func resourceCloudStackClusterRead(d *schema.ResourceData, meta interface{}) error {
193191
cs := meta.(*cloudstack.CloudStackClient)
194192

195-
r, count, err := cs.Cluster.GetClusterByID(d.Id())
193+
r, _, err := cs.Cluster.GetClusterByID(d.Id())
196194
if err != nil {
197195
return err
198196
}
199-
if count != 1 {
200-
return errors.New(fmt.Sprintf("Multiple clusters. Invalid zone id: %s", d.Id()))
201-
}
202197

203198
d.Set("allocation_state", r.Allocationstate)
204199
d.Set("cluster_type", r.Clustertype)

cloudstack/resource_cloudstack_pod.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
package cloudstack
2121

2222
import (
23-
"errors"
24-
"fmt"
25-
2623
"github.com/apache/cloudstack-go/v2/cloudstack"
2724
"github.com/hashicorp/terraform/helper/schema"
2825
)
@@ -93,15 +90,11 @@ func resourceCloudStackPodCreate(d *schema.ResourceData, meta interface{}) error
9390
func resourceCloudStackPodRead(d *schema.ResourceData, meta interface{}) error {
9491
cs := meta.(*cloudstack.CloudStackClient)
9592

96-
r, count, err := cs.Pod.GetPodByID(d.Id())
93+
r, _, err := cs.Pod.GetPodByID(d.Id())
9794
if err != nil {
9895
return err
9996
}
10097

101-
if count != 1 {
102-
return errors.New(fmt.Sprintf("Multiple pods. Invalid zone id: %s", d.Id()))
103-
}
104-
10598
d.Set("allocation_state", r.Allocationstate)
10699
d.Set("end_ip", r.Endip)
107100
d.Set("gateway", r.Gateway)

cloudstack/resource_cloudstack_zone.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ func resourceCloudStackZone() *schema.Resource {
5757
"domain": {
5858
Type: schema.TypeString,
5959
Optional: true,
60-
ForceNew: true,
60+
Computed: true,
6161
},
6262
"domain_id": {
6363
Type: schema.TypeString,
6464
Optional: true,
65+
ForceNew: true,
6566
},
6667
"guest_cidr_address": {
6768
Type: schema.TypeString,

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ require (
88
github.com/hashicorp/hcl v1.0.0 // indirect
99
github.com/hashicorp/terraform v0.12.0
1010
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect
11-
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect
12-
golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef // indirect
1311
gopkg.in/ini.v1 v1.40.0 // indirect
1412
)
1513

14+
replace github.com/apache/cloudstack-go/v2 => /Users/mp/go/src/github.com/poddm/cloudstack-go
15+
1616
go 1.16

go.sum

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ github.com/agl/ed25519 v0.0.0-20150830182803-278e1ec8e8a6/go.mod h1:WPjqKcmVOxf0
2222
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
2323
github.com/antchfx/xpath v0.0.0-20190129040759-c8489ed3251e/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk=
2424
github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M=
25-
github.com/apache/cloudstack-go/v2 v2.13.2 h1:Y06CXNle++Gs24YjeNI7Ot8ZUQjLix2oPn/CMuVr/TU=
26-
github.com/apache/cloudstack-go/v2 v2.13.2/go.mod h1:aosD8Svfu5nhH5Sp4zcsVV1hT5UGt3mTgRXM8YqTKe0=
2725
github.com/apparentlymart/go-cidr v1.0.0 h1:lGDvXx8Lv9QHjrAVP7jyzleG4F9+FkRhJcEsDFxeb8w=
2826
github.com/apparentlymart/go-cidr v1.0.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc=
2927
github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
@@ -349,9 +347,8 @@ golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73r
349347
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
350348
golang.org/x/net v0.0.0-20190502183928-7f726cade0ab/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
351349
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
350+
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
352351
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
353-
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI=
354-
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
355352
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
356353
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
357354
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -378,17 +375,14 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
378375
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
379376
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
380377
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
381-
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
378+
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
382379
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
383-
golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef h1:fPxZ3Umkct3LZ8gK9nbk+DWDJ9fstZa2grBn+lWVKPs=
384-
golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
385380
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
386381
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
387382
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
388383
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
384+
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
389385
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
390-
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
391-
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
392386
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
393387
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
394388
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

website/docs/r/cluster.html.markdown

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
layout: "cloudstack"
3+
page_title: "CloudStack: cloudstack_cluster"
4+
sidebar_current: "docs-cloudstack-resource-cluster"
5+
description: |-
6+
Adds a new cluster
7+
---
8+
9+
# cloudstack_cluster
10+
11+
Adds a new cluster
12+
13+
## Example Usage
14+
15+
Basic usage:
16+
17+
```hcl
18+
resource "cloudstack_cluster" "example" {
19+
cluster_name = "example"
20+
cluster_type = "CloudManaged"
21+
hypervisor = "KVM"
22+
pod_id = cloudstack_pod.example.id
23+
zone_id = cloudstack_zone.example.id
24+
}
25+
```
26+
27+
## Argument Reference
28+
29+
The following arguments are supported:
30+
31+
* `allocation_state` - (Optional) Allocation state of this cluster for allocation of new resources.
32+
* `cluster_name` - (Required) the cluster name.
33+
* `cluster_type` - (Required) type of the cluster: CloudManaged, ExternalManaged.
34+
* `guest_vswitch_name` - (Optional) Name of virtual switch used for guest traffic in the cluster. This would override zone wide traffic label setting..
35+
* `guest_vswitch_type` - (Optional) Type of virtual switch used for guest traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch).
36+
* `hypervisor` - (Required) hypervisor type of the cluster: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator,Ovm3.
37+
* `ovm3_cluster` - (Optional) Ovm3 native OCFS2 clustering enabled for cluster.
38+
* `ovm3_pool` - (Optional) Ovm3 native pooling enabled for cluster.
39+
* `ovm3_vip` - (Optional) Ovm3 vip to use for pool (and cluster).
40+
* `password` - (Optional) the password for the host.
41+
* `public_vswitch_name` - (Optional) Name of virtual switch used for public traffic in the cluster. This would override zone wide traffic label setting..
42+
* `public_vswitch_type` - (Optional) Type of virtual switch used for public traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch).
43+
* `pod_id` - (Required) the Pod ID for the host.
44+
* `url` - (Optional) the URL.
45+
* `username` - (Optional) the username for the cluster.
46+
* `vsm_ip_address` - (Optional) the ipaddress of the VSM associated with this cluster.
47+
* `vsm_password` - (Optional) the password for the VSM associated with this cluster.
48+
* `vsm_username` - (Optional) the username for the VSM associated with this cluster.
49+
* `zone_id` - (Required) the Zone ID for the cluster.
50+
51+
52+
## Attributes Reference
53+
54+
The following attributes are exported:
55+
56+
* `id` - The instance ID.
57+
58+
59+
60+
## Import
61+
62+
Clusters can be imported; use `<CLUSTER ID>` as the import ID. For
63+
example:
64+
65+
```shell
66+
terraform import cloudstack_cluster.example 5cf69677-7e4b-4bf4-b868-f0b02bb72ee0
67+
```
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
layout: "cloudstack"
3+
page_title: "CloudStack: physical_network"
4+
sidebar_current: "docs-cloudstack-resource-physical-network"
5+
description: |-
6+
Creates a physical network
7+
---
8+
9+
# physical_network
10+
11+
Creates a physical network
12+
13+
## Example Usage
14+
15+
Basic usage:
16+
17+
```hcl
18+
resource "cloudstack_physical_network" "example" {
19+
broadcast_domain_range = "ZONE"
20+
isolation_methods = "VLAN"
21+
name = "example"
22+
network_speed = "10G"
23+
tags = "vlan"
24+
zone_id = cloudstack_zone.example.id
25+
}
26+
```
27+
28+
## Argument Reference
29+
30+
The following arguments are supported:
31+
32+
* `broadcast_domain_range` - (Optional) changeme.
33+
* `domain_id` - (Optional) changeme.
34+
* `isolation_methods` - (Optional) changeme.
35+
* `name` - (Required) changeme.
36+
* `network_speed` - (Optional) changeme.
37+
* `tags` - (Optional) changeme.
38+
* `vlan` - (Optional) changeme.
39+
* `zone_id` - (Required) changeme.
40+
41+
42+
## Attributes Reference
43+
44+
The following attributes are exported:
45+
46+
* `id` - The instance ID.
47+
48+
49+
## Import
50+
51+
Physical networks can be imported; use `<PHYSICAL NETWORK ID>` as the import ID. For
52+
example:
53+
54+
```shell
55+
terraform import physical_network.example 5cf69677-7e4b-4bf4-b868-f0b02bb72ee0
56+
```

website/docs/r/pod.html.markdown

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
layout: "cloudstack"
3+
page_title: "CloudStack: cloudstack_pod"
4+
sidebar_current: "docs-cloudstack-resource-pod"
5+
description: |-
6+
Creates a new Pod.
7+
---
8+
9+
# cloudstack_pod
10+
11+
Creates a new Pod.
12+
13+
## Example Usage
14+
15+
Basic usage:
16+
17+
```hcl
18+
resource "cloudstack_pod" "example" {
19+
allocation_state = "Disabled"
20+
gateway = "172.29.0.1"
21+
name = "example"
22+
netmask = "255.255.240.0"
23+
start_ip = "172.29.0.2"
24+
zone_id = cloudstack_zone.example.id
25+
}
26+
```
27+
28+
## Argument Reference
29+
30+
The following arguments are supported:
31+
32+
* `allocation_state` - (Optional) allocation state of this Pod for allocation of new resources.
33+
* `end_ip` - (Optional) the ending IP address for the Pod.
34+
* `gateway` - (Required) the gateway for the Pod.
35+
* `name` - (Required) the name of the Pod.
36+
* `netmask` - (Required) the netmask for the Pod.
37+
* `start_ip` - (Required) the starting IP address for the Pod.
38+
* `zone_id` - (Required) the Zone ID in which the Pod will be created.
39+
40+
41+
## Attributes Reference
42+
43+
The following attributes are exported:
44+
45+
* `id` - The instance ID.
46+
47+
48+
49+
## Import
50+
51+
A pod can be imported; use `<POD ID>` as the import ID. For
52+
example:
53+
54+
```shell
55+
terraform import cloudstack_pod.example 5cf69677-7e4b-4bf4-b868-f0b02bb72ee0
56+
```

0 commit comments

Comments
 (0)