From 8b51be4e43b9b080adf4eaf6d1eb2357e6570ff3 Mon Sep 17 00:00:00 2001 From: "shenwen.yin" Date: Mon, 24 Feb 2025 17:31:54 +0800 Subject: [PATCH] docs: rerun generate --- docs/data-sources/cloudtower_cluster.md | 69 --- docs/data-sources/cloudtower_datacenter.md | 70 --- docs/data-sources/cloudtower_host.md | 171 ------- docs/data-sources/cloudtower_iso.md | 103 ---- docs/data-sources/cloudtower_svt_iso.md | 101 ---- docs/data-sources/cloudtower_vlan.md | 130 ------ docs/data-sources/cloudtower_vm.md | 153 ------ docs/data-sources/cloudtower_vm_snapshot.md | 174 ------- docs/data-sources/cluster.md | 37 ++ ...late.md => content_library_vm_template.md} | 51 +- docs/data-sources/datacenter.md | 37 ++ docs/data-sources/host.md | 47 ++ docs/data-sources/iso.md | 39 ++ docs/data-sources/svt_iso.md | 43 ++ docs/data-sources/vlan.md | 43 ++ docs/data-sources/vm.md | 44 ++ docs/data-sources/vm_snapshot.md | 77 +++ ...oudtower_vm_template.md => vm_template.md} | 2 +- docs/data-sources/vm_volume.md | 39 ++ docs/index.md | 143 +----- docs/resources/cloudtower_cluster.md | 67 --- docs/resources/cloudtower_vm.md | 439 ------------------ docs/resources/cluster.md | 33 ++ ...late.md => content_library_vm_template.md} | 49 +- ...cloudtower_datacenter.md => datacenter.md} | 13 +- docs/resources/vm.md | 170 +++++++ ...oudtower_vm_snapshot.md => vm_snapshot.md} | 35 +- ...oudtower_vm_template.md => vm_template.md} | 43 +- main.go | 2 +- 29 files changed, 625 insertions(+), 1799 deletions(-) delete mode 100644 docs/data-sources/cloudtower_cluster.md delete mode 100644 docs/data-sources/cloudtower_datacenter.md delete mode 100644 docs/data-sources/cloudtower_host.md delete mode 100644 docs/data-sources/cloudtower_iso.md delete mode 100644 docs/data-sources/cloudtower_svt_iso.md delete mode 100644 docs/data-sources/cloudtower_vlan.md delete mode 100644 docs/data-sources/cloudtower_vm.md delete mode 100644 docs/data-sources/cloudtower_vm_snapshot.md create mode 100644 docs/data-sources/cluster.md rename docs/data-sources/{cloudtower_content_library_vm_template.md => content_library_vm_template.md} (53%) create mode 100644 docs/data-sources/datacenter.md create mode 100644 docs/data-sources/host.md create mode 100644 docs/data-sources/iso.md create mode 100644 docs/data-sources/svt_iso.md create mode 100644 docs/data-sources/vlan.md create mode 100644 docs/data-sources/vm.md create mode 100644 docs/data-sources/vm_snapshot.md rename docs/data-sources/{cloudtower_vm_template.md => vm_template.md} (95%) create mode 100644 docs/data-sources/vm_volume.md delete mode 100644 docs/resources/cloudtower_cluster.md delete mode 100644 docs/resources/cloudtower_vm.md create mode 100644 docs/resources/cluster.md rename docs/resources/{cloudtower_content_library_vm_template.md => content_library_vm_template.md} (51%) rename docs/resources/{cloudtower_datacenter.md => datacenter.md} (54%) create mode 100644 docs/resources/vm.md rename docs/resources/{cloudtower_vm_snapshot.md => vm_snapshot.md} (58%) rename docs/resources/{cloudtower_vm_template.md => vm_template.md} (53%) diff --git a/docs/data-sources/cloudtower_cluster.md b/docs/data-sources/cloudtower_cluster.md deleted file mode 100644 index aad10b7..0000000 --- a/docs/data-sources/cloudtower_cluster.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_cluster Data Source - cloudtower-terraform-provider" -subcategory: "" -description: |- - CloudTower cluster data source. ---- - -# cloudtower_cluster (Data Source) - -CloudTower cluster data source. - - - - -## Schema - -### Optional - -- `name` (String) filter clusters by name -- `name_contains` (String) filter clusters by name contain a certain string -- `name_in` (List of String) filter clusters by name as an array - -### Read-Only - -- `clusters` (List of Object) list of clusters (see [below for nested schema](#nestedatt--clusters)) -- `id` (String) The ID of this resource. - - -### Nested Schema for `clusters` - -Read-Only: - -- `id` (String) -- `name` (String) - -## Usage - -All arguments are optional, and if multiple arguments are provided, they are ANDed together. - -### Use name to get a specific cluster - -use name will search a cluster by its name directly. Return of the data source will be a list, even if there is only one cluster found, use index 0 to get the cluster. - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} -``` - -### Use name_contains to fuzzy search clusters - -use name_contains will search clusters by its name contains a certain string. Return a list of clusters, use index to get the cluster. - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name_contains = "sample" -} -``` - -### Use name_in to search clusters in name array - -use name_in will search clusters by its name in a certain array. Return a list of clusters, use index to get the cluster. - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name_in = ["sample_cluster", "sample_cluster2"] -} -``` \ No newline at end of file diff --git a/docs/data-sources/cloudtower_datacenter.md b/docs/data-sources/cloudtower_datacenter.md deleted file mode 100644 index 2e96e65..0000000 --- a/docs/data-sources/cloudtower_datacenter.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_datacenter Data Source - cloudtower-terraform-provider" -subcategory: "" -description: |- - CloudTower datacenter data source. ---- - -# cloudtower_datacenter (Data Source) - -CloudTower datacenter data source. - - - - -## Schema - -### Optional - -- `name` (String) filter datacenters by name -- `name_contains` (String) filter datacenters by name contain a certain string -- `name_in` (List of String) filter datacenters by name as an array - -### Read-Only - -- `datacenters` (List of Object) list of datacenters (see [below for nested schema](#nestedatt--datacenters)) -- `id` (String) The ID of this resource. - - -### Nested Schema for `datacenters` - -Read-Only: - -- `id` (String) -- `name` (String) - -## Usage - -All arguments are optional, and if multiple arguments are provided, they are ANDed together. - -### Use name to get a specific datacenter - -use name will search a datacenter by its name directly. Return of the data source will be a list, even if there is only one datacenter found, use index 0 to get the datacenter. - -```hcl -data "cloudtower_datacenter" "sample_datacenter" { - name = "sample_datacenter" -} -``` - -### Use name_contains to fuzzy search datacenters - -use name_contains will search datacenters by its name contains a certain string. Return a list of datacenters, use index to get the datacenter. - -```hcl -data "cloudtower_datacenter" "sample_datacenter" { - name_contains = "sample" -} -``` - -### Use name_in to search datacenters in name array - -use name_in will search datacenters by its name in a certain array. Return a list of datacenters, use index to get the datacenter. - -```hcl -data "cloudtower_datacenter" "sample_datacenter" { - name_in = ["sample1", "sample2"] -} -``` - diff --git a/docs/data-sources/cloudtower_host.md b/docs/data-sources/cloudtower_host.md deleted file mode 100644 index c2fee73..0000000 --- a/docs/data-sources/cloudtower_host.md +++ /dev/null @@ -1,171 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_host Data Source - cloudtower-terraform-provider" -subcategory: "" -description: |- - CloudTower host data source. ---- - -# cloudtower_host (Data Source) - -CloudTower host data source. - - - - -## Schema - -### Optional - -- `cluster_id` (String) filter hosts by cluster id -- `cluster_id_in` (List of String) filter datacenters by cluster id as an array -- `data_ip` (String) filter hosts by data IP -- `data_ip_contains` (String) filter hosts by data IP contain a certain string -- `data_ip_in` (List of String) filter datacenters by data ip as an array -- `management_ip` (String) filter hosts by management IP -- `management_ip_contains` (String) filter hosts by management IP contain a certain string -- `management_ip_in` (List of String) filter datacenters by management ip as an array -- `name` (String) filter hosts by name -- `name_contains` (String) filter hosts by name contain a certain string -- `name_in` (List of String) filter data source by name as an array - -### Read-Only - -- `hosts` (List of Object) list of hosts (see [below for nested schema](#nestedatt--hosts)) -- `id` (String) The ID of this resource. - - -### Nested Schema for `hosts` - -Read-Only: - -- `data_ip` (String) -- `id` (String) -- `management_ip` (String) -- `name` (String) - - -## Usage - -All arguments are optional, and if multiple arguments are provided, they are ANDed together. - -### Use name to get a specific host - -use name will search a host by its name directly. Return of the data source will be a list, even if there is only one host found, use index 0 to get the host. - -```hcl -data "cloudtower_host" "sample_host" { - name = "sample_host" -} -``` - -### Use name_contains to fuzzy search hosts - -use name_contains will search hosts by its name contains a certain string. Return a list of hosts, use index to get the host. - -```hcl -data "cloudtower_host" "sample_host" { - name_contains = "sample" -} -``` - -### Use name_in to search hosts in name array - -use name_in will search hosts by its name in a certain array. Return a list of hosts, use index to get the host. - -```hcl -data "cloudtower_host" "sample_host" { - name_in = ["sample1", "sample2"] -} -``` - -### Use management_ip to get a specific host - -use management_ip will search a host by its management_ip directly. Return of the data source will be a list, even if there is only one host found, use index 0 to get the host. - -```hcl -data "cloudtower_host" "sample_host" { - management_ip = "192.168.1.1" -} -``` - -### Use management_ip_contains to fuzzy search hosts - -use management_ip_contains will search hosts by its management_ip contains a certain string. Return a list of hosts, use index to get the host. - -```hcl -data "cloudtower_host" "sample_host" { - management_ip_contains = "31.16" -} -``` - -### Use management_ip_in to search hosts in management_ip array - -use management_ip_in will search hosts by its management_ip in a certain array. Return a list of hosts, use index to get the host. - -```hcl -data "cloudtower_host" "sample_host" { - management_ip_in = ["192.168.1.1", "192.168.1.2"] -} -``` - -### Use data_ip to get a specific host - -use data_ip will search a host by its data_ip directly. Return of the data source will be a list, even if there is only one host found, use index 0 to get the host. - -```hcl -data "cloudtower_host" "sample_host" { - data_ip = "10.0.1.1" -} -``` - -### Use data_ip_contains to fuzzy search hosts - -use data_ip_contains will search hosts by its data_ip contains a certain string. Return a list of hosts, use index to get the host. - -```hcl -data "cloudtower_host" "sample_host" { - data_ip_contains = "255.255" -} -``` - -### Use data_ip_in to search hosts in data_ip array - -use data_ip_in will search hosts by its data_ip in a certain array. Return a list of hosts, use index to get the host. - -```hcl -data "cloudtower_host" "sample_host" { - data_ip_in = ["10.0.1.1", "10.0.255.255"] -} - -``` - -### Use cluster_id to get host in a specific cluster - -use cluster_id will search hosts in a specific cluster. Return a list of hosts, use index to get the host. - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_host" "sample_host" { - cluster_id = data.cloudtower_cluster.sample_cluster.clusters[0].clusters[0].id -} -``` - -### Use cluster_id_in to get hosts in a one of clusters - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_host" "sample_host" { - cluster_id_in = [data.cloudtower_cluster.sample_cluster.clusters[0].clusters[0].id] -} -``` - - - - diff --git a/docs/data-sources/cloudtower_iso.md b/docs/data-sources/cloudtower_iso.md deleted file mode 100644 index 7a0d06f..0000000 --- a/docs/data-sources/cloudtower_iso.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_iso Data Source - cloudtower-terraform-provider" -subcategory: "" -description: |- - CloudTower iso data source. ---- - -# cloudtower_iso (Data Source) - -CloudTower iso data source. - - - - -## Schema - -### Optional - -- `cluster_id` (String) filter ISOs by cluster id -- `cluster_id_in` (List of String) filter iso by cluster id as an array -- `name` (String) filter ISOs by name -- `name_contains` (String) filter ISOs by name contain a certain string -- `name_in` (List of String) filter iso by name as an array - -### Read-Only - -- `id` (String) The ID of this resource. -- `isos` (List of Object) list of ISOs (see [below for nested schema](#nestedatt--isos)) - - -### Nested Schema for `isos` - -Read-Only: - -- `id` (String) -- `name` (String) - - -## Usage - -All arguments are optional, and if multiple arguments are provided, they are ANDed together. - -### Use name to get a specific image - -use name will search a image by its name directly. Return of the data source will be a list, even if there is only one image found, use index 0 to get the image. - -```hcl -data "cloudtower_iso" "sample_iso" { - name = "sample_iso" -} -``` - -### Use name_contains to fuzzy search images - -use name_contains will search images by its name contains a certain string. Return a list of images, use index to get the image. - -```hcl -data "cloudtower_iso" "sample_iso" { - name_contains = "sample" -} -``` - -### Use name_in to search images in name array - -use name_in will search images by its name in a certain array. Return a list of images, use index to get the image. - -```hcl -data "cloudtower_iso" "sample_iso" { - name_in = ["sample_iso", "sample_iso2"] -} -``` - -### Use cluster_id to get a specific image stored in a cluster - -use cluster_id will search a image by its cluster id directly. Return of the data source will be a list, even if there is only one image found, use index 0 to get the image. - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_iso" "sample_iso" { - cluster_id = data.cloudtower_cluster.sample_cluster.clusters[0].id -} -``` - -### Use cluster_id_in to search images stored in clusters - -use cluster_id_in will search images by its cluster id in a certain array. Return a list of images, use index to get the image, recommend to use cluster_id, as vm could only mount svt iso directly from cluster it runs on. - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_iso" "sample_iso" { - cluster_id_in = [data.cloudtower_cluster.sample_cluster.clusters[0].id] -} -``` - - - diff --git a/docs/data-sources/cloudtower_svt_iso.md b/docs/data-sources/cloudtower_svt_iso.md deleted file mode 100644 index 50de70d..0000000 --- a/docs/data-sources/cloudtower_svt_iso.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_svt_iso Data Source - cloudtower-terraform-provider" -subcategory: "" -description: |- - CloudTower vmtools iso data source. ---- - -# cloudtower_svt_iso (Data Source) - -CloudTower vmtools iso data source. - - - - -## Schema - -### Optional - -- `cluster_id` (String) filter svt ISOs by cluster id -- `cluster_id_in` (List of String) filter svt ISOs by cluster id in -- `name` (String) filter svt ISOs by name -- `name_contains` (String) filter svt ISOs by name contain a certain string -- `name_in` (List of String) filter svt ISOs by name in -- `version` (Number) filter svt ISOs by version -- `version_gte` (Number) filter svt ISOs by version greater than or equal to -- `version_in` (List of Number) filter svt ISOs by version in - -### Read-Only - -- `id` (String) The ID of this resource. -- `isos` (List of Object) list of ISOs (see [below for nested schema](#nestedatt--isos)) - - -### Nested Schema for `isos` - -Read-Only: - -- `id` (String) -- `name` (String) -- `version` (Number) - -### Usage - -All arguments are optional, and if multiple arguments are provided, they are ANDed together. - -### Use name to get a specific image - -use name will search a image by its name directly. Return of the data source will be a list, even if there is only one image found, use index 0 to get the image. - -```hcl -data "cloudtower_svt_iso" "sample_iso" { - name = "sample_iso" -} -``` - -### Use name_contains to fuzzy search images - -use name_contains will search images by its name contains a certain string. Return a list of images, use index to get the image. - -```hcl -data "cloudtower_svt_iso" "sample_iso" { - name_contains = "sample" -} -``` - -### Use name_in to search images in name array - -use name_in will search images by its name in a certain array. Return a list of images, use index to get the image. - -```hcl -data "cloudtower_svt_iso" "sample_iso" { - name_in = ["sample_iso", "sample_iso2"] -} -``` - -### Use cluster_id to get a specific image stored in a cluster - -use cluster_id will search a image by its cluster id directly. Return of the data source will be a list, even if there is only one image found, use index 0 to get the image. - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} -data "cloudtower_svt_iso" "sample_iso" { - cluster_id = data.cloudtower_cluster.sample_cluster.clusters[0].clusters[0].id -} -``` - -### Use cluster_id_in to search images stored in a cluster in a certain array - -use cluster_id_in will search images by its cluster id in a certain array. Return a list of images, use index to get the image. Recommend to use cluster_id, as vm could only mount svt iso directly from cluster it runs on. - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} -data "cloudtower_svt_iso" "sample_iso" { - cluster_id_in = [data.cloudtower_cluster.sample_cluster.clusters[0].clusters[0].id] -} -``` diff --git a/docs/data-sources/cloudtower_vlan.md b/docs/data-sources/cloudtower_vlan.md deleted file mode 100644 index 6385213..0000000 --- a/docs/data-sources/cloudtower_vlan.md +++ /dev/null @@ -1,130 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_vlan Data Source - cloudtower-terraform-provider" -subcategory: "" -description: |- - CloudTower vlan data source. ---- - -# cloudtower_vlan (Data Source) - -CloudTower vlan data source. - - - - -## Schema - -### Optional - -- `cluster_id` (String) filter vlans by cluster id -- `cluster_id_in` (List of String) filter vlans by cluster id as array -- `name` (String) filter vlans by name -- `name_contains` (String) filter vlans by name contain a certain string -- `name_in` (List of String) filter vlans by name -- `type` (String) filter vlans by type -- `type_in` (List of String) filter vlans by type as array - -### Read-Only - -- `id` (String) The ID of this resource. -- `vlans` (List of Object) list of vlans (see [below for nested schema](#nestedatt--vlans)) - - -### Nested Schema for `vlans` - -Read-Only: - -- `cluster_id` (String) -- `id` (String) -- `name` (String) -- `type` (String) - -### Usage - -All arguments are optional, and if multiple arguments are provided, they are ANDed together. - -### Use name to get a specific vlan - -use name will search a vlan by its name directly. Return of the data source will be a list, even if there is only one vlan found, use index 0 to get the vlan. - -```hcl -data "cloudtower_vlan" "sample_vlan" { - name = "sample_vlan" -} -``` - -### Use name_contains to fuzzy search vlans - -use name_contains will search vlans by its name contains a certain string. Return a list of vlans, use index to get the vlan. - -```hcl -data "cloudtower_vlan" "sample_vlan" { - name_contains = "sample" -} -``` - -### Use name_in to search vlans in name array - -use name_in will search vlans by its name in a certain array. Return a list of vlans, use index to get the vlan. - -```hcl -data "cloudtower_vlan" "sample_vlan" { - name_in = ["sample_vlan", "sample_vlan2"] -} -``` - -### Use type to get a filter vlans by type - -filter vlan by type, return a list of vlans, use index to get the vlan, recommand to use with other filters. - -Only accept `"ACCESS", "MANAGEMENT", "MIGRATION", "STORAGE", "VM"` - -```hcl -data "cloudtower_vlan" "sample_vlan" { - type = "VM" - name = "sample_vlan" -} -``` - -### Use type_in to filter vlans by type as array - -filter vlans by type in a certain array, return a list of vlans, use index to get the vlan, recommand to use with other filters. - -Only accept `"ACCESS", "MANAGEMENT", "MIGRATION", "STORAGE", "VM"` - -```hcl -data "cloudtower_vlan" "sample_vlan" { - type_in = ["VM", "STORAGE"] - name = "sample_vlan" -} -``` - -### Use cluster_id to get a specific vlan stored in a cluster - -use cluster_id will search a vlan by its cluster id directly. Return a list of vlans, use index to get the vlan. - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_vlan" "sample_vlan" { - cluster_id = data.cloudtower_cluster.sample_cluster.clusters[0].clusters[0].id -} -``` - -### Use cluster_id_in to search vlans stored in clusters - -use cluster_id_in will search vlans by its cluster id in a certain array. Return a list of vlans, use index to get the vlan, recommand to use with other filters. - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_vlan" "sample_vlan" { - cluster_id_in = [data.cloudtower_cluster.sample_cluster.clusters[0].clusters[0].id] - name = "sample_vlan" -} -``` \ No newline at end of file diff --git a/docs/data-sources/cloudtower_vm.md b/docs/data-sources/cloudtower_vm.md deleted file mode 100644 index 2325e38..0000000 --- a/docs/data-sources/cloudtower_vm.md +++ /dev/null @@ -1,153 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_vm Data Source - cloudtower-terraform-provider" -subcategory: "" -description: |- - CloudTower vm data source. ---- - -# cloudtower_vm (Data Source) - -CloudTower vm data source. - - - - -## Schema - -### Optional - -- `cluster_id` (String) filter VMs by cluster id -- `cluster_id_in` (List of String) filter VMs by cluster id in an array -- `host_id` (String) filter VMs by host id -- `host_id_in` (List of String) filter VMs by host id in an array -- `name` (String) filter VMs by name -- `name_contains` (String) filter VMs by name contain a certain string -- `name_in` (List of String) filter VMs by name in an array -- `status` (String) filter VMs by status -- `status_in` (List of String) filter VMs by status in an array - -### Read-Only - -- `id` (String) The ID of this resource. -- `vms` (List of Object) list of VMs (see [below for nested schema](#nestedatt--vms)) - - -### Nested Schema for `vms` - -Read-Only: - -- `id` (String) -- `name` (String) -- `status` (String) - - -### Usage - -All arguments are optional, and if multiple arguments are provided, they are ANDed together. - -### Use name to get a specific VM - -use name will search a VM by its name directly. Return of the data source will be a list, even if there is only one VM found, use index 0 to get the VM. - -```hcl -data "cloudtower_vm" "sample_vm" { - name = "sample_vm" -} -``` - -### Use name_contains to fuzzy search VMs - -use name_contains will search VMs by its name contains a certain string. Return a list of VMs, use index to get the VM. - -```hcl -data "cloudtower_vm" "sample_vm" { - name_contains = "sample" -} -``` - -### Use name_in to search VMs in name array - -use name_in will search VMs by its name in a certain array. Return a list of VMs, use index to get the VM. - -```hcl -data "cloudtower_vm" "sample_vm" { - name_in = ["sample_vm", "sample_vm2"] -} -``` - -### Use status to get a filter VMs by power status - -use status will search VMs by its power status. Return a list of VMs, use index to get the VM. - -only accept `"RUNNING", "STOPPED", "SUSPENDED"` - -```hcl -data "cloudtower_vm" "sample_vm" { - status = "RUNNING" -} -``` - -### Use status_in to search VMs in status array - -use status_in will search VMs by its power status in a certain array. Return a list of VMs, use index to get the VM. - -only accept `"RUNNING", "STOPPED", "SUSPENDED"` - -```hcl -data "cloudtower_vm" "sample_vm" { - status_in = ["RUNNING", "STOPPED"] -} -``` - -### Use cluster_id to get VMs run on a specific cluster - -use cluster_id will search VMs by its cluster id it runs on. Return a list of VMs, use index to get the VM. - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_vm" "sample_vm" { - cluster_id = data.cloudtower_cluster.sample_cluster.clusters[0].id -} -``` - -### Use cluster_id_in to search VMs run on multiple clusters - -use cluster_id_in will search VMs run on multiple clusters. Return a list of VMs, use index to get the VM. - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_vm" "sample_vm" { - cluster_id_in = [data.cloudtower_cluster.sample_cluster.clusters[0].id, data.cloudtower_cluster.sample_cluster.clusters[1].id] -} -``` - -### Use host_id to get VMs run on a specific host - -use host_id will search VMs by its host id it runs on. Return a list of VMs, use index to get the VM. - -```hcl -data "cloudtower_host" "sample_host" { - name = "sample_host" -} - -data "cloudtower_vm" "sample_vm" { - host_id = data.cloudtower_host.sample_host.hosts[0].id -} -``` - -### Use host_id_in to search VMs run on multiple hosts - -use host_id_in will search VMs run on multiple hosts. Return a list of VMs, use index to get the VM. - -```hcl -data "cloudtower_host" "sample_host" { - name = "sample_host" -} -``` \ No newline at end of file diff --git a/docs/data-sources/cloudtower_vm_snapshot.md b/docs/data-sources/cloudtower_vm_snapshot.md deleted file mode 100644 index 6e3152c..0000000 --- a/docs/data-sources/cloudtower_vm_snapshot.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_vm_snapshot Data Source - cloudtower-terraform-provider" -subcategory: "" -description: |- - CloudTower vm snapshot data source. ---- - -# cloudtower_vm_snapshot (Data Source) - -CloudTower vm snapshot data source. - - - - -## Schema - -### Optional - -- `name` (String) vm snapshot's name -- `name_contains` (String) filter vm snapshot by its name contains characters -- `name_in` (List of String) vm snapshot's name as an array -- `vm_id` (String) vm's id of the snapshot -- `vm_id_in` (List of String) vm's id of the snapshot as an array - -### Read-Only - -- `id` (String) The ID of this resource. -- `vm_snapshots` (List of Object) list of queried vm snapshots (see [below for nested schema](#nestedatt--vm_snapshots)) - - -### Nested Schema for `vm_snapshots` - -Read-Only: - -- `cd_roms` (List of Object) (see [below for nested schema](#nestedobjatt--vm_snapshots--cd_roms)) -- `create_time` (String) -- `disks` (List of Object) (see [below for nested schema](#nestedobjatt--vm_snapshots--disks)) -- `id` (String) -- `name` (String) -- `nics` (List of Object) (see [below for nested schema](#nestedobjatt--vm_snapshots--nics)) - - -### Nested Schema for `vm_snapshots.cd_roms` - -Read-Only: - -- `boot` (Number) -- `elf_image_id` (String) -- `svt_image_id` (String) - - - -### Nested Schema for `vm_snapshots.disks` - -Read-Only: - -- `boot` (Number) -- `bus` (String) -- `name` (String) -- `path` (String) -- `size` (Number) -- `storage_policy` (String) - - - -### Nested Schema for `vm_snapshots.nics` - -Read-Only: - -- `enabled` (Boolean) -- `idx` (Number) -- `mirror` (Boolean) -- `model` (String) -- `vlan_id` (String) - - -### Usage - -All arguments are optional, and if multiple arguments are provided, they are ANDed together. - -### Use name to get a specific vm snapshot - -use name will search a vm snapshot by its name directly. Return of the data source will be a list, even if there is only one vm snapshot found, use index 0 to get the vm snapshot. - -```hcl -data "cloudtower_vm_snapshot" "sample_vm_snapshot" { - name = "sample_vm_snapshot" -} -``` - -### Use name_contains to fuzzy search vm snapshots - -use name_contains will search vm snapshots by its name contains a certain string. Return a list of vm snapshots, use index to get the vm snapshot. - -```hcl -data "cloudtower_vm_snapshot" "sample_vm_snapshot" { - name_contains = "sample" -} -``` - -### Use name_in to search vm snapshots in name array - -use name_in will search vm snapshots by its name in a certain array. Return a list of vm snapshots, use index to get the vm snapshot. - -```hcl -data "cloudtower_vm_snapshot" "sample_vm_snapshot" { - name_in = ["sample_vm_snapshot", "sample_vm_snapshot2"] -} -``` - -### Use vm_id to get snapshot of a specific vm - -use vm_id will search a vm snapshot by its vm id directly. Return a list of vm snapshots, use index to get the vm snapshot. - -```hcl -data "cloudtower_vm" "sample_vm" { - name = "sample_vm" -} - -data "cloudtower_vm_snapshot" "sample_vm_snapshot" { - vm_id = data.cloudtower_vm.sample_vm.vms[0].id -} -``` - -### Use vm_id_in to search vm snapshots of vms - -use vm_id_in will search vm snapshots by its vm id in a certain array. Return a list of vm snapshots, use index to get the vm snapshot. - -```hcl -data "cloudtower_vm" "sample_vm" { - name = "sample_vm" -} - -data "cloudtower_vm_snapshot" "sample_vm_snapshot" { - vm_id_in = [data.cloudtower_vm.sample_vm.vms[0].id, data.cloudtower_vm.sample_vm.vms[1].id] -} -``` - -### rollback vm to specific snapshot - -if an snapshot is not managed by terraform, and you want to rollback vm to that snapshot, you can use this data source to get the snapshot id, and use it in cloudtower_vm resource. - -```hcl - -data "cloudtower_vm_snapshot" "sample_vm_snapshot" { - name = "sample_vm_snapshot" -} - -// here is an vm already been managed by terraform, rollback_to will not take effect when create vm. -resource "cloudtower_vm" "sample_vm" { - name = "sample_vm" - # ... any other vm configuration - rollback_to = data.cloudtower_vm_snapshot.sample_vm_snapshot.vm_snapshots[0].id -} -``` - -### rebuild vm from specific snapshot - -if an snapshot is not managed by terraform, and you want to rebuild vm from that snapshot, you can use this data source to get the snapshot id, and use it in cloudtower_vm resource. - -```hcl -data "cloudtower_vm_snapshot" "sample_vm_snapshot" { - name = "sample_vm_snapshot" -} - -resource "cloudtower_vm" "sample_vm_rebuild" { - name = "tf-test-vm-from-snapshot" - cluster_id = cloudtower_cluster.sample_cluster.id - create_effect { - rebuild_from_snapshot = data.cloudtower_vm_snapshot.sample_vm_snapshot.vm_snapshots[0].id - } -} -``` \ No newline at end of file diff --git a/docs/data-sources/cluster.md b/docs/data-sources/cluster.md new file mode 100644 index 0000000..53930e5 --- /dev/null +++ b/docs/data-sources/cluster.md @@ -0,0 +1,37 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cloudtower_cluster Data Source - terraform-provider-cloudtower" +subcategory: "" +description: |- + CloudTower cluster data source. +--- + +# cloudtower_cluster (Data Source) + +CloudTower cluster data source. + + + + +## Schema + +### Optional + +- `name` (String) filter clusters by name +- `name_contains` (String) filter clusters by name contain a certain string +- `name_in` (List of String) filter clusters by name as an array + +### Read-Only + +- `clusters` (List of Object) list of clusters (see [below for nested schema](#nestedatt--clusters)) +- `id` (String) The ID of this resource. + + +### Nested Schema for `clusters` + +Read-Only: + +- `id` (String) +- `name` (String) + + diff --git a/docs/data-sources/cloudtower_content_library_vm_template.md b/docs/data-sources/content_library_vm_template.md similarity index 53% rename from docs/data-sources/cloudtower_content_library_vm_template.md rename to docs/data-sources/content_library_vm_template.md index f23bd42..6468e9d 100644 --- a/docs/data-sources/cloudtower_content_library_vm_template.md +++ b/docs/data-sources/content_library_vm_template.md @@ -1,6 +1,6 @@ --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_content_library_vm_template Data Source - cloudtower-terraform-provider" +page_title: "cloudtower_content_library_vm_template Data Source - terraform-provider-cloudtower" subcategory: "" description: |- CloudTower content library vm template data source. @@ -18,6 +18,7 @@ CloudTower content library vm template data source. ### Optional - `cluster_id_in` (List of String) the cluster id which template has already distributed to. +- `cluster_in` (List of String, Deprecated) the cluster id which template has already distributed to. - `name` (String) content library vm template's name - `name_contains` (String) filter content_library vm template by its name contains characters - `name_in` (String) content library vm template's name as an array @@ -72,51 +73,3 @@ Read-Only: - `vlan_id` (String) -### Usage - -All arguments are optional, and if multiple arguments are provided, they are ANDed together. - -### Use name to get a specific content library vm template - -use name will search a content library vm template by its name directly. Return of the data source will be a list, even if there is only one content library vm template found, use index 0 to get the content library vm template. - -```hcl -data "cloudtower_content_library_vm_template" "sample_content_library_vm_template" { - name = "sample_content_library_vm_template" -} -``` - -### Use name_contains to fuzzy search content library vm templates - -use name_contains will search content library vm templates by its name contains a certain string. Return a list of content library vm templates, use index to get the content library vm template. - -```hcl -data "cloudtower_content_library_vm_template" "sample_content_library_vm_template" { - name_contains = "sample" -} -``` - -### Use name_in to search content library vm templates in name array - -use name_in will search content library vm templates by its name in a certain array. Return a list of content library vm templates, use index to get the content library vm template. - -```hcl -data "cloudtower_content_library_vm_template" "sample_content_library_vm_template" { - name_in = ["sample1", "sample2"] -} -``` - -### Use cluster_id_in to restrict the content library vm template already distributed to certain clusters - -if need to search content library vm template already been distributed to certain clusters, use cluster_in to restrict the search. Recommand to use with other filters. - -```hcl -data "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_content_library_vm_template" "sample_content_library_vm_template" { - name_contains = "sample" - cluster_id_in = [data.cloudtower_cluster.sample_cluster.clusters[0].clusters[0].id] -} -``` \ No newline at end of file diff --git a/docs/data-sources/datacenter.md b/docs/data-sources/datacenter.md new file mode 100644 index 0000000..cad299b --- /dev/null +++ b/docs/data-sources/datacenter.md @@ -0,0 +1,37 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cloudtower_datacenter Data Source - terraform-provider-cloudtower" +subcategory: "" +description: |- + CloudTower datacenter data source. +--- + +# cloudtower_datacenter (Data Source) + +CloudTower datacenter data source. + + + + +## Schema + +### Optional + +- `name` (String) filter datacenters by name +- `name_contains` (String) filter datacenters by name contain a certain string +- `name_in` (List of String) filter datacenters by name as an array + +### Read-Only + +- `datacenters` (List of Object) list of datacenters (see [below for nested schema](#nestedatt--datacenters)) +- `id` (String) The ID of this resource. + + +### Nested Schema for `datacenters` + +Read-Only: + +- `id` (String) +- `name` (String) + + diff --git a/docs/data-sources/host.md b/docs/data-sources/host.md new file mode 100644 index 0000000..0c89245 --- /dev/null +++ b/docs/data-sources/host.md @@ -0,0 +1,47 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cloudtower_host Data Source - terraform-provider-cloudtower" +subcategory: "" +description: |- + CloudTower host data source. +--- + +# cloudtower_host (Data Source) + +CloudTower host data source. + + + + +## Schema + +### Optional + +- `cluster_id` (String) filter hosts by cluster id +- `cluster_id_in` (List of String) filter datacenters by cluster id as an array +- `data_ip` (String) filter hosts by data IP +- `data_ip_contains` (String) filter hosts by data IP contain a certain string +- `data_ip_in` (List of String) filter datacenters by data ip as an array +- `management_ip` (String) filter hosts by management IP +- `management_ip_contains` (String) filter hosts by management IP contain a certain string +- `management_ip_in` (List of String) filter datacenters by management ip as an array +- `name` (String) filter hosts by name +- `name_contains` (String) filter hosts by name contain a certain string +- `name_in` (List of String) filter data source by name as an array + +### Read-Only + +- `hosts` (List of Object) list of hosts (see [below for nested schema](#nestedatt--hosts)) +- `id` (String) The ID of this resource. + + +### Nested Schema for `hosts` + +Read-Only: + +- `data_ip` (String) +- `id` (String) +- `management_ip` (String) +- `name` (String) + + diff --git a/docs/data-sources/iso.md b/docs/data-sources/iso.md new file mode 100644 index 0000000..ea2b77a --- /dev/null +++ b/docs/data-sources/iso.md @@ -0,0 +1,39 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cloudtower_iso Data Source - terraform-provider-cloudtower" +subcategory: "" +description: |- + CloudTower iso data source. +--- + +# cloudtower_iso (Data Source) + +CloudTower iso data source. + + + + +## Schema + +### Optional + +- `cluster_id` (String) filter ISOs by cluster id +- `cluster_id_in` (List of String) filter iso by cluster id as an array +- `name` (String) filter ISOs by name +- `name_contains` (String) filter ISOs by name contain a certain string +- `name_in` (List of String) filter iso by name as an array + +### Read-Only + +- `id` (String) The ID of this resource. +- `isos` (List of Object) list of ISOs (see [below for nested schema](#nestedatt--isos)) + + +### Nested Schema for `isos` + +Read-Only: + +- `id` (String) +- `name` (String) + + diff --git a/docs/data-sources/svt_iso.md b/docs/data-sources/svt_iso.md new file mode 100644 index 0000000..3fe7c9a --- /dev/null +++ b/docs/data-sources/svt_iso.md @@ -0,0 +1,43 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cloudtower_svt_iso Data Source - terraform-provider-cloudtower" +subcategory: "" +description: |- + CloudTower vmtools iso data source. +--- + +# cloudtower_svt_iso (Data Source) + +CloudTower vmtools iso data source. + + + + +## Schema + +### Optional + +- `cluster_id` (String) filter svt ISOs by cluster id +- `cluster_id_in` (List of String) filter svt ISOs by cluster id in +- `name` (String) filter svt ISOs by name +- `name_contains` (String) filter svt ISOs by name contain a certain string +- `name_in` (List of String) filter svt ISOs by name in +- `version` (Number) filter svt ISOs by version +- `version_gte` (Number) filter svt ISOs by version greater than or equal to +- `version_in` (List of Number) filter svt ISOs by version in + +### Read-Only + +- `id` (String) The ID of this resource. +- `isos` (List of Object) list of ISOs (see [below for nested schema](#nestedatt--isos)) + + +### Nested Schema for `isos` + +Read-Only: + +- `id` (String) +- `name` (String) +- `version` (Number) + + diff --git a/docs/data-sources/vlan.md b/docs/data-sources/vlan.md new file mode 100644 index 0000000..2c6b4f6 --- /dev/null +++ b/docs/data-sources/vlan.md @@ -0,0 +1,43 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cloudtower_vlan Data Source - terraform-provider-cloudtower" +subcategory: "" +description: |- + CloudTower vlan data source. +--- + +# cloudtower_vlan (Data Source) + +CloudTower vlan data source. + + + + +## Schema + +### Optional + +- `cluster_id` (String) filter vlans by cluster id +- `cluster_id_in` (List of String) filter vlans by cluster id as array +- `name` (String) filter vlans by name +- `name_contains` (String) filter vlans by name contain a certain string +- `name_in` (List of String) filter vlans by name +- `type` (String) filter vlans by type +- `type_in` (List of String) filter vlans by type as array + +### Read-Only + +- `id` (String) The ID of this resource. +- `vlans` (List of Object) list of vlans (see [below for nested schema](#nestedatt--vlans)) + + +### Nested Schema for `vlans` + +Read-Only: + +- `cluster_id` (String) +- `id` (String) +- `name` (String) +- `type` (String) + + diff --git a/docs/data-sources/vm.md b/docs/data-sources/vm.md new file mode 100644 index 0000000..b8b9967 --- /dev/null +++ b/docs/data-sources/vm.md @@ -0,0 +1,44 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cloudtower_vm Data Source - terraform-provider-cloudtower" +subcategory: "" +description: |- + CloudTower vm data source. +--- + +# cloudtower_vm (Data Source) + +CloudTower vm data source. + + + + +## Schema + +### Optional + +- `cluster_id` (String) filter VMs by cluster id +- `cluster_id_in` (List of String) filter VMs by cluster id in an array +- `host_id` (String) filter VMs by host id +- `host_id_in` (List of String) filter VMs by host id in an array +- `name` (String) filter VMs by name +- `name_contains` (String) filter VMs by name contain a certain string +- `name_in` (List of String) filter VMs by name in an array +- `status` (String) filter VMs by status +- `status_in` (List of String) filter VMs by status in an array + +### Read-Only + +- `id` (String) The ID of this resource. +- `vms` (List of Object) list of VMs (see [below for nested schema](#nestedatt--vms)) + + +### Nested Schema for `vms` + +Read-Only: + +- `id` (String) +- `name` (String) +- `status` (String) + + diff --git a/docs/data-sources/vm_snapshot.md b/docs/data-sources/vm_snapshot.md new file mode 100644 index 0000000..6cfab26 --- /dev/null +++ b/docs/data-sources/vm_snapshot.md @@ -0,0 +1,77 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cloudtower_vm_snapshot Data Source - terraform-provider-cloudtower" +subcategory: "" +description: |- + CloudTower vm snapshot data source. +--- + +# cloudtower_vm_snapshot (Data Source) + +CloudTower vm snapshot data source. + + + + +## Schema + +### Optional + +- `name` (String) vm snapshot's name +- `name_contains` (String) filter vm snapshot by its name contains characters +- `name_in` (List of String) vm snapshot's name as an array +- `vm_id` (String) vm's id of the snapshot +- `vm_id_in` (List of String) vm's id of the snapshot as an array + +### Read-Only + +- `id` (String) The ID of this resource. +- `vm_snapshots` (List of Object) list of queried vm snapshots (see [below for nested schema](#nestedatt--vm_snapshots)) + + +### Nested Schema for `vm_snapshots` + +Read-Only: + +- `cd_roms` (List of Object) (see [below for nested schema](#nestedobjatt--vm_snapshots--cd_roms)) +- `create_time` (String) +- `disks` (List of Object) (see [below for nested schema](#nestedobjatt--vm_snapshots--disks)) +- `id` (String) +- `name` (String) +- `nics` (List of Object) (see [below for nested schema](#nestedobjatt--vm_snapshots--nics)) + + +### Nested Schema for `vm_snapshots.cd_roms` + +Read-Only: + +- `boot` (Number) +- `elf_image_id` (String) +- `svt_image_id` (String) + + + +### Nested Schema for `vm_snapshots.disks` + +Read-Only: + +- `boot` (Number) +- `bus` (String) +- `name` (String) +- `path` (String) +- `size` (Number) +- `storage_policy` (String) + + + +### Nested Schema for `vm_snapshots.nics` + +Read-Only: + +- `enabled` (Boolean) +- `idx` (Number) +- `mirror` (Boolean) +- `model` (String) +- `vlan_id` (String) + + diff --git a/docs/data-sources/cloudtower_vm_template.md b/docs/data-sources/vm_template.md similarity index 95% rename from docs/data-sources/cloudtower_vm_template.md rename to docs/data-sources/vm_template.md index 36592ce..81e7ba4 100644 --- a/docs/data-sources/cloudtower_vm_template.md +++ b/docs/data-sources/vm_template.md @@ -1,6 +1,6 @@ --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_vm_template Data Source - cloudtower-terraform-provider" +page_title: "cloudtower_vm_template Data Source - terraform-provider-cloudtower" subcategory: "" description: |- CloudTower vm template data source. diff --git a/docs/data-sources/vm_volume.md b/docs/data-sources/vm_volume.md new file mode 100644 index 0000000..963fa1f --- /dev/null +++ b/docs/data-sources/vm_volume.md @@ -0,0 +1,39 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cloudtower_vm_volume Data Source - terraform-provider-cloudtower" +subcategory: "" +description: |- + CloudTower vm volume data source. +--- + +# cloudtower_vm_volume (Data Source) + +CloudTower vm volume data source. + + + + +## Schema + +### Optional + +- `cluster_id` (String) filter VM volumes by cluster id +- `cluster_id_in` (List of String) filter VM volumes by cluster id in an array +- `name` (String) filter VM volumes by name +- `name_contains` (String) filter VM volumes by name contain a certain string +- `name_in` (List of String) filter VM volumes by name in an array + +### Read-Only + +- `id` (String) The ID of this resource. +- `vm_volumes` (List of Object) list of VM volumes (see [below for nested schema](#nestedatt--vm_volumes)) + + +### Nested Schema for `vm_volumes` + +Read-Only: + +- `id` (String) +- `name` (String) + + diff --git a/docs/index.md b/docs/index.md index bec84da..bdcef19 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,153 +1,26 @@ --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower-terraform-provider Provider" +page_title: "cloudtower Provider" subcategory: "" description: |- + --- -# cloudtower-terraform-provider Provider +# cloudtower Provider + -The `cloudtower-terraform-provider` provider is used to interact with the resources supported by CloudTower. The provider needs to be configured with the proper credentials before it can be used. -Use the navigation to the left to read about the available resources. - + ## Schema -### Optional +### Required -- `cloudtower_server` (String) The CloudTower Server's endpoint, if not set, will use localhost. - `password` (String) The user password for CloudTower API operations. - `user_source` (String) The source type of user - `username` (String) The username for CloudTower API operations. -## Features - -### Vm - -- create - - 1. create blank vm - 2. create vm from template/content library template - 3. clone vm - 4. rebuild vm - -- update - 1. update vm's cpu/memory - 2. cd-rom and disk - 3. nic - 4. ha - 5. power status - -### Template and content library template - -- clone from vm -- distribute to clusters (content library template only) - -### Snapshot - -- create snapshot for vm -- rollback to snapshot - -### Datacenter and cluster - -- connect cluster -- create datacenter -- move cluster in and out from datacenter - -## Quick Start - -Here is an example to create a VM with 2 disks and 1 cdrom on cluster "sample_cluster", with an already uploaded CD-ROM name contains ubuntu, also speiciy the host to run the VM on. - -```hcl -terraform { - required_providers { - cloudtower = { - version = "~> 0.1.7" - source = "registry.terraform.io/smartxworks/cloudtower" - } - } -} - -locals { - GB = 1024 * local.MB - MB = 1024 * local.KB - KB = 1024 -} - -// authentication block, password will be prompted when apply, otherwise you can use environment variables -provider "cloudtower" { - username = "username" - user_source = "LOCAL" - cloudtower_server = "http://terraform.tower.com" -} - -data "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_vlan" "vm_vlan" { - name = "default" - type = "VM" - cluster_id = data.data.cloudtower_cluster.sample_cluster.clusters[0].clusters[0].id -} - -data "cloudtower_iso" "ubuntu" { - name_contains = "ubuntu" - cluster_id = data.data.cloudtower_cluster.sample_cluster.clusters[0].clusters[0].id -} - -data "cloudtower_host" "target_host" { - management_ip_contains = "17.42" - cluster_id = data.cloudtower_cluster.sample_cluster.clusters[0].id -} - -resource "cloudtower_vm" "tf_test" { - name = "tf-test" - description = "managed by terraform" - cluster_id = data.cloudtower_cluster.sample_cluster.clusters[0].id - host_id = data.cloudtower_host.target_host.hosts[0].id - vcpu = 4 - memory = 8 * local.GB - ha = true - firmware = "BIOS" - status = "STOPPED" - force_status_change = true - - cd_rom { - boot = 1 - iso_id = data.cloudtower_iso.ubuntu.isos[0].id - } - - - disk { - boot = 2 - bus = "VIRTIO" - vm_volume { - storage_policy = "REPLICA_2_THIN_PROVISION" - name = "disk1" - size = 10 * local.GB - } - } - - disk { - boot = 3 - bus = "VIRTIO" - vm_volume { - storage_policy = "REPLICA_3_THICK_PROVISION" - name = "disk2" - size = 1 * local.GB - } - } - - cd_rom { - boot = 4 - iso_id = "" - } +### Optional - nic { - vlan_id = data.cloudtower_vlan.vm_vlan.vlans[0].id - } -} -``` +- `cloudtower_server` (String) The CloudTower Server name. diff --git a/docs/resources/cloudtower_cluster.md b/docs/resources/cloudtower_cluster.md deleted file mode 100644 index 82aed6d..0000000 --- a/docs/resources/cloudtower_cluster.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_cluster Resource - cloudtower-terraform-provider" -subcategory: "" -description: |- - CloudTower cluster resource. ---- - -# cloudtower_cluster (Resource) - -CloudTower cluster resource. - - - - -## Schema - -### Required - -- `ip` (String) cluster's IP -- `password` (String) cluster's password -- `username` (String) cluster's username - -### Optional - -- `datacenter_id` (String) the id of the datacenter this cluster belongs to - -### Read-Only - -- `id` (String) cluster's id -- `name` (String) cluster's name - - -## Usage - -### Connect a cluster - -This will connect a cluster to cloudtower. - -```hcl -resource "cloudtower_cluster" "sample_cluster" { - ip = "192.168.1.1" - username = "admin" - password = "password" -} -``` - -### Connect a cluster and add it to a datacenter - -Connect a cluster, and also add the cluster to a datacenter. - -```hcl -data "cloudtower_datacenter" "sample_datacenter" { - name = "sample_datacenter" -} - -resource "cloudtower_cluster" "sample_cluster" { - ip = "192.168.1.1" - username = "admin" - password = "password" - datacenter_id = data.cloudtower_datacenter.sample_datacenter.datacenters[0].id -} -``` - -## Restrictions - -If an cluster has already been connected to cloudtower, it will throw an error if you try to connect it again. You can use datasource to handle it or import the cluster to terraform state. \ No newline at end of file diff --git a/docs/resources/cloudtower_vm.md b/docs/resources/cloudtower_vm.md deleted file mode 100644 index b0b22aa..0000000 --- a/docs/resources/cloudtower_vm.md +++ /dev/null @@ -1,439 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_vm Resource - cloudtower-terraform-provider" -subcategory: "" -description: |- - CloudTower vm resource. ---- - -# cloudtower_vm (Resource) - -CloudTower vm resource. - - - -## Schema - -### Required - -- `name` (String) VM's name - -### Optional - -- `cd_rom` (Block List) VM's CD-ROM (see [below for nested schema](#nestedblock--cd_rom)) -- `cluster_id` (String) VM's cluster id -- `cpu_cores` (Number) VM's cpu cores -- `cpu_sockets` (Number) VM's cpu sockets -- `create_effect` (Block List, Max: 1) (see [below for nested schema](#nestedblock--create_effect)) -- `description` (String) VM's description -- `disk` (Block List) VM's virtual disks (see [below for nested schema](#nestedblock--disk)) -- `firmware` (String) VM's firmware, forcenew as it isn't able to modify after create, must be one of 'BIOS', 'UEFI' -- `folder_id` (String) VM's folder id -- `force_status_change` (Boolean) force VM's status change, will apply when power off or restart -- `guest_os_type` (String) VM's guest OS type -- `ha` (Boolean) whether VM is HA or not -- `host_id` (String) VM's host id -- `memory` (Number) VM's memory, in the unit of byte, must be a multiple of 512MB, long value, ignore the decimal point -- `nic` (Block List) VM's virtual nic (see [below for nested schema](#nestedblock--nic)) -- `rollback_to` (String) Vm is going to rollback to target snapshot -- `status` (String) VM's status -- `vcpu` (Number) VM's vcpu - -### Read-Only - -- `id` (String) VM's id - - - -### Nested Schema for `cd_rom` - -Required: - -- `boot` (Number) VM CD-ROM's boot order -- `iso_id` (String) mount an ISO to a VM CD-ROM by specific it's id - -Read-Only: - -- `id` (String) VM CD-ROM's id - - - -### Nested Schema for `create_effect` - -Optional: - -- `clone_from_content_library_template` (String) Id of source content library VM template to be cloned -- `clone_from_template` (String) Id of source VM template to be cloned -- `clone_from_vm` (String) Id of source vm from created vm to be cloned from -- `cloud_init` (Block List, Max: 1) Set up cloud-init config when create vm from template (see [below for nested schema](#nestedblock--create_effect--cloud_init)) -- `is_full_copy` (Boolean) If the vm is full copy from template or not -- `rebuild_from_snapshot` (String) Id of snapshot for created vm to be rebuilt from - - - -### Nested Schema for `create_effect.cloud_init` - -Optional: - -- `default_user_password` (String) Password of default user -- `hostname` (String) hostname -- `nameservers` (List of String) Name server address list. At most 3 name servers are allowed. -- `networks` (Block List, Max: 1) Network configuration list. (see [below for nested schema](#nestedblock--create_effect--cloud_init--networks)) -- `public_keys` (List of String) Add a list of public keys for the cloud-init default user.At most 10 public keys can be added to the list. -- `user_data` (String) User-provided cloud-init user-data field. Base64 encoding is not supported. Size limit: 32KiB. - - - -### Nested Schema for `create_effect.cloud_init.networks` - -Required: - -- `nic_index` (Number) Index of VM NICs. The index starts at 0, which refers to the first NIC.At most 16 NICs are supported, so the index range is [0, 15]. -- `type` (String) Network type. Allowed enum values are ipv4, ipv4_dhcp. - -Optional: - -- `ip_address` (String) IPv4 address. This field is only used when type is not set to ipv4_dhcp. -- `netmask` (String) Netmask. This field is only used when type is not set to ipv4_dhcp. -- `routes` (Block List, Max: 1) Static route list (see [below for nested schema](#nestedblock--create_effect--cloud_init--networks--routes)) - - - -### Nested Schema for `create_effect.cloud_init.networks.routes` - -Optional: - -- `gateway` (String) Gateway to access the static route address. -- `netmask` (String) Netmask of the network -- `network` (String) Static route network address. If set to 0.0.0.0, then first use the user settings to configure the default route. - - - -### Nested Schema for `disk` - -Required: - -- `boot` (Number) VM disk's boot order -- `bus` (String) VM disk's bus - -Optional: - -- `vm_volume` (Block List, Max: 1) create a new VM volume and use it as a VM disk (see [below for nested schema](#nestedblock--disk--vm_volume)) -- `vm_volume_id` (String) use an existing VM volume as a VM disk, by specific it's id - -Read-Only: - -- `id` (String) the VM disk's id - - - -### Nested Schema for `disk.vm_volume` - -Required: - -- `name` (String) the new VM volume's name -- `size` (Number) the new VM volume's size, in the unit of byte -- `storage_policy` (String) the new VM volume's storage policy - -Optional: - -- `origin_path` (String) the VM volume will create base on the path - -Read-Only: - -- `id` (String) the VM volume's id -- `path` (String) the VM volume's iscsi LUN path - - - -### Nested Schema for `nic` - -Required: - -- `vlan_id` (String) specific the vlan's id the VM nic will use - -Optional: - -- `enabled` (Boolean) whether the VM nic is enabled -- `gateway` (String) VM nic's gateway -- `ip_address` (String) VM nic's IP address -- `mac_address` (String) VM nic's mac address -- `mirror` (Boolean) whether the VM nic use mirror mode -- `model` (String) VM nic's model -- `subnet_mask` (String) VM nic's subnet mask - -Read-Only: - -- `id` (String) VM nic's id -- `idx` (Number) VM nic's index - -## Usage - -### create a blank vm - -This will create a blank vm on speicifed cluster. - -```hcl -datasource "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} -resource "cloudtower_vm" "sample_vm" { - name = "sample_vm" - cluster_id = datasource.cloudtower_cluster.sample_cluster.clusters[0].id - cpu_cores = 1 - cpu_sockets = 1 - memory = 1073741824 - vcpu = 1 - nic { - vlan_id = "vlan_id" - } - disk { - boot = 1 - bus = "scsi" - vm_volume { - name = "sample_vm_volume" - size = 1073741824 - storage_policy = "REPLICA_2_THICK_PROVISION" - } - } -} -``` - -### clone from another vm - -use create_effect.clone_from_vm can clone a new vm from another vm - -```hcl -resource "cloudtower_vm" "tf_test_cloned-vm" { - name = "tf-test-cloned-vm" - cluster_id = cloudtower_cluster.sample_cluster.id - create_effect { - clone_from_vm = cloudtower_vm.tf_test.id - } -} -``` - -### rebuild from snapshot - -use create_effect.rebuild_from_snapshot can rebuild a vm from a snapshot - -```hcl -datasource "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -datasource "cloudtower_vm_snapshot" "sample_snapshot" { - name = "sample-snapshot" -} - -resource "cloudtower_vm" "sample_vm_from_snapshot" { - name = "sample-vm-from_snapshot" - cluster_id = data.cloudtower_cluster.sample_cluster.clusters[0].id - create_effect { - rebuild_from_snapshot = data.cloudtower_vm_snapshot.sample_snapshot.snapshots[0].id - } -} -``` - -### clone from content library template - -Create a vm from content library template, which is support to be used between different cluster. - -Use effect.clone_from_content_library_template to clone a vm from content library template. - -```hcl -datasource "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_content_library_vm_template" "sample_template" { - name = "sample_template" -} - -resource "cloudtower_vm" "sample_content_library_vm" { - name = "sample-content-library-template-vm" - create_effect { - is_full_copy = false - clone_from_content_library_template = data.cloudtower_content_library_vm_template.sample_template.vm_templates[0].id - } -} -``` - -### clone from content libarary template with modification - -Clone from content libarary template support modificiation from the origin template. - -#### computing resource - -cpu_cores, cpu_sockets, memory, vcpu can be modified from template. - -```hcl -datasource "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_content_library_vm_template" "sample_template" { - name = "sample_template" -} - -resource "cloudtower_vm" "sample_content_library_vm" { - name = "sample-content-library-template-vm" - create_effect { - is_full_copy = false - clone_from_content_library_template = data.cloudtower_content_library_vm_template.sample_template.vm_templates[0].id - } - vcpu = 12 - cpu_cores = 3 - cpu_sockets = 4 - memory = 1073741824 -} -``` - -#### disk - -As use terraform to manage vm, if you want to modify disk from template, you should declare all disk in disk block, otherwise it will leave part of disk under management while others not, which may cause many side effect. - -If you want fully control the disks, declared any disk in disk block, it will override all disk from template, so you should declare all disk in disk block. - -To use disk from template with disk modification, you should configure origin_path of disk to make disk create base on template disk. - -```hcl -datasource "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_content_library_vm_template" "sample_template" { - name = "sample_template" -} - -resource "cloudtower_vm" "sample_content_library_vm" { - cluster_id = data.cloudtower_cluster.sample_cluster.clusters[0].id - name = "sample-content-library-template-vm" - create_effect { - is_full_copy = false - clone_from_content_library_template = data.cloudtower_content_library_vm_template.sample_template.vm_templates[0].id - } - dynamic "disk" { - for_each = data.cloudtower_content_library_vm_template.sample_template.vm_templates[0].disks - content { - boot = disk.value.boot - bus = disk.value.bus - vm_volume { - storage_policy = disk.value.storage_policy - name = "${var.config["vm_name"][count.index]}-${disk.key + 1}" - size = disk.value.size - origin_path = disk.value.path - } - } - } - disk { - boot = length(data.cloudtower_content_library_vm_template.query_templates.content_library_vm_templates[0].vm_templates[0].disks) + disk.key - bus = "VIRTIO" - vm_volume { - storage_policy = "REPLICA_2_THIN_PROVISION" - name = "new-volume" - size = disk.value * local.GB - } - } - - cd_rom { - boot = length(data.cloudtower_content_library_vm_template.query_templates.content_library_vm_templates[0].vm_templates[0].disks) + 2 - iso_id = "" - } -} -``` - -#### nic - -If nic is not configured, it will use default vlan of cluster for every nic. - -The same to disk, if you want to modify nic from template, you should declare all nic in nic block. - -``` -datasource "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_content_library_vm_template" "sample_template" { - name = "sample_template" -} - -data "cloudtower_vlan" "sample_vlan" { - name = "default" - type = "VM" - cluster_id = data.data.cloudtower_cluster.sample_cluster.clusters[0].clusters[0].id -} - -resource "cloudtower_vm" "sample_content_library_vm" { - cluster_id = data.cloudtower_cluster.sample_cluster.clusters[0].id - name = "sample-content-library-template-vm" - create_effect { - is_full_copy = false - clone_from_content_library_template = data.cloudtower_content_library_vm_template.sample_template.vm_templates[0].id - } - - cd_rom { - boot = 0 - iso_id = "" - } - - nic { - vlan_id = data.cloudtower_vlan.sample_vlan.vlans[0].id - } -} -``` - -### clone from content library template with cloud init - -If template support cloud-init, pass cloudinit config can set up vm's starting ip, hostname, default user password, etc. - -Configure them in create_effect.cloud_init block. - -```hcl -datasource "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} -resource "cloudtower_vm" "sample_cloud_init_vm" { - name = "tf-test-cloned-vm-from-template-modify-cloud-init" - create_effect { - is_full_copy = false - clone_from_template = data.cloudtower_vm_template.tf_test_template.vm_templates[0].id - cloud_init { - hostname = "tf-test-vm-hostname" - default_user_password = 111111 - networks { - type = "IPV4" - nic_index = 0 - ip_address = "192.168.11.2" - netmask = "255.255.255.0", - gateway = "192.168.11.1" - } - } - } -} -``` - -### clone from template - -Deprecated, content library template is preferred, but vm template is also supported, usage is close to content library template. - -use create_effect.clone_from_template can clone a new vm from template. - -```hcl -datasource "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -data "cloudtower_vm_template" "sample_template" { - cluster_id = data.cloudtower_cluster.sample_cluster.clusters[0].id - name = var.vm_template_with_cloud_init -} - -resource "cloudtower_vm" "tf_test_cloned_vm" { - name = "tf-test-cloned-vm-from-template" - create_effect { - is_full_copy = false - clone_from_template = data.cloudtower_vm_template.sample_template.vm_templates[0].id - } -} -``` diff --git a/docs/resources/cluster.md b/docs/resources/cluster.md new file mode 100644 index 0000000..b7c0739 --- /dev/null +++ b/docs/resources/cluster.md @@ -0,0 +1,33 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cloudtower_cluster Resource - terraform-provider-cloudtower" +subcategory: "" +description: |- + CloudTower cluster resource. +--- + +# cloudtower_cluster (Resource) + +CloudTower cluster resource. + + + + +## Schema + +### Required + +- `ip` (String) cluster's IP +- `password` (String) cluster's password +- `username` (String) cluster's username + +### Optional + +- `datacenter_id` (String) the id of the datacenter this cluster belongs to + +### Read-Only + +- `id` (String) cluster's id +- `name` (String) cluster's name + + diff --git a/docs/resources/cloudtower_content_library_vm_template.md b/docs/resources/content_library_vm_template.md similarity index 51% rename from docs/resources/cloudtower_content_library_vm_template.md rename to docs/resources/content_library_vm_template.md index ca5567d..ff6354d 100644 --- a/docs/resources/cloudtower_content_library_vm_template.md +++ b/docs/resources/content_library_vm_template.md @@ -1,6 +1,6 @@ --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_content_library_vm_template Resource - cloudtower-terraform-provider" +page_title: "cloudtower_content_library_vm_template Resource - terraform-provider-cloudtower" subcategory: "" description: |- CloudTower content library VM template resource @@ -67,51 +67,4 @@ Read-Only: - `model` (String) - `vlan_id` (String) -## Usage -use content library vm template can help you share template accross clusters. - -### create a template from vm - -This will create a template from vm in cloudtower, the template store in specified cluster. - -use cloud_init_supported to mark if template support cloud_init. - -specified more cluster_id to distribute template to other clusters. - -```hcl - -datasource "cloudtower_cluster" "sample_cluster" { - name = "sample_cluster" -} - -datasource "cloudtower_vm" "sample_vm" { - name = "sample_vm" -} - -resource "cloudtower_content_library_vm_template" "sample_template" { - name = "sample_template" - cloud_init_supported = false - cluster_id = [data.cloudtower_cluster.sample_cluster.clusters[0].id] - src_vm_id = data.cloudtower_vm.sample_vm.vms[0].id -} -``` - - -### clone a vm from content library template - -Clone a vm from content library template, this will create a vm directly from a template, without any modification, for further usage, please see cloudtower_vm resource. - -```hcl -datasource "cloudtower_vm_template" "sample_template" { - name = "tf-test-template" -} - -resource "cloudtower_vm" "sample_cloned_vm" { - name = "tf-test-cloned-vm-from-template" - create_effect { - is_full_copy = false - clone_from_template = data.cloudtower_vm_template.sample_template.vm_templates[0].id - } -} -``` \ No newline at end of file diff --git a/docs/resources/cloudtower_datacenter.md b/docs/resources/datacenter.md similarity index 54% rename from docs/resources/cloudtower_datacenter.md rename to docs/resources/datacenter.md index 0e9e134..9300fa6 100644 --- a/docs/resources/cloudtower_datacenter.md +++ b/docs/resources/datacenter.md @@ -1,6 +1,6 @@ --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_datacenter Resource - cloudtower-terraform-provider" +page_title: "cloudtower_datacenter Resource - terraform-provider-cloudtower" subcategory: "" description: |- CloudTower datacenter resource. @@ -24,14 +24,3 @@ CloudTower datacenter resource. - `id` (String) datacenter's id -## Usage - -### Create a datacenter - -This will create a datacenter in cloudtower, and will manage its lifecycle with terraform - -```hcl -resource "cloudtower_datacenter" "sample_datacenter" { - name = "sample_datacenter" -} -``` \ No newline at end of file diff --git a/docs/resources/vm.md b/docs/resources/vm.md new file mode 100644 index 0000000..6420350 --- /dev/null +++ b/docs/resources/vm.md @@ -0,0 +1,170 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cloudtower_vm Resource - terraform-provider-cloudtower" +subcategory: "" +description: |- + CloudTower vm resource. +--- + +# cloudtower_vm (Resource) + +CloudTower vm resource. + + + + +## Schema + +### Required + +- `name` (String) VM's name + +### Optional + +- `cd_rom` (Block List) VM's CD-ROM (see [below for nested schema](#nestedblock--cd_rom)) +- `cluster_id` (String) VM's cluster id +- `cpu_cores` (Number) VM's cpu cores +- `cpu_sockets` (Number) VM's cpu sockets +- `create_effect` (Block List, Max: 1) (see [below for nested schema](#nestedblock--create_effect)) +- `description` (String) VM's description +- `disk` (Block List) VM's virtual disks (see [below for nested schema](#nestedblock--disk)) +- `firmware` (String) VM's firmware, forcenew as it isn't able to modify after create, must be one of 'BIOS', 'UEFI' +- `folder_id` (String) VM's folder id +- `force_status_change` (Boolean) force VM's status change, will apply when power off or restart +- `guest_os_type` (String) VM's guest OS type +- `ha` (Boolean) whether VM is HA or not +- `host_id` (String) VM's host id +- `memory` (Number) VM's memory, in the unit of byte, must be a multiple of 512MB, long value, ignore the decimal point +- `nic` (Block List) VM's virtual nic (see [below for nested schema](#nestedblock--nic)) +- `rollback_to` (String) Vm is going to rollback to target snapshot +- `status` (String) VM's status +- `vcpu` (Number) VM's vcpu + +### Read-Only + +- `id` (String) VM's id + + +### Nested Schema for `cd_rom` + +Required: + +- `boot` (Number) VM CD-ROM's boot order +- `iso_id` (String) mount an ISO to a VM CD-ROM by specific it's id + +Read-Only: + +- `id` (String) VM CD-ROM's id + + + +### Nested Schema for `create_effect` + +Optional: + +- `clone_from_content_library_template` (String) Id of source content library VM template to be cloned +- `clone_from_template` (String) Id of source VM template to be cloned +- `clone_from_vm` (String) Id of source vm from created vm to be cloned from +- `cloud_init` (Block List, Max: 1) Set up cloud-init config when create vm from template (see [below for nested schema](#nestedblock--create_effect--cloud_init)) +- `is_full_copy` (Boolean) If the vm is full copy from template or not +- `rebuild_from_snapshot` (String) Id of snapshot for created vm to be rebuilt from + + +### Nested Schema for `create_effect.cloud_init` + +Optional: + +- `default_user_password` (String) Password of default user +- `hostname` (String) hostname +- `nameservers` (List of String) Name server address list. At most 3 name servers are allowed. +- `networks` (Block List, Max: 1) Network configuration list. (see [below for nested schema](#nestedblock--create_effect--cloud_init--networks)) +- `public_keys` (List of String) Add a list of public keys for the cloud-init default user.At most 10 public keys can be added to the list. +- `user_data` (String) User-provided cloud-init user-data field. Base64 encoding is not supported. Size limit: 32KiB. + + +### Nested Schema for `create_effect.cloud_init.networks` + +Required: + +- `nic_index` (Number) Index of VM NICs. The index starts at 0, which refers to the first NIC.At most 16 NICs are supported, so the index range is [0, 15]. +- `type` (String) Network type. Allowed enum values are ipv4, ipv4_dhcp. + +Optional: + +- `ip_address` (String) IPv4 address. This field is only used when type is not set to ipv4_dhcp. +- `netmask` (String) Netmask. This field is only used when type is not set to ipv4_dhcp. +- `routes` (Block List, Max: 1) Static route list (see [below for nested schema](#nestedblock--create_effect--cloud_init--networks--routes)) + + +### Nested Schema for `create_effect.cloud_init.networks.routes` + +Optional: + +- `gateway` (String) Gateway to access the static route address. +- `netmask` (String) Netmask of the network +- `network` (String) Static route network address. If set to 0.0.0.0, then first use the user settings to configure the default route. + + + + + + +### Nested Schema for `disk` + +Required: + +- `boot` (Number) VM disk's boot order +- `bus` (String) VM disk's bus + +Optional: + +- `vm_volume` (Block List, Max: 1) create a new VM volume and use it as a VM disk (see [below for nested schema](#nestedblock--disk--vm_volume)) +- `vm_volume_id` (String) use an existing VM volume as a VM disk, by specific it's id + +Read-Only: + +- `id` (String) the VM disk's id + + +### Nested Schema for `disk.vm_volume` + +Required: + +- `name` (String) the new VM volume's name +- `size` (Number) the new VM volume's size, in the unit of byte +- `storage_policy` (String) the new VM volume's storage policy + +Optional: + +- `origin_path` (String) the VM volume will create base on the path + +Read-Only: + +- `id` (String) the VM volume's id +- `path` (String) the VM volume's iscsi LUN path + + + + +### Nested Schema for `nic` + +Required: + +- `vlan_id` (String) specific the vlan's id the VM nic will use + +Optional: + +- `enabled` (Boolean) whether the VM nic is enabled +- `gateway` (String) VM nic's gateway +- `ip_address` (String) VM nic's IP address +- `mac_address` (String) VM nic's mac address +- `mirror` (Boolean) whether the VM nic use mirror mode +- `model` (String) VM nic's model +- `subnet_mask` (String) VM nic's subnet mask + +Read-Only: + +- `id` (String) VM nic's id +- `idx` (Number) VM nic's index + + diff --git a/docs/resources/cloudtower_vm_snapshot.md b/docs/resources/vm_snapshot.md similarity index 58% rename from docs/resources/cloudtower_vm_snapshot.md rename to docs/resources/vm_snapshot.md index 0b50975..c84e46d 100644 --- a/docs/resources/cloudtower_vm_snapshot.md +++ b/docs/resources/vm_snapshot.md @@ -1,6 +1,6 @@ --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_vm_snapshot Resource - cloudtower-terraform-provider" +page_title: "cloudtower_vm_snapshot Resource - terraform-provider-cloudtower" subcategory: "" description: |- CloudTower vm snapshot resource @@ -65,37 +65,4 @@ Read-Only: - `model` (String) - `vlan_id` (String) -## Usage -### Create a vm snapshot - -This will create a vm snapshot in cloudtower, and will manage its lifecycle with terraform - -```hcl -data "cloudtower_vm" "sample_vm" { - name = "sample_vm" -} - -resource "cloudtower_vm_snapshot" "sample_vm_snapshot" { - name = "sample_vm_snapshot" - vm_id = data.cloudtower_vm.sample_vm.vms[0].id -} -``` - -### Create a vm snapshot with consistent_type - -Consisent type can be defined when create a vm snapshot. - -Only accept `["CRASH_CONSISTENT", "FILE_SYSTEM_CONSISTENT"]`, and Only Vm tools is running on the VM, `FILE_SYSTEM_CONSISTENT` can be used. - -```hcl -data "cloudtower_vm" "sample_vm" { - name = "sample_vm" -} - -resource "cloudtower_vm_snapshot" "sample_vm_snapshot" { - name = "sample_vm_snapshot" - vm_id = data.cloudtower_vm.sample_vm.vms[0].id - consistent_type = "FILE_SYSTEM_CONSISTENT" -} -``` \ No newline at end of file diff --git a/docs/resources/cloudtower_vm_template.md b/docs/resources/vm_template.md similarity index 53% rename from docs/resources/cloudtower_vm_template.md rename to docs/resources/vm_template.md index 3a5d358..0d63113 100644 --- a/docs/resources/cloudtower_vm_template.md +++ b/docs/resources/vm_template.md @@ -1,6 +1,6 @@ --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cloudtower_vm_template Resource - cloudtower-terraform-provider" +page_title: "cloudtower_vm_template Resource - terraform-provider-cloudtower" subcategory: "" description: |- CloudTower VM template resource @@ -67,44 +67,3 @@ Read-Only: - `vlan_id` (String) - -## Usage - -template usage is deprecated, please use content library vm template instead. - -### create a template from vm - -This will create a template from vm in cloudtower, the template will store in vm's cluster, and will manage its lifecycle with terraform. - -use cloud_init_supported to mark if template support cloud_init -```hcl - -datasource "cloudtower_vm" "sample_vm" { - name = "sample_vm" -} - -resource "cloudtower_vm_template" "sample_template" { - name = "sample_template" - cloud_init_supported = false - description = "sample template" - src_vm_id = data.cloudtower_vm.sample_vm.vms[0].id -} -``` - -### clone a vm from template - -Clone a vm from template, this will create a vm directly from a template, without any modification, for further usage, please see cloudtower_vm resource. - -```hcl -datasource "cloudtower_vm_template" "sample_template" { - name = "tf-test-template" -} - -resource "cloudtower_vm" "sample_cloned_vm" { - name = "tf-test-cloned-vm-from-template" - create_effect { - is_full_copy = false - clone_from_template = data.cloudtower_vm_template.sample_template.vm_templates[0].id - } -} -``` \ No newline at end of file diff --git a/main.go b/main.go index 0010dd8..f5f1d4e 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,7 @@ var ( version string = "dev" // goreleaser can also pass the specific commit if you want - // commit string = "" + commit string = "" ) func main() {