Skip to content

Commit

Permalink
updating website docs
Browse files Browse the repository at this point in the history
  • Loading branch information
poddm committed Aug 18, 2023
1 parent 9a89e1e commit 5aba15e
Show file tree
Hide file tree
Showing 12 changed files with 418 additions and 40 deletions.
35 changes: 15 additions & 20 deletions cloudstack/resource_cloudstack_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
package cloudstack

import (
"errors"
"fmt"

"github.com/apache/cloudstack-go/v2/cloudstack"
"github.com/hashicorp/terraform/helper/schema"
)
Expand Down Expand Up @@ -53,12 +50,12 @@ func resourceCloudStackCluster() *schema.Resource {
"guest_vswitch_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"guest_vswitch_type": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"hypervisor": {
Type: schema.TypeString,
Expand All @@ -67,32 +64,32 @@ func resourceCloudStackCluster() *schema.Resource {
"ovm3_cluster": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"ovm3_pool": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"ovm3_vip": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"password": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"public_vswitch_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"public_vswitch_type": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"pod_id": {
Type: schema.TypeString,
Expand All @@ -101,27 +98,27 @@ func resourceCloudStackCluster() *schema.Resource {
"url": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"username": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"vsm_ip_address": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"vsm_password": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"vsm_username": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"zone_id": {
Type: schema.TypeString,
Expand All @@ -133,6 +130,7 @@ func resourceCloudStackCluster() *schema.Resource {

func resourceCloudStackClusterCreate(d *schema.ResourceData, meta interface{}) error {
cs := meta.(*cloudstack.CloudStackClient)

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))
if v, ok := d.GetOk("allocation_state"); ok {
p.SetAllocationstate(v.(string))
Expand Down Expand Up @@ -192,13 +190,10 @@ func resourceCloudStackClusterCreate(d *schema.ResourceData, meta interface{}) e
func resourceCloudStackClusterRead(d *schema.ResourceData, meta interface{}) error {
cs := meta.(*cloudstack.CloudStackClient)

r, count, err := cs.Cluster.GetClusterByID(d.Id())
r, _, err := cs.Cluster.GetClusterByID(d.Id())
if err != nil {
return err
}
if count != 1 {
return errors.New(fmt.Sprintf("Multiple clusters. Invalid zone id: %s", d.Id()))
}

d.Set("allocation_state", r.Allocationstate)
d.Set("cluster_type", r.Clustertype)
Expand Down
9 changes: 1 addition & 8 deletions cloudstack/resource_cloudstack_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
package cloudstack

import (
"errors"
"fmt"

"github.com/apache/cloudstack-go/v2/cloudstack"
"github.com/hashicorp/terraform/helper/schema"
)
Expand Down Expand Up @@ -93,15 +90,11 @@ func resourceCloudStackPodCreate(d *schema.ResourceData, meta interface{}) error
func resourceCloudStackPodRead(d *schema.ResourceData, meta interface{}) error {
cs := meta.(*cloudstack.CloudStackClient)

r, count, err := cs.Pod.GetPodByID(d.Id())
r, _, err := cs.Pod.GetPodByID(d.Id())
if err != nil {
return err
}

if count != 1 {
return errors.New(fmt.Sprintf("Multiple pods. Invalid zone id: %s", d.Id()))
}

d.Set("allocation_state", r.Allocationstate)
d.Set("end_ip", r.Endip)
d.Set("gateway", r.Gateway)
Expand Down
3 changes: 2 additions & 1 deletion cloudstack/resource_cloudstack_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ func resourceCloudStackZone() *schema.Resource {
"domain": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"domain_id": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"guest_cidr_address": {
Type: schema.TypeString,
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ require (
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/terraform v0.12.0
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect
golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef // indirect
gopkg.in/ini.v1 v1.40.0 // indirect
)

replace github.com/apache/cloudstack-go/v2 => /Users/mp/go/src/github.com/poddm/cloudstack-go

go 1.16
12 changes: 3 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ github.com/agl/ed25519 v0.0.0-20150830182803-278e1ec8e8a6/go.mod h1:WPjqKcmVOxf0
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/antchfx/xpath v0.0.0-20190129040759-c8489ed3251e/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk=
github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M=
github.com/apache/cloudstack-go/v2 v2.13.2 h1:Y06CXNle++Gs24YjeNI7Ot8ZUQjLix2oPn/CMuVr/TU=
github.com/apache/cloudstack-go/v2 v2.13.2/go.mod h1:aosD8Svfu5nhH5Sp4zcsVV1hT5UGt3mTgRXM8YqTKe0=
github.com/apparentlymart/go-cidr v1.0.0 h1:lGDvXx8Lv9QHjrAVP7jyzleG4F9+FkRhJcEsDFxeb8w=
github.com/apparentlymart/go-cidr v1.0.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc=
github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
Expand Down Expand Up @@ -349,9 +347,8 @@ golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190502183928-7f726cade0ab/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand All @@ -378,17 +375,14 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef h1:fPxZ3Umkct3LZ8gK9nbk+DWDJ9fstZa2grBn+lWVKPs=
golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
67 changes: 67 additions & 0 deletions website/docs/r/cluster.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
layout: "cloudstack"
page_title: "CloudStack: cloudstack_cluster"
sidebar_current: "docs-cloudstack-resource-cluster"
description: |-
Adds a new cluster
---

# cloudstack_cluster

Adds a new cluster

## Example Usage

Basic usage:

```hcl
resource "cloudstack_cluster" "example" {
cluster_name = "example"
cluster_type = "CloudManaged"
hypervisor = "KVM"
pod_id = cloudstack_pod.example.id
zone_id = cloudstack_zone.example.id
}
```

## Argument Reference

The following arguments are supported:

* `allocation_state` - (Optional) Allocation state of this cluster for allocation of new resources.
* `cluster_name` - (Required) the cluster name.
* `cluster_type` - (Required) type of the cluster: CloudManaged, ExternalManaged.
* `guest_vswitch_name` - (Optional) Name of virtual switch used for guest traffic in the cluster. This would override zone wide traffic label setting..
* `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).
* `hypervisor` - (Required) hypervisor type of the cluster: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator,Ovm3.
* `ovm3_cluster` - (Optional) Ovm3 native OCFS2 clustering enabled for cluster.
* `ovm3_pool` - (Optional) Ovm3 native pooling enabled for cluster.
* `ovm3_vip` - (Optional) Ovm3 vip to use for pool (and cluster).
* `password` - (Optional) the password for the host.
* `public_vswitch_name` - (Optional) Name of virtual switch used for public traffic in the cluster. This would override zone wide traffic label setting..
* `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).
* `pod_id` - (Required) the Pod ID for the host.
* `url` - (Optional) the URL.
* `username` - (Optional) the username for the cluster.
* `vsm_ip_address` - (Optional) the ipaddress of the VSM associated with this cluster.
* `vsm_password` - (Optional) the password for the VSM associated with this cluster.
* `vsm_username` - (Optional) the username for the VSM associated with this cluster.
* `zone_id` - (Required) the Zone ID for the cluster.


## Attributes Reference

The following attributes are exported:

* `id` - The instance ID.



## Import

Clusters can be imported; use `<CLUSTER ID>` as the import ID. For
example:

```shell
terraform import cloudstack_cluster.example 5cf69677-7e4b-4bf4-b868-f0b02bb72ee0
```
56 changes: 56 additions & 0 deletions website/docs/r/physical_network.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
layout: "cloudstack"
page_title: "CloudStack: physical_network"
sidebar_current: "docs-cloudstack-resource-physical-network"
description: |-
Creates a physical network
---

# physical_network

Creates a physical network

## Example Usage

Basic usage:

```hcl
resource "cloudstack_physical_network" "example" {
broadcast_domain_range = "ZONE"
isolation_methods = "VLAN"
name = "example"
network_speed = "10G"
tags = "vlan"
zone_id = cloudstack_zone.example.id
}
```

## Argument Reference

The following arguments are supported:

* `broadcast_domain_range` - (Optional) changeme.
* `domain_id` - (Optional) changeme.
* `isolation_methods` - (Optional) changeme.
* `name` - (Required) changeme.
* `network_speed` - (Optional) changeme.
* `tags` - (Optional) changeme.
* `vlan` - (Optional) changeme.
* `zone_id` - (Required) changeme.


## Attributes Reference

The following attributes are exported:

* `id` - The instance ID.


## Import

Physical networks can be imported; use `<PHYSICAL NETWORK ID>` as the import ID. For
example:

```shell
terraform import physical_network.example 5cf69677-7e4b-4bf4-b868-f0b02bb72ee0
```
56 changes: 56 additions & 0 deletions website/docs/r/pod.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
layout: "cloudstack"
page_title: "CloudStack: cloudstack_pod"
sidebar_current: "docs-cloudstack-resource-pod"
description: |-
Creates a new Pod.
---

# cloudstack_pod

Creates a new Pod.

## Example Usage

Basic usage:

```hcl
resource "cloudstack_pod" "example" {
allocation_state = "Disabled"
gateway = "172.29.0.1"
name = "example"
netmask = "255.255.240.0"
start_ip = "172.29.0.2"
zone_id = cloudstack_zone.example.id
}
```

## Argument Reference

The following arguments are supported:

* `allocation_state` - (Optional) allocation state of this Pod for allocation of new resources.
* `end_ip` - (Optional) the ending IP address for the Pod.
* `gateway` - (Required) the gateway for the Pod.
* `name` - (Required) the name of the Pod.
* `netmask` - (Required) the netmask for the Pod.
* `start_ip` - (Required) the starting IP address for the Pod.
* `zone_id` - (Required) the Zone ID in which the Pod will be created.


## Attributes Reference

The following attributes are exported:

* `id` - The instance ID.



## Import

A pod can be imported; use `<POD ID>` as the import ID. For
example:

```shell
terraform import cloudstack_pod.example 5cf69677-7e4b-4bf4-b868-f0b02bb72ee0
```
Loading

0 comments on commit 5aba15e

Please sign in to comment.