From bf1afc66dd909eb03a2621d5d0339ae64d0b0e44 Mon Sep 17 00:00:00 2001 From: kjubybot Date: Wed, 23 Mar 2022 11:40:51 +0300 Subject: [PATCH] Fixed asyncs tasks parsing; Applied k8s API changes; Updated docs --- decort/models_api.go | 48 ++++++---- decort/resource_k8s.go | 29 +++++- decort/resource_k8s_wg.go | 27 ++++-- docs/data-sources/grid.md | 43 +++++++++ docs/data-sources/grid_list.md | 50 ++++++++++ docs/data-sources/image.md | 56 +++++++++-- docs/data-sources/image_list.md | 94 +++++++++++++++++++ docs/data-sources/image_list_stacks.md | 63 +++++++++++++ docs/resources/cdrom_image.md | 89 ++++++++++++++++++ docs/resources/delete_images.md | 40 ++++++++ docs/resources/image.md | 92 ++++++++++++++++++ docs/resources/{k8s.md => kubernetes.md} | 15 +++ .../resources/{k8s_wg.md => kubernetes_wg.md} | 12 +++ docs/resources/virtual_image.md | 92 ++++++++++++++++++ go.sum | 1 - 15 files changed, 715 insertions(+), 36 deletions(-) create mode 100644 docs/data-sources/grid.md create mode 100644 docs/data-sources/grid_list.md create mode 100644 docs/data-sources/image_list.md create mode 100644 docs/data-sources/image_list_stacks.md create mode 100644 docs/resources/cdrom_image.md create mode 100644 docs/resources/delete_images.md create mode 100644 docs/resources/image.md rename docs/resources/{k8s.md => kubernetes.md} (76%) rename docs/resources/{k8s_wg.md => kubernetes_wg.md} (67%) create mode 100644 docs/resources/virtual_image.md diff --git a/decort/models_api.go b/decort/models_api.go index 7673e3e..2dfa986 100644 --- a/decort/models_api.go +++ b/decort/models_api.go @@ -25,7 +25,8 @@ Visit https://github.com/rudecs/terraform-provider-decort for full source code p package decort import ( - "bytes" + "encoding/json" + "fmt" "strconv" "time" ) @@ -35,6 +36,7 @@ import ( var Timeout30s = time.Second * 30 var Timeout60s = time.Second * 60 var Timeout180s = time.Second * 180 +var Timeout10m = time.Minute * 10 // // structures related to /cloudapi/rg/list API @@ -581,11 +583,12 @@ const VinsDeleteAPI = "/restmachine/cloudapi/vins/delete" //K8sNodeRecord represents a worker/master group type K8sNodeRecord struct { - ID int `json:"id"` - Disk int `json:"disk"` - Cpu int `json:"cpu"` - Num int `json:"num"` - Ram int `json:"ram"` + ID int `json:"id"` + Name string `json:"name"` + Disk int `json:"disk"` + Cpu int `json:"cpu"` + Num int `json:"num"` + Ram int `json:"ram"` } //K8sRecord represents k8s instance @@ -611,22 +614,35 @@ const K8sDeleteAPI = "/restmachine/cloudapi/k8s/delete" const K8sWgCreateAPI = "/restmachine/cloudapi/k8s/workersGroupAdd" const K8sWgDeleteAPI = "/restmachine/cloudapi/k8s/workersGroupDelete" +const K8sGetConfigAPI = "/restmachine/cloudapi/k8s/getConfig" + //Blasphemous workaround for parsing Result value type TaskResult int func (r *TaskResult) UnmarshalJSON(b []byte) error { - b = bytes.Trim(b, `"`) - if len(b) == 0 { - *r = 0 - return nil - } - - n, err := strconv.Atoi(string(b)) - if err != nil { - return err + if b[0] == '"' { + b := b[1 : len(b)-1] + if len(b) == 0 { + *r = 0 + return nil + } + n, err := strconv.Atoi(string(b)) + if err != nil { + return err + } + *r = TaskResult(n) + } else if b[0] == '[' { + res := []interface{}{} + if err := json.Unmarshal(b, &res); err != nil { + return err + } + if n, ok := res[0].(float64); ok { + *r = TaskResult(n) + } else { + return fmt.Errorf("could not unmarshal %v into int", res[0]) + } } - *r = TaskResult(n) return nil } diff --git a/decort/resource_k8s.go b/decort/resource_k8s.go index e20d021..66be33a 100644 --- a/decort/resource_k8s.go +++ b/decort/resource_k8s.go @@ -44,6 +44,7 @@ func resourceK8sCreate(d *schema.ResourceData, m interface{}) error { urlValues.Add("name", d.Get("name").(string)) urlValues.Add("rgId", strconv.Itoa(d.Get("rg_id").(int))) urlValues.Add("k8ciId", strconv.Itoa(d.Get("k8sci_id").(int))) + urlValues.Add("workerGroupName", d.Get("wg_name").(string)) var masterNode K8sNodeRecord if masters, ok := d.GetOk("masters"); ok { @@ -67,7 +68,6 @@ func resourceK8sCreate(d *schema.ResourceData, m interface{}) error { urlValues.Add("workerRam", strconv.Itoa(workerNode.Ram)) urlValues.Add("workerDisk", strconv.Itoa(workerNode.Disk)) - //TODO find a way to avoid hardcoding these values //if withLB, ok := d.GetOk("with_lb"); ok { //urlValues.Add("withLB", strconv.FormatBool(withLB.(bool))) //} @@ -121,6 +121,11 @@ func resourceK8sCreate(d *schema.ResourceData, m interface{}) error { d.Set("default_wg_id", k8s.Groups.Workers[0].ID) + urlValues = &url.Values{} + urlValues.Add("k8sId", d.Id()) + kubeconfig, err := controller.decortAPICall("POST", K8sGetConfigAPI, urlValues) + d.Set("kubeconfig", kubeconfig) + return nil } @@ -136,6 +141,7 @@ func resourceK8sRead(d *schema.ResourceData, m interface{}) error { d.Set("name", k8s.Name) d.Set("rg_id", k8s.RgID) d.Set("k8sci_id", k8s.CI) + d.Set("wg_name", k8s.Groups.Workers[0].Name) d.Set("masters", nodeToResource(k8s.Groups.Masters)) d.Set("workers", nodeToResource(k8s.Groups.Workers[0])) d.Set("default_wg_id", k8s.Groups.Workers[0].ID) @@ -216,6 +222,13 @@ func resourceK8sSchemaMake() map[string]*schema.Schema { Description: "ID of the k8s catalog item to base this instance on.", }, + "wg_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Name for first worker group created with cluster.", + }, + "masters": { Type: schema.TypeList, Optional: true, @@ -265,6 +278,12 @@ func resourceK8sSchemaMake() map[string]*schema.Schema { Computed: true, Description: "ID of default workers group for this instace.", }, + + "kubeconfig": { + Type: schema.TypeString, + Computed: true, + Description: "Kubeconfig for cluster access.", + }, } } @@ -282,7 +301,13 @@ func resourceK8s() *schema.Resource { State: schema.ImportStatePassthrough, }, - //TODO timeouts + Timeouts: &schema.ResourceTimeout{ + Create: &Timeout10m, + Read: &Timeout30s, + Update: &Timeout60s, + Delete: &Timeout60s, + Default: &Timeout60s, + }, Schema: resourceK8sSchemaMake(), } diff --git a/decort/resource_k8s_wg.go b/decort/resource_k8s_wg.go index a099f6a..c5ba95c 100644 --- a/decort/resource_k8s_wg.go +++ b/decort/resource_k8s_wg.go @@ -28,7 +28,6 @@ import ( "net/url" "strconv" - "github.com/google/uuid" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" log "github.com/sirupsen/logrus" ) @@ -39,7 +38,7 @@ func resourceK8sWgCreate(d *schema.ResourceData, m interface{}) error { controller := m.(*ControllerCfg) urlValues := &url.Values{} urlValues.Add("k8sId", strconv.Itoa(d.Get("k8s_id").(int))) - urlValues.Add("name", uuid.New().String()) + urlValues.Add("name", d.Get("name").(string)) urlValues.Add("workerNum", strconv.Itoa(d.Get("num").(int))) urlValues.Add("workerCpu", strconv.Itoa(d.Get("cpu").(int))) urlValues.Add("workerRam", strconv.Itoa(d.Get("ram").(int))) @@ -51,6 +50,9 @@ func resourceK8sWgCreate(d *schema.ResourceData, m interface{}) error { } d.SetId(resp) + + // This code is the supposed flow, but at the time of writing it's not yet implemented by the platfom + //urlValues = &url.Values{} //urlValues.Add("auditId", strings.Trim(resp, `"`)) @@ -90,6 +92,7 @@ func resourceK8sWgRead(d *schema.ResourceData, m interface{}) error { return err } + d.Set("name", wg.Name) d.Set("num", wg.Num) d.Set("cpu", wg.Cpu) d.Set("ram", wg.Ram) @@ -145,13 +148,12 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema { Description: "ID of k8s instance.", }, - //Unused but required by creation API. Sending generated UUID each time - //"name": { - //Type: schema.TypeString, - //Required: true, - //ForceNew: true, - //Description: "Name of the worker group.", - //}, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Name of the worker group.", + }, "num": { Type: schema.TypeInt, @@ -200,7 +202,12 @@ func resourceK8sWg() *schema.Resource { State: schema.ImportStatePassthrough, }, - //TODO timeouts + Timeouts: &schema.ResourceTimeout{ + Create: &Timeout10m, + Read: &Timeout30s, + Delete: &Timeout60s, + Default: &Timeout60s, + }, Schema: resourceK8sWgSchemaMake(), } diff --git a/docs/data-sources/grid.md b/docs/data-sources/grid.md new file mode 100644 index 0000000..485b964 --- /dev/null +++ b/docs/data-sources/grid.md @@ -0,0 +1,43 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "decort_grid Data Source - terraform-provider-decort" +subcategory: "" +description: |- + +--- + +# decort_grid (Data Source) + + + + + + +## Schema + +### Required + +- **grid_id** (Number) + +### Optional + +- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + +### Read-Only + +- **flag** (String) +- **gid** (Number) +- **guid** (Number) +- **id** (Number) The ID of this resource. +- **location_code** (String) +- **name** (String) + + +### Nested Schema for `timeouts` + +Optional: + +- **default** (String) +- **read** (String) + + diff --git a/docs/data-sources/grid_list.md b/docs/data-sources/grid_list.md new file mode 100644 index 0000000..1a98ff8 --- /dev/null +++ b/docs/data-sources/grid_list.md @@ -0,0 +1,50 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "decort_grid_list Data Source - terraform-provider-decort" +subcategory: "" +description: |- + +--- + +# decort_grid_list (Data Source) + + + + + + +## Schema + +### Optional + +- **id** (String) The ID of this resource. +- **page** (Number) page number +- **size** (Number) page size +- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + +### Read-Only + +- **items** (List of Object) grid list (see [below for nested schema](#nestedatt--items)) + + +### Nested Schema for `timeouts` + +Optional: + +- **default** (String) +- **read** (String) + + + +### Nested Schema for `items` + +Read-Only: + +- **flag** (String) +- **gid** (Number) +- **guid** (Number) +- **id** (Number) +- **location_code** (String) +- **name** (String) + + diff --git a/docs/data-sources/image.md b/docs/data-sources/image.md index 5b2d886..bc5f002 100644 --- a/docs/data-sources/image.md +++ b/docs/data-sources/image.md @@ -17,21 +17,53 @@ description: |- ### Required -- **name** (String) Name of the image to locate. This parameter is case sensitive. +- **image_id** (Number) image id ### Optional -- **account_id** (Number) Optional ID of the account to limit image search to. - **id** (String) The ID of this resource. +- **shared_with** (List of Number) - **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) ### Read-Only -- **arch** (String) Binary architecture of this image. -- **pool** (String) Pool where this image is located. -- **sep_id** (Number) Storage end-point provider serving this image. -- **size** (Number) Size of the image in GB. -- **status** (String) Current model status of this image. +- **account_id** (Number) AccountId to make the image exclusive +- **architecture** (String) binary architecture of this image, one of X86_64 of PPC64_LE +- **boot_type** (String) Boot type of image bios or uefi +- **bootable** (Boolean) Does this image boot OS +- **computeci_id** (Number) +- **desc** (String) +- **drivers** (List of String) List of types of compute suitable for image. Example: [ "KVM_X86" ] +- **enabled** (Boolean) +- **gid** (Number) grid (platform) ID where this template should be create in +- **guid** (Number) +- **history** (List of Object) (see [below for nested schema](#nestedatt--history)) +- **hot_resize** (Boolean) Does this machine supports hot resize +- **image_type** (String) Image type linux, windows or other +- **last_modified** (Number) +- **link_to** (Number) +- **meta** (List of String) meta +- **milestones** (Number) +- **name** (String) Name of the rescue disk +- **password** (String) Optional password for the image +- **password_dl** (String) password for upload binary media +- **permanently** (Boolean) Whether to completely delete the image +- **pool_name** (String) pool for image create +- **provider_name** (String) +- **purge_attempts** (Number) +- **reference_id** (String) +- **res_id** (String) +- **res_name** (String) +- **rescuecd** (Boolean) +- **sep_id** (Number) storage endpoint provider ID +- **size** (Number) image size +- **status** (String) status +- **tech_status** (String) tech atatus +- **unc_path** (String) unc path +- **url** (String) URL where to download media from +- **username** (String) Optional username for the image +- **username_dl** (String) username for upload binary media +- **version** (String) version ### Nested Schema for `timeouts` @@ -42,3 +74,13 @@ Optional: - **read** (String) + +### Nested Schema for `history` + +Read-Only: + +- **guid** (String) +- **id** (Number) +- **timestamp** (Number) + + diff --git a/docs/data-sources/image_list.md b/docs/data-sources/image_list.md new file mode 100644 index 0000000..6e562a1 --- /dev/null +++ b/docs/data-sources/image_list.md @@ -0,0 +1,94 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "decort_image_list Data Source - terraform-provider-decort" +subcategory: "" +description: |- + +--- + +# decort_image_list (Data Source) + + + + + + +## Schema + +### Optional + +- **id** (String) The ID of this resource. +- **page** (Number) page number +- **sep_id** (Number) filter images by storage endpoint provider ID +- **shared_with** (Number) filter images by account ID availability +- **size** (Number) page size +- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + +### Read-Only + +- **items** (List of Object) image list (see [below for nested schema](#nestedatt--items)) + + +### Nested Schema for `timeouts` + +Optional: + +- **default** (String) +- **read** (String) + + + +### Nested Schema for `items` + +Read-Only: + +- **account_id** (Number) +- **architecture** (String) +- **boot_type** (String) +- **bootable** (Boolean) +- **computeci_id** (Number) +- **desc** (String) +- **drivers** (List of String) +- **enabled** (Boolean) +- **gid** (Number) +- **guid** (Number) +- **history** (List of Object) (see [below for nested schema](#nestedobjatt--items--history)) +- **hot_resize** (Boolean) +- **image_id** (Number) +- **image_type** (String) +- **last_modified** (Number) +- **link_to** (Number) +- **meta** (List of String) +- **milestones** (Number) +- **name** (String) +- **password** (String) +- **password_dl** (String) +- **permanently** (Boolean) +- **pool_name** (String) +- **provider_name** (String) +- **purge_attempts** (Number) +- **reference_id** (String) +- **res_id** (String) +- **res_name** (String) +- **rescuecd** (Boolean) +- **sep_id** (Number) +- **shared_with** (List of Number) +- **size** (Number) +- **status** (String) +- **tech_status** (String) +- **unc_path** (String) +- **url** (String) +- **username** (String) +- **username_dl** (String) +- **version** (String) + + +### Nested Schema for `items.history` + +Read-Only: + +- **guid** (String) +- **id** (Number) +- **timestamp** (Number) + + diff --git a/docs/data-sources/image_list_stacks.md b/docs/data-sources/image_list_stacks.md new file mode 100644 index 0000000..76c007f --- /dev/null +++ b/docs/data-sources/image_list_stacks.md @@ -0,0 +1,63 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "decort_image_list_stacks Data Source - terraform-provider-decort" +subcategory: "" +description: |- + +--- + +# decort_image_list_stacks (Data Source) + + + + + + +## Schema + +### Required + +- **image_id** (Number) image id + +### Optional + +- **id** (String) The ID of this resource. +- **page** (Number) page number +- **size** (Number) page size +- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + +### Read-Only + +- **items** (List of Object) items of stacks list (see [below for nested schema](#nestedatt--items)) + + +### Nested Schema for `timeouts` + +Optional: + +- **default** (String) +- **read** (String) + + + +### Nested Schema for `items` + +Read-Only: + +- **api_key** (String) +- **api_url** (String) +- **app_id** (String) +- **desc** (String) +- **drivers** (List of String) +- **error** (Number) +- **guid** (Number) +- **id** (Number) +- **images** (List of Number) +- **login** (String) +- **name** (String) +- **passwd** (String) +- **reference_id** (String) +- **status** (String) +- **type** (String) + + diff --git a/docs/resources/cdrom_image.md b/docs/resources/cdrom_image.md new file mode 100644 index 0000000..da72956 --- /dev/null +++ b/docs/resources/cdrom_image.md @@ -0,0 +1,89 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "decort_cdrom_image Resource - terraform-provider-decort" +subcategory: "" +description: |- + +--- + +# decort_cdrom_image (Resource) + + + + + + +## Schema + +### Required + +- **drivers** (List of String) List of types of compute suitable for image. Example: [ "KVM_X86" ] +- **gid** (Number) grid (platform) ID where this template should be create in +- **name** (String) Name of the rescue disk +- **url** (String) URL where to download ISO from + +### Optional + +- **account_id** (Number) AccountId to make the image exclusive +- **architecture** (String) binary architecture of this image, one of X86_64 of PPC64_LE +- **bootable** (Boolean) Does this image boot OS +- **computeci_id** (Number) +- **enabled** (Boolean) +- **enabled_stacks** (List of String) +- **hot_resize** (Boolean) Does this machine supports hot resize +- **id** (String) The ID of this resource. +- **password** (String) Optional password for the image +- **password_dl** (String) password for upload binary media +- **permanently** (Boolean) Whether to completely delete the image +- **pool_name** (String) pool for image create +- **sep_id** (Number) storage endpoint provider ID +- **shared_with** (List of Number) +- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) +- **username** (String) Optional username for the image +- **username_dl** (String) username for upload binary media + +### Read-Only + +- **boot_type** (String) Boot type of image bios or uefi +- **desc** (String) +- **guid** (Number) +- **history** (List of Object) (see [below for nested schema](#nestedatt--history)) +- **image_id** (Number) image id +- **image_type** (String) Image type linux, windows or other +- **link_to** (Number) +- **meta** (List of String) meta +- **milestones** (Number) +- **provider_name** (String) +- **purge_attempts** (Number) +- **reference_id** (String) +- **res_id** (String) +- **res_name** (String) +- **rescuecd** (Boolean) +- **size** (Number) image size +- **status** (String) status +- **tech_status** (String) tech atatus +- **unc_path** (String) unc path +- **version** (String) version + + +### Nested Schema for `timeouts` + +Optional: + +- **create** (String) +- **default** (String) +- **delete** (String) +- **read** (String) +- **update** (String) + + + +### Nested Schema for `history` + +Read-Only: + +- **guid** (String) +- **id** (Number) +- **timestamp** (Number) + + diff --git a/docs/resources/delete_images.md b/docs/resources/delete_images.md new file mode 100644 index 0000000..0bc352e --- /dev/null +++ b/docs/resources/delete_images.md @@ -0,0 +1,40 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "decort_delete_images Resource - terraform-provider-decort" +subcategory: "" +description: |- + +--- + +# decort_delete_images (Resource) + + + + + + +## Schema + +### Required + +- **image_ids** (List of Number) images ids for deleting +- **reason** (String) reason for deleting the images + +### Optional + +- **id** (String) The ID of this resource. +- **permanently** (Boolean) whether to completely delete the images +- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + + +### Nested Schema for `timeouts` + +Optional: + +- **create** (String) +- **default** (String) +- **delete** (String) +- **read** (String) +- **update** (String) + + diff --git a/docs/resources/image.md b/docs/resources/image.md new file mode 100644 index 0000000..a53623c --- /dev/null +++ b/docs/resources/image.md @@ -0,0 +1,92 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "decort_image Resource - terraform-provider-decort" +subcategory: "" +description: |- + +--- + +# decort_image (Resource) + + + + + + +## Schema + +### Required + +- **boot_type** (String) Boot type of image bios or uefi +- **drivers** (List of String) List of types of compute suitable for image. Example: [ "KVM_X86" ] +- **gid** (Number) grid (platform) ID where this template should be create in +- **image_type** (String) Image type linux, windows or other +- **name** (String) Name of the rescue disk +- **url** (String) URL where to download media from + +### Optional + +- **account_id** (Number) AccountId to make the image exclusive +- **architecture** (String) binary architecture of this image, one of X86_64 of PPC64_LE +- **bootable** (Boolean) Does this image boot OS +- **computeci_id** (Number) +- **enabled** (Boolean) +- **enabled_stacks** (List of String) +- **hot_resize** (Boolean) Does this machine supports hot resize +- **id** (String) The ID of this resource. +- **image_id** (Number) image id +- **password** (String) Optional password for the image +- **password_dl** (String) password for upload binary media +- **permanently** (Boolean) Whether to completely delete the image +- **pool_name** (String) pool for image create +- **reason** (String) +- **sep_id** (Number) storage endpoint provider ID +- **shared_with** (List of Number) +- **sync** (Boolean) Create image from a media identified by URL (in synchronous mode) +- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) +- **username** (String) Optional username for the image +- **username_dl** (String) username for upload binary media + +### Read-Only + +- **desc** (String) +- **guid** (Number) +- **history** (List of Object) (see [below for nested schema](#nestedatt--history)) +- **last_modified** (Number) +- **link_to** (Number) +- **meta** (List of String) meta +- **milestones** (Number) +- **provider_name** (String) +- **purge_attempts** (Number) +- **reference_id** (String) +- **res_id** (String) +- **res_name** (String) +- **rescuecd** (Boolean) +- **size** (Number) image size +- **status** (String) status +- **tech_status** (String) tech atatus +- **unc_path** (String) unc path +- **version** (String) version + + +### Nested Schema for `timeouts` + +Optional: + +- **create** (String) +- **default** (String) +- **delete** (String) +- **read** (String) +- **update** (String) + + + +### Nested Schema for `history` + +Read-Only: + +- **guid** (String) +- **id** (Number) +- **timestamp** (Number) + + diff --git a/docs/resources/k8s.md b/docs/resources/kubernetes.md similarity index 76% rename from docs/resources/k8s.md rename to docs/resources/kubernetes.md index 5c235f7..f0e9509 100644 --- a/docs/resources/k8s.md +++ b/docs/resources/kubernetes.md @@ -20,16 +20,19 @@ description: |- - **k8sci_id** (Number) ID of the k8s catalog item to base this instance on. - **name** (String) Name of the cluster. - **rg_id** (Number) Resource group ID that this instance belongs to. +- **wg_name** (String) Name for first worker group created with cluster. ### Optional - **id** (String) The ID of this resource. - **masters** (Block List, Max: 1) Master node(s) configuration. (see [below for nested schema](#nestedblock--masters)) +- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) - **workers** (Block List, Max: 1) Worker node(s) configuration. (see [below for nested schema](#nestedblock--workers)) ### Read-Only - **default_wg_id** (Number) ID of default workers group for this instace. +- **kubeconfig** (String) Kubeconfig for cluster access. ### Nested Schema for `masters` @@ -42,6 +45,18 @@ Required: - **ram** (Number) Node RAM in MB. + +### Nested Schema for `timeouts` + +Optional: + +- **create** (String) +- **default** (String) +- **delete** (String) +- **read** (String) +- **update** (String) + + ### Nested Schema for `workers` diff --git a/docs/resources/k8s_wg.md b/docs/resources/kubernetes_wg.md similarity index 67% rename from docs/resources/k8s_wg.md rename to docs/resources/kubernetes_wg.md index 51363a8..62251d1 100644 --- a/docs/resources/k8s_wg.md +++ b/docs/resources/kubernetes_wg.md @@ -18,6 +18,7 @@ description: |- ### Required - **k8s_id** (Number) ID of k8s instance. +- **name** (String) Name of the worker group. ### Optional @@ -26,5 +27,16 @@ description: |- - **id** (String) The ID of this resource. - **num** (Number) Number of worker nodes to create. - **ram** (Number) Worker node RAM in MB. +- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + + +### Nested Schema for `timeouts` + +Optional: + +- **create** (String) +- **default** (String) +- **delete** (String) +- **read** (String) diff --git a/docs/resources/virtual_image.md b/docs/resources/virtual_image.md new file mode 100644 index 0000000..1604064 --- /dev/null +++ b/docs/resources/virtual_image.md @@ -0,0 +1,92 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "decort_virtual_image Resource - terraform-provider-decort" +subcategory: "" +description: |- + +--- + +# decort_virtual_image (Resource) + + + + + + +## Schema + +### Required + +- **name** (String) name of the virtual image to create +- **target_id** (Number) ID of real image to link this virtual image to upon creation + +### Optional + +- **account_id** (Number) AccountId to make the image exclusive +- **architecture** (String) binary architecture of this image, one of X86_64 of PPC64_LE +- **bootable** (Boolean) Does this image boot OS +- **computeci_id** (Number) +- **enabled** (Boolean) +- **enabled_stacks** (List of String) +- **hot_resize** (Boolean) Does this machine supports hot resize +- **id** (String) The ID of this resource. +- **link_to** (Number) +- **password** (String) Optional password for the image +- **password_dl** (String) password for upload binary media +- **permanently** (Boolean) Whether to completely delete the image +- **pool_name** (String) pool for image create +- **reason** (String) +- **sep_id** (Number) storage endpoint provider ID +- **shared_with** (List of Number) +- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) +- **username** (String) Optional username for the image +- **username_dl** (String) username for upload binary media + +### Read-Only + +- **boot_type** (String) Boot type of image bios or uefi +- **desc** (String) +- **drivers** (List of String) List of types of compute suitable for image. Example: [ "KVM_X86" ] +- **gid** (Number) grid (platform) ID where this template should be create in +- **guid** (Number) +- **history** (List of Object) (see [below for nested schema](#nestedatt--history)) +- **image_id** (Number) image id +- **image_type** (String) Image type linux, windows or other +- **last_modified** (Number) +- **meta** (List of String) meta +- **milestones** (Number) +- **provider_name** (String) +- **purge_attempts** (Number) +- **reference_id** (String) +- **res_id** (String) +- **res_name** (String) +- **rescuecd** (Boolean) +- **size** (Number) image size +- **status** (String) status +- **tech_status** (String) tech atatus +- **unc_path** (String) unc path +- **url** (String) URL where to download media from +- **version** (String) version + + +### Nested Schema for `timeouts` + +Optional: + +- **create** (String) +- **default** (String) +- **delete** (String) +- **read** (String) +- **update** (String) + + + +### Nested Schema for `history` + +Read-Only: + +- **guid** (String) +- **id** (Number) +- **timestamp** (Number) + + diff --git a/go.sum b/go.sum index 2f6b550..b3d57c6 100644 --- a/go.sum +++ b/go.sum @@ -169,7 +169,6 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=