diff --git a/CHANGELOG.md b/CHANGELOG.md index abb18e57..890c377b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,210 @@ -## Version 4.10.3 +## Version 4.11.0 -### Исправлено +### Добавлено + +#### audit +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1163 | Вычисляемые поля `resgroup_id`, `account_id`, `compute_id` в datasource `decort_cb_audit` в cloudbroker/audit | + +#### bservice +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1137 | Для поля `chipset` изменено значение по умолчанию с `i440fx` на `Q35` в resource `decort_bservice_group` в cloudapi/bservice| #### disks | Идентификатор
задачи | Описание | | --- | --- | -| BATF-1204 | Ошибка построения и применения плана при использовании состояния, созданного в предыдущих версиях провайдера в resources `decort_disk` в cloudapi/disks и в `decort_cb_disk` cloudbroker/disks | +| BATF-1186 | Опциональное поле `cache` в resources `decort_disk` в cloudapi/disks и в `decort_cb_disk` в cloudbroker/disks | +| BATF-1186 | Вычисляемое поле `cache` в datasources `decort_disk`, `decort_disk_list`, `decort_disk_list_deleted`,`decort_disk_list_unattached` в cloudapi/disks и `decort_cb_disk`, `decort_cb_disk_list`, `decort_cb_disk_list_deleted`, `decort_cb_disk_list_unattached` в cloudbroker/disks | +| BATF-1201 | Опциональное поле `blk_discard` в resource `decort_cb_disk` в cloudbroker/disks | +| BATF-1201 | Вычисляемое поле `blk_discard` в datasources `decort_disk`, `decort_disk_list`, `decort_disk_list_deleted` и `decort_disk_list_unattached` в cloudapi/disks и `decort_cb_disk`, `decort_cb_disk_list`, `decort_cb_disk_list_deleted` и `decort_cb_disk_list_unattached` в cloudbroker/disks | + +#### k8s +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1137 | Для поля `chipset` добавлено значение по умолчанию `Q35` и валидация возможных значений (`i440fx`, `Q35`) в resources `decort_k8s`, `decort_k8s_wg` в cloudapi/k8s и `decort_cb_k8s_cp`, `decort_cb_k8s_wg` в cloudbroker/k8s| + +#### kvmvm +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1099 | Возможность миграции диска в другой `SEP` в `decort_cb_kvmvm` в cloudbroker/kvmvm | +| BATF-1137 | Для поля `chipset` добавлено значение по умолчанию `Q35` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm | +| BATF-1139 | Опциональное поле `read_only` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm | +| BATF-1139 | Вычисляемое поле `read_only` в datasources `decort_cb_kvmvm`, `decort_cb_kvmvm_list` в cloudbroker/kvmvm и в datasources `decort_kvmvm` и `decort_kvmvm_list` в cloudapi/kvmvm | +| BATF-1161 | Вычисляемое поле `sep_id` в блоке `disks` в datasources `decort_cb_kvmvm_list` в cloudbroker/kvmvm и `decort_kvmvm_list` в cloudapi/kvmvm | +| BATF-1187 | Опциональное поле `boot_disk_cache` в resources `decort_cb_kvmvm` в cloudbroker/kvmvm | +| BATF-1187 | Вычисляемое поле `cache` в структуру `disks` в datasources `decort_cb_kvmvm` в cloudbroker/kvmvm и `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_kvmvm` в cloudapi/kvmvm | +| BATF-1187 | Опциональное поле `cache` в структуру `disks` в resources `decort_cb_kvmvm` в cloudbroker/kvmvm | +| BATF-1160 | Опциональное поле `net_mask` в структуру `network` в resources `decort_kvmvm` в cloudapi/kvmvm и `decort_cb_kvmvm` в cloudbroker/kvmvm | +| BATF-1202 | Опциональные поля `boot_disk_blk_discard` и `blk_discard` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm | +| BATF-1202 | Вычисляемое поле `blk_discard` в datasources `decort_kvmvm` в cloudapi/kvmvm и в `decort_cb_kvmvm` в cloudbroker/kvmvm | +| BATF-1202 | Вычисляемое поле `blk_discard` в resource `decort_kvmvm` в cloudapi/kvmvm | + +#### node +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1135 | Вычисляемые поля `openvswitch_bridges`, `description`, `sdn_hypervisor_name` в datasource `decort_cb_node` в `cloudbroker/node` | +| BATF-1135 | Вычисляемые поля `flags`, `model_name` в структуру `cpu_info` в datasource `decort_cb_node` в `cloudbroker/node` | +| BATF-1135 | Вычисляемые поля `openvswitch_bridges`, `api_url`, `drivers`, `old_compat_lvm_id`, `cpu_allocation_ratio`, `mem_allocation_ratio`, `packages` в datasource `decort_cb_node_list` в `cloudbroker/node` | +| BATF-1135 | Вычисляемые поля `flags`, `model_name` в структуру `cpu_info` в datasource `decort_cb_node_list` в `cloudbroker/node` | +| BATF-1153 | Вычисляемое поле `usable_cpus` в datasource `decort_cb_node` и в `decort_cb_node_list` в `cloudbroker/node` | +| BATF-1193 | Вычисляемые поле `auto_start, auto_start_count` в datasource `decort_cb_node` и в `decort_cb_node_list` в `cloudbroker/node` | +| BATF-1197 | Вычисляемое поле `mem_allocation_ratio` в datasource `decort_cb_node` в `cloudbroker/node` | + +#### sep +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1161 | Опциональное поле `sep_ids` в datasource `decort_cb_sep_list` и в cloudbroker/sep | + +#### storage policy +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1164 | Опциональное поле `sep_tech_status` в datasource `decort_storage_policy_list` в `cloudapi/stpolicy` и в datasource `decort_cb_storage_policy_list` в `cloudbroker/stpolicy` | +| BATF-1152 | Вычисляемое поле `sep_tech_status` в datasource `decort_storage_policy_list` в `cloudapi/stpolicy` и в datasource `decort_cb_storage_policy_list` в `cloudbroker/stpolicy` | + +#### user +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1154 | Опциональное поле `sort_by` в datasource `decort_cb_user_get_audit` в `cloudbroker/user` | + +#### trunk +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1162 | Опциональное поле `mtu` в resource `decort_cb_trunk` в `cloudbroker/trunk` | +| BATF-1162 | Вычисляемое поле `mtu` в datasources `decort_cb_trunk` и `decort_cb_trunk_list` в `cloudbroker/trunk` и в datasources `decort_trunk` и `decort_trunk_list` в `cloudapi/trunk` | + +#### zone +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1192 | Опциональное поле `auto_start` в resource `decort_cb_zone` в `cloudbroker/zone` | +| BATF-1192 | Вычисляемое поле `auto_start` в datasources `decort_zone`, `decort_zone_list` в `cloudapi/zone` и в `decort_cb_zone_list`, `decort_cb_zone` в `cloudbroker/zone` | + +### Исправлено + +#### account +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1061 | Вывод значения поле `storage_policy_ids` в data_sourse`decort_cb_account` в cloudbroker/account | + +#### bservice +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1134 | Вычисляемое поле `stack_id` заменено на `node_id` в data_source и resource `decort_bservice` в cloudapi/bservice | +| BATF-1194 | Тип поля `driver` с опционального на вычисляемый в `decort_bservice_group` в `cloudbroker/bservice` | + +#### disks +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1205 | Ошибка построения и применения плана при использовании состояния, созданного в предыдущих версиях провайдера в resources `decort_disk` в cloudapi/disks и в `decort_cb_disk` cloudbroker/disks | #### image | Идентификатор
задачи | Описание | | --- | --- | -| BATF-1204 | Ошибка построения и применения плана при использовании состояния, созданного в предыдущих версиях провайдера в resources `decort_image_from_blank_compute`, `decort_image_from_platform_disk`, `decort_virtual_image` в cloudapi/image и в `decort_cb_cdrom_image`, `decort_cb_image`, `decort_cb_image_from_blank_compute`, `decort_cb_image_from_platform_disk`, `decort_cb_virtual_image` в cloudbroker/image | \ No newline at end of file +| BATF-1205 | Ошибка построения и применения плана при использовании состояния, созданного в предыдущих версиях провайдера в resources `decort_image_from_blank_compute`, `decort_image_from_platform_disk`, `decort_virtual_image` в cloudapi/image и в `decort_cb_cdrom_image`, `decort_cb_image`, `decort_cb_image_from_blank_compute`, `decort_cb_image_from_platform_disk`, `decort_cb_virtual_image` в cloudbroker/image | + +#### kvmvm +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1134 | Опциональные поля `stack_id`, `pin_to_stack` заменены на `node_id`, `pin_to_node` в resources `decort_kvmvm` в cloudapi/kvmvm и `decort_cb_kvmvm` в cloudbroker/kvmvm | +| BATF-1134 | Опциональные поля `stack_id`, `stack_name` заменены на `node_id`, `node_name` в data_source `decort_cb_kvmvm_list` в cloudbroker/kvmvm | +| BATF-1134 | Вычисляемое поле `stack_id` заменено на `node_id` в data_source `decort_kvmvm_pci_device_list` в cloudapi/kvmvm | +| BATF-1134 | Вычисляемые поля `stack_id`, `stack_name` заменены на `node_id`, `node_name` в data_source `decort_cb_kvmvm`, `decort_cb_kvmvm_list`, `decort_cb_kvmvm_list_deleted` в cloudbroker/kvmvm | +| BATF-1079 | Отображение поля `disks` в resource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm` в cloudbroker/kvmvm при импорте | +| BATF-1083 | Отображение поля `boot_disk` в resource `decort_kvmvm` в cloudapi/kvmvm при обновлении поля `image_id` | +| BATF-1092 | Отображение вычисляемых полей `devicename`,`created_by`, `deleted_by`, `updated_time` в блоке `disks` и блока `loader_meta_iso` в resource `decort_kvmvm`, datasource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm`, datasource `decort_cb_kvmvm` в cloudbroker/kvmvm | +| BATF-1142 | Остановка виртуальной машины перед удалением в resources `decort_kvmvm` и `decort_cb_kvmvm` в cloudapi/kvmvm и в cloudbroker/kvmvm | +| BATF-1165 | Тип поля `value` с опционального на обязательный в resource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm` в cloudbroker/kvmvm | +| BATF-1190 | Ошибка при старте на некорректной ноде при указании поля `node_id` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm | + +#### lb +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1188 | Тип поля `start` с обязательного на опциональный в `decort_lb` в `cloudapi/lb` и в `decort_cb_lb` в `cloudbroker/lb` | + +#### node +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1166 | Отображение datasource `decort_cb_node_list` в `cloudbroker/node` | +| BATF-1197 | Тип поля `cpu_allocation_ratio` с int на float в `decort_cb_node` в `cloudbroker/node` | + +#### pcidevice +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1134 | Обязательное поле `stack_id` заменено на `node_id` в resource `decort_cb_pcidevice` в cloudbroker/pcidevice | +| BATF-1134 | Вычисляемое поле `stack_id` заменено на `node_id` в datasoruces `decort_cb_pcidevice` и `decort_cb_pcidevice_list` в cloudbroker/pcidevice | + +#### rg +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1062 | Отображение datasourses `decort_rg_list_deleted` в cloudapi/rg и `decort_cb_rg_list_deleted` в cloudbroker/rg | + +#### sep +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1171 | Добавлен валидатор для поля `type` в resource `decort_cb_sep` в cloudbroker/sep | +| BATF-1171 | Заменено значение `ovs` на `ustor` в валидаторе поля `sep_type` в datasource `decort_cb_sep_template` в cloudbroker/sep | + +#### user +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1158 | Тип поля `emailaddress` с []string на string в `decort_cb_user` в `cloudbroker/user` | + +#### vins +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1134 | Вычисляемые поля `stack_id` заменены на `node_id` в datasource `decort_vins` в cloudapi/vins и datasource и resource `decort_cb_vins` в cloudbroker/vins | + + +### Удалено + +#### account +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1136 | Поле `cu_np` во всех resources и datasources | +| BATF-1146 | Поля `exttraffic` и `ext_traffic` во всех resources и datasources | + +#### disks +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1207 | Вычисляемое поле `ckey` из datasource `decort_disk_list_unattached` в cloudapi/disks и `decort_cb_disk_list_unattached` в cloudbroker/disks | + +#### flipgroup +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1195 | Опциональное поле `rg_id` из datasource `decort_flipgroup_list` в cloudapi/flipgroup и `decort_cb_flipgroup_list` в cloudbroker/flipgroup | +| BATF-1195 | Вычисляемые поля `rg_id` и `rg_name` из datasources `decort_flipgroup` и `decort_flipgroup_list` в cloudapi/flipgroup и `decort_cb_flipgroup` и `decort_cb_flipgroup_list` в cloudbroker/flipgroup | +| BATF-1195 | Вычисляемые поля `rg_id` и `rg_name` из resource `decort_flipgroup` в cloudapi/flipgroup и `decort_cb_flipgroup` в cloudbroker/flipgroup | + +#### grid +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1146 | Поля `exttraffic` и `ext_traffic` во всех datasources | + +#### image +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1134 | Datasource `decort_cb_image_List_stacks` в cloudbroker/image | +| BATF-1206 | Вычисляемое поле `ckey` в resource `decort_image` и datasource `decort_image` в cloudapi/image и resources `decort_cb_cdrom_image` и `decort_cb_virtual_image` в cloudbroker/image | + +#### node +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1134 | Вычисляемое поля `stack_id` в datasources `decort_cb_node` и `decort_cb_node_list` в cloudbroker/node | + +#### pcidevice +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1134 | Вычисляемые поля `ckey`, `meta` в datasources `decort_cb_pcidevice` и `decort_cb_pcidevice_list` в cloudbroker/pcidevice | + +#### stack +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1134 | Datasources `decort_stack` и `decort_stack_list` в cloudapi/stack и datasources `decort_cb_stack`, `decort_cb_stack_list` в cloudbroker/stack | + +#### rg +| Идентификатор
задачи | Описание | +| --- | --- | +| BATF-1138 | Опциональное поле `ext_traffic` в resource `decort_resgroup` в cloudbroker/rg | +| BATF-1138 | Поле `cu_np` в resources `decort_resgroup` в cloudapi/rg и в `decort_cb_rg` в cloudbroker/rg | +| BATF-1146 | Поля `exttraffic`, `ext_traffic` и `cu_np` во всех resources и datasources | diff --git a/Makefile b/Makefile index ab99e703..9cecc0bb 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ ZIPDIR = ./zip BINARY=${NAME} WORKPATH= ./examples/terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAMESPACE}/${VERSION}/${OS_ARCH} MAINPATH = ./cmd/decort/ -VERSION=4.10.3 +VERSION=4.11.0 OS_ARCH=$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH) FILES = ${BINARY}_${VERSION}_darwin_amd64\ diff --git a/README.md b/README.md index 27dab5a6..8316d73a 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Terraform provider для платформы Digital Energy Cloud Orchestration | Версия DECORT API | Версия провайдера Terraform | | ------ | ------ | +| 4.5.0 | 4.11.x | | 4.4.0 | 4.10.x | | 4.3.0 | 4.9.x | | 4.2.0 | 4.8.x | @@ -51,7 +52,6 @@ Terraform provider для платформы Digital Energy Cloud Orchestration - Работа с resource groups, - Работа с security groups, - Работа с snapshots, - - Работа с stacks, - Работа с trunk, - Работа с VINS, - Работа с SEPs, @@ -75,7 +75,6 @@ Terraform provider для платформы Digital Energy Cloud Orchestration - Работа с seps, - Работа с user, - Работа с security groups, - - Работа с stacks, - Работа с trunk, - Работа с VINS, - Работа с Zone. @@ -101,13 +100,13 @@ chmod u+x install.sh ``` 6. Дождаться сообщения об успешной установке. Установщик выведет актуальный блок конфигурации провайдера, скопируйте его ```bash -DECORT provider version 4.10.0 has been successfully installed +DECORT provider version 4.11.0 has been successfully installed Copy this provider configuration to main.tf file: terraform { required_providers { decort = { - version = "4.10.0" + version = "4.11.0" source = "basis/decort/decort" } } @@ -166,13 +165,13 @@ Windows: - host_name - имя хоста, держателя провайдера, например, basis - namespace - пространство имен хоста, например decort - type - тип провайдера, может совпадать с пространством имен, например, decort -- version - версия провайдера, например 4.10.0 +- version - версия провайдера, например 4.11.0 - target - архитектура операционной системы, например windows_amd64 В примере ниже используется путь до провайдера на машине с ОС Linux: ```bash -~/.terraform.d/plugins/basis/decort/decort/4.10.0/linux_amd64/tf-provider +~/.terraform.d/plugins/basis/decort/decort/4.11.0/linux_amd64/tf-provider ^ ^ ^ ^ ^ ^ host_name | | | | | | | | | | | @@ -197,7 +196,7 @@ Windows: terraform { required_providers { decort = { - version = "4.10.0" + version = "4.11.0" source = "basis/decort/decort" } } diff --git a/docs/data-sources/account.md b/docs/data-sources/account.md index 265847fb..ba59c0ca 100644 --- a/docs/data-sources/account.md +++ b/docs/data-sources/account.md @@ -107,7 +107,6 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `storage_policy` (List of Object) (see [below for nested schema](#nestedobjatt--resource_limits--storage_policy)) diff --git a/docs/data-sources/account_consumed_units.md b/docs/data-sources/account_consumed_units.md index 10876487..9f1a35e3 100644 --- a/docs/data-sources/account_consumed_units.md +++ b/docs/data-sources/account_consumed_units.md @@ -30,7 +30,6 @@ description: |- - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `id` (String) The ID of this resource. diff --git a/docs/data-sources/account_reserved_units.md b/docs/data-sources/account_reserved_units.md index bc847869..6e78cc85 100644 --- a/docs/data-sources/account_reserved_units.md +++ b/docs/data-sources/account_reserved_units.md @@ -30,7 +30,6 @@ description: |- - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `id` (String) The ID of this resource. diff --git a/docs/data-sources/account_resource_consumption_get.md b/docs/data-sources/account_resource_consumption_get.md index c2763bab..05e74f75 100644 --- a/docs/data-sources/account_resource_consumption_get.md +++ b/docs/data-sources/account_resource_consumption_get.md @@ -48,7 +48,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `ext_ips` (Number) -- `ext_traffic` (Number) - `gpu` (Number) - `policies` (List of Object) (see [below for nested schema](#nestedobjatt--consumed--policies)) - `ram` (Number) @@ -97,7 +96,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `ext_ips` (Number) -- `ext_traffic` (Number) - `gpu` (Number) - `policies` (List of Object) (see [below for nested schema](#nestedobjatt--reserved--policies)) - `ram` (Number) @@ -147,7 +145,6 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `storage_policy` (List of Object) (see [below for nested schema](#nestedobjatt--resource_limits--storage_policy)) diff --git a/docs/data-sources/account_resource_consumption_list.md b/docs/data-sources/account_resource_consumption_list.md index c70a9b8d..c23520ad 100644 --- a/docs/data-sources/account_resource_consumption_list.md +++ b/docs/data-sources/account_resource_consumption_list.md @@ -52,7 +52,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `ext_ips` (Number) -- `ext_traffic` (Number) - `gpu` (Number) - `policies` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed--policies)) - `ram` (Number) @@ -101,7 +100,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `ext_ips` (Number) -- `ext_traffic` (Number) - `gpu` (Number) - `policies` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved--policies)) - `ram` (Number) diff --git a/docs/data-sources/account_rg_list.md b/docs/data-sources/account_rg_list.md index 01e73a1e..f2b23e08 100644 --- a/docs/data-sources/account_rg_list.md +++ b/docs/data-sources/account_rg_list.md @@ -92,7 +92,6 @@ Read-Only: - `cpu` (Number) - `disksize` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) @@ -105,7 +104,6 @@ Read-Only: - `cpu` (Number) - `disksize` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) @@ -118,6 +116,5 @@ Read-Only: - `cpu` (Number) - `disksize` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) diff --git a/docs/data-sources/bservice.md b/docs/data-sources/bservice.md index b1481c10..9d192895 100644 --- a/docs/data-sources/bservice.md +++ b/docs/data-sources/bservice.md @@ -77,8 +77,8 @@ Read-Only: - `compgroup_role` (String) - `id` (Number) - `name` (String) +- `node_id` (Number) - `rg_id` (Number) -- `stack_id` (Number) - `status` (String) - `tech_status` (String) diff --git a/docs/data-sources/cb_account.md b/docs/data-sources/cb_account.md index 16a474a5..088e3380 100644 --- a/docs/data-sources/cb_account.md +++ b/docs/data-sources/cb_account.md @@ -87,7 +87,6 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `storage_policy` (List of Object) (see [below for nested schema](#nestedobjatt--resource_limits--storage_policy)) diff --git a/docs/data-sources/cb_account_list.md b/docs/data-sources/cb_account_list.md index 476ba58b..f73e2aad 100644 --- a/docs/data-sources/cb_account_list.md +++ b/docs/data-sources/cb_account_list.md @@ -99,7 +99,6 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `storage_policy` (List of Object) (see [below for nested schema](#nestedobjatt--items--resource_limits--storage_policy)) diff --git a/docs/data-sources/cb_account_list_deleted.md b/docs/data-sources/cb_account_list_deleted.md index a78c7efe..07715658 100644 --- a/docs/data-sources/cb_account_list_deleted.md +++ b/docs/data-sources/cb_account_list_deleted.md @@ -97,7 +97,6 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `storage_policy` (List of Object) (see [below for nested schema](#nestedobjatt--items--resource_limits--storage_policy)) diff --git a/docs/data-sources/cb_account_resource_consumption_get.md b/docs/data-sources/cb_account_resource_consumption_get.md index 9abfa440..646de1d4 100644 --- a/docs/data-sources/cb_account_resource_consumption_get.md +++ b/docs/data-sources/cb_account_resource_consumption_get.md @@ -48,7 +48,6 @@ Read-Only: - `disksize` (Number) - `disksizemax` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `policies` (List of Object) (see [below for nested schema](#nestedobjatt--consumed--policies)) - `ram` (Number) @@ -97,7 +96,6 @@ Read-Only: - `disksize` (Number) - `disksizemax` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `policies` (List of Object) (see [below for nested schema](#nestedobjatt--reserved--policies)) - `ram` (Number) @@ -147,5 +145,4 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) diff --git a/docs/data-sources/cb_account_resource_consumption_list.md b/docs/data-sources/cb_account_resource_consumption_list.md index f7367057..9484727c 100644 --- a/docs/data-sources/cb_account_resource_consumption_list.md +++ b/docs/data-sources/cb_account_resource_consumption_list.md @@ -52,7 +52,6 @@ Read-Only: - `disksize` (Number) - `disksizemax` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `policies` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed--policies)) - `ram` (Number) @@ -101,7 +100,6 @@ Read-Only: - `disksize` (Number) - `disksizemax` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `policies` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved--policies)) - `ram` (Number) diff --git a/docs/data-sources/cb_account_rg_list.md b/docs/data-sources/cb_account_rg_list.md index 2a1617e1..150e4a1a 100644 --- a/docs/data-sources/cb_account_rg_list.md +++ b/docs/data-sources/cb_account_rg_list.md @@ -93,7 +93,6 @@ Read-Only: - `disksize` (Number) - `disksizemax` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--consumed--seps)) @@ -119,7 +118,6 @@ Read-Only: - `disksize` (Number) - `disksizemax` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (Number) @@ -134,7 +132,6 @@ Read-Only: - `disksize` (Number) - `disksizemax` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--reserved--seps)) diff --git a/docs/data-sources/cb_audit.md b/docs/data-sources/cb_audit.md index a94d61b6..ab7c61ca 100644 --- a/docs/data-sources/cb_audit.md +++ b/docs/data-sources/cb_audit.md @@ -25,13 +25,16 @@ description: |- ### Read-Only +- `account_id` (Number) - `args` (String) - `call` (String) +- `compute_id` (Number) - `correlation_id` (String) - `guid` (String) - `id` (String) The ID of this resource. - `kwargs` (String) - `remote_addr` (String) +- `resgroup_id` (Number) - `responsetime` (Number) - `result` (String) - `status_code` (Number) diff --git a/docs/data-sources/cb_disk.md b/docs/data-sources/cb_disk.md index e7306837..05a38afe 100644 --- a/docs/data-sources/cb_disk.md +++ b/docs/data-sources/cb_disk.md @@ -28,7 +28,9 @@ description: |- - `account_id` (Number) - `account_name` (String) - `acl` (String) +- `blk_discard` (Boolean) - `boot_partition` (Number) +- `cache` (String) - `computes` (List of Object) (see [below for nested schema](#nestedatt--computes)) - `created_by` (String) - `created_time` (Number) diff --git a/docs/data-sources/cb_disk_list.md b/docs/data-sources/cb_disk_list.md index 67f88942..ace64ac9 100644 --- a/docs/data-sources/cb_disk_list.md +++ b/docs/data-sources/cb_disk_list.md @@ -56,7 +56,9 @@ Read-Only: - `account_id` (Number) - `account_name` (String) - `acl` (String) +- `blk_discard` (Boolean) - `boot_partition` (Number) +- `cache` (String) - `computes` (List of Object) (see [below for nested schema](#nestedobjatt--items--computes)) - `created_by` (String) - `created_time` (Number) diff --git a/docs/data-sources/cb_disk_list_deleted.md b/docs/data-sources/cb_disk_list_deleted.md index a6750dfe..d6cffefc 100644 --- a/docs/data-sources/cb_disk_list_deleted.md +++ b/docs/data-sources/cb_disk_list_deleted.md @@ -52,7 +52,9 @@ Read-Only: - `account_id` (Number) - `account_name` (String) - `acl` (String) +- `blk_discard` (Boolean) - `boot_partition` (Number) +- `cache` (String) - `computes` (List of Object) (see [below for nested schema](#nestedobjatt--items--computes)) - `created_by` (String) - `created_time` (Number) diff --git a/docs/data-sources/cb_disk_list_unattached.md b/docs/data-sources/cb_disk_list_unattached.md index aeb077b8..d8d42f44 100644 --- a/docs/data-sources/cb_disk_list_unattached.md +++ b/docs/data-sources/cb_disk_list_unattached.md @@ -51,12 +51,13 @@ Optional: Read-Only: -- `_ckey` (String) - `_meta` (List of String) - `account_id` (Number) - `account_name` (String) - `acl` (String) +- `blk_discard` (Boolean) - `boot_partition` (Number) +- `cache` (String) - `created_time` (Number) - `deleted_time` (Number) - `desc` (String) diff --git a/docs/data-sources/cb_disk_replication.md b/docs/data-sources/cb_disk_replication.md index e9f88435..15cff809 100644 --- a/docs/data-sources/cb_disk_replication.md +++ b/docs/data-sources/cb_disk_replication.md @@ -30,6 +30,7 @@ description: |- - `account_name` (String) - `acl` (String) - `boot_partition` (Number) +- `cache` (String) - `computes` (List of Object) (see [below for nested schema](#nestedatt--computes)) - `created_time` (Number) - `deleted_time` (Number) diff --git a/docs/data-sources/cb_flipgroup.md b/docs/data-sources/cb_flipgroup.md index 64113cf1..e4fc7c24 100644 --- a/docs/data-sources/cb_flipgroup.md +++ b/docs/data-sources/cb_flipgroup.md @@ -47,8 +47,6 @@ description: |- - `net_id` (Number) net_id - `net_type` (String) net_type - `network` (String) network -- `rg_id` (Number) rg_id -- `rg_name` (String) rg_name - `status` (String) status - `updated_by` (String) updated_by - `updated_time` (Number) updated_time diff --git a/docs/data-sources/cb_flipgroup_list.md b/docs/data-sources/cb_flipgroup_list.md index 2f81d70f..bcde1626 100644 --- a/docs/data-sources/cb_flipgroup_list.md +++ b/docs/data-sources/cb_flipgroup_list.md @@ -25,7 +25,6 @@ description: |- - `extnet_id` (Number) extnet_id - `name` (String) name - `page` (Number) Page number -- `rg_id` (Number) rg_id - `size` (Number) Page size - `sort_by` (String) sort by one of supported fields, format +|-(field) - `status` (String) Status diff --git a/docs/data-sources/cb_grid_get_consumption.md b/docs/data-sources/cb_grid_get_consumption.md index 46186c7e..77c0622d 100644 --- a/docs/data-sources/cb_grid_get_consumption.md +++ b/docs/data-sources/cb_grid_get_consumption.md @@ -47,7 +47,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `ext_ips` (Number) -- `ext_traffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--consumed--seps)) @@ -73,7 +72,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `ext_ips` (Number) -- `ext_traffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--reserved--seps)) diff --git a/docs/data-sources/cb_grid_list.md b/docs/data-sources/cb_grid_list.md index a30b0b00..e87ad5ee 100644 --- a/docs/data-sources/cb_grid_list.md +++ b/docs/data-sources/cb_grid_list.md @@ -72,7 +72,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `ext_ips` (Number) -- `ext_traffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--current--seps)) @@ -98,7 +97,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `ext_ips` (Number) -- `ext_traffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--reserved--seps)) diff --git a/docs/data-sources/cb_grid_list_consumption.md b/docs/data-sources/cb_grid_list_consumption.md index 8a76d3a9..d495c2bf 100644 --- a/docs/data-sources/cb_grid_list_consumption.md +++ b/docs/data-sources/cb_grid_list_consumption.md @@ -52,7 +52,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `ext_ips` (Number) -- `ext_traffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed--seps)) @@ -78,7 +77,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `ext_ips` (Number) -- `ext_traffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved--seps)) diff --git a/docs/data-sources/cb_image_list_stacks.md b/docs/data-sources/cb_image_list_stacks.md deleted file mode 100644 index 507a680d..00000000 --- a/docs/data-sources/cb_image_list_stacks.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "decort_cb_image_list_stacks Data Source - terraform-provider-decort" -subcategory: "" -description: |- - ---- - -# decort_cb_image_list_stacks (Data Source) - - - - - - -## Schema - -### Required - -- `image_id` (Number) image id - -### Optional - -- `name` (String) find by name -- `page` (Number) page number -- `size` (Number) page size -- `sort_by` (String) sort by one of supported fields, format +|-(field) -- `status` (String) find by status -- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) -- `type_image` (String) find by type - -### Read-Only - -- `entry_count` (Number) entry count -- `id` (String) The ID of this resource. -- `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) -- `ckey` (String) -- `cpu_allocation_ratio` (Number) -- `desc` (String) -- `descr` (String) -- `drivers` (List of String) -- `eco` (String) -- `error` (Number) -- `gid` (Number) -- `guid` (Number) -- `id` (Number) -- `images` (List of Number) -- `login` (String) -- `mem_allocation_ratio` (Number) -- `name` (String) -- `packages` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages)) -- `passwd` (String) -- `reference_id` (String) -- `status` (String) -- `type` (String) - - -### Nested Schema for `items.packages` - -Read-Only: - -- `libvirt_bin` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--libvirt_bin)) -- `libvirt_daemon` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--libvirt_daemon)) -- `lvm2_lockd` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--lvm2_lockd)) -- `openvswitch_common` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--openvswitch_common)) -- `openvswitch_switch` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--openvswitch_switch)) -- `qemu_system_x86` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--qemu_system_x86)) -- `sanlock` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--sanlock)) - - -### Nested Schema for `items.packages.libvirt_bin` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `items.packages.libvirt_daemon` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `items.packages.lvm2_lockd` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `items.packages.openvswitch_common` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `items.packages.openvswitch_switch` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `items.packages.qemu_system_x86` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `items.packages.sanlock` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) diff --git a/docs/data-sources/cb_kvmvm.md b/docs/data-sources/cb_kvmvm.md index 4d5252ef..fe4f041e 100644 --- a/docs/data-sources/cb_kvmvm.md +++ b/docs/data-sources/cb_kvmvm.md @@ -79,6 +79,8 @@ description: |- - `natable_vins_network_name` (String) - `need_reboot` (Boolean) - `network_interface_naming` (String) +- `node_id` (Number) +- `node_name` (String) - `numa_affinity` (String) - `numa_node_id` (Number) - `os_users` (List of Object) (see [below for nested schema](#nestedatt--os_users)) @@ -89,6 +91,7 @@ description: |- - `preferred_cpu` (List of Number) - `qemu_guest` (List of Object) (see [below for nested schema](#nestedatt--qemu_guest)) - `ram` (Number) +- `read_only` (Boolean) Shows if compute is locked to read-only operations. - `reference_id` (String) - `registered` (Boolean) - `res_name` (String) @@ -97,8 +100,6 @@ description: |- - `rg_name` (String) - `sep_id` (Number) - `snap_sets` (List of Object) (see [below for nested schema](#nestedatt--snap_sets)) -- `stack_id` (Number) -- `stack_name` (String) - `stateless_sep_id` (Number) - `stateless_sep_type` (String) - `status` (String) @@ -109,8 +110,6 @@ description: |- - `user_data` (String) - `user_managed` (Boolean) - `vgpus` (List of Object) List of virtual GPUs (see [below for nested schema](#nestedatt--vgpus)) -- `virtual_image_id` (Number) -- `virtual_image_name` (String) - `vnc_password` (String) - `zone_id` (Number) @@ -168,8 +167,10 @@ Read-Only: Read-Only: - `account_id` (Number) +- `blk_discard` (Boolean) - `boot_partition` (Number) - `bus_number` (Number) +- `cache` (String) - `ckey` (String) - `created_by` (String) - `created_time` (Number) diff --git a/docs/data-sources/cb_kvmvm_list.md b/docs/data-sources/cb_kvmvm_list.md index c48da52a..64daa5b0 100644 --- a/docs/data-sources/cb_kvmvm_list.md +++ b/docs/data-sources/cb_kvmvm_list.md @@ -26,13 +26,13 @@ description: |- - `includedeleted` (Boolean) - `ip_address` (String) Find by IP address - `name` (String) Find by name +- `node_id` (Number) Find by node ID +- `node_name` (String) Find by node name. - `page` (Number) - `rg_id` (Number) Find by RGID - `rg_name` (String) Find by resgroup name - `size` (Number) - `sort_by` (String) sort by one of supported fields, format +|-(field) -- `stack_id` (Number) Find by stack ID -- `stack_name` (String) Find by node name. - `status` (String) Find by status - `tech_status` (String) Find by tech status - `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) @@ -92,7 +92,6 @@ Read-Only: - `guid` (Number) - `hot_resize` (Boolean) - `hp_backed` (Boolean) -- `image_id` (Number) - `interfaces` (List of Object) (see [below for nested schema](#nestedobjatt--items--interfaces)) - `live_migration_job_id` (Number) - `loader_type` (String) @@ -105,6 +104,8 @@ Read-Only: - `need_reboot` (Boolean) - `network_interface_naming` (String) - `nid` (Number) +- `node_id` (Number) +- `node_name` (String) - `numa_affinity` (String) - `numa_node_id` (Number) - `os_users` (List of Object) (see [below for nested schema](#nestedobjatt--items--os_users)) @@ -113,6 +114,7 @@ Read-Only: - `preferred_cpu` (List of Number) - `qemu_guest` (List of Object) (see [below for nested schema](#nestedobjatt--items--qemu_guest)) - `ram` (Number) +- `read_only` (Boolean) - `reference_id` (String) - `registered` (Boolean) - `res_name` (String) @@ -120,8 +122,6 @@ Read-Only: - `rg_id` (Number) - `rg_name` (String) - `snap_sets` (List of Object) (see [below for nested schema](#nestedobjatt--items--snap_sets)) -- `stack_id` (Number) -- `stack_name` (String) - `stateless_sep_id` (Number) - `stateless_sep_type` (String) - `status` (String) @@ -134,7 +134,6 @@ Read-Only: - `user_managed` (Boolean) - `vgpus` (List of Number) - `vins_connected` (Number) -- `virtual_image_id` (Number) - `zone_id` (Number) @@ -184,6 +183,7 @@ Read-Only: - `bus_number` (Number) - `disk_id` (Number) - `pci_slot` (Number) +- `sep_id` (Number) diff --git a/docs/data-sources/cb_kvmvm_list_deleted.md b/docs/data-sources/cb_kvmvm_list_deleted.md index 7a1f942e..f2e9ac20 100644 --- a/docs/data-sources/cb_kvmvm_list_deleted.md +++ b/docs/data-sources/cb_kvmvm_list_deleted.md @@ -86,7 +86,6 @@ Read-Only: - `guid` (Number) - `hot_resize` (Boolean) - `hp_backed` (Boolean) -- `image_id` (Number) - `interfaces` (List of Object) (see [below for nested schema](#nestedobjatt--items--interfaces)) - `loader_type` (String) - `lock_status` (String) @@ -97,6 +96,8 @@ Read-Only: - `name` (String) - `need_reboot` (Boolean) - `network_interface_naming` (String) +- `node_id` (Number) +- `node_name` (String) - `numa_affinity` (String) - `numa_node_id` (Number) - `os_users` (List of Object) (see [below for nested schema](#nestedobjatt--items--os_users)) @@ -111,8 +112,6 @@ Read-Only: - `rg_id` (Number) - `rg_name` (String) - `snap_sets` (List of Object) (see [below for nested schema](#nestedobjatt--items--snap_sets)) -- `stack_id` (Number) -- `stack_name` (String) - `stateless_sep_id` (Number) - `stateless_sep_type` (String) - `status` (String) @@ -125,7 +124,6 @@ Read-Only: - `user_managed` (Boolean) - `vgpus` (List of Number) - `vins_connected` (Number) -- `virtual_image_id` (Number) - `zone_id` (Number) diff --git a/docs/data-sources/cb_kvmvm_pci_device_list.md b/docs/data-sources/cb_kvmvm_pci_device_list.md index 40e9bab0..a1156af2 100644 --- a/docs/data-sources/cb_kvmvm_pci_device_list.md +++ b/docs/data-sources/cb_kvmvm_pci_device_list.md @@ -58,7 +58,7 @@ Read-Only: - `hwpath` (String) - `meta` (List of String) - `name` (String) +- `node_id` (Number) - `rg_id` (Number) -- `stack_id` (Number) - `status` (String) - `system_name` (String) diff --git a/docs/data-sources/cb_node.md b/docs/data-sources/cb_node.md index af303c22..1387739d 100644 --- a/docs/data-sources/cb_node.md +++ b/docs/data-sources/cb_node.md @@ -25,29 +25,35 @@ description: |- ### Read-Only +- `auto_start` (Boolean) +- `auto_start_count` (Number) - `consumption` (List of Object) (see [below for nested schema](#nestedatt--consumption)) - `cpu_allocation_ratio` (Number) - `cpu_info` (List of Object) (see [below for nested schema](#nestedatt--cpu_info)) +- `description` (String) - `dpdk` (List of Object) (see [below for nested schema](#nestedatt--dpdk)) - `gid` (Number) - `id` (String) The ID of this resource. - `ipaddr` (List of String) - `isolated_cpus` (List of String) +- `mem_allocation_ratio` (Number) - `name` (String) - `need_reboot` (Boolean) - `net_addr` (List of Object) (see [below for nested schema](#nestedatt--net_addr)) - `network_mode` (String) - `nic_info` (List of Object) (see [below for nested schema](#nestedatt--nic_info)) - `numa_topology` (List of Object) (see [below for nested schema](#nestedatt--numa_topology)) +- `openvswitch_bridges` (List of String) - `reserved_cpus` (List of String) - `roles` (List of String) +- `sdn_hypervisor_name` (String) - `sriov_enabled` (Boolean) -- `stack_id` (Number) - `status` (String) - `to_active` (List of Object) (see [below for nested schema](#nestedatt--to_active)) - `to_installing` (List of Object) (see [below for nested schema](#nestedatt--to_installing)) - `to_maintenance` (List of Object) (see [below for nested schema](#nestedatt--to_maintenance)) - `to_restricted` (List of Object) (see [below for nested schema](#nestedatt--to_restricted)) +- `usable_cpus` (List of String) - `version` (String) - `zone_id` (Number) @@ -115,6 +121,8 @@ Read-Only: - `clock_speed` (Number) - `core_count` (Number) +- `flags` (List of String) +- `model_name` (String) - `phys_count` (Number) diff --git a/docs/data-sources/cb_node_list.md b/docs/data-sources/cb_node_list.md index 89ea2516..f55a78e2 100644 --- a/docs/data-sources/cb_node_list.md +++ b/docs/data-sources/cb_node_list.md @@ -50,9 +50,14 @@ Optional: Read-Only: - `additional_pkgs` (List of String) +- `api_url` (String) +- `auto_start` (Boolean) +- `auto_start_count` (Number) +- `cpu_allocation_ratio` (Number) - `cpu_info` (List of Object) (see [below for nested schema](#nestedobjatt--items--cpu_info)) - `description` (String) - `dpdk` (List of Object) (see [below for nested schema](#nestedobjatt--items--dpdk)) +- `drivers` (List of String) - `gid` (Number) - `guid` (String) - `hostkey` (String) @@ -61,6 +66,7 @@ Read-Only: - `lastcheck` (Number) - `machine_guid` (String) - `mainboard_sn` (String) +- `mem_allocation_ratio` (Number) - `memory` (Number) - `milestones` (Number) - `model` (String) @@ -72,6 +78,9 @@ Read-Only: - `node_id` (Number) - `node_uuid` (String) - `numa_topology` (List of Object) (see [below for nested schema](#nestedobjatt--items--numa_topology)) +- `old_compat_lvm_id` (Number) +- `openvswitch_bridges` (List of String) +- `packages` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages)) - `peer_backup` (Number) - `peer_log` (Number) - `peer_stats` (Number) @@ -84,11 +93,11 @@ Read-Only: - `seps` (List of Number) - `serial_num` (String) - `sriov_enabled` (Boolean) -- `stack_id` (Number) - `status` (String) - `tags` (List of String) - `type` (String) - `uefi_firmware_file` (String) +- `usable_cpus` (List of String) - `version` (String) - `zone_id` (Number) @@ -99,6 +108,8 @@ Read-Only: - `clock_speed` (Number) - `core_count` (Number) +- `flags` (List of String) +- `model_name` (String) - `phys_count` (Number) @@ -189,3 +200,14 @@ Read-Only: - `one_g` (Number) - `total` (Number) - `two_m` (Number) + + + + + +### Nested Schema for `items.packages` + +Read-Only: + +- `size` (String) +- `ver` (String) diff --git a/docs/data-sources/cb_pcidevice.md b/docs/data-sources/cb_pcidevice.md index c7d76d0e..f83bd306 100644 --- a/docs/data-sources/cb_pcidevice.md +++ b/docs/data-sources/cb_pcidevice.md @@ -25,16 +25,14 @@ description: |- ### Read-Only -- `ckey` (String) - `compute_id` (Number) - `description` (String) - `guid` (Number) - `hw_path` (String) - `id` (String) The ID of this resource. -- `meta` (List of String) - `name` (String) +- `node_id` (Number) - `rg_id` (Number) -- `stack_id` (Number) - `status` (String) - `system_name` (String) diff --git a/docs/data-sources/cb_pcidevice_list.md b/docs/data-sources/cb_pcidevice_list.md index 1c39742d..4731a8cf 100644 --- a/docs/data-sources/cb_pcidevice_list.md +++ b/docs/data-sources/cb_pcidevice_list.md @@ -46,15 +46,13 @@ Optional: Read-Only: -- `ckey` (String) - `compute_id` (Number) - `description` (String) - `device_id` (Number) - `guid` (Number) - `hw_path` (String) -- `meta` (List of String) - `name` (String) +- `node_id` (Number) - `rg_id` (Number) -- `stack_id` (Number) - `status` (String) - `system_name` (String) diff --git a/docs/data-sources/cb_rg.md b/docs/data-sources/cb_rg.md index ef82ff32..95db46cc 100644 --- a/docs/data-sources/cb_rg.md +++ b/docs/data-sources/cb_rg.md @@ -89,7 +89,6 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `storage_policy` (Set of Object) (see [below for nested schema](#nestedobjatt--resource_limits--storage_policy)) diff --git a/docs/data-sources/cb_rg_list.md b/docs/data-sources/cb_rg_list.md index fc2921dd..b0b1cb4f 100644 --- a/docs/data-sources/cb_rg_list.md +++ b/docs/data-sources/cb_rg_list.md @@ -106,7 +106,6 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `storage_policy` (Set of Object) (see [below for nested schema](#nestedobjatt--items--resource_limits--storage_policy)) diff --git a/docs/data-sources/cb_rg_list_deleted.md b/docs/data-sources/cb_rg_list_deleted.md index 4ae6ddfb..1d2e05e2 100644 --- a/docs/data-sources/cb_rg_list_deleted.md +++ b/docs/data-sources/cb_rg_list_deleted.md @@ -104,7 +104,6 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `storage_policy` (Set of Object) (see [below for nested schema](#nestedobjatt--items--resource_limits--storage_policy)) diff --git a/docs/data-sources/cb_rg_resource_consumption_get.md b/docs/data-sources/cb_rg_resource_consumption_get.md index 8ea3f909..9ea6ed40 100644 --- a/docs/data-sources/cb_rg_resource_consumption_get.md +++ b/docs/data-sources/cb_rg_resource_consumption_get.md @@ -48,7 +48,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--consumed--seps)) @@ -74,7 +73,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--reserved--seps)) @@ -101,5 +99,4 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) diff --git a/docs/data-sources/cb_rg_resource_consumption_list.md b/docs/data-sources/cb_rg_resource_consumption_list.md index 2535f5b7..698d0c77 100644 --- a/docs/data-sources/cb_rg_resource_consumption_list.md +++ b/docs/data-sources/cb_rg_resource_consumption_list.md @@ -53,7 +53,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed--seps)) @@ -79,7 +78,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved--seps)) @@ -106,5 +104,4 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) diff --git a/docs/data-sources/cb_rg_usage.md b/docs/data-sources/cb_rg_usage.md index 33aeb5a4..c0756945 100644 --- a/docs/data-sources/cb_rg_usage.md +++ b/docs/data-sources/cb_rg_usage.md @@ -29,7 +29,6 @@ description: |- - `disk_size` (Number) - `disk_size_max` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `id` (String) The ID of this resource. - `ram` (Number) diff --git a/docs/data-sources/cb_sep_list.md b/docs/data-sources/cb_sep_list.md index b683f53d..0a31bc1b 100644 --- a/docs/data-sources/cb_sep_list.md +++ b/docs/data-sources/cb_sep_list.md @@ -23,6 +23,7 @@ description: |- - `name` (String) find by name - `page` (Number) page number - `provided_by` (Number) find by provided physical node id +- `sep_ids` (List of Number) sort by list of SEP identifiers - `size` (Number) page size - `sort_by` (String) sort by one of supported fields, format +|-(field) - `tech_status` (String) find by techStatus diff --git a/docs/data-sources/cb_stack.md b/docs/data-sources/cb_stack.md deleted file mode 100644 index 30b25f16..00000000 --- a/docs/data-sources/cb_stack.md +++ /dev/null @@ -1,134 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "decort_cb_stack Data Source - terraform-provider-decort" -subcategory: "" -description: |- - ---- - -# decort_cb_stack (Data Source) - - - - - - -## Schema - -### Required - -- `stack_id` (Number) stack_id - -### Optional - -- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) - -### Read-Only - -- `api_key` (String) api_key -- `api_url` (String) api_url -- `app_id` (String) api_id -- `ckey` (String) ckey -- `cpu_allocation_ratio` (Number) cpu_allocation_ratio -- `descr` (String) descr -- `description` (String) description -- `drivers` (List of String) drivers -- `eco` (String) eco -- `error` (Number) error -- `gid` (Number) gid -- `guid` (Number) guid -- `id` (String) The ID of this resource. -- `images` (List of Number) images -- `login` (String) login -- `mem_allocation_ratio` (Number) mem_allocation_ratio -- `meta` (List of String) meta -- `name` (String) name -- `packages` (List of Object) (see [below for nested schema](#nestedatt--packages)) -- `passwd` (String) password -- `reference_id` (String) reference_id -- `status` (String) status -- `type` (String) type - - -### Nested Schema for `timeouts` - -Optional: - -- `default` (String) -- `read` (String) - - - -### Nested Schema for `packages` - -Read-Only: - -- `libvirt_bin` (List of Object) (see [below for nested schema](#nestedobjatt--packages--libvirt_bin)) -- `libvirt_daemon` (List of Object) (see [below for nested schema](#nestedobjatt--packages--libvirt_daemon)) -- `lvm2_lockd` (List of Object) (see [below for nested schema](#nestedobjatt--packages--lvm2_lockd)) -- `openvswitch_common` (List of Object) (see [below for nested schema](#nestedobjatt--packages--openvswitch_common)) -- `openvswitch_switch` (List of Object) (see [below for nested schema](#nestedobjatt--packages--openvswitch_switch)) -- `qemu_system_x86` (List of Object) (see [below for nested schema](#nestedobjatt--packages--qemu_system_x86)) -- `sanlock` (List of Object) (see [below for nested schema](#nestedobjatt--packages--sanlock)) - - -### Nested Schema for `packages.libvirt_bin` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `packages.libvirt_daemon` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `packages.lvm2_lockd` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `packages.openvswitch_common` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `packages.openvswitch_switch` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `packages.qemu_system_x86` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `packages.sanlock` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) diff --git a/docs/data-sources/cb_stack_list.md b/docs/data-sources/cb_stack_list.md deleted file mode 100644 index 30a99874..00000000 --- a/docs/data-sources/cb_stack_list.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "decort_cb_stack_list Data Source - terraform-provider-decort" -subcategory: "" -description: |- - ---- - -# decort_cb_stack_list (Data Source) - - - - - - -## Schema - -### Optional - -- `by_id` (Number) by_id -- `name` (String) name -- `page` (Number) page number -- `size` (Number) page size -- `sort_by` (String) sort by one of supported fields, format +|-(field) -- `status` (String) type -- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) -- `type` (String) type - -### Read-Only - -- `entry_count` (Number) entry_count -- `id` (String) The ID of this resource. -- `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) -- `ckey` (String) -- `cpu_allocation_ratio` (Number) -- `descr` (String) -- `description` (String) -- `drivers` (List of String) -- `eco` (String) -- `error` (Number) -- `gid` (Number) -- `guid` (Number) -- `images` (List of Number) -- `login` (String) -- `mem_allocation_ratio` (Number) -- `meta` (List of String) -- `name` (String) -- `packages` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages)) -- `passwd` (String) -- `reference_id` (String) -- `stack_id` (Number) -- `status` (String) -- `type` (String) - - -### Nested Schema for `items.packages` - -Read-Only: - -- `libvirt_bin` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--libvirt_bin)) -- `libvirt_daemon` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--libvirt_daemon)) -- `lvm2_lockd` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--lvm2_lockd)) -- `openvswitch_common` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--openvswitch_common)) -- `openvswitch_switch` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--openvswitch_switch)) -- `qemu_system_x86` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--qemu_system_x86)) -- `sanlock` (List of Object) (see [below for nested schema](#nestedobjatt--items--packages--sanlock)) - - -### Nested Schema for `items.packages.libvirt_bin` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `items.packages.libvirt_daemon` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `items.packages.lvm2_lockd` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `items.packages.openvswitch_common` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `items.packages.openvswitch_switch` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `items.packages.qemu_system_x86` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) - - - -### Nested Schema for `items.packages.sanlock` - -Read-Only: - -- `installed_size` (String) -- `ver` (String) diff --git a/docs/data-sources/cb_storage_policy.md b/docs/data-sources/cb_storage_policy.md index c9e06d56..f978edfc 100644 --- a/docs/data-sources/cb_storage_policy.md +++ b/docs/data-sources/cb_storage_policy.md @@ -50,6 +50,7 @@ Read-Only: - `pool_names` (List of String) - `sep_id` (Number) +- `sep_name` (String) diff --git a/docs/data-sources/cb_storage_policy_list.md b/docs/data-sources/cb_storage_policy_list.md index 3e6e5d61..0129b2ca 100644 --- a/docs/data-sources/cb_storage_policy_list.md +++ b/docs/data-sources/cb_storage_policy_list.md @@ -26,6 +26,7 @@ description: |- - `pool_name` (String) - `resgroup_id` (Number) - `sep_id` (Number) +- `sep_tech_status` (String) - `size` (Number) - `sort_by` (String) - `status` (String) @@ -68,6 +69,7 @@ Read-Only: - `pool_names` (List of String) - `sep_id` (Number) - `sep_name` (String) +- `sep_tech_status` (String) diff --git a/docs/data-sources/cb_trunk.md b/docs/data-sources/cb_trunk.md index bfd864d8..a99c9e54 100644 --- a/docs/data-sources/cb_trunk.md +++ b/docs/data-sources/cb_trunk.md @@ -34,6 +34,7 @@ description: |- - `guid` (Number) GUID - `id` (String) The ID of this resource. - `mac` (String) MAC address +- `mtu` (Number) Maximum Transmission Unit - `name` (String) Name of the trunk - `native_vlan_id` (Number) Native VLAN ID - `ovs_bridge` (String) OVS bridge name diff --git a/docs/data-sources/cb_trunk_list.md b/docs/data-sources/cb_trunk_list.md index 874fc73c..db9fb404 100644 --- a/docs/data-sources/cb_trunk_list.md +++ b/docs/data-sources/cb_trunk_list.md @@ -55,6 +55,7 @@ Read-Only: - `guid` (Number) - `id` (Number) - `mac` (String) +- `mtu` (Number) - `name` (String) - `native_vlan_id` (Number) - `ovs_bridge` (String) diff --git a/docs/data-sources/cb_user_get_audit.md b/docs/data-sources/cb_user_get_audit.md index 7533b4dd..1a5b1478 100644 --- a/docs/data-sources/cb_user_get_audit.md +++ b/docs/data-sources/cb_user_get_audit.md @@ -20,6 +20,7 @@ description: |- - `call` (String) find by api call - `page` (Number) Page number - `size` (Number) Page size +- `sort_by` (String) sort by one of supported fields, format ± - `status_code` (Number) find by status code - `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) - `timestamp_at` (Number) find all audits after point in time (unixtime) diff --git a/docs/data-sources/cb_vins.md b/docs/data-sources/cb_vins.md index a7888204..7b47ec6d 100644 --- a/docs/data-sources/cb_vins.md +++ b/docs/data-sources/cb_vins.md @@ -131,8 +131,8 @@ Read-Only: Read-Only: - `cpu` (Number) +- `node_id` (Number) - `ram` (Number) -- `stack_id` (Number) - `uuid` (String) diff --git a/docs/data-sources/cb_zone.md b/docs/data-sources/cb_zone.md index 55492ed1..50b58f4a 100644 --- a/docs/data-sources/cb_zone.md +++ b/docs/data-sources/cb_zone.md @@ -26,6 +26,7 @@ description: |- ### Read-Only - `account_ids` (List of Number) +- `auto_start` (Boolean) - `bservice_ids` (List of Number) - `compute_ids` (List of Number) - `created_time` (Number) diff --git a/docs/data-sources/cb_zone_list.md b/docs/data-sources/cb_zone_list.md index e29e5866..88409396 100644 --- a/docs/data-sources/cb_zone_list.md +++ b/docs/data-sources/cb_zone_list.md @@ -49,6 +49,7 @@ Optional: Read-Only: +- `auto_start` (Boolean) - `created_time` (Number) - `deletable` (Boolean) - `description` (String) diff --git a/docs/data-sources/disk.md b/docs/data-sources/disk.md index 9b95a1b2..3cd581c3 100644 --- a/docs/data-sources/disk.md +++ b/docs/data-sources/disk.md @@ -28,6 +28,8 @@ description: |- - `account_id` (Number) The unique ID of the subscriber-owner of the disk - `account_name` (String) The name of the subscriber '(account') to whom this disk belongs - `acl` (String) +- `blk_discard` (Boolean) +- `cache` (String) - `computes` (List of Object) (see [below for nested schema](#nestedatt--computes)) - `created_by` (String) - `created_time` (Number) Created time diff --git a/docs/data-sources/disk_list.md b/docs/data-sources/disk_list.md index 4b8a51d8..b264cd7f 100644 --- a/docs/data-sources/disk_list.md +++ b/docs/data-sources/disk_list.md @@ -56,6 +56,8 @@ Read-Only: - `account_id` (Number) - `account_name` (String) - `acl` (String) +- `blk_discard` (Boolean) +- `cache` (String) - `computes` (List of Object) (see [below for nested schema](#nestedobjatt--items--computes)) - `created_by` (String) - `created_time` (Number) diff --git a/docs/data-sources/disk_list_deleted.md b/docs/data-sources/disk_list_deleted.md index 1839b113..71768326 100644 --- a/docs/data-sources/disk_list_deleted.md +++ b/docs/data-sources/disk_list_deleted.md @@ -52,6 +52,8 @@ Read-Only: - `account_id` (Number) - `account_name` (String) - `acl` (String) +- `blk_discard` (Boolean) +- `cache` (String) - `computes` (List of Object) (see [below for nested schema](#nestedobjatt--items--computes)) - `created_by` (String) - `created_time` (Number) diff --git a/docs/data-sources/disk_list_unattached.md b/docs/data-sources/disk_list_unattached.md index 3257df3d..b2c165b1 100644 --- a/docs/data-sources/disk_list_unattached.md +++ b/docs/data-sources/disk_list_unattached.md @@ -51,12 +51,13 @@ Optional: Read-Only: -- `_ckey` (String) - `_meta` (List of String) - `account_id` (Number) - `account_name` (String) - `acl` (String) +- `blk_discard` (Boolean) - `boot_partition` (Number) +- `cache` (String) - `created_time` (Number) - `deleted_time` (Number) - `desc` (String) diff --git a/docs/data-sources/flipgroup.md b/docs/data-sources/flipgroup.md index 04c43efd..f007c9b8 100644 --- a/docs/data-sources/flipgroup.md +++ b/docs/data-sources/flipgroup.md @@ -46,8 +46,6 @@ description: |- - `net_id` (Number) - `net_type` (String) - `network` (String) -- `rg_id` (Number) -- `rg_name` (String) - `status` (String) - `updated_by` (String) - `updated_time` (Number) diff --git a/docs/data-sources/flipgroup_list.md b/docs/data-sources/flipgroup_list.md index f70e060b..36599a54 100644 --- a/docs/data-sources/flipgroup_list.md +++ b/docs/data-sources/flipgroup_list.md @@ -25,7 +25,6 @@ description: |- - `extnet_id` (Number) Filter by ExtNetID - `name` (String) Filter by Name - `page` (Number) Page number -- `rg_id` (Number) Filter by RG ID - `size` (Number) Page size - `sort_by` (String) sort by one of supported fields, format +|-(field) - `status` (String) Status diff --git a/docs/data-sources/image.md b/docs/data-sources/image.md index a04e705e..bf6dc026 100644 --- a/docs/data-sources/image.md +++ b/docs/data-sources/image.md @@ -32,7 +32,6 @@ description: |- - `boot_type` (String) - `bootable` (Boolean) - `cd_presented_to` (String) -- `ckey` (String) - `compute_ci_id` (Number) - `deleted_time` (Number) - `desc` (String) diff --git a/docs/data-sources/kvmvm.md b/docs/data-sources/kvmvm.md index 30004933..935ff879 100644 --- a/docs/data-sources/kvmvm.md +++ b/docs/data-sources/kvmvm.md @@ -86,6 +86,7 @@ description: |- - `preferred_cpu` (List of Number) - `qemu_guest` (List of Object) (see [below for nested schema](#nestedatt--qemu_guest)) - `ram` (Number) +- `read_only` (Boolean) Shows if compute is in read-only mode. - `reference_id` (String) - `registered` (Boolean) - `res_name` (String) @@ -103,8 +104,6 @@ description: |- - `user_managed` (Boolean) - `userdata` (String) - `vgpus` (List of Object) List of virtual GPUs (see [below for nested schema](#nestedatt--vgpus)) -- `virtual_image_id` (Number) -- `virtual_image_name` (String) - `vnc_password` (String) - `zone_id` (Number) @@ -200,8 +199,10 @@ Read-Only: - `_ckey` (String) - `account_id` (Number) - `acl` (String) +- `blk_discard` (Boolean) - `boot_partition` (Number) - `bus_number` (Number) +- `cache` (String) - `created_by` (String) - `created_time` (Number) - `deleted_by` (String) diff --git a/docs/data-sources/kvmvm_list.md b/docs/data-sources/kvmvm_list.md index 56938238..e33891f2 100644 --- a/docs/data-sources/kvmvm_list.md +++ b/docs/data-sources/kvmvm_list.md @@ -89,7 +89,6 @@ Read-Only: - `guid` (Number) - `hot_resize` (Boolean) - `hp_backed` (Boolean) -- `image_id` (Number) - `interfaces` (List of Object) (see [below for nested schema](#nestedobjatt--items--interfaces)) - `live_migration_job_id` (Number) - `loader_type` (String) @@ -108,6 +107,7 @@ Read-Only: - `preferred_cpu` (List of Number) - `qemu_guest` (List of Object) (see [below for nested schema](#nestedobjatt--items--qemu_guest)) - `ram` (Number) +- `read_only` (Boolean) - `reference_id` (String) - `registered` (Boolean) - `res_name` (String) @@ -126,7 +126,6 @@ Read-Only: - `user_managed` (Boolean) - `vgpus` (List of Number) - `vins_connected` (Number) -- `virtual_image_id` (Number) - `zone_id` (Number) @@ -176,6 +175,7 @@ Read-Only: - `bus_number` (Number) - `disk_id` (Number) - `pci_slot` (Number) +- `sep_id` (Number) diff --git a/docs/data-sources/kvmvm_list_deleted.md b/docs/data-sources/kvmvm_list_deleted.md index 9650d5e6..d4d67745 100644 --- a/docs/data-sources/kvmvm_list_deleted.md +++ b/docs/data-sources/kvmvm_list_deleted.md @@ -86,7 +86,6 @@ Read-Only: - `guid` (Number) - `hot_resize` (Boolean) - `hp_backed` (Boolean) -- `image_id` (Number) - `interfaces` (List of Object) (see [below for nested schema](#nestedobjatt--items--interfaces)) - `live_migration_job_id` (Number) - `loader_type` (String) @@ -105,6 +104,7 @@ Read-Only: - `preferred_cpu` (List of Number) - `qemu_guest` (List of Object) (see [below for nested schema](#nestedobjatt--items--qemu_guest)) - `ram` (Number) +- `read_only` (Boolean) - `reference_id` (String) - `registered` (Boolean) - `res_name` (String) @@ -123,7 +123,6 @@ Read-Only: - `user_managed` (Boolean) - `vgpus` (List of Number) - `vins_connected` (Number) -- `virtual_image_id` (Number) - `zone_id` (Number) @@ -173,6 +172,7 @@ Read-Only: - `bus_number` (Number) - `disk_id` (Number) - `pci_slot` (Number) +- `sep_id` (Number) diff --git a/docs/data-sources/kvmvm_pci_device_list.md b/docs/data-sources/kvmvm_pci_device_list.md index 47e4cdd3..7e5bd7d4 100644 --- a/docs/data-sources/kvmvm_pci_device_list.md +++ b/docs/data-sources/kvmvm_pci_device_list.md @@ -56,7 +56,7 @@ Read-Only: - `guid` (Number) - `hwpath` (String) - `name` (String) +- `node_id` (Number) - `rg_id` (Number) -- `stack_id` (Number) - `status` (String) - `system_name` (String) diff --git a/docs/data-sources/resgroup.md b/docs/data-sources/resgroup.md index c6320fb8..584408a9 100644 --- a/docs/data-sources/resgroup.md +++ b/docs/data-sources/resgroup.md @@ -89,7 +89,6 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `storage_policy` (Set of Object) (see [below for nested schema](#nestedobjatt--resource_limits--storage_policy)) diff --git a/docs/data-sources/rg_list.md b/docs/data-sources/rg_list.md index c7584514..982b4417 100644 --- a/docs/data-sources/rg_list.md +++ b/docs/data-sources/rg_list.md @@ -106,7 +106,6 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `storage_policy` (Set of Object) (see [below for nested schema](#nestedobjatt--items--resource_limits--storage_policy)) diff --git a/docs/data-sources/rg_list_deleted.md b/docs/data-sources/rg_list_deleted.md index 9a50fd25..cae870e6 100644 --- a/docs/data-sources/rg_list_deleted.md +++ b/docs/data-sources/rg_list_deleted.md @@ -104,7 +104,6 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `storage_policy` (Set of Object) (see [below for nested schema](#nestedobjatt--items--resource_limits--storage_policy)) diff --git a/docs/data-sources/rg_resource_consumption_get.md b/docs/data-sources/rg_resource_consumption_get.md index fae1e4d4..c6abdc79 100644 --- a/docs/data-sources/rg_resource_consumption_get.md +++ b/docs/data-sources/rg_resource_consumption_get.md @@ -48,7 +48,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--consumed--seps)) @@ -74,7 +73,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--reserved--seps)) @@ -101,5 +99,4 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) diff --git a/docs/data-sources/rg_resource_consumption_list.md b/docs/data-sources/rg_resource_consumption_list.md index 76aac06c..02c645c3 100644 --- a/docs/data-sources/rg_resource_consumption_list.md +++ b/docs/data-sources/rg_resource_consumption_list.md @@ -53,7 +53,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed--seps)) @@ -79,7 +78,6 @@ Read-Only: - `disk_size` (Number) - `disk_size_max` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `ram` (Number) - `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved--seps)) @@ -106,5 +104,4 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) diff --git a/docs/data-sources/rg_usage.md b/docs/data-sources/rg_usage.md index 70a26b05..c321a8f7 100644 --- a/docs/data-sources/rg_usage.md +++ b/docs/data-sources/rg_usage.md @@ -29,7 +29,6 @@ description: |- - `disk_size` (Number) - `disk_size_max` (Number) - `extips` (Number) -- `exttraffic` (Number) - `gpu` (Number) - `id` (String) The ID of this resource. - `ram` (Number) diff --git a/docs/data-sources/stack.md b/docs/data-sources/stack.md deleted file mode 100644 index 9582fb63..00000000 --- a/docs/data-sources/stack.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "decort_stack Data Source - terraform-provider-decort" -subcategory: "" -description: |- - ---- - -# decort_stack (Data Source) - - - - - - -## Schema - -### Required - -- `stack_id` (Number) - -### Optional - -- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) - -### Read-Only - -- `cpu_allocation_ratio` (Number) -- `descr` (String) -- `drivers` (List of String) -- `id` (String) The ID of this resource. -- `mem_allocation_ratio` (Number) -- `name` (String) -- `status` (String) -- `type` (String) - - -### Nested Schema for `timeouts` - -Optional: - -- `default` (String) -- `read` (String) diff --git a/docs/data-sources/stack_list.md b/docs/data-sources/stack_list.md deleted file mode 100644 index 8bf6fa26..00000000 --- a/docs/data-sources/stack_list.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "decort_stack_list Data Source - terraform-provider-decort" -subcategory: "" -description: |- - ---- - -# decort_stack_list (Data Source) - - - - - - -## Schema - -### Optional - -- `by_id` (Number) Find by ID -- `name` (String) Find by name -- `page` (Number) Page number -- `size` (Number) Page size -- `sort_by` (String) sort by one of supported fields, format +|-(field) -- `status` (String) Find by status -- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) -- `type` (String) Find by type - -### Read-Only - -- `entry_count` (Number) -- `id` (String) The ID of this resource. -- `items` (List of Object) (see [below for nested schema](#nestedatt--items)) - - -### Nested Schema for `timeouts` - -Optional: - -- `default` (String) -- `read` (String) - - - -### Nested Schema for `items` - -Read-Only: - -- `name` (String) -- `stack_id` (Number) -- `status` (String) -- `type` (String) diff --git a/docs/data-sources/storage_policy.md b/docs/data-sources/storage_policy.md index 06f2c5d5..ed447d9f 100644 --- a/docs/data-sources/storage_policy.md +++ b/docs/data-sources/storage_policy.md @@ -50,6 +50,7 @@ Read-Only: - `pool_names` (List of String) - `sep_id` (Number) +- `sep_name` (String) diff --git a/docs/data-sources/storage_policy_list.md b/docs/data-sources/storage_policy_list.md index ccb43319..3b7cf09e 100644 --- a/docs/data-sources/storage_policy_list.md +++ b/docs/data-sources/storage_policy_list.md @@ -26,6 +26,7 @@ description: |- - `pool_name` (String) - `resgroup_id` (Number) - `sep_id` (Number) +- `sep_tech_status` (String) - `size` (Number) - `sort_by` (String) - `status` (String) @@ -68,6 +69,7 @@ Read-Only: - `pool_names` (List of String) - `sep_id` (Number) - `sep_name` (String) +- `sep_tech_status` (String) diff --git a/docs/data-sources/trunk.md b/docs/data-sources/trunk.md index f22d1f41..a4e223e8 100644 --- a/docs/data-sources/trunk.md +++ b/docs/data-sources/trunk.md @@ -34,6 +34,7 @@ description: |- - `guid` (Number) GUID - `id` (String) The ID of this resource. - `mac` (String) MAC address +- `mtu` (Number) Maximum Transmission Unit - `name` (String) Name of the trunk - `native_vlan_id` (Number) Native VLAN ID - `ovs_bridge` (String) OVS bridge name diff --git a/docs/data-sources/trunk_list.md b/docs/data-sources/trunk_list.md index 97b4ee10..49fe9f43 100644 --- a/docs/data-sources/trunk_list.md +++ b/docs/data-sources/trunk_list.md @@ -55,6 +55,7 @@ Read-Only: - `guid` (Number) - `id` (Number) - `mac` (String) +- `mtu` (Number) - `name` (String) - `native_vlan_id` (Number) - `ovs_bridge` (String) diff --git a/docs/data-sources/vins.md b/docs/data-sources/vins.md index cae66d63..3c1bd87c 100644 --- a/docs/data-sources/vins.md +++ b/docs/data-sources/vins.md @@ -140,8 +140,8 @@ Read-Only: Read-Only: - `cpu` (Number) +- `node_id` (Number) - `ram` (Number) -- `stack_id` (Number) - `uuid` (String) diff --git a/docs/data-sources/zone.md b/docs/data-sources/zone.md index 08b72907..828bf574 100644 --- a/docs/data-sources/zone.md +++ b/docs/data-sources/zone.md @@ -17,6 +17,7 @@ description: |- ### Required +- `auto_start` (Boolean) - `zone_id` (Number) ### Optional diff --git a/docs/data-sources/zone_list.md b/docs/data-sources/zone_list.md index 1d02960c..7333e600 100644 --- a/docs/data-sources/zone_list.md +++ b/docs/data-sources/zone_list.md @@ -49,6 +49,7 @@ Optional: Read-Only: +- `auto_start` (Boolean) - `created_time` (Number) - `deletable` (Boolean) - `description` (String) diff --git a/docs/resources/account.md b/docs/resources/account.md index 3cda1654..f2752bbd 100644 --- a/docs/resources/account.md +++ b/docs/resources/account.md @@ -69,7 +69,6 @@ Optional: - `cu_d` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) Read-Only: diff --git a/docs/resources/bservice.md b/docs/resources/bservice.md index 42b3089d..cdb85559 100644 --- a/docs/resources/bservice.md +++ b/docs/resources/bservice.md @@ -99,8 +99,8 @@ Read-Only: - `compgroup_role` (String) - `id` (Number) - `name` (String) +- `node_id` (Number) - `rg_id` (Number) -- `stack_id` (Number) - `status` (String) - `tech_status` (String) diff --git a/docs/resources/bservice_group.md b/docs/resources/bservice_group.md index 1f180334..4d002d0e 100644 --- a/docs/resources/bservice_group.md +++ b/docs/resources/bservice_group.md @@ -28,10 +28,9 @@ description: |- ### Optional -- `chipset` (String) +- `chipset` (String) Chipset for virtual machines. - `cloud_init` (String) Optional cloud_init parameters. Applied when creating new compute instance only, ignored in all other cases. - `compgroup_id` (Number) -- `driver` (String) compute driver like a KVM_X86, etc. - `extnets` (List of Number) list of external networks to connect computes to - `force_stop` (Boolean) force stop Compute Group - `force_update` (Boolean) force resize Compute Group @@ -56,6 +55,7 @@ description: |- - `created_time` (Number) - `deleted_by` (String) - `deleted_time` (Number) +- `driver` (String) - `gid` (Number) - `guid` (Number) - `id` (String) The ID of this resource. diff --git a/docs/resources/cb_account.md b/docs/resources/cb_account.md index 3ea83b18..3eaaeb1c 100644 --- a/docs/resources/cb_account.md +++ b/docs/resources/cb_account.md @@ -70,7 +70,6 @@ Optional: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) Read-Only: diff --git a/docs/resources/cb_cdrom_image.md b/docs/resources/cb_cdrom_image.md index 2bfc274b..97e34348 100644 --- a/docs/resources/cb_cdrom_image.md +++ b/docs/resources/cb_cdrom_image.md @@ -40,7 +40,6 @@ description: |- - `acl` (List of Object) (see [below for nested schema](#nestedatt--acl)) - `boot_type` (String) Boot type of image bios or uefi -- `ckey` (String) - `deleted_time` (Number) - `desc` (String) - `drivers` (List of String) diff --git a/docs/resources/cb_disk.md b/docs/resources/cb_disk.md index 9857560e..a250ad52 100644 --- a/docs/resources/cb_disk.md +++ b/docs/resources/cb_disk.md @@ -24,6 +24,8 @@ description: |- ### Optional +- `blk_discard` (Boolean) +- `cache` (String) Cache mode for the disk - `desc` (String) - `detach` (Boolean) detach disk from machine first - `iotune` (Block List, Max: 1) (see [below for nested schema](#nestedblock--iotune)) diff --git a/docs/resources/cb_flipgroup.md b/docs/resources/cb_flipgroup.md index 95b9ab3e..6754c2ca 100644 --- a/docs/resources/cb_flipgroup.md +++ b/docs/resources/cb_flipgroup.md @@ -49,8 +49,6 @@ description: |- - `milestones` (Number) milestones - `net_mask` (Number) - `network` (String) network -- `rg_id` (Number) rg_id -- `rg_name` (String) rg_name - `status` (String) - `updated_by` (String) updated_by - `updated_time` (Number) updated_time diff --git a/docs/resources/cb_k8s_cp.md b/docs/resources/cb_k8s_cp.md index af6be1ab..abf8faea 100644 --- a/docs/resources/cb_k8s_cp.md +++ b/docs/resources/cb_k8s_cp.md @@ -26,7 +26,7 @@ description: |- ### Optional - `additional_sans` (List of String) Optional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names -- `chipset` (String) Type of the emulated system. +- `chipset` (String) Type of the emulated system. Possible values: i440fx, Q35. Default: Q35 - `cluster_config` (String) is used to define global settings and configurations for the entire cluster. It includes parameters such as cluster name, DNS settings, authentication methods, and other cluster-wide configurations. insert a valid JSON string with all levels of nesting. - `cpu` (Number) Node CPU count. - `desc` (String) Text description of this instance. diff --git a/docs/resources/cb_k8s_wg.md b/docs/resources/cb_k8s_wg.md index ef3aec5f..ffa5ff39 100644 --- a/docs/resources/cb_k8s_wg.md +++ b/docs/resources/cb_k8s_wg.md @@ -24,7 +24,7 @@ description: |- ### Optional - `annotations` (List of String) -- `chipset` (String) Type of the emulated system. +- `chipset` (String) Type of the emulated system. Possible values: i440fx, Q35. Default: Q35 - `cloud_init` (String) - `cpu` (Number) Worker node CPU count. - `disk` (Number) Worker node boot disk size. If unspecified or 0, size is defined by OS image size. diff --git a/docs/resources/cb_kvmvm.md b/docs/resources/cb_kvmvm.md index a44dfae4..144caca0 100644 --- a/docs/resources/cb_kvmvm.md +++ b/docs/resources/cb_kvmvm.md @@ -30,6 +30,8 @@ description: |- - `alt_boot_id` (Number) ID of CD-ROM live image to boot - `anti_affinity_rules` (Block List) (see [below for nested schema](#nestedblock--anti_affinity_rules)) - `auto_start_w_node` (Boolean) +- `boot_disk_blk_discard` (Boolean) +- `boot_disk_cache` (String) Setting the boot disk caching mode - `boot_disk_size` (Number) This compute instance boot disk size in GB. Make sure it is large enough to accomodate selected OS image. - `boot_type` (String) Type of image upload. - `cd` (Block Set, Max: 1) (see [below for nested schema](#nestedblock--cd)) @@ -54,22 +56,23 @@ description: |- - `loader_type` (String) Type of image vm. - `network` (Block Set) Optional network connection(s) for this compute. You may specify several network blocks, one for each connection. (see [below for nested schema](#nestedblock--network)) - `network_interface_naming` (String) Name of netfowrk interface. +- `node_id` (Number) ID of node to start compute - `numa_affinity` (String) Rule for VM placement with NUMA affinity. - `os_version` (String) the OS version installed on the VM - `pause` (Boolean) - `pci_devices` (Set of Number) ID of the connected pci devices - `permanently` (Boolean) -- `pin_to_stack` (Boolean) +- `pin_to_node` (Boolean) - `pool` (String) Pool to use if sepId is set, can be also empty if needed to be chosen by system. - `port_forwarding` (Block Set) (see [below for nested schema](#nestedblock--port_forwarding)) - `preferred_cpu` (List of Number) Recommended isolated CPUs. Field is ignored if compute.cpupin=False or compute.pinned=False +- `read_only` (Boolean) Sets read-only mode for this compute. Only data operations allowed when enabled. - `reset` (Boolean) - `restore` (Boolean) - `rollback` (Block Set, Max: 1) (see [below for nested schema](#nestedblock--rollback)) - `security_groups` (Block Set) list of security group IDs to apply to this interface (see [below for nested schema](#nestedblock--security_groups)) - `sep_id` (Number) ID of SEP to create bootDisk on. Uses image's sepId if not set. - `snapshot` (Block Set) (see [below for nested schema](#nestedblock--snapshot)) -- `stack_id` (Number) ID of stack to start compute - `started` (Boolean) Is compute started. - `tags` (Block Set) (see [below for nested schema](#nestedblock--tags)) - `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) @@ -116,6 +119,7 @@ description: |- - `natable_vins_network` (String) - `natable_vins_network_name` (String) - `need_reboot` (Boolean) +- `node_name` (String) Name of the node, on which VM started - `numa_node_id` (Number) - `os_users` (List of Object) Guest OS users provisioned on this compute instance. (see [below for nested schema](#nestedatt--os_users)) - `pinned` (Number) @@ -125,7 +129,6 @@ description: |- - `reserved_node_cpus` (List of Number) - `rg_name` (String) Name of the resource group where this compute instance is located. - `snap_sets` (List of Object) (see [below for nested schema](#nestedatt--snap_sets)) -- `stack_name` (String) Name of the stack, on which VM started - `stateless_sep_id` (Number) - `stateless_sep_type` (String) - `status` (String) @@ -134,7 +137,6 @@ description: |- - `updated_time` (Number) - `user_managed` (Boolean) - `vgpus` (List of Object) List of virtual GPUs (see [below for nested schema](#nestedatt--vgpus)) -- `virtual_image_id` (Number) - `virtual_image_name` (String) - `vnc_password` (String) @@ -147,9 +149,6 @@ Required: - `mode` (String) EQ or NE or ANY - the comparison mode is 'value', recorded by the specified 'key' - `policy` (String) RECOMMENDED or REQUIRED, the degree of 'strictness' of this rule - `topology` (String) compute or node, for whom rule applies - -Optional: - - `value` (String) value that must match the key to be taken into account when analyzing this rule @@ -162,9 +161,6 @@ Required: - `mode` (String) EQ or NE or ANY - the comparison mode is 'value', recorded by the specified 'key' - `policy` (String) RECOMMENDED or REQUIRED, the degree of 'strictness' of this rule - `topology` (String) compute or node, for whom rule applies - -Optional: - - `value` (String) value that must match the key to be taken into account when analyzing this rule @@ -187,6 +183,8 @@ Required: Optional: +- `blk_discard` (Boolean) +- `cache` (String) Setting the disk caching mode - `desc` (String) Optional description - `disk_type` (String) The type of disk in terms of its role in compute: 'B=Boot, D=Data' - `image_id` (Number) Specify image id for create disk from template @@ -243,6 +241,7 @@ Optional: - `ip_address` (String) Optional IP address to assign to this connection. This IP should belong to the selected network and free for use. - `mac` (String) MAC address associated with this connection. MAC address is assigned automatically. - `mtu` (Number) Maximum transmission unit, used only for DPDK type, must be 1-9216 +- `net_mask` (Number) Subnet mask, used only for DPDK and VFNIC network types - `sdn_interface_id` (String) unique_identifier of LogicalPort on SDN side - `weight` (Number) weight the network if you need to sort network list, the smallest attach first. zero or null weight attach last diff --git a/docs/resources/cb_pcidevice.md b/docs/resources/cb_pcidevice.md index 56a85407..5509840e 100644 --- a/docs/resources/cb_pcidevice.md +++ b/docs/resources/cb_pcidevice.md @@ -19,8 +19,8 @@ description: |- - `hw_path` (String) PCI address of the device - `name` (String) Name of Device +- `node_id` (Number) Node ID - `rg_id` (Number) Resource GROUP -- `stack_id` (Number) stackId ### Optional diff --git a/docs/resources/cb_rg.md b/docs/resources/cb_rg.md index 21fcb73a..7481534e 100644 --- a/docs/resources/cb_rg.md +++ b/docs/resources/cb_rg.md @@ -97,7 +97,6 @@ Optional: - `cu_dm` (Number) MaxVDiskCapacity - `cu_i` (Number) MaxNumPublicIP - `cu_m` (Number) MaxMemoryCapacity -- `cu_np` (Number) MaxNetworkPeerTransfer Read-Only: diff --git a/docs/resources/cb_storage_policy.md b/docs/resources/cb_storage_policy.md index 98a76b76..e926a654 100644 --- a/docs/resources/cb_storage_policy.md +++ b/docs/resources/cb_storage_policy.md @@ -43,6 +43,10 @@ Required: - `pool_name` (String) - `sep_id` (Number) +Read-Only: + +- `sep_name` (String) + ### Nested Schema for `timeouts` diff --git a/docs/resources/cb_trunk.md b/docs/resources/cb_trunk.md index 609d65ab..efedbab2 100644 --- a/docs/resources/cb_trunk.md +++ b/docs/resources/cb_trunk.md @@ -26,6 +26,7 @@ description: |- - `account_ids` (Set of Number) List of account IDs with access to this trunk - `description` (String) Description of the trunk - `enable` (Boolean) Whether the trunk should be enabled +- `mtu` (Number) Maximum Transmission Unit - `native_vlan_id` (Number) Native VLAN ID - `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) diff --git a/docs/resources/cb_user.md b/docs/resources/cb_user.md index 861d3607..6ea73466 100644 --- a/docs/resources/cb_user.md +++ b/docs/resources/cb_user.md @@ -17,7 +17,7 @@ description: |- ### Required -- `emailaddress` (List of String) email addresses of the user +- `emailaddress` (String) email address of the user - `username` (String) ID of user ### Optional diff --git a/docs/resources/cb_vins.md b/docs/resources/cb_vins.md index 10e01c12..def08bee 100644 --- a/docs/resources/cb_vins.md +++ b/docs/resources/cb_vins.md @@ -198,8 +198,8 @@ Read-Only: Read-Only: - `cpu` (Number) +- `node_id` (Number) - `ram` (Number) -- `stack_id` (Number) - `uuid` (String) diff --git a/docs/resources/cb_virtual_image.md b/docs/resources/cb_virtual_image.md index d152cee7..27828af1 100644 --- a/docs/resources/cb_virtual_image.md +++ b/docs/resources/cb_virtual_image.md @@ -37,7 +37,6 @@ description: |- - `acl` (List of Object) (see [below for nested schema](#nestedatt--acl)) - `architecture` (String) binary architecture of this image, one of X86_64 - `boot_type` (String) Boot type of image bios or uefi -- `ckey` (String) - `deleted_time` (Number) - `desc` (String) - `drivers` (List of String) List of types of compute suitable for image. Example: [ "KVM_X86" ] diff --git a/docs/resources/cb_zone.md b/docs/resources/cb_zone.md index 94beb14c..d51881b1 100644 --- a/docs/resources/cb_zone.md +++ b/docs/resources/cb_zone.md @@ -21,6 +21,7 @@ description: |- ### Optional +- `auto_start` (Boolean) - `description` (String) - `node_ids` (List of Number) - `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) diff --git a/docs/resources/disk.md b/docs/resources/disk.md index caa26054..50017bed 100644 --- a/docs/resources/disk.md +++ b/docs/resources/disk.md @@ -37,6 +37,7 @@ description: |- - `account_name` (String) The name of the subscriber '(account') to whom this disk belongs - `acl` (String) +- `cache` (String) - `computes` (List of Object) (see [below for nested schema](#nestedatt--computes)) - `created_by` (String) - `created_time` (Number) Created time diff --git a/docs/resources/flipgroup.md b/docs/resources/flipgroup.md index 9ba30166..cb297ce8 100644 --- a/docs/resources/flipgroup.md +++ b/docs/resources/flipgroup.md @@ -46,8 +46,6 @@ description: |- - `id` (String) The ID of this resource. - `milestones` (Number) - `network` (String) -- `rg_id` (Number) -- `rg_name` (String) - `status` (String) - `updated_by` (String) - `updated_time` (Number) diff --git a/docs/resources/image.md b/docs/resources/image.md index 19503747..6f95f59f 100644 --- a/docs/resources/image.md +++ b/docs/resources/image.md @@ -44,7 +44,6 @@ description: |- - `architecture` (String) - `bootable` (Boolean) - `cd_presented_to` (String) -- `ckey` (String) - `compute_ci_id` (Number) - `deleted_time` (Number) - `desc` (String) diff --git a/docs/resources/image_virtual.md b/docs/resources/image_virtual.md index a38b9d85..7237af0f 100644 --- a/docs/resources/image_virtual.md +++ b/docs/resources/image_virtual.md @@ -32,7 +32,6 @@ description: |- - `boot_type` (String) - `bootable` (Boolean) - `cd_presented_to` (String) -- `ckey` (String) - `compute_ci_id` (Number) - `deleted_time` (Number) - `desc` (String) diff --git a/docs/resources/k8s.md b/docs/resources/k8s.md index 6807812b..bc0d595e 100644 --- a/docs/resources/k8s.md +++ b/docs/resources/k8s.md @@ -28,7 +28,7 @@ description: |- - `additional_sans` (List of String) Optional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names - `annotations` (List of String) -- `chipset` (String) Type of the emulated system. +- `chipset` (String) Type of the emulated system. Possible values: i440fx, Q35. Default: Q35 - `cloud_init` (String) Meta data for working group computes, format YAML 'user_data': 1111 - `cluster_config` (String) is used to define global settings and configurations for the entire cluster. It includes parameters such as cluster name, DNS settings, authentication methods, and other cluster-wide configurations. insert a valid JSON string with all levels of nesting. - `desc` (String) Text description of this instance. diff --git a/docs/resources/k8s_cp.md b/docs/resources/k8s_cp.md index 5339fc0a..95710bb8 100644 --- a/docs/resources/k8s_cp.md +++ b/docs/resources/k8s_cp.md @@ -26,7 +26,7 @@ description: |- ### Optional - `additional_sans` (List of String) Optional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names -- `chipset` (String) Type of the emulated system. +- `chipset` (String) Type of the emulated system. Possible values: i440fx, Q35. Default: Q35 - `cluster_config` (String) is used to define global settings and configurations for the entire cluster. It includes parameters such as cluster name, DNS settings, authentication methods, and other cluster-wide configurations. insert a valid JSON string with all levels of nesting. - `cpu` (Number) Node CPU count. - `desc` (String) Text description of this instance. diff --git a/docs/resources/k8s_wg.md b/docs/resources/k8s_wg.md index 40f6646f..e81395ea 100644 --- a/docs/resources/k8s_wg.md +++ b/docs/resources/k8s_wg.md @@ -24,7 +24,7 @@ description: |- ### Optional - `annotations` (List of String) -- `chipset` (String) Type of the emulated system. +- `chipset` (String) Type of the emulated system. Possible values: i440fx, Q35. Default: Q35 - `cloud_init` (String) - `cpu` (Number) Worker node CPU count. - `disk` (Number) Worker node boot disk size. If unspecified or 0, size is defined by OS image size. diff --git a/docs/resources/kvmvm.md b/docs/resources/kvmvm.md index 59d9ad2e..92130569 100644 --- a/docs/resources/kvmvm.md +++ b/docs/resources/kvmvm.md @@ -56,7 +56,7 @@ description: |- - `pause` (Boolean) - `pci_devices` (Set of Number) ID of the connected pci devices - `permanently` (Boolean) -- `pin_to_stack` (Boolean) +- `pin_to_node` (Boolean) - `pool` (String) Pool to use if sepId is set, can be also empty if needed to be chosen by system. - `port_forwarding` (Block Set) (see [below for nested schema](#nestedblock--port_forwarding)) - `preferred_cpu` (List of Number) Recommended isolated CPUs. Field is ignored if compute.cpupin=False or compute.pinned=False @@ -114,6 +114,7 @@ description: |- - `numa_node_id` (Number) - `os_users` (List of Object) Guest OS users provisioned on this compute instance. (see [below for nested schema](#nestedatt--os_users)) - `pinned` (Boolean) +- `read_only` (Boolean) Shows if compute is in read-only mode. - `reference_id` (String) - `registered` (Boolean) - `res_name` (String) @@ -141,9 +142,6 @@ Required: - `mode` (String) EQ or NE or ANY - the comparison mode is 'value', recorded by the specified 'key' - `policy` (String) RECOMMENDED or REQUIRED, the degree of 'strictness' of this rule - `topology` (String) compute or node, for whom rule applies - -Optional: - - `value` (String) value that must match the key to be taken into account when analyzing this rule @@ -156,9 +154,6 @@ Required: - `mode` (String) EQ or NE or ANY - the comparison mode is 'value', recorded by the specified 'key' - `policy` (String) RECOMMENDED or REQUIRED, the degree of 'strictness' of this rule - `topology` (String) compute or node, for whom rule applies - -Optional: - - `value` (String) value that must match the key to be taken into account when analyzing this rule @@ -190,6 +185,8 @@ Optional: Read-Only: +- `blk_discard` (Boolean) +- `cache` (String) - `created_by` (String) - `created_time` (Number) - `deleted_by` (String) @@ -218,6 +215,7 @@ Optional: - `ip_address` (String) Optional IP address to assign to this connection. This IP should belong to the selected network and free for use. - `mac` (String) MAC address associated with this connection. MAC address is assigned automatically. - `mtu` (Number) Maximum transmission unit, used only for DPDK type, must be 1-9216 +- `net_mask` (Number) Subnet mask, used only for DPDK and VFNIC network types - `sdn_interface_id` (String) unique_identifier of LogicalPort on SDN side - `weight` (Number) weight the network if you need to sort network list, the smallest attach first. zero or null weight attach last @@ -301,6 +299,8 @@ Required: Read-Only: +- `blk_discard` (Boolean) +- `cache` (String) - `created_by` (String) - `created_time` (Number) - `deleted_by` (String) diff --git a/docs/resources/lb.md b/docs/resources/lb.md index aed0ab28..efad36f3 100644 --- a/docs/resources/lb.md +++ b/docs/resources/lb.md @@ -19,7 +19,6 @@ description: |- - `name` (String) - `rg_id` (Number) -- `start` (Boolean) ### Optional @@ -32,6 +31,7 @@ description: |- - `restart` (Boolean) - `restore` (Boolean) - `safe` (Boolean) +- `start` (Boolean) - `sysctl_params` (List of Map of String) - `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) - `vins_id` (Number) diff --git a/docs/resources/resgroup.md b/docs/resources/resgroup.md index 46f38fe0..1c4769eb 100644 --- a/docs/resources/resgroup.md +++ b/docs/resources/resgroup.md @@ -98,7 +98,6 @@ Optional: - `cpu` (Number) Limit on the total number of CPUs in this resource group. - `disk` (Number) Limit on the total volume of virtual storage resources in this resource group, specified in GB. - `ext_ips` (Number) Limit on the total number of external IP addresses this resource group can use. -- `ext_traffic` (Number) Limit on the total ingress network traffic for this resource group, specified in GB. - `ram` (Number) Limit on the total amount of RAM in this resource group, specified in MB. Read-Only: @@ -154,7 +153,6 @@ Read-Only: - `cu_dm` (Number) - `cu_i` (Number) - `cu_m` (Number) -- `cu_np` (Number) - `gpu_units` (Number) - `storage_policy` (Set of Object) (see [below for nested schema](#nestedobjatt--resource_limits--storage_policy)) diff --git a/docs/resources/vins.md b/docs/resources/vins.md index a934b42a..7e7e2f54 100644 --- a/docs/resources/vins.md +++ b/docs/resources/vins.md @@ -195,8 +195,8 @@ Read-Only: Read-Only: - `cpu` (Number) +- `node_id` (Number) - `ram` (Number) -- `stack_id` (Number) - `uuid` (String) diff --git a/go.mod b/go.mod index f03ca8fc..7d33361a 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/hashicorp/terraform-plugin-sdk/v2 v2.38.1 github.com/sirupsen/logrus v1.9.0 golang.org/x/net v0.44.0 - repository.basistech.ru/BASIS/decort-golang-sdk v1.12.10 + repository.basistech.ru/BASIS/decort-golang-sdk v1.13.8 ) require ( diff --git a/go.sum b/go.sum index c9956042..8d794520 100644 --- a/go.sum +++ b/go.sum @@ -318,5 +318,5 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -repository.basistech.ru/BASIS/decort-golang-sdk v1.12.10 h1:7RLk2Vjl6evKo4dLxlxiQCrRJSSlUwLztO3ZE/uBt+8= -repository.basistech.ru/BASIS/decort-golang-sdk v1.12.10/go.mod h1:S/f7GxwWcE88eFpORV+I9xqEf8zDW5srQHpG2XQCLZM= +repository.basistech.ru/BASIS/decort-golang-sdk v1.13.8 h1:Uc+GBfbEg1dQPMuFfqNhKZmMO19N7OvdCNHIFnLLkp0= +repository.basistech.ru/BASIS/decort-golang-sdk v1.13.8/go.mod h1:S/f7GxwWcE88eFpORV+I9xqEf8zDW5srQHpG2XQCLZM= diff --git a/internal/provider/data_sources_map.go b/internal/provider/data_sources_map.go index 13510628..8d1bcf28 100644 --- a/internal/provider/data_sources_map.go +++ b/internal/provider/data_sources_map.go @@ -38,7 +38,6 @@ import ( "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/secgroup" "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/sep" "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/snapshot" - "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/stack" "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/stpolicy" "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/trunk" "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/vfpool" @@ -66,7 +65,6 @@ import ( cb_rg "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/rg" cb_secgroup "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/secgroup" cb_sep "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/sep" - cb_stack "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/stack" cb_stpolicy "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/stpolicy" cb_trunk "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/trunk" cb_user "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/user" @@ -161,8 +159,6 @@ func newDataSourcesMap() map[string]*schema.Resource { "decort_lb_list_deleted": lb.DataSourceLBListDeleted(), "decort_flipgroup": flipgroup.DataSourceFlipgroup(), "decort_flipgroup_list": flipgroup.DataSourceFlipGroupList(), - "decort_stack": stack.DataSourceStack(), - "decort_stack_list": stack.DataSourceStackList(), "decort_vfpool": vfpool.DataSourceVFPool(), "decort_vfpool_list": vfpool.DataSourceVFPoolList(), "decort_account_resource_consumption_list": account.DataSourceAccountResourceConsumptionList(), @@ -218,7 +214,6 @@ func newDataSourcesMap() map[string]*schema.Resource { "decort_cb_grid_list_consumption": cb_grid.DataSourceGridListConsumption(), "decort_cb_grid_get_consumption": cb_grid.DataSourceGridGetConsumption(), "decort_cb_image_list": cb_image.DataSourceImageList(), - "decort_cb_image_list_stacks": cb_image.DataSourceImageListStacks(), "decort_cb_kvmvm": cb_kvmvm.DataSourceCompute(), "decort_cb_kvmvm_affinity_relations": cb_kvmvm.DataSourceComputeAffinityRelations(), "decort_cb_kvmvm_audits": cb_kvmvm.DataSourceComputeAudits(), @@ -277,8 +272,6 @@ func newDataSourcesMap() map[string]*schema.Resource { "decort_cb_flipgroup": cb_flipgroup.DataSourceFlipgroup(), "decort_cb_security_group": cb_secgroup.DataSourceSecurityGroup(), "decort_cb_security_group_list": cb_secgroup.DataSourceSecurityGroupList(), - "decort_cb_stack_list": cb_stack.DataSourceStacksList(), - "decort_cb_stack": cb_stack.DataSourceStack(), "decort_cb_storage_policy": cb_stpolicy.DataSourceStoragePolicy(), "decort_cb_storage_policy_list": cb_stpolicy.DataSourceStoragePolicyList(), "decort_cb_trunk": cb_trunk.DataSourceTrunk(), diff --git a/internal/service/cloudapi/account/data_source_account.go b/internal/service/cloudapi/account/data_source_account.go index bcc1d347..5c117f50 100644 --- a/internal/service/cloudapi/account/data_source_account.go +++ b/internal/service/cloudapi/account/data_source_account.go @@ -41,7 +41,6 @@ import ( "repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants" ) -// TODO: resources (additional ds / additional request inside body (?)) func dataSourceAccountRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { acc, err := utilityAccountCheckPresence(ctx, d, m) if err != nil { @@ -119,10 +118,6 @@ func resourceLimitsSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, @@ -171,91 +166,6 @@ func sepsSchemaMake() map[string]*schema.Schema { return res } -func resourcesSchemaMake() map[string]*schema.Schema { - res := map[string]*schema.Schema{ - "current": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "cpu": { - Type: schema.TypeInt, - Computed: true, - }, - "disksize": { - Type: schema.TypeFloat, - Computed: true, - }, - "extips": { - Type: schema.TypeInt, - Computed: true, - }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, - "gpu": { - Type: schema.TypeInt, - Computed: true, - }, - "ram": { - Type: schema.TypeInt, - Computed: true, - }, - "seps": { - Type: schema.TypeSet, - Computed: true, - Elem: &schema.Resource{ - Schema: sepsSchemaMake(), - }, - }, - }, - }, - }, - "reserved": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "cpu": { - Type: schema.TypeInt, - Computed: true, - }, - "disksize": { - Type: schema.TypeFloat, - Computed: true, - }, - "extips": { - Type: schema.TypeInt, - Computed: true, - }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, - "gpu": { - Type: schema.TypeInt, - Computed: true, - }, - "ram": { - Type: schema.TypeInt, - Computed: true, - }, - "seps": { - Type: schema.TypeSet, - Computed: true, - Elem: &schema.Resource{ - Schema: sepsSchemaMake(), - }, - }, - }, - }, - }, - } - - return res -} - func computesSchemaMake() map[string]*schema.Schema { res := map[string]*schema.Schema{ "started": { diff --git a/internal/service/cloudapi/account/data_source_account_consumed_units.go b/internal/service/cloudapi/account/data_source_account_consumed_units.go index e8375b19..7d4ed6f5 100644 --- a/internal/service/cloudapi/account/data_source_account_consumed_units.go +++ b/internal/service/cloudapi/account/data_source_account_consumed_units.go @@ -55,7 +55,6 @@ func dataSourceAccountConsumedUnitsRead(ctx context.Context, d *schema.ResourceD d.Set("cu_dm", accountConsumedUnits.CUDM) d.Set("cu_i", accountConsumedUnits.CUI) d.Set("cu_m", accountConsumedUnits.CUM) - d.Set("cu_np", accountConsumedUnits.CUNP) d.Set("gpu_units", accountConsumedUnits.GPUUnits) return nil @@ -88,10 +87,6 @@ func dataSourceAccountConsumedUnitsSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, diff --git a/internal/service/cloudapi/account/data_source_account_get_resource_consumption.go b/internal/service/cloudapi/account/data_source_account_get_resource_consumption.go index 439c33d2..a0925483 100644 --- a/internal/service/cloudapi/account/data_source_account_get_resource_consumption.go +++ b/internal/service/cloudapi/account/data_source_account_get_resource_consumption.go @@ -108,10 +108,6 @@ func dataSourceResourceLimitsSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, diff --git a/internal/service/cloudapi/account/data_source_account_reserved_units.go b/internal/service/cloudapi/account/data_source_account_reserved_units.go index 9d2341cb..8e2ec66b 100644 --- a/internal/service/cloudapi/account/data_source_account_reserved_units.go +++ b/internal/service/cloudapi/account/data_source_account_reserved_units.go @@ -55,7 +55,6 @@ func dataSourceAccountReservedUnitsRead(ctx context.Context, d *schema.ResourceD d.Set("cu_dm", accountReservedUnits.CUDM) d.Set("cu_i", accountReservedUnits.CUI) d.Set("cu_m", accountReservedUnits.CUM) - d.Set("cu_np", accountReservedUnits.CUNP) d.Set("gpu_units", accountReservedUnits.GPUUnits) return nil @@ -88,10 +87,6 @@ func dataSourceAccountReservedUnitsSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, diff --git a/internal/service/cloudapi/account/data_source_account_resource_consumption_list.go b/internal/service/cloudapi/account/data_source_account_resource_consumption_list.go index 99ab961a..ad3736e7 100644 --- a/internal/service/cloudapi/account/data_source_account_resource_consumption_list.go +++ b/internal/service/cloudapi/account/data_source_account_resource_consumption_list.go @@ -131,10 +131,6 @@ func dataSourceAccResourceSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "ext_traffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudapi/account/data_source_account_rg_list.go b/internal/service/cloudapi/account/data_source_account_rg_list.go index 5da9e97b..1f3b6680 100644 --- a/internal/service/cloudapi/account/data_source_account_rg_list.go +++ b/internal/service/cloudapi/account/data_source_account_rg_list.go @@ -80,12 +80,11 @@ func flattenAccRGComputes(argc account.RGComputes) []map[string]interface{} { func flattenAccResourceHack(r account.LimitsRG) []map[string]interface{} { res := make([]map[string]interface{}, 0) temp := map[string]interface{}{ - "cpu": r.CPU, - "disksize": r.DiskSize, - "extips": r.ExtIPs, - "exttraffic": r.ExtTraffic, - "gpu": r.GPU, - "ram": r.RAM, + "cpu": r.CPU, + "disksize": r.DiskSize, + "extips": r.ExtIPs, + "gpu": r.GPU, + "ram": r.RAM, //"seps": flattenAccountSeps(r.SEPs), } res = append(res, temp) @@ -95,12 +94,11 @@ func flattenAccResourceHack(r account.LimitsRG) []map[string]interface{} { func flattenAccResourceRg(r account.Resource) []map[string]interface{} { res := make([]map[string]interface{}, 0) temp := map[string]interface{}{ - "cpu": r.CPU, - "disksize": r.DiskSize, - "extips": r.ExtIPs, - "exttraffic": r.ExtTraffic, - "gpu": r.GPU, - "ram": r.RAM, + "cpu": r.CPU, + "disksize": r.DiskSize, + "extips": r.ExtIPs, + "gpu": r.GPU, + "ram": r.RAM, } res = append(res, temp) return res @@ -223,10 +221,6 @@ func dataSourceAccountRGListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -256,10 +250,6 @@ func dataSourceAccountRGListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -288,10 +278,6 @@ func dataSourceAccountRGListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudapi/account/flattens.go b/internal/service/cloudapi/account/flattens.go index fcab67e3..2ee43f1b 100644 --- a/internal/service/cloudapi/account/flattens.go +++ b/internal/service/cloudapi/account/flattens.go @@ -8,8 +8,6 @@ import ( func flattenAccount(d *schema.ResourceData, acc account.RecordAccount) error { d.Set("dc_location", acc.DCLocation) d.Set("desc", acc.Description) - //TODO - // d.Set("resources", flattenAccResources(acc.Resources)) d.Set("acl", flattenAccAcl(acc.ACL)) d.Set("company", acc.Company) d.Set("companyurl", acc.CompanyURL) @@ -52,8 +50,6 @@ func flattenAccount(d *schema.ResourceData, acc account.RecordAccount) error { func flattenAccountResource(d *schema.ResourceData, acc account.RecordAccount) error { d.Set("dc_location", acc.DCLocation) d.Set("desc", acc.Description) - //TODO - // d.Set("resources", flattenAccResources(acc.Resources)) d.Set("acl", flattenAccAcl(acc.ACL)) d.Set("company", acc.Company) d.Set("companyurl", acc.CompanyURL) @@ -144,7 +140,6 @@ func flattenAccResourceLimits(rl account.ResourceLimits) []map[string]interface{ "cu_dm": rl.CUDM, "cu_i": rl.CUI, "cu_m": rl.CUM, - "cu_np": rl.CUNP, "gpu_units": rl.GPUUnits, "storage_policy": flattenSTPolicy(rl.StoragePolicy), } @@ -165,16 +160,6 @@ func flattenSTPolicy(ast []account.StoragePolicyItem) []map[string]interface{} { return res } -// func flattenAccResources(r account.Resources) []map[string]interface{} { -// res := make([]map[string]interface{}, 0) -// temp := map[string]interface{}{ -// "current": flattenAccResource(r.Current), -// "reserved": flattenAccResource(r.Reserved), -// } -// res = append(res, temp) -// return res -// } - func flattenAccountSeps(seps map[string]map[string]account.DiskUsage) []map[string]interface{} { res := make([]map[string]interface{}, 0) for sepKey, sepVal := range seps { @@ -198,7 +183,6 @@ func flattenAccResource(r account.Resource) []map[string]interface{} { "disk_size": r.DiskSize, "disk_size_max": r.DiskSizeMax, "ext_ips": r.ExtIPs, - "ext_traffic": r.ExtTraffic, "gpu": r.GPU, "ram": r.RAM, "seps": flattenAccountSeps(r.SEPs), diff --git a/internal/service/cloudapi/account/resource_account.go b/internal/service/cloudapi/account/resource_account.go index 9e6595d8..619248f0 100644 --- a/internal/service/cloudapi/account/resource_account.go +++ b/internal/service/cloudapi/account/resource_account.go @@ -297,15 +297,6 @@ func resourceAccountUpdate(ctx context.Context, d *schema.ResourceData, m interf } updated = true } - if resLimitConv["cu_np"] != nil { - maxNP := int(resLimitConv["cu_np"].(float64)) - if maxNP == 0 { - req.MaxNetworkPeerTransfer = -1 - } else { - req.MaxNetworkPeerTransfer = int64(maxNP) - } - updated = true - } if resLimitConv["gpu_units"] != nil { gpuUnits := int(resLimitConv["gpu_units"].(float64)) if gpuUnits == 0 { @@ -548,11 +539,6 @@ func resourceAccountSchemaMake() map[string]*schema.Schema { Optional: true, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Optional: true, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Optional: true, @@ -585,13 +571,6 @@ func resourceAccountSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, - // "resources": { - // Type: schema.TypeList, - // Computed: true, - // Elem: &schema.Resource{ - // Schema: resourcesSchemaMake(), - // }, - // }, "acl": { Type: schema.TypeList, Computed: true, diff --git a/internal/service/cloudapi/audit/utility_audit.go b/internal/service/cloudapi/audit/utility_audit.go index b0d39315..73f537cf 100644 --- a/internal/service/cloudapi/audit/utility_audit.go +++ b/internal/service/cloudapi/audit/utility_audit.go @@ -52,7 +52,7 @@ func utilityAuditCheckPresence(ctx context.Context, d *schema.ResourceData, m in req.AuditGuid = d.Get("audit_guid").(string) } - log.Debugf("utilityStackCheckPresence: load audit") + log.Debugf("utilityAuditCheckPresence: load audit") auditInfo, err := c.CloudAPI().Audit().Get(ctx, req) if err != nil { return nil, err diff --git a/internal/service/cloudapi/bservice/data_source_bservice.go b/internal/service/cloudapi/bservice/data_source_bservice.go index 079984ad..15a6181c 100644 --- a/internal/service/cloudapi/bservice/data_source_bservice.go +++ b/internal/service/cloudapi/bservice/data_source_bservice.go @@ -110,7 +110,7 @@ func dataSourceBasicServiceSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/cloudapi/bservice/flattens.go b/internal/service/cloudapi/bservice/flattens.go index 108f48f0..42f13064 100644 --- a/internal/service/cloudapi/bservice/flattens.go +++ b/internal/service/cloudapi/bservice/flattens.go @@ -101,7 +101,7 @@ func flattenBasicServiceComputes(bscs bservice.ListComputes) []map[string]interf "id": bsc.ID, "name": bsc.Name, "rg_id": bsc.RGID, - "stack_id": bsc.StackID, + "node_id": bsc.NodeID, "status": bsc.Status, "tech_status": bsc.TechStatus, } diff --git a/internal/service/cloudapi/bservice/resource_bservice.go b/internal/service/cloudapi/bservice/resource_bservice.go index 49347d76..468793f3 100644 --- a/internal/service/cloudapi/bservice/resource_bservice.go +++ b/internal/service/cloudapi/bservice/resource_bservice.go @@ -576,7 +576,7 @@ func resourceBasicServiceSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/cloudapi/bservice/resource_bservice_group.go b/internal/service/cloudapi/bservice/resource_bservice_group.go index 4dd24a54..90cf7489 100644 --- a/internal/service/cloudapi/bservice/resource_bservice_group.go +++ b/internal/service/cloudapi/bservice/resource_bservice_group.go @@ -58,7 +58,6 @@ func resourceBasicServiceGroupCreate(ctx context.Context, d *schema.ResourceData RAM: uint64(d.Get("ram").(int)), Disk: uint64(d.Get("disk").(int)), ImageID: uint64(d.Get("image_id").(int)), - Driver: d.Get("driver").(string), StoragePolicyID: uint64(d.Get("storage_policy_id").(int)), } @@ -424,13 +423,8 @@ func resourceBasicServiceGroupSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{"i440fx", "Q35"}, false), - Default: "i440fx", - }, - "driver": { - Type: schema.TypeString, - Optional: true, - Description: "compute driver like a KVM_X86, etc.", - Default: "KVM_X86", + Default: "Q35", + Description: "Chipset for virtual machines.", }, /// "role": { @@ -579,6 +573,10 @@ func resourceBasicServiceGroupSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, + "driver": { + Type: schema.TypeString, + Computed: true, + }, "gid": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudapi/disks/data_source_disk.go b/internal/service/cloudapi/disks/data_source_disk.go index 86feb8c0..fa108163 100644 --- a/internal/service/cloudapi/disks/data_source_disk.go +++ b/internal/service/cloudapi/disks/data_source_disk.go @@ -80,6 +80,10 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "blk_discard": { + Type: schema.TypeBool, + Computed: true, + }, // "boot_partition": { // Type: schema.TypeInt, // Computed: true, @@ -382,6 +386,10 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "cache": { + Type: schema.TypeString, + Computed: true, + }, "size_available": { Type: schema.TypeFloat, Computed: true, diff --git a/internal/service/cloudapi/disks/data_source_disk_list.go b/internal/service/cloudapi/disks/data_source_disk_list.go index 776efec2..63b3d2dc 100644 --- a/internal/service/cloudapi/disks/data_source_disk_list.go +++ b/internal/service/cloudapi/disks/data_source_disk_list.go @@ -147,6 +147,10 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "blk_discard": { + Type: schema.TypeBool, + Computed: true, + }, // "boot_partition": { // Type: schema.TypeInt, // Computed: true, @@ -456,6 +460,10 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "cache": { + Type: schema.TypeString, + Computed: true, + }, "size_available": { Type: schema.TypeFloat, Computed: true, diff --git a/internal/service/cloudapi/disks/data_source_disk_list_unattached.go b/internal/service/cloudapi/disks/data_source_disk_list_unattached.go index f73a178e..589a9956 100644 --- a/internal/service/cloudapi/disks/data_source_disk_list_unattached.go +++ b/internal/service/cloudapi/disks/data_source_disk_list_unattached.go @@ -138,11 +138,6 @@ func dataSourceDiskListUnattachedSchemaMake() map[string]*schema.Schema { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "_ckey": { - Type: schema.TypeString, - Computed: true, - Description: "CKey", - }, "_meta": { Type: schema.TypeList, Computed: true, @@ -165,6 +160,10 @@ func dataSourceDiskListUnattachedSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "blk_discard": { + Type: schema.TypeBool, + Computed: true, + }, "boot_partition": { Type: schema.TypeInt, Computed: true, @@ -391,6 +390,11 @@ func dataSourceDiskListUnattachedSchemaMake() map[string]*schema.Schema { Computed: true, Description: "shareable", }, + "cache": { + Type: schema.TypeString, + Computed: true, + Description: "Cache mode for the disk", + }, "size_max": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudapi/disks/data_source_list_deleted.go b/internal/service/cloudapi/disks/data_source_list_deleted.go index f45a712c..f5df39b3 100644 --- a/internal/service/cloudapi/disks/data_source_list_deleted.go +++ b/internal/service/cloudapi/disks/data_source_list_deleted.go @@ -128,6 +128,10 @@ func dataSourceDiskDeletedListSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "blk_discard": { + Type: schema.TypeBool, + Computed: true, + }, // "boot_partition": { // Type: schema.TypeInt, // Computed: true, @@ -437,6 +441,10 @@ func dataSourceDiskDeletedListSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "cache": { + Type: schema.TypeString, + Computed: true, + }, "size_available": { Type: schema.TypeFloat, Computed: true, diff --git a/internal/service/cloudapi/disks/flattens.go b/internal/service/cloudapi/disks/flattens.go index 8e51249f..95841e0a 100644 --- a/internal/service/cloudapi/disks/flattens.go +++ b/internal/service/cloudapi/disks/flattens.go @@ -21,11 +21,11 @@ func flattenDiskListUnattached(ul *disks.ListDisksUnattached) []map[string]inter for _, unattachedDisk := range ul.Data { unattachedDiskAcl, _ := json.Marshal(unattachedDisk.ACL) tmp := map[string]interface{}{ - "_ckey": unattachedDisk.CKey, "_meta": flattens.FlattenMeta(unattachedDisk.Meta), "account_id": unattachedDisk.AccountID, "account_name": unattachedDisk.AccountName, "acl": string(unattachedDiskAcl), + "blk_discard": unattachedDisk.BLKDiscard, "boot_partition": unattachedDisk.BootPartition, "created_time": unattachedDisk.CreatedTime, "deleted_time": unattachedDisk.DeletedTime, @@ -57,6 +57,7 @@ func flattenDiskListUnattached(ul *disks.ListDisksUnattached) []map[string]inter "role": unattachedDisk.Role, "sep_id": unattachedDisk.SEPID, "shareable": unattachedDisk.Shareable, + "cache": unattachedDisk.Cache, "size_max": unattachedDisk.SizeMax, "size_used": unattachedDisk.SizeUsed, "snapshots": flattenDiskSnapshotList(unattachedDisk.Snapshots), @@ -75,6 +76,7 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) { d.Set("account_id", disk.AccountID) d.Set("account_name", disk.AccountName) d.Set("acl", string(diskAcl)) + d.Set("blk_discard", disk.BLKDiscard) // d.Set("boot_partition", disk.BootPartition) d.Set("computes", flattenDiskComputes(disk.Computes)) d.Set("created_by", disk.CreatedBy) @@ -95,7 +97,6 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) { // d.Set("login", disk.Login) d.Set("machine_id", disk.MachineID) d.Set("machine_name", disk.MachineName) - d.Set("milestones", disk.Milestones) d.Set("disk_name", disk.Name) d.Set("order", disk.Order) d.Set("params", disk.Params) @@ -114,10 +115,10 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) { d.Set("role", disk.Role) d.Set("sep_id", disk.SepID) d.Set("sep_type", disk.SepType) - d.Set("size_available", disk.SizeAvailable) d.Set("size_max", disk.SizeMax) d.Set("size_used", disk.SizeUsed) d.Set("shareable", disk.Shareable) + d.Set("cache", disk.Cache) d.Set("snapshots", flattenDiskSnapshotList(disk.Snapshots)) d.Set("status", disk.Status) d.Set("storage_policy_id", disk.StoragePolicyID) @@ -186,6 +187,7 @@ func flattenDiskReplica(d *schema.ResourceData, disk *disks.RecordDisk, statusRe d.Set("size_max", disk.SizeMax) d.Set("size_used", disk.SizeUsed) d.Set("shareable", disk.Shareable) + d.Set("cache", disk.Cache) d.Set("snapshots", flattenDiskSnapshotList(disk.Snapshots)) d.Set("status", disk.Status) d.Set("status_replication", statusReplication) @@ -219,6 +221,7 @@ func flattenDiskList(dl *disks.ListDisks) []map[string]interface{} { "account_id": disk.AccountID, "account_name": disk.AccountName, "acl": string(diskAcl), + "blk_discard": disk.BLKDiscard, "computes": flattenDiskComputes(disk.Computes), "created_by": disk.CreatedBy, "created_time": disk.CreatedTime, @@ -250,6 +253,7 @@ func flattenDiskList(dl *disks.ListDisks) []map[string]interface{} { "sep_id": disk.SepID, "sep_type": disk.SepType, "shareable": disk.Shareable, + "cache": disk.Cache, "size_available": disk.SizeAvailable, "size_max": disk.SizeMax, "size_used": disk.SizeUsed, diff --git a/internal/service/cloudapi/disks/resource_disk.go b/internal/service/cloudapi/disks/resource_disk.go index 7ad1e7e1..a9ce2c0c 100644 --- a/internal/service/cloudapi/disks/resource_disk.go +++ b/internal/service/cloudapi/disks/resource_disk.go @@ -533,6 +533,10 @@ func resourceDiskSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "cache": { + Type: schema.TypeString, + Computed: true, + }, // "boot_partition": { // Type: schema.TypeInt, // Computed: true, diff --git a/internal/service/cloudapi/disks/resource_disk_snapshot.go b/internal/service/cloudapi/disks/resource_disk_snapshot.go index 0ddd7327..0b350a96 100644 --- a/internal/service/cloudapi/disks/resource_disk_snapshot.go +++ b/internal/service/cloudapi/disks/resource_disk_snapshot.go @@ -133,7 +133,7 @@ func resourceDiskSnapshotUpdate(ctx context.Context, d *schema.ResourceData, m i TimeStamp: uint64(d.Get("timestamp").(int)), } - log.Debugf("resourceDiskUpdtae: Snapshot rollback with label", label) + log.Debugf("resourceDiskUpdtae: Snapshot rollback with label %s", label) _, err := c.CloudAPI().Disks().SnapshotRollback(ctx, req) if err != nil { return diag.FromErr(err) diff --git a/internal/service/cloudapi/flipgroup/data_source_flipgroup.go b/internal/service/cloudapi/flipgroup/data_source_flipgroup.go index 759d5544..354a1128 100644 --- a/internal/service/cloudapi/flipgroup/data_source_flipgroup.go +++ b/internal/service/cloudapi/flipgroup/data_source_flipgroup.go @@ -145,14 +145,6 @@ func dataSourceFlipgroupSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, - "rg_id": { - Type: schema.TypeInt, - Computed: true, - }, - "rg_name": { - Type: schema.TypeString, - Computed: true, - }, "status": { Type: schema.TypeString, Computed: true, diff --git a/internal/service/cloudapi/flipgroup/data_source_flipgroup_list.go b/internal/service/cloudapi/flipgroup/data_source_flipgroup_list.go index 90aa3a79..93437ddd 100644 --- a/internal/service/cloudapi/flipgroup/data_source_flipgroup_list.go +++ b/internal/service/cloudapi/flipgroup/data_source_flipgroup_list.go @@ -90,11 +90,6 @@ func dataSourceFlipgroupListSchemaMake() map[string]*schema.Schema { Optional: true, Description: "Filter by IP-address", }, - "rg_id": { - Type: schema.TypeInt, - Optional: true, - Description: "Filter by RG ID", - }, "sort_by": { Type: schema.TypeString, Optional: true, diff --git a/internal/service/cloudapi/flipgroup/flattens.go b/internal/service/cloudapi/flipgroup/flattens.go index abe66f6d..715311e9 100644 --- a/internal/service/cloudapi/flipgroup/flattens.go +++ b/internal/service/cloudapi/flipgroup/flattens.go @@ -61,8 +61,6 @@ func flattenFlipgroup(d *schema.ResourceData, fg *flipgroup.RecordFLIPGroup) { d.Set("net_id", fg.NetID) d.Set("net_type", fg.NetType) d.Set("network", fg.Network) - d.Set("rg_id", fg.RGID) - d.Set("rg_name", fg.RGName) d.Set("status", fg.Status) d.Set("updated_by", fg.UpdatedBy) d.Set("updated_time", fg.UpdatedTime) diff --git a/internal/service/cloudapi/flipgroup/resource_flipgroup.go b/internal/service/cloudapi/flipgroup/resource_flipgroup.go index 3892d32e..4cf53573 100644 --- a/internal/service/cloudapi/flipgroup/resource_flipgroup.go +++ b/internal/service/cloudapi/flipgroup/resource_flipgroup.go @@ -265,14 +265,6 @@ func resourceFlipgroupSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, - "rg_id": { - Type: schema.TypeInt, - Computed: true, - }, - "rg_name": { - Type: schema.TypeString, - Computed: true, - }, "updated_by": { Type: schema.TypeString, Computed: true, diff --git a/internal/service/cloudapi/flipgroup/utility_flipgroup.go b/internal/service/cloudapi/flipgroup/utility_flipgroup.go index c423f9ff..2e43e04d 100644 --- a/internal/service/cloudapi/flipgroup/utility_flipgroup.go +++ b/internal/service/cloudapi/flipgroup/utility_flipgroup.go @@ -165,9 +165,6 @@ func utilityFlipgroupListCheckPresence(ctx context.Context, d *schema.ResourceDa if byIp, ok := d.GetOk("by_ip"); ok { req.ByIP = byIp.(string) } - if rgId, ok := d.GetOk("rg_id"); ok { - req.RGID = uint64(rgId.(int)) - } if byId, ok := d.GetOk("by_id"); ok { req.ByID = uint64(byId.(int)) } diff --git a/internal/service/cloudapi/image/flattens.go b/internal/service/cloudapi/image/flattens.go index eb52215b..45b863fa 100644 --- a/internal/service/cloudapi/image/flattens.go +++ b/internal/service/cloudapi/image/flattens.go @@ -26,7 +26,6 @@ func flattenImage(d *schema.ResourceData, img *image.RecordImage) { cdPresentedTo, _ := json.Marshal(img.CdPresentedTo) d.Set("unc_path", img.UNCPath) - d.Set("ckey", img.CKey) d.Set("account_id", img.AccountID) d.Set("acl", FlattenACL(img.ACL)) d.Set("architecture", img.Architecture) diff --git a/internal/service/cloudapi/image/image_ds_subresource.go b/internal/service/cloudapi/image/image_ds_subresource.go index 7e353aa7..a55bfa01 100644 --- a/internal/service/cloudapi/image/image_ds_subresource.go +++ b/internal/service/cloudapi/image/image_ds_subresource.go @@ -49,10 +49,6 @@ func dataSourceImageExtendSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, - "ckey": { - Type: schema.TypeString, - Computed: true, - }, "account_id": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudapi/k8s/resource_k8s.go b/internal/service/cloudapi/k8s/resource_k8s.go index e1301150..3582643f 100644 --- a/internal/service/cloudapi/k8s/resource_k8s.go +++ b/internal/service/cloudapi/k8s/resource_k8s.go @@ -805,11 +805,13 @@ func resourceK8sSchemaMake() map[string]*schema.Schema { Description: "insert ssl certificate in x509 pem format", }, - "chipset": { - Type: schema.TypeString, - Optional: true, - Description: "Type of the emulated system.", - }, + "chipset": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false), + Default: "Q35", + Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35", + }, "desc": { Type: schema.TypeString, diff --git a/internal/service/cloudapi/k8s/resource_k8s_cp.go b/internal/service/cloudapi/k8s/resource_k8s_cp.go index 381071c7..8489fc16 100644 --- a/internal/service/cloudapi/k8s/resource_k8s_cp.go +++ b/internal/service/cloudapi/k8s/resource_k8s_cp.go @@ -715,11 +715,13 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema { ), Description: "Node RAM in MB.", }, - "chipset": { - Type: schema.TypeString, - Optional: true, - Description: "Type of the emulated system.", - }, + "chipset": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false), + Default: "Q35", + Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35", + }, "disk": { Type: schema.TypeInt, Optional: true, diff --git a/internal/service/cloudapi/k8s/resource_k8s_wg.go b/internal/service/cloudapi/k8s/resource_k8s_wg.go index ebda4cf2..e6d6c43d 100644 --- a/internal/service/cloudapi/k8s/resource_k8s_wg.go +++ b/internal/service/cloudapi/k8s/resource_k8s_wg.go @@ -290,11 +290,13 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema { Description: "Number of worker nodes to create.", }, - "chipset": { - Type: schema.TypeString, - Optional: true, - Description: "Type of the emulated system.", - }, + "chipset": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false), + Default: "Q35", + Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35", + }, "cpu": { Type: schema.TypeInt, diff --git a/internal/service/cloudapi/kvmvm/data_source_compute.go b/internal/service/cloudapi/kvmvm/data_source_compute.go index 941c0584..d428a219 100644 --- a/internal/service/cloudapi/kvmvm/data_source_compute.go +++ b/internal/service/cloudapi/kvmvm/data_source_compute.go @@ -256,6 +256,10 @@ func computeListDisksSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, + "blk_discard": { + Type: schema.TypeBool, + Computed: true, + }, "boot_partition": { Type: schema.TypeInt, Computed: true, @@ -264,6 +268,10 @@ func computeListDisksSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, + "cache": { + Type: schema.TypeString, + Computed: true, + }, "created_time": { Type: schema.TypeInt, Computed: true, @@ -1035,6 +1043,11 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "read_only": { + Type: schema.TypeBool, + Computed: true, + Description: "Shows if compute is in read-only mode.", + }, "userdata": { Type: schema.TypeString, Computed: true, @@ -1128,14 +1141,6 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema { }, }, }, - "virtual_image_id": { - Type: schema.TypeInt, - Computed: true, - }, - "virtual_image_name": { - Type: schema.TypeString, - Computed: true, - }, "stateless_sep_id": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudapi/kvmvm/data_source_compute_list.go b/internal/service/cloudapi/kvmvm/data_source_compute_list.go index ebed8034..83d22b04 100644 --- a/internal/service/cloudapi/kvmvm/data_source_compute_list.go +++ b/internal/service/cloudapi/kvmvm/data_source_compute_list.go @@ -76,6 +76,10 @@ func computeDisksSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, + "sep_id": { + Type: schema.TypeInt, + Computed: true, + }, } } func itemComputeSchemaMake() map[string]*schema.Schema { @@ -226,10 +230,6 @@ func itemComputeSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "image_id": { - Type: schema.TypeInt, - Computed: true, - }, "interfaces": { Type: schema.TypeList, Computed: true, @@ -409,6 +409,11 @@ func itemComputeSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "read_only": { + Type: schema.TypeBool, + Computed: true, + Description: "Shows if compute is in read-only mode.", + }, "vgpus": { Type: schema.TypeList, Computed: true, @@ -420,10 +425,6 @@ func itemComputeSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "virtual_image_id": { - Type: schema.TypeInt, - Computed: true, - }, "loader_type": { Type: schema.TypeString, Computed: true, diff --git a/internal/service/cloudapi/kvmvm/data_source_compute_pci_device_list.go b/internal/service/cloudapi/kvmvm/data_source_compute_pci_device_list.go index b95ab76b..a806ed46 100644 --- a/internal/service/cloudapi/kvmvm/data_source_compute_pci_device_list.go +++ b/internal/service/cloudapi/kvmvm/data_source_compute_pci_device_list.go @@ -128,7 +128,7 @@ func dataSourceComputePCIDeviceListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/cloudapi/kvmvm/flattens.go b/internal/service/cloudapi/kvmvm/flattens.go index 615c6f48..0cda2bfa 100644 --- a/internal/service/cloudapi/kvmvm/flattens.go +++ b/internal/service/cloudapi/kvmvm/flattens.go @@ -50,6 +50,7 @@ func flattenDisks(disks []compute.InfoDisk) []map[string]interface{} { // "bus_number": disk.BusNumber, "disk_id": disk.ID, // "pci_slot": disk.PCISlot, + "sep_id": disk.SepID, } res = append(res, temp) } @@ -179,76 +180,73 @@ func flattenComputeList(computes *compute.ListComputes) []map[string]interface{} customFields, _ := json.Marshal(compute.CustomFields) devices, _ := json.Marshal(compute.Devices) temp := map[string]interface{}{ - "acl": flattenListACL(compute.ACL), - "account_id": compute.AccountID, - "account_name": compute.AccountName, - "affinity_label": compute.AffinityLabel, - "affinity_rules": flattenListRules(compute.AffinityRules), - "affinity_weight": compute.AffinityWeight, - "anti_affinity_rules": flattenListRules(compute.AntiAffinityRules), - "arch": compute.Architecture, - "auto_start_w_node": compute.AutoStart, - "boot_order": compute.BootOrder, - "bootdisk_size": compute.BootDiskSize, - "boot_image_id": compute.BootImageID, - "chipset": compute.Chipset, - "cd_image_id": compute.CdImageId, - "clone_reference": compute.CloneReference, - "clones": compute.Clones, - "computeci_id": compute.ComputeCIID, - "cpu_pin": compute.CPUPin, - "cpus": compute.CPU, - "created_by": compute.CreatedBy, - "created_time": compute.CreatedTime, - "custom_fields": string(customFields), - "deleted_by": compute.DeletedBy, - "deleted_time": compute.DeletedTime, - "desc": compute.Description, - "devices": string(devices), - "disks": flattenDisks(compute.Disks), - "driver": compute.Driver, - "gid": compute.GID, - "guid": compute.GUID, - "hp_backed": compute.HPBacked, - "compute_id": compute.ID, - //TODO - // "image_id": compute.ImageID, - "interfaces": flattenInterfaces(compute.Interfaces), - "live_migration_job_id": compute.LiveMigrationJobID, - "lock_status": compute.LockStatus, - "manager_id": compute.ManagerID, - "manager_type": compute.ManagerType, - "migrationjob": compute.MigrationJob, - "milestones": compute.Milestones, - "name": compute.Name, - "need_reboot": compute.NeedReboot, - "numa_affinity": compute.NumaAffinity, - "numa_node_id": compute.NumaNodeId, - "os_version": compute.OSVersion, - "pinned": compute.PinnedToStack, - "preferred_cpu": compute.PreferredCPU, - "qemu_guest": flattenQemuQuest(compute.QemuQuest), - "ram": compute.RAM, - "reference_id": compute.ReferenceID, - "registered": compute.Registered, - "res_name": compute.ResName, - "reserved_node_cpus": compute.ReservedNodeCpus, - "rg_id": compute.RGID, - "rg_name": compute.RGName, - "snap_sets": flattenSnapSets(compute.SnapSets), - "stateless_sep_id": compute.StatelessSepID, - "stateless_sep_type": compute.StatelessSepType, - "status": compute.Status, - "tags": flattenTags(compute.Tags), - "tech_status": compute.TechStatus, - "total_disk_size": compute.TotalDiskSize, - "updated_by": compute.UpdatedBy, - "updated_time": compute.UpdatedTime, - "user_managed": compute.UserManaged, - "vgpus": compute.VGPUs, - "vins_connected": compute.VINSConnected, - //TODO - // "virtual_image_id": compute.VirtualImageID, + "acl": flattenListACL(compute.ACL), + "account_id": compute.AccountID, + "account_name": compute.AccountName, + "affinity_label": compute.AffinityLabel, + "affinity_rules": flattenListRules(compute.AffinityRules), + "affinity_weight": compute.AffinityWeight, + "anti_affinity_rules": flattenListRules(compute.AntiAffinityRules), + "arch": compute.Architecture, + "auto_start_w_node": compute.AutoStart, + "boot_order": compute.BootOrder, + "bootdisk_size": compute.BootDiskSize, + "boot_image_id": compute.BootImageID, + "chipset": compute.Chipset, + "cd_image_id": compute.CdImageId, + "clone_reference": compute.CloneReference, + "clones": compute.Clones, + "computeci_id": compute.ComputeCIID, + "cpu_pin": compute.CPUPin, + "cpus": compute.CPU, + "created_by": compute.CreatedBy, + "created_time": compute.CreatedTime, + "custom_fields": string(customFields), + "deleted_by": compute.DeletedBy, + "deleted_time": compute.DeletedTime, + "desc": compute.Description, + "devices": string(devices), + "disks": flattenDisks(compute.Disks), + "driver": compute.Driver, + "gid": compute.GID, + "guid": compute.GUID, + "hp_backed": compute.HPBacked, + "compute_id": compute.ID, + "interfaces": flattenInterfaces(compute.Interfaces), + "live_migration_job_id": compute.LiveMigrationJobID, + "lock_status": compute.LockStatus, + "manager_id": compute.ManagerID, + "manager_type": compute.ManagerType, + "migrationjob": compute.MigrationJob, + "milestones": compute.Milestones, + "name": compute.Name, + "need_reboot": compute.NeedReboot, + "numa_affinity": compute.NumaAffinity, + "numa_node_id": compute.NumaNodeId, + "os_version": compute.OSVersion, + "pinned": compute.PinnedToNode, + "preferred_cpu": compute.PreferredCPU, + "qemu_guest": flattenQemuQuest(compute.QemuQuest), + "ram": compute.RAM, + "reference_id": compute.ReferenceID, + "registered": compute.Registered, + "res_name": compute.ResName, + "reserved_node_cpus": compute.ReservedNodeCpus, + "rg_id": compute.RGID, + "rg_name": compute.RGName, + "snap_sets": flattenSnapSets(compute.SnapSets), + "stateless_sep_id": compute.StatelessSepID, + "stateless_sep_type": compute.StatelessSepType, + "status": compute.Status, + "tags": flattenTags(compute.Tags), + "tech_status": compute.TechStatus, + "total_disk_size": compute.TotalDiskSize, + "updated_by": compute.UpdatedBy, + "updated_time": compute.UpdatedTime, + "user_managed": compute.UserManaged, + "read_only": compute.ReadOnly, + "vgpus": compute.VGPUs, + "vins_connected": compute.VINSConnected, "loader_type": compute.LoaderType, "boot_type": compute.BootType, "hot_resize": compute.HotResize, @@ -279,6 +277,8 @@ func flattenBootDisk(bootDisk *compute.ItemComputeDisk) []map[string]interface{} "present_to": bootDisk.PresentTo, "storage_policy_id": bootDisk.StoragePolicyID, "to_clean": bootDisk.ToClean, + "cache": bootDisk.Cache, + "blk_discard": bootDisk.BLKDiscard, } res = append(res, temp) @@ -333,6 +333,8 @@ func flattenComputeDisksDemo(disksList compute.ListComputeDisks, disksBlocks, ex "deleted_time": disk.DeletedTime, "updated_time": disk.UpdatedTime, "permanently": pernamentlyValue, + "cache": disk.Cache, + "blk_discard": disk.BLKDiscard, } res = append(res, temp) indexDataDisks++ @@ -351,6 +353,7 @@ func flattenNetwork(networks []interface{}, interfaces compute.ListInterfaces) [ "ip_address": network.IPAddress, "mac": network.MAC, "mtu": network.MTU, + "net_mask": network.NetMask, "sdn_interface_id": network.SDNInterfaceID, "weight": flattenNetworkWeight(networks, network.NetID, network.NetType), "enabled": network.Enabled, @@ -428,12 +431,7 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute, pc d.Set("gid", computeRec.GID) d.Set("guid", computeRec.GUID) d.Set("compute_id", computeRec.ID) - //TODO - // if computeRec.VirtualImageID != 0 { - // d.Set("image_id", computeRec.VirtualImageID) - // } else { - // d.Set("image_id", computeRec.ImageID) - // } + d.Set("image_id", computeRec.ImageID) d.Set("interfaces", flattenInterfaces(computeRec.Interfaces)) d.Set("lock_status", computeRec.LockStatus) d.Set("manager_id", computeRec.ManagerID) @@ -451,7 +449,7 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute, pc if err := d.Set("os_users", parseOsUsers(computeRec.OSUsers)); err != nil { return err } - d.Set("pinned", computeRec.PinnedToStack) + d.Set("pinned", computeRec.PinnedToNode) d.Set("preferred_cpu", computeRec.PreferredCPU) d.Set("ram", computeRec.RAM) d.Set("reference_id", computeRec.ReferenceID) @@ -469,11 +467,9 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute, pc d.Set("updated_by", computeRec.UpdatedBy) d.Set("updated_time", computeRec.UpdatedTime) d.Set("user_managed", computeRec.UserManaged) + d.Set("read_only", computeRec.ReadOnly) d.Set("vnc_password", computeRec.VNCPassword) d.Set("vgpus", flattenVGPUs(computeRec.VGPUs)) - //TODO - // d.Set("virtual_image_id", computeRec.VirtualImageID) - // d.Set("virtual_image_name", computeRec.VirtualImageName) d.Set("loader_type", computeRec.LoaderType) d.Set("boot_type", computeRec.BootType) d.Set("hot_resize", computeRec.HotResize) @@ -585,9 +581,11 @@ func flattenListComputeDisks(disks compute.ListComputeDisks) []map[string]interf "_ckey": disk.CKey, "acl": string(acl), "account_id": disk.AccountID, + "blk_discard": disk.BLKDiscard, "boot_partition": disk.BootPartition, "bus_number": disk.BusNumber, "created_time": disk.CreatedTime, + "cache": disk.Cache, "created_by": disk.CreatedBy, "deleted_time": disk.DeletedTime, "deleted_by": disk.DeletedBy, @@ -722,7 +720,7 @@ func flattenDataCompute(d *schema.ResourceData, computeRec compute.RecordCompute d.Set("natable_vins_network", computeRec.NatableVINSNetwork) d.Set("natable_vins_network_name", computeRec.NatableVINSNetworkName) d.Set("os_users", flattenOsUsers(computeRec.OSUsers)) - d.Set("pinned", computeRec.PinnedToStack) + d.Set("pinned", computeRec.PinnedToNode) d.Set("preferred_CPU", computeRec.PreferredCPU) d.Set("qemu_guest", flattenQemuQuest(computeRec.QemuQuest)) d.Set("ram", computeRec.RAM) @@ -741,12 +739,10 @@ func flattenDataCompute(d *schema.ResourceData, computeRec compute.RecordCompute d.Set("updated_by", computeRec.UpdatedBy) d.Set("updated_time", computeRec.UpdatedTime) d.Set("user_managed", computeRec.UserManaged) + d.Set("read_only", computeRec.ReadOnly) d.Set("userdata", string(userdata)) d.Set("vnc_password", computeRec.VNCPassword) d.Set("vgpus", flattenVGPUs(computeRec.VGPUs)) - //TODO - // d.Set("virtual_image_id", computeRec.VirtualImageID) - // d.Set("virtual_image_name", computeRec.VirtualImageName) d.Set("pci_devices", flattenPCI(*pciList)) d.Set("loader_type", computeRec.LoaderType) d.Set("boot_type", computeRec.BootType) @@ -884,7 +880,7 @@ func flattenPCIDevice(deviceList []compute.ItemPCIDevice) []map[string]interface "device_id": dev.ID, "name": dev.Name, "rg_id": dev.RGID, - "stack_id": dev.StackID, + "node_id": dev.NodeID, "status": dev.Status, "system_name": dev.SystemName, } diff --git a/internal/service/cloudapi/kvmvm/network_subresource.go b/internal/service/cloudapi/kvmvm/network_subresource.go index 1ce9e7db..38ec9a0e 100644 --- a/internal/service/cloudapi/kvmvm/network_subresource.go +++ b/internal/service/cloudapi/kvmvm/network_subresource.go @@ -184,6 +184,13 @@ func networkSubresourceSchemaMake() map[string]*schema.Schema { Computed: true, Description: "network enable flag", }, + + "net_mask": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Subnet mask, used only for DPDK and VFNIC network types", + }, } return rets } diff --git a/internal/service/cloudapi/kvmvm/resource_compute.go b/internal/service/cloudapi/kvmvm/resource_compute.go index 46ea0f8d..24618565 100644 --- a/internal/service/cloudapi/kvmvm/resource_compute.go +++ b/internal/service/cloudapi/kvmvm/resource_compute.go @@ -182,6 +182,12 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf reqInterface.MTU = uint64(netInterfaceVal["mtu"].(int)) } + if reqInterface.NetType == "DPDK" || reqInterface.NetType == "VFNIC" { + if netMask, netMaskSet := netInterfaceVal["net_mask"]; netMaskSet { + reqInterface.NetMask = uint64(netMask.(int)) + } + } + ipaddr, ipSet := netInterfaceVal["ip_address"] if ipSet { reqInterface.IPAddr = ipaddr.(string) @@ -460,16 +466,16 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf } } - if d.Get("pin_to_stack").(bool) { + if d.Get("pin_to_node").(bool) { if !d.Get("started").(bool) { - warnings.Add(errors.New("cannot pin to stack a VM, VM should be started")) + warnings.Add(errors.New("cannot pin to node a VM, VM should be started")) } if d.Get("started").(bool) { - req := compute.PinToStackRequest{ + req := compute.PinToNodeRequest{ ComputeID: computeId, } req.AutoStart = d.Get("auto_start_w_node").(bool) - _, err = c.CloudAPI().Compute().PinToStack(ctx, req) + _, err = c.CloudAPI().Compute().PinToNode(ctx, req) if err != nil { warnings.Add(err) } @@ -637,7 +643,7 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf } } - if !d.Get("pin_to_stack").(bool) && d.Get("auto_start_w_node").(bool) { + if !d.Get("pin_to_node").(bool) && d.Get("auto_start_w_node").(bool) { req := compute.UpdateRequest{ ComputeID: computeId, AutoStart: d.Get("auto_start_w_node").(bool), @@ -1775,6 +1781,7 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf return diag.FromErr(err) } } + } else { req := compute.StopRequest{ ComputeID: computeRec.ID, @@ -1785,28 +1792,28 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf } } - if d.HasChange("pin_to_stack") || d.HasChange("started") { - newPin := d.Get("pin_to_stack") - if !newPin.(bool) && d.HasChange("pin_to_stack") { - req := compute.UnpinFromStackRequest{ + if d.HasChange("pin_to_node") || d.HasChange("started") { + newPin := d.Get("pin_to_node") + if !newPin.(bool) && d.HasChange("pin_to_node") { + req := compute.UnpinFromNodeRequest{ ComputeID: computeRec.ID, } - _, err := c.CloudAPI().Compute().UnpinFromStack(ctx, req) + _, err := c.CloudAPI().Compute().UnpinFromNode(ctx, req) if err != nil { return diag.FromErr(err) } } if newPin.(bool) { if !d.Get("started").(bool) { - return diag.Errorf("Cannot pin to stack a VM, that is not started") + return diag.Errorf("Cannot pin to node a VM, that is not started") } - req := compute.PinToStackRequest{ + req := compute.PinToNodeRequest{ ComputeID: computeRec.ID, } req.AutoStart = d.Get("auto_start_w_node").(bool) - _, err = c.CloudAPI().Compute().PinToStack(ctx, req) + _, err = c.CloudAPI().Compute().PinToNode(ctx, req) if err != nil { return diag.FromErr(err) } @@ -1992,6 +1999,10 @@ func disksSubresourceSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "cache": { + Type: schema.TypeString, + Computed: true, + }, "created_by": { Type: schema.TypeString, Computed: true, @@ -2012,6 +2023,10 @@ func disksSubresourceSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, + "blk_discard": { + Type: schema.TypeBool, + Computed: true, + }, } return rets } @@ -2199,7 +2214,7 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema { }, "value": { Type: schema.TypeString, - Optional: true, + Required: true, Description: "value that must match the key to be taken into account when analyzing this rule", }, }, @@ -2235,7 +2250,7 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema { }, "value": { Type: schema.TypeString, - Optional: true, + Required: true, Description: "value that must match the key to be taken into account when analyzing this rule", }, }, @@ -2345,7 +2360,7 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema { Schema: cdSubresourceSchemaMake(), }, }, - "pin_to_stack": { + "pin_to_node": { Type: schema.TypeBool, Optional: true, Default: false, @@ -2735,6 +2750,11 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "read_only": { + Type: schema.TypeBool, + Computed: true, + Description: "Shows if compute is in read-only mode.", + }, "vnc_password": { Type: schema.TypeString, Computed: true, @@ -2866,12 +2886,12 @@ func ResourceCompute() *schema.Resource { }, CustomizeDiff: func(ctx context.Context, diff *schema.ResourceDiff, i interface{}) error { - if diff.HasChanges() || diff.HasChanges("chipset", "pin_to_stack", "auto_start_w_node", "network", "affinity_rules", "anti_affinity_rules", + if diff.HasChanges() || diff.HasChanges("chipset", "pin_to_node", "auto_start_w_node", "network", "affinity_rules", "anti_affinity_rules", "extra_disks", "tags", "port_forwarding", "user_access", "snapshot", "pci_devices", "preferred_cpu", "security_groups") { diff.SetNewComputed("updated_time") diff.SetNewComputed("updated_by") } - if diff.HasChanges("pin_to_stack") { + if diff.HasChanges("pin_to_node") { diff.SetNewComputed("pinned") } if diff.HasChanges("image_id") { diff --git a/internal/service/cloudapi/kvmvm/utility_compute.go b/internal/service/cloudapi/kvmvm/utility_compute.go index a0fb6f18..bb35e03b 100644 --- a/internal/service/cloudapi/kvmvm/utility_compute.go +++ b/internal/service/cloudapi/kvmvm/utility_compute.go @@ -281,6 +281,12 @@ func utilityComputeNetworksConfigure(ctx context.Context, d *schema.ResourceData req.MTU = uint64(netData["mtu"].(int)) } + if req.NetType == "DPDK" || req.NetType == "VFNIC" { + if netMask, ok := netData["net_mask"].(int); ok && netMask > 0 { + req.NetMask = uint64(netMask) + } + } + _, err := c.CloudAPI().Compute().NetAttach(ctx, req) if err != nil { log.Errorf("utilityComputeNetworksConfigure: failed to attach net ID %d of type %s to Compute ID %s: %s", diff --git a/internal/service/cloudapi/lb/lb_resource_subresource.go b/internal/service/cloudapi/lb/lb_resource_subresource.go index a64956eb..ae3d42dc 100644 --- a/internal/service/cloudapi/lb/lb_resource_subresource.go +++ b/internal/service/cloudapi/lb/lb_resource_subresource.go @@ -60,7 +60,8 @@ func lbResourceSchemaMake() map[string]*schema.Schema { } sch["start"] = &schema.Schema{ Type: schema.TypeBool, - Required: true, + Optional: true, + Default: true, } sch["desc"] = &schema.Schema{ Type: schema.TypeString, diff --git a/internal/service/cloudapi/lb/resource_lb.go b/internal/service/cloudapi/lb/resource_lb.go index 307a3b00..d673b329 100644 --- a/internal/service/cloudapi/lb/resource_lb.go +++ b/internal/service/cloudapi/lb/resource_lb.go @@ -82,7 +82,10 @@ func resourceLBCreate(ctx context.Context, d *schema.ResourceData, m interface{} RGID: uint64(d.Get("rg_id").(int)), ExtNetID: uint64(d.Get("extnet_id").(int)), VINSID: uint64(d.Get("vins_id").(int)), - Start: d.Get("start").(bool), + } + + if start, ok := d.GetOk("start"); ok { + req.Start = start.(bool) } if desc, ok := d.GetOk("desc"); ok { diff --git a/internal/service/cloudapi/lb/resource_lb_backend_server.go b/internal/service/cloudapi/lb/resource_lb_backend_server.go index ed28e9f6..3b70c54c 100644 --- a/internal/service/cloudapi/lb/resource_lb_backend_server.go +++ b/internal/service/cloudapi/lb/resource_lb_backend_server.go @@ -212,8 +212,6 @@ func resourceLBBackendServerUpdate(ctx context.Context, d *schema.ResourceData, return diag.FromErr(err) } - //TODO: перенести servers сюда - return resourceLBBackendServerRead(ctx, d, m) } diff --git a/internal/service/cloudapi/rg/data_source_rg.go b/internal/service/cloudapi/rg/data_source_rg.go index 9e436859..09f928a2 100644 --- a/internal/service/cloudapi/rg/data_source_rg.go +++ b/internal/service/cloudapi/rg/data_source_rg.go @@ -114,10 +114,6 @@ func DataSourceResgroup() *schema.Resource { // Type: schema.TypeInt, // Computed: true, // }, -// "exttraffic": { -// Type: schema.TypeInt, -// Computed: true, -// }, // "gpu": { // Type: schema.TypeInt, // Computed: true, @@ -169,10 +165,6 @@ func DataSourceResgroup() *schema.Resource { // Type: schema.TypeInt, // Computed: true, // }, -// "exttraffic": { -// Type: schema.TypeInt, -// Computed: true, -// }, // "gpu": { // Type: schema.TypeInt, // Computed: true, @@ -261,10 +253,6 @@ func resourceLimitsSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, diff --git a/internal/service/cloudapi/rg/data_source_rg_resource_consumption_list.go b/internal/service/cloudapi/rg/data_source_rg_resource_consumption_list.go index 3ce473b0..a954fc0b 100644 --- a/internal/service/cloudapi/rg/data_source_rg_resource_consumption_list.go +++ b/internal/service/cloudapi/rg/data_source_rg_resource_consumption_list.go @@ -138,10 +138,6 @@ func dataSourceRGResourceSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -183,10 +179,6 @@ func dataSourceResourceLimitsSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, diff --git a/internal/service/cloudapi/rg/data_source_rg_usage.go b/internal/service/cloudapi/rg/data_source_rg_usage.go index 2cc5f4bc..cf68b4b8 100644 --- a/internal/service/cloudapi/rg/data_source_rg_usage.go +++ b/internal/service/cloudapi/rg/data_source_rg_usage.go @@ -76,10 +76,6 @@ func dataSourceRgUsageSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudapi/rg/flattens.go b/internal/service/cloudapi/rg/flattens.go index ce821500..9cf853c3 100644 --- a/internal/service/cloudapi/rg/flattens.go +++ b/internal/service/cloudapi/rg/flattens.go @@ -63,7 +63,6 @@ func flattenRGSeps(seps map[string]map[string]rg.DiskUsage) []map[string]interfa // "cpu": r.CPU, // "disksize": r.DiskSize, // "extips": r.ExtIPs, -// "exttraffic": r.ExtTraffic, // "gpu": r.GPU, // "ram": r.RAM, // "seps": flattenRgSeps(r.SEPs), @@ -143,13 +142,12 @@ func flattenRgSeps(seps map[string]map[string]rg.DiskUsage) []map[string]interfa func flattenQuota(resource rg.ResourceLimits) []map[string]interface{} { res := make([]map[string]interface{}, 0) temp := map[string]interface{}{ - "cpu": resource.CUC, - "ram": resource.CUM, - "disk": resource.CUDM, - "ext_ips": resource.CUI, - "ext_traffic": resource.CUNP, - "gpu_units": resource.GPUUnits, - "cu_d": resource.CUD, + "cpu": resource.CUC, + "ram": resource.CUM, + "disk": resource.CUDM, + "ext_ips": resource.CUI, + "gpu_units": resource.GPUUnits, + "cu_d": resource.CUD, } res = append(res, temp) @@ -164,7 +162,6 @@ func flattenResource(resource rg.Resource) []map[string]interface{} { "disk_size": resource.DiskSize, "disk_size_max": resource.DiskSizeMax, "extips": resource.ExtIPs, - "exttraffic": resource.ExtTraffic, "gpu": resource.GPU, "ram": resource.RAM, "seps": flattenRGSeps(resource.SEPs), @@ -292,7 +289,6 @@ func flattenRgResourceLimits(rl rg.ResourceLimits) []map[string]interface{} { "cu_i": rl.CUI, "cu_m": rl.CUM, "cu_dm": rl.CUDM, - "cu_np": rl.CUNP, "gpu_units": rl.GPUUnits, "storage_policy": flattenRgStoragePolicy(rl.StoragePolicies), } @@ -609,7 +605,6 @@ func flattenRgUsageResource(d *schema.ResourceData, usage rg.RecordResourceUsage d.Set("disk_size", usage.DiskSize) d.Set("disk_size_max", usage.DiskSizeMax) d.Set("extips", usage.ExtIPs) - d.Set("exttraffic", usage.ExtraTraffic) d.Set("gpu", usage.GPU) d.Set("ram", usage.RAM) d.Set("seps", flattenRgSeps(usage.SEPs)) diff --git a/internal/service/cloudapi/rg/models.go b/internal/service/cloudapi/rg/models.go index 2e0f1aeb..81f58066 100644 --- a/internal/service/cloudapi/rg/models.go +++ b/internal/service/cloudapi/rg/models.go @@ -37,17 +37,15 @@ type ResourceLimits struct { CUD float64 `json:"CU_D"` CUI float64 `json:"CU_I"` CUM float64 `json:"CU_M"` - CUNP float64 `json:"CU_NP"` GpuUnits float64 `json:"gpu_units"` } type QuotaRecord struct { // this is how quota is reported by /api/.../rg/get - Cpu int `json:"CU_C"` // CPU count in pcs - Ram int `json:"CU_M"` // RAM volume in MB - Disk int `json:"CU_D"` // Disk capacity in GB - ExtIPs int `json:"CU_I"` // Ext IPs count - ExtTraffic int `json:"CU_NP"` // Ext network traffic - GpuUnits int `json:"gpu_units"` // GPU count + Cpu int `json:"CU_C"` // CPU count in pcs + Ram int `json:"CU_M"` // RAM volume in MB + Disk int `json:"CU_D"` // Disk capacity in GB + ExtIPs int `json:"CU_I"` // Ext IPs count + GpuUnits int `json:"gpu_units"` // GPU count } // Main information about audit @@ -85,9 +83,6 @@ type Resource struct { // Number of External IPs ExtIPs int64 `json:"extips"` - // External traffic - ExtTraffic int64 `json:"exttraffic"` - // Number of grafic cores GPU int64 `json:"gpu"` diff --git a/internal/service/cloudapi/rg/quota_subresource.go b/internal/service/cloudapi/rg/quota_subresource.go index 398ac64b..a50562af 100644 --- a/internal/service/cloudapi/rg/quota_subresource.go +++ b/internal/service/cloudapi/rg/quota_subresource.go @@ -34,12 +34,11 @@ package rg func makeQuotaRecord(arg_list []interface{}) QuotaRecord { quota := QuotaRecord{ - Cpu: -1, - Ram: -1, - Disk: -1, - ExtTraffic: -1, - ExtIPs: -1, - GpuUnits: -1, + Cpu: -1, + Ram: -1, + Disk: -1, + ExtIPs: -1, + GpuUnits: -1, } if len(arg_list) != 0 { subres_data := arg_list[0].(map[string]interface{}) @@ -56,10 +55,6 @@ func makeQuotaRecord(arg_list []interface{}) QuotaRecord { quota.Ram = subres_data["ram"].(int) // RAM volume in MB } - if subres_data["ext_traffic"].(int) > 0 { - quota.ExtTraffic = subres_data["ext_traffic"].(int) - } - if subres_data["ext_ips"].(int) > 0 { quota.ExtIPs = subres_data["ext_ips"].(int) } @@ -77,7 +72,6 @@ func makeQuotaRecord(arg_list []interface{}) QuotaRecord { // quota_map["cpu"] = quota.Cpu // quota_map["ram"] = quota.Ram // NB: this is float64, unlike the rest of values // quota_map["disk"] = quota.Disk -// quota_map["ext_traffic"] = quota.ExtTraffic // quota_map["ext_ips"] = quota.ExtIPs // quota_map["gpu_units"] = quota.GpuUnits diff --git a/internal/service/cloudapi/rg/resource_rg.go b/internal/service/cloudapi/rg/resource_rg.go index e3ef5b6d..5b792373 100644 --- a/internal/service/cloudapi/rg/resource_rg.go +++ b/internal/service/cloudapi/rg/resource_rg.go @@ -127,14 +127,6 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter req.MaxNumPublicIP = maxNumPublicIP } } - if quotaMap["ext_traffic"] != nil { - maxNP := int64(quotaMap["ext_traffic"].(int)) - if maxNP == 0 { - req.MaxNetworkPeerTransfer = -1 - } else { - req.MaxNetworkPeerTransfer = maxNP - } - } } if defNetType, ok := d.GetOk("def_net_type"); ok { req.DefNet = defNetType.(string) // NOTE: in API default network type is set by "def_net" parameter @@ -640,12 +632,6 @@ func ResourceRgSchemaMake() map[string]*schema.Schema { Computed: true, Description: "Limit on the total volume of virtual storage resources in this resource group, specified in GB.", }, - "ext_traffic": { - Type: schema.TypeInt, - Optional: true, - Computed: true, - Description: "Limit on the total ingress network traffic for this resource group, specified in GB.", - }, "ext_ips": { Type: schema.TypeInt, Optional: true, @@ -913,10 +899,6 @@ func ResourceRgSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, diff --git a/internal/service/cloudapi/rg/state_upgraders.go b/internal/service/cloudapi/rg/state_upgraders.go index 0eee6690..887b615d 100644 --- a/internal/service/cloudapi/rg/state_upgraders.go +++ b/internal/service/cloudapi/rg/state_upgraders.go @@ -11,12 +11,11 @@ func resourceRGStateUpgradeV1(ctx context.Context, rawState map[string]interface quota, ok := rawState["quota"] if !ok || quota == nil { rawState["quota"] = QuotaRecord{ - Cpu: -1, - Ram: -1, - Disk: -1, - ExtTraffic: -1, - ExtIPs: -1, - GpuUnits: -1, + Cpu: -1, + Ram: -1, + Disk: -1, + ExtIPs: -1, + GpuUnits: -1, } return rawState, nil } diff --git a/internal/service/cloudapi/rg/utility_rg.go b/internal/service/cloudapi/rg/utility_rg.go index b172abae..54bdc819 100644 --- a/internal/service/cloudapi/rg/utility_rg.go +++ b/internal/service/cloudapi/rg/utility_rg.go @@ -113,14 +113,6 @@ func utilityUpdateRG(ctx context.Context, d *schema.ResourceData, m interface{}, req.MaxNumPublicIP = maxNumPublicIP } } - if resLimitsConv["ext_traffic"] != nil { - maxNP := int64(resLimitsConv["ext_traffic"].(int)) - if maxNP == 0 { - req.MaxNetworkPeerTransfer = -1 - } else { - req.MaxNetworkPeerTransfer = maxNP - } - } } } diff --git a/internal/service/cloudapi/stack/data_source_stack.go b/internal/service/cloudapi/stack/data_source_stack.go deleted file mode 100644 index 10bd1bd1..00000000 --- a/internal/service/cloudapi/stack/data_source_stack.go +++ /dev/null @@ -1,110 +0,0 @@ -/* -Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. -Authors: -Petr Krutov, -Stanislav Solovev, -Kasim Baybikov, - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud -Orchestration Technology) with Terraform by Hashicorp. - -Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort - -Please see README.md to learn where to place source code so that it -builds seamlessly. - -Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki -*/ - -package stack - -import ( - "context" - "strconv" - - "repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants" - - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func dataSourceStackRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - stack, err := utilityStackCheckPresence(ctx, d, m) - if err != nil { - d.SetId("") // ensure ID is empty in this case - return diag.FromErr(err) - } - d.SetId(strconv.Itoa(d.Get("stack_id").(int))) - flattenStack(d, stack) - return nil -} - -func dataSourceStackSchemaMake() map[string]*schema.Schema { - res := map[string]*schema.Schema{ - "stack_id": { - Type: schema.TypeInt, - Required: true, - }, - "cpu_allocation_ratio": { - Type: schema.TypeFloat, - Computed: true, - }, - "descr": { - Type: schema.TypeString, - Computed: true, - }, - "drivers": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "mem_allocation_ratio": { - Type: schema.TypeFloat, - Computed: true, - }, - "name": { - Type: schema.TypeString, - Computed: true, - }, - "status": { - Type: schema.TypeString, - Computed: true, - }, - "type": { - Type: schema.TypeString, - Computed: true, - }, - } - return res -} - -func DataSourceStack() *schema.Resource { - return &schema.Resource{ - SchemaVersion: 1, - - ReadContext: dataSourceStackRead, - - Timeouts: &schema.ResourceTimeout{ - Read: &constants.Timeout30s, - Default: &constants.Timeout60s, - }, - - Schema: dataSourceStackSchemaMake(), - } -} diff --git a/internal/service/cloudapi/stack/data_source_stack_list.go b/internal/service/cloudapi/stack/data_source_stack_list.go deleted file mode 100644 index 2cd9f7b4..00000000 --- a/internal/service/cloudapi/stack/data_source_stack_list.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. -Authors: -Petr Krutov, -Stanislav Solovev, -Kasim Baybikov, - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud -Orchestration Technology) with Terraform by Hashicorp. - -Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort - -Please see README.md to learn where to place source code so that it -builds seamlessly. - -Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki -*/ - -package stack - -import ( - "context" - - "github.com/google/uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants" -) - -func dataSourceStackListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - stackList, err := utilityStackListCheckPresence(ctx, d, m) - if err != nil { - d.SetId("") - return diag.FromErr(err) - } - - id := uuid.New() - d.SetId(id.String()) - d.Set("items", flattenStackList(stackList)) - d.Set("entry_count", stackList.EntryCount) - - return nil -} - -func dataSourceStackListSchemaMake() map[string]*schema.Schema { - res := map[string]*schema.Schema{ - "by_id": { - Type: schema.TypeInt, - Optional: true, - Description: "Find by ID", - }, - "name": { - Type: schema.TypeString, - Optional: true, - Description: "Find by name", - }, - "type": { - Type: schema.TypeString, - Optional: true, - Description: "Find by type", - }, - "status": { - Type: schema.TypeString, - Optional: true, - Description: "Find by status", - }, - "sort_by": { - Type: schema.TypeString, - Optional: true, - Description: "sort by one of supported fields, format +|-(field)", - }, - "page": { - Type: schema.TypeInt, - Optional: true, - Description: "Page number", - }, - "size": { - Type: schema.TypeInt, - Optional: true, - Description: "Page size", - }, - - "items": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "stack_id": { - Type: schema.TypeInt, - Computed: true, - }, - "name": { - Type: schema.TypeString, - Computed: true, - }, - "status": { - Type: schema.TypeString, - Computed: true, - }, - "type": { - Type: schema.TypeString, - Computed: true, - }, - }, - }, - }, - "entry_count": { - Type: schema.TypeInt, - Computed: true, - }, - } - return res -} - -func DataSourceStackList() *schema.Resource { - return &schema.Resource{ - SchemaVersion: 1, - - ReadContext: dataSourceStackListRead, - - Timeouts: &schema.ResourceTimeout{ - Read: &constants.Timeout30s, - Default: &constants.Timeout60s, - }, - - Schema: dataSourceStackListSchemaMake(), - } -} diff --git a/internal/service/cloudapi/stack/flattens.go b/internal/service/cloudapi/stack/flattens.go deleted file mode 100644 index 2ed24e03..00000000 --- a/internal/service/cloudapi/stack/flattens.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. -Authors: -Petr Krutov, -Stanislav Solovev, -Kasim Baybikov, - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud -Orchestration Technology) with Terraform by Hashicorp. - -Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort - -Please see README.md to learn where to place source code so that it -builds seamlessly. - -Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki -*/ - -package stack - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - log "github.com/sirupsen/logrus" - "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/stack" -) - -func flattenStackList(stackl *stack.ListStacks) []map[string]interface{} { - res := make([]map[string]interface{}, 0) - for _, stack := range stackl.Data { - temp := map[string]interface{}{ - "stack_id": stack.ID, - "name": stack.Name, - "status": stack.Status, - "type": stack.Type, - } - res = append(res, temp) - } - return res - -} - -func flattenStack(d *schema.ResourceData, details *stack.InfoStack) error { - log.Debugf("flattenStack: decoded Stack name %q / ID %d", - details.Name, details.ID) - - d.Set("stack_id", details.ID) - d.Set("cpu_allocation_ratio", details.CPUAllocationRatio) - d.Set("name", details.Name) - d.Set("descr", details.Descr) - d.Set("mem_allocation_ratio", details.MemAllocationRatio) - d.Set("status", details.Status) - d.Set("type", details.Type) - d.Set("drivers", details.Drivers) - return nil -} diff --git a/internal/service/cloudapi/stack/utility_stack.go b/internal/service/cloudapi/stack/utility_stack.go deleted file mode 100644 index b0349727..00000000 --- a/internal/service/cloudapi/stack/utility_stack.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. -Authors: -Petr Krutov, -Stanislav Solovev, -Kasim Baybikov, - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud -Orchestration Technology) with Terraform by Hashicorp. - -Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort - -Please see README.md to learn where to place source code so that it -builds seamlessly. - -Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki -*/ - -package stack - -import ( - "context" - "strconv" - - "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/stack" - "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func utilityStackCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*stack.InfoStack, error) { - c := m.(*controller.ControllerCfg) - req := stack.GetRequest{} - - if d.Id() != "" { - stackId, _ := strconv.ParseUint(d.Id(), 10, 64) - req.StackId = stackId - } else { - req.StackId = uint64(d.Get("stack_id").(int)) - } - - stackData, err := c.CloudAPI().Stack().Get(ctx, req) - if err != nil { - return nil, err - } - - return stackData, nil -} diff --git a/internal/service/cloudapi/stack/utility_stack_list.go b/internal/service/cloudapi/stack/utility_stack_list.go deleted file mode 100644 index e868d822..00000000 --- a/internal/service/cloudapi/stack/utility_stack_list.go +++ /dev/null @@ -1,82 +0,0 @@ -/* -Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. -Authors: -Petr Krutov, -Stanislav Solovev, -Kasim Baybikov, - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud -Orchestration Technology) with Terraform by Hashicorp. - -Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort - -Please see README.md to learn where to place source code so that it -builds seamlessly. - -Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki -*/ - -package stack - -import ( - "context" - - log "github.com/sirupsen/logrus" - "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/stack" - "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func utilityStackListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*stack.ListStacks, error) { - c := m.(*controller.ControllerCfg) - req := stack.ListRequest{} - - if byId, ok := d.GetOk("by_id"); ok { - req.ByID = uint64(byId.(int)) - } - if name, ok := d.GetOk("name"); ok { - req.Name = name.(string) - } - - if status, ok := d.GetOk("status"); ok { - req.Status = status.(string) - } - - if stackType, ok := d.GetOk("type"); ok { - req.Type = stackType.(string) - } - - if sortBy, ok := d.GetOk("sort_by"); ok { - req.SortBy = sortBy.(string) - } - - if size, ok := d.GetOk("size"); ok { - req.Size = uint64(size.(int)) - } - if page, ok := d.GetOk("page"); ok { - req.Page = uint64(page.(int)) - } - - log.Debugf("utilityStackListCheckPresence: load stack list") - stackList, err := c.CloudAPI().Stack().List(ctx, req) - if err != nil { - return nil, err - } - - return stackList, nil -} diff --git a/internal/service/cloudapi/stpolicy/flattens.go b/internal/service/cloudapi/stpolicy/flattens.go index 2ab72c00..51b7e9ad 100644 --- a/internal/service/cloudapi/stpolicy/flattens.go +++ b/internal/service/cloudapi/stpolicy/flattens.go @@ -20,9 +20,10 @@ func flattenAccessSEPPools(accessSEPPools stpolicy.ListAccessSEPPools) []map[str res := make([]map[string]interface{}, 0, len(accessSEPPools)) for _, asp := range accessSEPPools { temp := map[string]interface{}{ - "sep_id": asp.SEPID, - "sep_name": asp.Name, - "pool_names": asp.PoolNames, + "sep_id": asp.SEPID, + "sep_name": asp.Name, + "pool_names": asp.PoolNames, + "sep_tech_status": asp.SepTechStatus, } res = append(res, temp) diff --git a/internal/service/cloudapi/stpolicy/schema.go b/internal/service/cloudapi/stpolicy/schema.go index 44df4c1e..bf153999 100644 --- a/internal/service/cloudapi/stpolicy/schema.go +++ b/internal/service/cloudapi/stpolicy/schema.go @@ -1,6 +1,9 @@ package stpolicy -import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +import ( + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" +) func dataSourceStoragePolicySchemaMake() map[string]*schema.Schema { res := map[string]*schema.Schema{ @@ -44,6 +47,10 @@ func dataSourceStoragePolicySchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, + "sep_name": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, @@ -120,6 +127,11 @@ func dataSourceStoragePolicyListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Optional: true, }, + "sep_tech_status": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"ENABLED", "DISABLED"}, true), + }, "pool_name": { Type: schema.TypeString, Optional: true, @@ -174,6 +186,10 @@ func dataSourceStoragePolicyListSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "sep_tech_status": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, diff --git a/internal/service/cloudapi/stpolicy/utility_storage_policy_list.go b/internal/service/cloudapi/stpolicy/utility_storage_policy_list.go index 2dfb220b..77588b48 100644 --- a/internal/service/cloudapi/stpolicy/utility_storage_policy_list.go +++ b/internal/service/cloudapi/stpolicy/utility_storage_policy_list.go @@ -56,6 +56,10 @@ func utilityStoragePolicyListCheckPresence(ctx context.Context, d *schema.Resour req.SepID = uint64(SEPID.(int)) } + if SEPtechstatus, ok := d.GetOk("sep_tech_status"); ok { + req.SepTechStatus = SEPtechstatus.(string) + } + if poolName, ok := d.GetOk("pool_name"); ok { req.PoolName = poolName.(string) } diff --git a/internal/service/cloudapi/trunk/flattens.go b/internal/service/cloudapi/trunk/flattens.go index f4fb0cef..9a0efc16 100644 --- a/internal/service/cloudapi/trunk/flattens.go +++ b/internal/service/cloudapi/trunk/flattens.go @@ -18,6 +18,7 @@ func flattenTrunk(d *schema.ResourceData, trunkItem *trunk.ItemTrunk) { d.Set("account_ids", trunkItem.AccountIDs) d.Set("ovs_bridge", trunkItem.OVSBridge) d.Set("native_vlan_id", trunkItem.NativeVLANID) + d.Set("mtu", trunkItem.MTU) d.Set("status", trunkItem.Status) d.Set("trunk_tags", trunkItem.TrunkTags) d.Set("created_at", trunkItem.CreatedAt) @@ -44,6 +45,7 @@ func flattenTrunkList(trunkList *trunk.ListTrunks) []map[string]interface{} { "name": trunkItem.Name, "native_vlan_id": trunkItem.NativeVLANID, "ovs_bridge": trunkItem.OVSBridge, + "mtu": trunkItem.MTU, "status": trunkItem.Status, "trunk_tags": trunkItem.TrunkTags, "updated_at": trunkItem.UpdatedAt, diff --git a/internal/service/cloudapi/trunk/schema.go b/internal/service/cloudapi/trunk/schema.go index dc25ce6d..566e6a7f 100644 --- a/internal/service/cloudapi/trunk/schema.go +++ b/internal/service/cloudapi/trunk/schema.go @@ -52,6 +52,11 @@ func dataSourceTrunkSchemaMake() map[string]*schema.Schema { Computed: true, Description: "Native VLAN ID", }, + "mtu": { + Type: schema.TypeInt, + Computed: true, + Description: "Maximum Transmission Unit", + }, "status": { Type: schema.TypeString, Computed: true, @@ -208,6 +213,11 @@ func dataSourceTrunkListSchemaMake() map[string]*schema.Schema { Computed: true, Description: "OVS bridge name", }, + "mtu": { + Type: schema.TypeInt, + Computed: true, + Description: "Maximum Transmission Unit", + }, "status": { Type: schema.TypeString, Computed: true, diff --git a/internal/service/cloudapi/vins/data_source_vins.go b/internal/service/cloudapi/vins/data_source_vins.go index f5995d67..7004a2ec 100644 --- a/internal/service/cloudapi/vins/data_source_vins.go +++ b/internal/service/cloudapi/vins/data_source_vins.go @@ -84,7 +84,7 @@ func vnfConfigResourcesSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/cloudapi/vins/flattens.go b/internal/service/cloudapi/vins/flattens.go index db2260a5..ac82940e 100644 --- a/internal/service/cloudapi/vins/flattens.go +++ b/internal/service/cloudapi/vins/flattens.go @@ -52,10 +52,10 @@ func flattenMGMT(mgmt vins.RecordMGMT) []map[string]interface{} { func flattenResources(resources vins.RecordResources) []map[string]interface{} { res := make([]map[string]interface{}, 0) temp := map[string]interface{}{ - "cpu": resources.CPU, - "ram": resources.RAM, - "stack_id": resources.StackID, - "uuid": resources.UUID, + "cpu": resources.CPU, + "ram": resources.RAM, + "node_id": resources.NodeID, + "uuid": resources.UUID, } res = append(res, temp) return res diff --git a/internal/service/cloudapi/zone/data_source_zone.go b/internal/service/cloudapi/zone/data_source_zone.go index 788a21fe..38ee5a6a 100644 --- a/internal/service/cloudapi/zone/data_source_zone.go +++ b/internal/service/cloudapi/zone/data_source_zone.go @@ -58,6 +58,10 @@ func dataSourceZoneSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Required: true, }, + "auto_start": { + Type: schema.TypeBool, + Required: true, + }, "guid": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudapi/zone/data_source_zone_list.go b/internal/service/cloudapi/zone/data_source_zone_list.go index 0ef22887..6b5c75df 100644 --- a/internal/service/cloudapi/zone/data_source_zone_list.go +++ b/internal/service/cloudapi/zone/data_source_zone_list.go @@ -115,6 +115,10 @@ func dataSourceZoneListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Required: true, }, + "auto_start": { + Type: schema.TypeBool, + Computed: true, + }, "guid": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudapi/zone/flattens.go b/internal/service/cloudapi/zone/flattens.go index fb9a5329..5af35114 100644 --- a/internal/service/cloudapi/zone/flattens.go +++ b/internal/service/cloudapi/zone/flattens.go @@ -59,6 +59,7 @@ func flattenZone(d *schema.ResourceData, item *zone.RecordZone) error { d.Set("lb_ids", item.LBIDs) d.Set("bservice_ids", item.BserviceIDs) d.Set("k8s_ids", item.K8SIDs) + d.Set("auto_start", item.AutoStart) log.Debugf("flattenZone: decoded RecordZone name %q / ID %d, complete", item.Name, item.ID) @@ -80,6 +81,7 @@ func flattenZoneList(zone *zone.ListZones) []map[string]interface{} { "created_time": zone.CreatedTime, "updated_time": zone.UpdatedTime, "node_ids": zone.NodeIDs, + "auto_start": zone.AutoStart, } res = append(res, temp) } diff --git a/internal/service/cloudbroker/account/flattens.go b/internal/service/cloudbroker/account/flattens.go index 190bd725..628c8b99 100644 --- a/internal/service/cloudbroker/account/flattens.go +++ b/internal/service/cloudbroker/account/flattens.go @@ -120,7 +120,6 @@ func flattenAccLimits(l account.Limits) []map[string]interface{} { "disksize": l.DiskSize, "disksizemax": l.DiskSizeMax, "extips": l.ExtIPs, - "exttraffic": l.ExtTraffic, "gpu": l.GPU, "ram": l.RAM, "seps": l.SEPs, @@ -136,7 +135,6 @@ func flattenAccResource(r account.Resource) []map[string]interface{} { "disksize": r.DiskSize, "disksizemax": r.DiskSizeMax, "extips": r.ExtIPs, - "exttraffic": r.ExtTraffic, "gpu": r.GPU, "ram": r.RAM, "seps": flattenAccountSeps(r.SEPs), @@ -190,7 +188,6 @@ func flattenRgResourceLimits(rl account.ResourceLimits) []map[string]interface{} "cu_dm": rl.CuDM, "cu_i": rl.CuI, "cu_m": rl.CuM, - "cu_np": rl.CuNP, "gpu_units": rl.GPUUnits, "storage_policy": flattenSTPolicy(rl.StoragePolicies), } diff --git a/internal/service/cloudbroker/account/resource_account.go b/internal/service/cloudbroker/account/resource_account.go index fa77ac6a..1756ccdf 100644 --- a/internal/service/cloudbroker/account/resource_account.go +++ b/internal/service/cloudbroker/account/resource_account.go @@ -126,14 +126,6 @@ func resourceAccountCreate(ctx context.Context, d *schema.ResourceData, m interf req.MaxNumPublicIP = maxNumPublicIP } } - if resLimitsConv["cu_np"] != nil { - maxNP := int64(resLimitsConv["cu_np"].(float64)) - if maxNP == 0 { - req.MaxNetworkPeerTransfer = -1 - } else { - req.MaxNetworkPeerTransfer = maxNP - } - } if resLimitsConv["gpu_units"] != nil { gpuUnits := int64(resLimitsConv["gpu_units"].(float64)) if gpuUnits == 0 { diff --git a/internal/service/cloudbroker/account/schema.go b/internal/service/cloudbroker/account/schema.go index 0685f600..c12cb670 100644 --- a/internal/service/cloudbroker/account/schema.go +++ b/internal/service/cloudbroker/account/schema.go @@ -138,11 +138,6 @@ func resourceAccountSchemaMake() map[string]*schema.Schema { Optional: true, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Optional: true, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Optional: true, @@ -665,10 +660,6 @@ func dataSourceAccountListDeletedSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, @@ -1024,10 +1015,6 @@ func dataSourceAccountResourceConsumptionGetSchemaMake() map[string]*schema.Sche Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -1128,10 +1115,6 @@ func dataSourceAccountResourceConsumptionGetSchemaMake() map[string]*schema.Sche Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -1236,10 +1219,6 @@ func dataSourceAccountResourceConsumptionGetSchemaMake() map[string]*schema.Sche Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, @@ -1427,10 +1406,6 @@ func dataSourceAccountListSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, @@ -1548,10 +1523,6 @@ func dataSourceAccountResourceConsumptionListSchemaMake() map[string]*schema.Sch Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -1652,10 +1623,6 @@ func dataSourceAccountResourceConsumptionListSchemaMake() map[string]*schema.Sch Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -1842,10 +1809,6 @@ func dataSourceAccountRGListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -1902,10 +1865,6 @@ func dataSourceAccountRGListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -1942,10 +1901,6 @@ func dataSourceAccountRGListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -2331,10 +2286,6 @@ func dataSourceAccountSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, diff --git a/internal/service/cloudbroker/account/utility_account.go b/internal/service/cloudbroker/account/utility_account.go index 791d638c..8ca0b17e 100644 --- a/internal/service/cloudbroker/account/utility_account.go +++ b/internal/service/cloudbroker/account/utility_account.go @@ -271,14 +271,6 @@ func utilityAccountUpdate(ctx context.Context, d *schema.ResourceData, m interfa req.MaxNumPublicIP = int64(maxNumPublicIP) } } - if resLimitConv["cu_np"] != nil { - maxNP := int(resLimitConv["cu_np"].(float64)) - if maxNP == 0 { - req.MaxNetworkPeerTransfer = -1 - } else { - req.MaxNetworkPeerTransfer = int64(maxNP) - } - } if resLimitConv["gpu_units"] != nil { gpuUnits := int(resLimitConv["gpu_units"].(float64)) if gpuUnits == 0 { diff --git a/internal/service/cloudbroker/audit/flattens.go b/internal/service/cloudbroker/audit/flattens.go index 9da6cde7..0fbffe3a 100644 --- a/internal/service/cloudbroker/audit/flattens.go +++ b/internal/service/cloudbroker/audit/flattens.go @@ -50,11 +50,13 @@ func flattenAudit(d *schema.ResourceData, au *audit.RecordAudit) { d.Set("responsetime", au.ResponseTime) d.Set("result", au.Result) d.Set("status_code", au.StatusCode) - d.Set("tags", au.Tags) d.Set("timestamp", au.Timestamp) d.Set("timestamp_end", au.TimestampEnd) d.Set("ttl", au.TTL) d.Set("user", au.User) + d.Set("resgroup_id", au.ResgroupID) + d.Set("account_id", au.AccountID) + d.Set("compute_id", au.ComputeID) } func flattenAuditList(au *audit.ListAudits) []map[string]interface{} { diff --git a/internal/service/cloudbroker/audit/schema.go b/internal/service/cloudbroker/audit/schema.go index 0856a62e..7fafc58e 100644 --- a/internal/service/cloudbroker/audit/schema.go +++ b/internal/service/cloudbroker/audit/schema.go @@ -46,11 +46,6 @@ func dataSourceAuditSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - //TODO - //"tags": { - // Type: schema.TypeString, - // Computed: true, - //}, "timestamp": { Type: schema.TypeFloat, Computed: true, @@ -67,6 +62,18 @@ func dataSourceAuditSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "resgroup_id": { + Type: schema.TypeInt, + Computed: true, + }, + "account_id": { + Type: schema.TypeInt, + Computed: true, + }, + "compute_id": { + Type: schema.TypeInt, + Computed: true, + }, } } diff --git a/internal/service/cloudbroker/audit/utility_audit.go b/internal/service/cloudbroker/audit/utility_audit.go index a9274b4b..365149a1 100644 --- a/internal/service/cloudbroker/audit/utility_audit.go +++ b/internal/service/cloudbroker/audit/utility_audit.go @@ -52,7 +52,7 @@ func utilityAuditCheckPresence(ctx context.Context, d *schema.ResourceData, m in req.AuditGuid = d.Get("audit_guid").(string) } - log.Debugf("utilityStackCheckPresence: load stack") + log.Debugf("utilityAuditCheckPresence: load audit") auditInfo, err := c.CloudBroker().Audit().Get(ctx, req) if err != nil { return nil, err diff --git a/internal/service/cloudbroker/disks/flattens.go b/internal/service/cloudbroker/disks/flattens.go index 11d811d9..9798a4dc 100644 --- a/internal/service/cloudbroker/disks/flattens.go +++ b/internal/service/cloudbroker/disks/flattens.go @@ -13,6 +13,7 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) { d.Set("account_id", disk.AccountID) d.Set("account_name", disk.AccountName) d.Set("acl", string(diskAcl)) + d.Set("blk_discard", disk.BLKDiscard) d.Set("boot_partition", disk.BootPartition) d.Set("computes", flattenDiskComputes(disk.Computes)) d.Set("created_by", disk.CreatedBy) @@ -53,6 +54,7 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) { d.Set("sep_id", disk.SEPID) d.Set("sep_type", disk.SEPType) d.Set("shareable", disk.Shareable) + d.Set("cache", disk.Cache) d.Set("size_available", disk.SizeAvailable) d.Set("size_max", disk.SizeMax) d.Set("size_used", disk.SizeUsed) @@ -108,6 +110,7 @@ func flattenDiskReplica(d *schema.ResourceData, disk *disks.RecordDisk, statusRe d.Set("sep_id", disk.SEPID) d.Set("sep_type", disk.SEPType) d.Set("shareable", disk.Shareable) + d.Set("cache", disk.Cache) d.Set("size_max", disk.SizeMax) d.Set("size_used", disk.SizeUsed) d.Set("snapshots", flattendDiskSnapshotList(disk.Snapshots)) @@ -183,6 +186,7 @@ func flattenDiskList(dl *disks.ListDisks) []map[string]interface{} { "account_id": disk.AccountID, "account_name": disk.AccountName, "acl": string(diskAcl), + "blk_discard": disk.BLKDiscard, "boot_partition": disk.BootPartition, "computes": flattenDiskComputes(disk.Computes), "created_by": disk.CreatedBy, @@ -221,6 +225,8 @@ func flattenDiskList(dl *disks.ListDisks) []map[string]interface{} { "role": disk.Role, "sep_id": disk.SEPID, "sep_type": disk.SEPType, + "shareable": disk.Shareable, + "cache": disk.Cache, "size_available": disk.SizeAvailable, "size_max": disk.SizeMax, "size_used": disk.SizeUsed, @@ -293,11 +299,11 @@ func flattenDiskListUnattached(ul *disks.ListUnattachedDisks) []map[string]inter for _, unattachedDisk := range ul.Data { unattachedDiskAcl, _ := json.Marshal(unattachedDisk.ACL) tmp := map[string]interface{}{ - "_ckey": unattachedDisk.CKey, "_meta": flattens.FlattenMeta(unattachedDisk.Meta), "account_id": unattachedDisk.AccountID, "account_name": unattachedDisk.AccountName, "acl": string(unattachedDiskAcl), + "blk_discard": unattachedDisk.BLKDiscard, "boot_partition": unattachedDisk.BootPartition, "created_time": unattachedDisk.CreatedTime, "deleted_time": unattachedDisk.DeletedTime, @@ -330,6 +336,7 @@ func flattenDiskListUnattached(ul *disks.ListUnattachedDisks) []map[string]inter "role": unattachedDisk.Role, "sep_id": unattachedDisk.SEPID, "shareable": unattachedDisk.Shareable, + "cache": unattachedDisk.Cache, "size_max": unattachedDisk.SizeMax, "size_used": unattachedDisk.SizeUsed, "snapshots": flattenDiskSnapshotList(unattachedDisk.Snapshots), diff --git a/internal/service/cloudbroker/disks/resource_disk.go b/internal/service/cloudbroker/disks/resource_disk.go index bbf7f40b..8d90dd11 100644 --- a/internal/service/cloudbroker/disks/resource_disk.go +++ b/internal/service/cloudbroker/disks/resource_disk.go @@ -75,6 +75,14 @@ func resourceDiskCreate(ctx context.Context, d *schema.ResourceData, m interface req.Pool = pool.(string) } + if cache, ok := d.GetOk("cache"); ok { + req.Cache = cache.(string) + } + + if blkDiscard, ok := d.GetOk("blk_discard"); ok { + req.BLKDiscard = blkDiscard.(bool) + } + diskID, err := c.CloudBroker().Disks().Create(ctx, req) if err != nil { d.SetId("") @@ -236,6 +244,18 @@ func resourceDiskUpdate(ctx context.Context, d *schema.ResourceData, m interface } } + if d.HasChange("cache") { + if err := resourceDiskChangeCache(ctx, d, m); err != nil { + return diag.FromErr(err) + } + } + + if d.HasChange("blk_discard") { + if err := resourceDiskChangeBLKDiscard(ctx, d, m); err != nil { + return diag.FromErr(err) + } + } + if d.HasChange("node_ids") { log.Debugf("resourceDiskUpdate: present for disk %d", d.Get("disk_id")) if err := resourceDiskChangeNodes(ctx, d, m, false); err != nil { @@ -362,6 +382,26 @@ func resourceDiskChangeStoragePolicyID(ctx context.Context, d *schema.ResourceDa return err } +func resourceDiskChangeCache(ctx context.Context, d *schema.ResourceData, m interface{}) error { + c := m.(*controller.ControllerCfg) + + _, err := c.CloudBroker().Disks().Update(ctx, disks.UpdateRequest{ + DiskID: uint64(d.Get("disk_id").(int)), + Cache: d.Get("cache").(string), + }) + return err +} + +func resourceDiskChangeBLKDiscard(ctx context.Context, d *schema.ResourceData, m interface{}) error { + c := m.(*controller.ControllerCfg) + + _, err := c.CloudBroker().Disks().Update(ctx, disks.UpdateRequest{ + DiskID: uint64(d.Get("disk_id").(int)), + BLKDiscard: d.Get("blk_discard").(bool), + }) + return err +} + func resourceDiskChangeNodes(ctx context.Context, d *schema.ResourceData, m interface{}, afterCreate bool) error { c := m.(*controller.ControllerCfg) diskID := uint64(d.Get("disk_id").(int)) diff --git a/internal/service/cloudbroker/disks/schema.go b/internal/service/cloudbroker/disks/schema.go index 204a4603..d90b6091 100644 --- a/internal/service/cloudbroker/disks/schema.go +++ b/internal/service/cloudbroker/disks/schema.go @@ -22,6 +22,10 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "blk_discard": { + Type: schema.TypeBool, + Computed: true, + }, "boot_partition": { Type: schema.TypeInt, Computed: true, @@ -281,6 +285,10 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "cache": { + Type: schema.TypeString, + Computed: true, + }, "size_available": { Type: schema.TypeFloat, Computed: true, @@ -456,6 +464,10 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "blk_discard": { + Type: schema.TypeBool, + Computed: true, + }, "boot_partition": { Type: schema.TypeInt, Computed: true, @@ -719,6 +731,10 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "cache": { + Type: schema.TypeString, + Computed: true, + }, "size_available": { Type: schema.TypeFloat, Computed: true, @@ -880,6 +896,10 @@ func dataSourceDiskListDeletedSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "blk_discard": { + Type: schema.TypeBool, + Computed: true, + }, "boot_partition": { Type: schema.TypeInt, Computed: true, @@ -1143,6 +1163,10 @@ func dataSourceDiskListDeletedSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "cache": { + Type: schema.TypeString, + Computed: true, + }, "size_available": { Type: schema.TypeFloat, Computed: true, @@ -1400,11 +1424,6 @@ func dataSourceDiskListUnattachedSchemaMake() map[string]*schema.Schema { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "_ckey": { - Type: schema.TypeString, - Computed: true, - Description: "CKey", - }, "_meta": { Type: schema.TypeList, Computed: true, @@ -1427,6 +1446,10 @@ func dataSourceDiskListUnattachedSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "blk_discard": { + Type: schema.TypeBool, + Computed: true, + }, "boot_partition": { Type: schema.TypeInt, Computed: true, @@ -1659,6 +1682,10 @@ func dataSourceDiskListUnattachedSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "cache": { + Type: schema.TypeString, + Computed: true, + }, "size_max": { Type: schema.TypeInt, Computed: true, @@ -1964,12 +1991,23 @@ func resourceDiskSchemaMake() map[string]*schema.Schema { Optional: true, Computed: true, }, + "cache": { + Type: schema.TypeString, + Optional: true, + Default: "none", + Description: "Cache mode for the disk", + }, "restore": { Type: schema.TypeBool, Optional: true, Default: false, Description: "restore deleting disk", }, + "blk_discard": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, "account_name": { Type: schema.TypeString, Computed: true, @@ -2569,6 +2607,10 @@ func dataSourceDiskReplicationSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "cache": { + Type: schema.TypeString, + Computed: true, + }, "size_max": { Type: schema.TypeInt, Computed: true, @@ -2939,6 +2981,10 @@ func resourceDiskReplicationSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "cache": { + Type: schema.TypeString, + Computed: true, + }, "size_max": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudbroker/extnet/utility_extnet_resource.go b/internal/service/cloudbroker/extnet/utility_extnet_resource.go index 99f3bfd3..67558f33 100644 --- a/internal/service/cloudbroker/extnet/utility_extnet_resource.go +++ b/internal/service/cloudbroker/extnet/utility_extnet_resource.go @@ -332,15 +332,15 @@ func handleRestartUpdate(ctx context.Context, d *schema.ResourceData, c *control } func handleMigrateUpdate(ctx context.Context, d *schema.ResourceData, c *controller.ControllerCfg, recNet *extnet.RecordExtNet) error { - stackId := uint64(d.Get("migrate").(int)) + nodeId := uint64(d.Get("migrate").(int)) - if err := ic.ExistStack(ctx, stackId, c); err != nil { + if err := ic.ExistNode(ctx, nodeId, c); err != nil { return err } req := extnet.DeviceMigrateRequest{ - NetID: recNet.ID, - StackID: stackId, + NetID: recNet.ID, + NodeID: nodeId, } _, err := c.CloudBroker().ExtNet().DeviceMigrate(ctx, req) diff --git a/internal/service/cloudbroker/flipgroup/flattens.go b/internal/service/cloudbroker/flipgroup/flattens.go index 4c35c5cb..b4f78774 100644 --- a/internal/service/cloudbroker/flipgroup/flattens.go +++ b/internal/service/cloudbroker/flipgroup/flattens.go @@ -63,8 +63,6 @@ func flattenFlipgroup(d *schema.ResourceData, flip *flipgroup.RecordFLIPGroup) { d.Set("net_id", flip.NetID) d.Set("net_type", flip.NetType) d.Set("network", flip.Network) - d.Set("rg_id", flip.RGID) - d.Set("rg_name", flip.RGName) d.Set("status", flip.Status) d.Set("updated_by", flip.UpdatedBy) d.Set("updated_time", flip.UpdatedTime) diff --git a/internal/service/cloudbroker/flipgroup/schema.go b/internal/service/cloudbroker/flipgroup/schema.go index 0539f69c..011f56c7 100644 --- a/internal/service/cloudbroker/flipgroup/schema.go +++ b/internal/service/cloudbroker/flipgroup/schema.go @@ -123,16 +123,6 @@ func dataSourceFlipgroupSchemaMake() map[string]*schema.Schema { Computed: true, Description: "network", }, - "rg_id": { - Type: schema.TypeInt, - Computed: true, - Description: "rg_id", - }, - "rg_name": { - Type: schema.TypeString, - Computed: true, - Description: "rg_name", - }, "status": { Type: schema.TypeString, Computed: true, @@ -179,11 +169,6 @@ func dataSourceFlipgroupsListSchemaMake() map[string]*schema.Schema { Optional: true, Description: "by_ip", }, - "rg_id": { - Type: schema.TypeInt, - Optional: true, - Description: "rg_id", - }, "by_id": { Type: schema.TypeInt, Optional: true, @@ -464,16 +449,6 @@ func resourceFlipgroupSchemaMake() map[string]*schema.Schema { Computed: true, Description: "network", }, - "rg_id": { - Type: schema.TypeInt, - Computed: true, - Description: "rg_id", - }, - "rg_name": { - Type: schema.TypeString, - Computed: true, - Description: "rg_name", - }, "status": { Type: schema.TypeString, Computed: true, diff --git a/internal/service/cloudbroker/flipgroup/utility_flipgroup_list.go b/internal/service/cloudbroker/flipgroup/utility_flipgroup_list.go index 6d9f0fef..f1b5d58d 100644 --- a/internal/service/cloudbroker/flipgroup/utility_flipgroup_list.go +++ b/internal/service/cloudbroker/flipgroup/utility_flipgroup_list.go @@ -63,9 +63,6 @@ func utilityFlipgroupListCheckPresence(ctx context.Context, d *schema.ResourceDa if byIp, ok := d.GetOk("by_ip"); ok { req.ByIP = byIp.(string) } - if rgId, ok := d.GetOk("rg_id"); ok { - req.RGID = uint64(rgId.(int)) - } if byID, ok := d.GetOk("by_id"); ok { req.ByID = uint64(byID.(int)) } diff --git a/internal/service/cloudbroker/grid/flattens.go b/internal/service/cloudbroker/grid/flattens.go index 12d444c5..11fa14a9 100644 --- a/internal/service/cloudbroker/grid/flattens.go +++ b/internal/service/cloudbroker/grid/flattens.go @@ -73,7 +73,6 @@ func flattenGridRecordResource(rr grid.RecordResource) []map[string]interface{} "disk_size": rr.DiskSize, "disk_size_max": rr.DiskSizeMax, "ext_ips": rr.ExtIPs, - "ext_traffic": rr.ExtTraffic, "gpu": rr.GPU, "ram": rr.RAM, "seps": flattenGridSeps(rr.SEPs), diff --git a/internal/service/cloudbroker/grid/schema.go b/internal/service/cloudbroker/grid/schema.go index 7cf7bee6..18ac1616 100644 --- a/internal/service/cloudbroker/grid/schema.go +++ b/internal/service/cloudbroker/grid/schema.go @@ -124,10 +124,6 @@ func dataSourceGridListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "ext_traffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -184,10 +180,6 @@ func dataSourceGridListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "ext_traffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -338,10 +330,6 @@ func dataSourceGridGetConsumptionSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "ext_traffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -398,10 +386,6 @@ func dataSourceGridGetConsumptionSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "ext_traffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -469,10 +453,6 @@ func dataSourceGridListConsumptionSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "ext_traffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -529,10 +509,6 @@ func dataSourceGridListConsumptionSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "ext_traffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudbroker/ic/input_checks.go b/internal/service/cloudbroker/ic/input_checks.go index c5839e48..0a1d2610 100644 --- a/internal/service/cloudbroker/ic/input_checks.go +++ b/internal/service/cloudbroker/ic/input_checks.go @@ -15,8 +15,8 @@ import ( cb_k8ci "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/k8ci" cb_k8s "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/k8s" cb_lb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/lb" + cb_node "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/node" cb_rg "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/rg" - cb_stack "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/stack" cb_trunk "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/trunk" cb_vfpool "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/vfpool" cb_vins "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/vins" @@ -467,53 +467,23 @@ func ExistGID(ctx context.Context, gid uint64, c *controller.ControllerCfg) erro return fmt.Errorf("GID with id %v not found", gid) } -func ExistStack(ctx context.Context, stackId uint64, c *controller.ControllerCfg) error { - req := cb_stack.ListRequest{ - ByID: stackId, +func ExistNode(ctx context.Context, nodeId uint64, c *controller.ControllerCfg) error { + req := cb_node.ListRequest{ + ByID: nodeId, } - stackList, err := c.CloudBroker().Stack().List(ctx, req) + nodeList, err := c.CloudBroker().Node().List(ctx, req) if err != nil { return err } - if len(stackList.Data) == 0 { - return fmt.Errorf("stack with id %v not found", stackList) + if len(nodeList.Data) == 0 { + return fmt.Errorf("node with id %v not found", nodeList) } return nil } -// ExistStackInPcidevice checks if compute exists with specified stackId and specified non-deleted rgId. -func ExistStackInPcidevice(ctx context.Context, stackId, rgId uint64, c *controller.ControllerCfg) error { - req := cb_rg.ListRequest{ - ByID: rgId, - IncludeDeleted: false, - } - - rgList, err := c.CloudBroker().RG().List(ctx, req) - if err != nil { - return err - } - - for _, v := range rgList.Data { - for _, idVM := range v.VMs { - req := cb_compute.GetRequest{ - ComputeID: idVM, - } - computeRec, err := c.CloudBroker().Compute().Get(ctx, req) - if err != nil { - return err - } - if computeRec.StackID == stackId { - return nil - } - } - } - - return fmt.Errorf("no compute found with stack_id %v and rg_id %v", stackId, rgId) -} - func ExistLB(ctx context.Context, lbId uint64, c *controller.ControllerCfg) error { req := cb_lb.ListRequest{ diff --git a/internal/service/cloudbroker/image/data_source_image_list_stacks.go b/internal/service/cloudbroker/image/data_source_image_list_stacks.go deleted file mode 100644 index 8e536ba8..00000000 --- a/internal/service/cloudbroker/image/data_source_image_list_stacks.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved. -Authors: -Petr Krutov, -Stanislav Solovev, - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud -Orchestration Technology) with Terraform by Hashicorp. - -Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort - -Please see README.md to learn where to place source code so that it -builds seamlessly. - -Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki -*/ - -package image - -import ( - "context" - - "github.com/google/uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants" -) - -func dataSourceImageListStacksRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - imageListStacks, err := utilityImageListStacksCheckPresence(ctx, d, m) - if err != nil { - d.SetId("") - return diag.FromErr(err) - } - id := uuid.New() - d.SetId(id.String()) - d.Set("items", flattenImageListStacks(imageListStacks)) - d.Set("entry_count", imageListStacks.EntryCount) - return nil -} - -func DataSourceImageListStacks() *schema.Resource { - return &schema.Resource{ - SchemaVersion: 1, - - ReadContext: dataSourceImageListStacksRead, - - Timeouts: &schema.ResourceTimeout{ - Read: &constants.Timeout30s, - Default: &constants.Timeout60s, - }, - - Schema: dataSourceImageListStacksSchemaMake(), - } -} diff --git a/internal/service/cloudbroker/image/flattens.go b/internal/service/cloudbroker/image/flattens.go index e6eb48de..9dcabf7c 100644 --- a/internal/service/cloudbroker/image/flattens.go +++ b/internal/service/cloudbroker/image/flattens.go @@ -161,40 +161,6 @@ func flattenEco(m interface{}) string { return output } -func flattenImageListStacks(stack *image.ListStacks) []map[string]interface{} { - log.Debug("flattenImageListStacks") - temp := make([]map[string]interface{}, 0, len(stack.Data)) - for _, item := range stack.Data { - t := map[string]interface{}{ - "ckey": item.CKey, - //"meta": flattens.FlattenMeta(item.Meta), - "api_url": item.APIURL, - "api_key": item.APIKey, - "app_id": item.AppID, - "cpu_allocation_ratio": item.CPUAllocationRatio, - "desc": item.Description, - "descr": item.Descr, - "drivers": item.Drivers, - "eco": flattenEco(item.Eco), - "error": item.Error, - "gid": item.GID, - "guid": item.GUID, - "id": item.ID, - "images": item.Images, - "login": item.Login, - "mem_allocation_ratio": item.MemAllocationRatio, - "name": item.Name, - "packages": flattenPackages(item.Packages), - "passwd": item.Password, - "reference_id": item.ReferenceID, - "status": item.Status, - "type": item.Type, - } - temp = append(temp, t) - } - return temp -} - func flattenPackages(pg image.Packages) []map[string]interface{} { log.Debug("flattenPackages") res := make([]map[string]interface{}, 0) diff --git a/internal/service/cloudbroker/image/schema.go b/internal/service/cloudbroker/image/schema.go index 684922b7..37f02150 100644 --- a/internal/service/cloudbroker/image/schema.go +++ b/internal/service/cloudbroker/image/schema.go @@ -36,291 +36,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) -func dataSourceImageListStacksSchemaMake() map[string]*schema.Schema { - return map[string]*schema.Schema{ - "image_id": { - Type: schema.TypeInt, - Required: true, - Description: "image id", - }, - "sort_by": { - Type: schema.TypeString, - Optional: true, - Description: "sort by one of supported fields, format +|-(field)", - }, - "page": { - Type: schema.TypeInt, - Optional: true, - Description: "page number", - }, - "size": { - Type: schema.TypeInt, - Optional: true, - Description: "page size", - }, - "name": { - Type: schema.TypeString, - Optional: true, - Description: "find by name", - }, - "status": { - Type: schema.TypeString, - Optional: true, - Description: "find by status", - }, - "type_image": { - Type: schema.TypeString, - Optional: true, - Description: "find by type", - }, - "items": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "ckey": { - Type: schema.TypeString, - Computed: true, - }, - "api_url": { - Type: schema.TypeString, - Computed: true, - }, - "api_key": { - Type: schema.TypeString, - Computed: true, - }, - "app_id": { - Type: schema.TypeString, - Computed: true, - }, - "cpu_allocation_ratio": { - Type: schema.TypeFloat, - Computed: true, - }, - "desc": { - Type: schema.TypeString, - Computed: true, - }, - "descr": { - Type: schema.TypeString, - Computed: true, - }, - "drivers": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "eco": { - Type: schema.TypeString, - Computed: true, - }, - "error": { - Type: schema.TypeInt, - Computed: true, - }, - "gid": { - Type: schema.TypeInt, - Computed: true, - }, - "guid": { - Type: schema.TypeInt, - Computed: true, - }, - "id": { - Type: schema.TypeInt, - Computed: true, - }, - "images": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeInt, - }, - }, - "login": { - Type: schema.TypeString, - Computed: true, - }, - "mem_allocation_ratio": { - Type: schema.TypeFloat, - Computed: true, - }, - "name": { - Type: schema.TypeString, - Computed: true, - }, - "packages": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "libvirt_bin": { - Type: schema.TypeList, - Computed: true, - Description: "libvirt_bin", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "libvirt_daemon": { - Type: schema.TypeList, - Computed: true, - Description: "libvirt_daemon", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "lvm2_lockd": { - Type: schema.TypeList, - Computed: true, - Description: "lvm2_lockd", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "openvswitch_common": { - Type: schema.TypeList, - Computed: true, - Description: "openvswitch_common", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "openvswitch_switch": { - Type: schema.TypeList, - Computed: true, - Description: "openvswitch_switch", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "qemu_system_x86": { - Type: schema.TypeList, - Computed: true, - Description: "qemu_system_x86", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "sanlock": { - Type: schema.TypeList, - Computed: true, - Description: "sanlock", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - }, - }, - }, - "passwd": { - Type: schema.TypeString, - Computed: true, - }, - "reference_id": { - Type: schema.TypeString, - Computed: true, - }, - "status": { - Type: schema.TypeString, - Computed: true, - }, - "type": { - Type: schema.TypeString, - Computed: true, - }, - }, - }, - Description: "items of stacks list", - }, - "entry_count": { - Type: schema.TypeInt, - Computed: true, - Description: "entry count", - }, - } -} - func dataSourceImageListSchemaMake() map[string]*schema.Schema { rets := map[string]*schema.Schema{ "sep_id": { @@ -1017,10 +732,6 @@ func resourceCDROMImageSchemaMake() map[string]*schema.Schema { Computed: true, Description: "unc path", }, - "ckey": { - Type: schema.TypeString, - Computed: true, - }, "acl": { Type: schema.TypeList, Computed: true, @@ -1531,10 +1242,6 @@ func resourceVirtualImageSchemaMake() map[string]*schema.Schema { Computed: true, Description: "unc path", }, - "ckey": { - Type: schema.TypeString, - Computed: true, - }, "acl": { Type: schema.TypeList, Computed: true, diff --git a/internal/service/cloudbroker/image/utility_image_list_stacks.go b/internal/service/cloudbroker/image/utility_image_list_stacks.go deleted file mode 100644 index a85451b2..00000000 --- a/internal/service/cloudbroker/image/utility_image_list_stacks.go +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved. -Authors: -Petr Krutov, -Stanislav Solovev, - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud -Orchestration Technology) with Terraform by Hashicorp. - -Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort - -Please see README.md to learn where to place source code so that it -builds seamlessly. - -Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki -*/ - -package image - -import ( - "context" - - log "github.com/sirupsen/logrus" - "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/image" - "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func utilityImageListStacksCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*image.ListStacks, error) { - c := m.(*controller.ControllerCfg) - req := image.ListStacksRequest{ - ImageID: uint64(d.Get("image_id").(int)), - } - - if sortBy, ok := d.GetOk("sort_by"); ok { - req.SortBy = sortBy.(string) - } - if page, ok := d.GetOk("page"); ok { - req.Page = uint64(page.(int)) - } - if size, ok := d.GetOk("size"); ok { - req.Size = uint64(size.(int)) - } - if name, ok := d.GetOk("name"); ok { - req.Name = name.(string) - } - if status, ok := d.GetOk("status"); ok { - req.Status = status.(string) - } - if typeImage, ok := d.GetOk("type_image"); ok { - req.Type = typeImage.(string) - } - - log.Debugf("utilityImageListStacksCheckPresence: load image list") - imageListStacks, err := c.CloudBroker().Image().ListStacks(ctx, req) - if err != nil { - return nil, err - } - - return imageListStacks, nil -} diff --git a/internal/service/cloudbroker/k8s/schema.go b/internal/service/cloudbroker/k8s/schema.go index ecb1242e..d6d879cb 100644 --- a/internal/service/cloudbroker/k8s/schema.go +++ b/internal/service/cloudbroker/k8s/schema.go @@ -1466,12 +1466,14 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema { Optional: true, Description: "insert ssl certificate in x509 pem format", }, - "chipset": { - Type: schema.TypeString, - Optional: true, - Description: "Type of the emulated system.", - }, - "lb_sysctl_params": { + "chipset": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false), + Default: "Q35", + Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35", + }, + "lb_sysctl_params": { Type: schema.TypeList, Optional: true, Description: "Custom sysctl values for Load Balancer instance. Applied on boot.", @@ -1808,17 +1810,19 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema { ), Description: "Node RAM in MB.", }, - "chipset": { - Type: schema.TypeString, - Optional: true, - Description: "Type of the emulated system.", - }, - "disk": { - Type: schema.TypeInt, - Optional: true, - Computed: true, - Description: "Worker node boot disk size. If unspecified or 0, size is defined by OS image size.", - }, + "chipset": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false), + Default: "Q35", + Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35", + }, + "disk": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Worker node boot disk size. If unspecified or 0, size is defined by OS image size.", + }, "labels": { Type: schema.TypeList, Computed: true, diff --git a/internal/service/cloudbroker/kvmvm/flattens.go b/internal/service/cloudbroker/kvmvm/flattens.go index 55eb827d..590ea1af 100644 --- a/internal/service/cloudbroker/kvmvm/flattens.go +++ b/internal/service/cloudbroker/kvmvm/flattens.go @@ -78,7 +78,7 @@ func flattenCompute(d *schema.ResourceData, computeRec *compute.RecordCompute, p d.Set("need_reboot", computeRec.NeedReboot) d.Set("numa_node_id", computeRec.NumaNodeId) d.Set("os_users", flattenOSUsers(computeRec.OSUsers)) - d.Set("pinned", computeRec.PinnedToStack) + d.Set("pinned", computeRec.PinnedToNode) d.Set("preferred_cpu", computeRec.PreferredCPU) d.Set("ram", computeRec.RAM) d.Set("reference_id", computeRec.ReferenceID) @@ -88,9 +88,9 @@ func flattenCompute(d *schema.ResourceData, computeRec *compute.RecordCompute, p d.Set("rg_name", computeRec.RGName) d.Set("rg_id", computeRec.RGID) d.Set("snap_sets", flattenSnapSets(computeRec.SnapSets)) - d.Set("stack_id", computeRec.StackID) - d.Set("stack_name", computeRec.StackName) d.Set("started", computeRec.TechStatus == "STARTED") + d.Set("node_id", computeRec.NodeID) + d.Set("node_name", computeRec.NodeName) d.Set("stateless_sep_id", computeRec.StatelessSEPID) d.Set("stateless_sep_type", computeRec.StatelessSEPType) d.Set("status", computeRec.Status) @@ -100,11 +100,9 @@ func flattenCompute(d *schema.ResourceData, computeRec *compute.RecordCompute, p d.Set("updated_time", computeRec.UpdatedTime) d.Set("user_data", string(userData)) d.Set("user_managed", computeRec.UserManaged) + d.Set("read_only", computeRec.ReadOnly) d.Set("vnc_password", computeRec.VNCPassword) d.Set("vgpus", flattenVGPUs(computeRec.VGPUs)) - //TODO - // d.Set("virtual_image_id", computeRec.VirtualImageID) - // d.Set("virtual_image_name", computeRec.VirtualImageName) d.Set("pci_devices", flattenPCI(*pciList)) d.Set("loader_type", computeRec.LoaderType) d.Set("boot_type", computeRec.BootType) @@ -286,6 +284,8 @@ func flattenComputeDisks(disksList compute.ListDisks, disksBlocks, extraDisks [] "delete_by": disk.DeletedBy, "delete_time": disk.DeletedTime, "update_time": disk.UpdatedTime, + "cache": disk.Cache, + "blk_discard": disk.BLKDiscard, } res = append(res, temp) indexDataDisks++ @@ -327,79 +327,78 @@ func flattenComputeList(computes *compute.ListComputes) []map[string]interface{} devices, _ := json.Marshal(computeItem.Devices) userData, _ := json.Marshal(computeItem.Userdata) temp := map[string]interface{}{ - "acl": flattenListACLInterface(computeItem.ACL), - "account_id": computeItem.AccountID, - "account_name": computeItem.AccountName, - "affinity_label": computeItem.AffinityLabel, - "affinity_rules": flattenListRules(computeItem.AffinityRules), - "affinity_weight": computeItem.AffinityWeight, - "anti_affinity_rules": flattenListRules(computeItem.AntiAffinityRules), - "arch": computeItem.Arch, - "auto_start_w_node": computeItem.AutoStart, - "chipset": computeItem.Chipset, - "cd_image_id": computeItem.CdImageId, - "boot_order": computeItem.BootOrder, - "boot_image_id": computeItem.BootImageID, - "bootdisk_size": computeItem.BootDiskSize, - "clone_reference": computeItem.CloneReference, - "clones": computeItem.Clones, - "computeci_id": computeItem.ComputeCIID, - "cpus": computeItem.CPUs, - "created_by": computeItem.CreatedBy, - "created_time": computeItem.CreatedTime, - "custom_fields": string(customFields), - "deleted_by": computeItem.DeletedBy, - "deleted_time": computeItem.DeletedTime, - "desc": computeItem.Description, - "devices": string(devices), - "disks": flattenDisks(computeItem.Disks), - "driver": computeItem.Driver, - "gid": computeItem.GID, - "guid": computeItem.GUID, - "hp_backed": computeItem.HPBacked, - "compute_id": computeItem.ID, - "cpu_pin": computeItem.CPUPin, - "interfaces": flattenInterfaces(computeItem.Interfaces), - "live_migration_job_id": computeItem.LiveMigrationJobID, - "lock_status": computeItem.LockStatus, - "manager_id": computeItem.ManagerID, - "manager_type": computeItem.ManagerType, - "migrationjob": computeItem.MigrationJob, - "milestones": computeItem.Milestones, - "nid": computeItem.NID, - "name": computeItem.Name, - "need_reboot": computeItem.NeedReboot, - "numa_affinity": computeItem.NumaAffinity, - "numa_node_id": computeItem.NumaNodeId, - "os_users": flattenOSUsers(computeItem.OSUsers), - "os_version": computeItem.OSVersion, - "pinned": computeItem.PinnedToStack, - "preferred_cpu": computeItem.PreferredCPU, - "qemu_guest": flattenQemuQuest(computeItem.QemuQuest), - "ram": computeItem.RAM, - "reference_id": computeItem.ReferenceID, - "registered": computeItem.Registered, - "res_name": computeItem.ResName, - "reserved_node_cpus": computeItem.ReservedNodeCpus, - "rg_id": computeItem.RGID, - "rg_name": computeItem.RGName, - "snap_sets": flattenSnapSets(computeItem.SnapSets), - "stack_id": computeItem.StackID, - "stack_name": computeItem.StackName, - "stateless_sep_id": computeItem.StatelessSEPID, - "stateless_sep_type": computeItem.StatelessSEPType, - "status": computeItem.Status, - "tags": flattenTags(computeItem.Tags), - "tech_status": computeItem.TechStatus, - "total_disk_size": computeItem.TotalDiskSize, - "updated_by": computeItem.UpdatedBy, - "updated_time": computeItem.UpdatedTime, - "user_data": string(userData), - "user_managed": computeItem.UserManaged, - "vgpus": computeItem.VGPUs, - "vins_connected": computeItem.VINSConnected, - //TODO - // "virtual_image_id": computeItem.VirtualImageID, + "acl": flattenListACLInterface(computeItem.ACL), + "account_id": computeItem.AccountID, + "account_name": computeItem.AccountName, + "affinity_label": computeItem.AffinityLabel, + "affinity_rules": flattenListRules(computeItem.AffinityRules), + "affinity_weight": computeItem.AffinityWeight, + "anti_affinity_rules": flattenListRules(computeItem.AntiAffinityRules), + "arch": computeItem.Arch, + "auto_start_w_node": computeItem.AutoStart, + "chipset": computeItem.Chipset, + "cd_image_id": computeItem.CdImageId, + "boot_order": computeItem.BootOrder, + "boot_image_id": computeItem.BootImageID, + "bootdisk_size": computeItem.BootDiskSize, + "clone_reference": computeItem.CloneReference, + "clones": computeItem.Clones, + "computeci_id": computeItem.ComputeCIID, + "cpus": computeItem.CPUs, + "created_by": computeItem.CreatedBy, + "created_time": computeItem.CreatedTime, + "custom_fields": string(customFields), + "deleted_by": computeItem.DeletedBy, + "deleted_time": computeItem.DeletedTime, + "desc": computeItem.Description, + "devices": string(devices), + "disks": flattenDisks(computeItem.Disks), + "driver": computeItem.Driver, + "gid": computeItem.GID, + "guid": computeItem.GUID, + "hp_backed": computeItem.HPBacked, + "compute_id": computeItem.ID, + "cpu_pin": computeItem.CPUPin, + "interfaces": flattenInterfaces(computeItem.Interfaces), + "live_migration_job_id": computeItem.LiveMigrationJobID, + "lock_status": computeItem.LockStatus, + "manager_id": computeItem.ManagerID, + "manager_type": computeItem.ManagerType, + "migrationjob": computeItem.MigrationJob, + "milestones": computeItem.Milestones, + "nid": computeItem.NID, + "name": computeItem.Name, + "need_reboot": computeItem.NeedReboot, + "numa_affinity": computeItem.NumaAffinity, + "numa_node_id": computeItem.NumaNodeId, + "os_users": flattenOSUsers(computeItem.OSUsers), + "os_version": computeItem.OSVersion, + "pinned": computeItem.PinnedToNode, + "preferred_cpu": computeItem.PreferredCPU, + "qemu_guest": flattenQemuQuest(computeItem.QemuQuest), + "ram": computeItem.RAM, + "reference_id": computeItem.ReferenceID, + "registered": computeItem.Registered, + "res_name": computeItem.ResName, + "reserved_node_cpus": computeItem.ReservedNodeCpus, + "rg_id": computeItem.RGID, + "rg_name": computeItem.RGName, + "snap_sets": flattenSnapSets(computeItem.SnapSets), + "node_id": computeItem.NodeID, + "node_name": computeItem.NodeName, + "stateless_sep_id": computeItem.StatelessSEPID, + "stateless_sep_type": computeItem.StatelessSEPType, + "status": computeItem.Status, + "tags": flattenTags(computeItem.Tags), + "tech_status": computeItem.TechStatus, + "total_disk_size": computeItem.TotalDiskSize, + "updated_by": computeItem.UpdatedBy, + "updated_time": computeItem.UpdatedTime, + "user_data": string(userData), + "user_managed": computeItem.UserManaged, + "read_only": computeItem.ReadOnly, + "vgpus": computeItem.VGPUs, + "vins_connected": computeItem.VINSConnected, "loader_type": computeItem.LoaderType, "boot_type": computeItem.BootType, "hot_resize": computeItem.HotResize, @@ -419,78 +418,74 @@ func flattenDeletedComputeList(computes *compute.ListDeletedComputes) []map[stri devices, _ := json.Marshal(computeItem.Devices) userData, _ := json.Marshal(computeItem.Userdata) temp := map[string]interface{}{ - "acl": flattenListACLInterface(computeItem.ACL), - "account_id": computeItem.AccountID, - "account_name": computeItem.AccountName, - "affinity_label": computeItem.AffinityLabel, - "affinity_rules": flattenListRules(computeItem.AffinityRules), - "affinity_weight": computeItem.AffinityWeight, - "anti_affinity_rules": flattenListRules(computeItem.AntiAffinityRules), - "arch": computeItem.Arch, - "auto_start_w_node": computeItem.AutoStart, - "chipset": computeItem.Chipset, - "cd_image_id": computeItem.CdImageId, - "boot_order": computeItem.BootOrder, - "bootdisk_size": computeItem.BootDiskSize, - "boot_image_id": computeItem.BootImageID, - "clone_reference": computeItem.CloneReference, - "clones": computeItem.Clones, - "computeci_id": computeItem.ComputeCIID, - "cpus": computeItem.CPUs, - "created_by": computeItem.CreatedBy, - "created_time": computeItem.CreatedTime, - "custom_fields": string(customFields), - "deleted_by": computeItem.DeletedBy, - "deleted_time": computeItem.DeletedTime, - "desc": computeItem.Description, - "devices": string(devices), - "disks": flattenDisks(computeItem.Disks), - "driver": computeItem.Driver, - "gid": computeItem.GID, - "guid": computeItem.GUID, - "hp_backed": computeItem.HPBacked, - "compute_id": computeItem.ID, - "cpu_pin": computeItem.CPUPin, - //TODO - // "image_id": computeItem.ImageID, - "interfaces": flattenInterfaces(computeItem.Interfaces), - "lock_status": computeItem.LockStatus, - "manager_id": computeItem.ManagerID, - "manager_type": computeItem.ManagerType, - "migrationjob": computeItem.MigrationJob, - "milestones": computeItem.Milestones, - "name": computeItem.Name, - "need_reboot": computeItem.NeedReboot, - "numa_affinity": computeItem.NumaAffinity, - "numa_node_id": computeItem.NumaNodeId, - "os_users": flattenOSUsers(computeItem.OSUsers), - "os_version": computeItem.OSVersion, - "pinned": computeItem.PinnedToStack, - "preferred_cpu": computeItem.PreferredCPU, - "ram": computeItem.RAM, - "reference_id": computeItem.ReferenceID, - "registered": computeItem.Registered, - "res_name": computeItem.ResName, - "reserved_node_cpus": computeItem.ReservedNodeCpus, - "rg_id": computeItem.RGID, - "rg_name": computeItem.RGName, - "snap_sets": flattenSnapSets(computeItem.SnapSets), - "stack_id": computeItem.StackID, - "stack_name": computeItem.StackName, - "stateless_sep_id": computeItem.StatelessSEPID, - "stateless_sep_type": computeItem.StatelessSEPType, - "status": computeItem.Status, - "tags": flattenTags(computeItem.Tags), - "tech_status": computeItem.TechStatus, - "total_disk_size": computeItem.TotalDiskSize, - "updated_by": computeItem.UpdatedBy, - "updated_time": computeItem.UpdatedTime, - "user_data": string(userData), - "user_managed": computeItem.UserManaged, - "vgpus": computeItem.VGPUs, - "vins_connected": computeItem.VINSConnected, - //TODO - // "virtual_image_id": computeItem.VirtualImageID, + "acl": flattenListACLInterface(computeItem.ACL), + "account_id": computeItem.AccountID, + "account_name": computeItem.AccountName, + "affinity_label": computeItem.AffinityLabel, + "affinity_rules": flattenListRules(computeItem.AffinityRules), + "affinity_weight": computeItem.AffinityWeight, + "anti_affinity_rules": flattenListRules(computeItem.AntiAffinityRules), + "arch": computeItem.Arch, + "auto_start_w_node": computeItem.AutoStart, + "chipset": computeItem.Chipset, + "cd_image_id": computeItem.CdImageId, + "boot_order": computeItem.BootOrder, + "bootdisk_size": computeItem.BootDiskSize, + "boot_image_id": computeItem.BootImageID, + "clone_reference": computeItem.CloneReference, + "clones": computeItem.Clones, + "computeci_id": computeItem.ComputeCIID, + "cpus": computeItem.CPUs, + "created_by": computeItem.CreatedBy, + "created_time": computeItem.CreatedTime, + "custom_fields": string(customFields), + "deleted_by": computeItem.DeletedBy, + "deleted_time": computeItem.DeletedTime, + "desc": computeItem.Description, + "devices": string(devices), + "disks": flattenDisks(computeItem.Disks), + "driver": computeItem.Driver, + "gid": computeItem.GID, + "guid": computeItem.GUID, + "hp_backed": computeItem.HPBacked, + "compute_id": computeItem.ID, + "cpu_pin": computeItem.CPUPin, + "interfaces": flattenInterfaces(computeItem.Interfaces), + "lock_status": computeItem.LockStatus, + "manager_id": computeItem.ManagerID, + "manager_type": computeItem.ManagerType, + "migrationjob": computeItem.MigrationJob, + "milestones": computeItem.Milestones, + "name": computeItem.Name, + "need_reboot": computeItem.NeedReboot, + "numa_affinity": computeItem.NumaAffinity, + "numa_node_id": computeItem.NumaNodeId, + "os_users": flattenOSUsers(computeItem.OSUsers), + "os_version": computeItem.OSVersion, + "pinned": computeItem.PinnedToNode, + "preferred_cpu": computeItem.PreferredCPU, + "ram": computeItem.RAM, + "reference_id": computeItem.ReferenceID, + "registered": computeItem.Registered, + "res_name": computeItem.ResName, + "reserved_node_cpus": computeItem.ReservedNodeCpus, + "rg_id": computeItem.RGID, + "rg_name": computeItem.RGName, + "snap_sets": flattenSnapSets(computeItem.SnapSets), + "node_id": computeItem.NodeID, + "node_name": computeItem.NodeName, + "stateless_sep_id": computeItem.StatelessSEPID, + "stateless_sep_type": computeItem.StatelessSEPType, + "status": computeItem.Status, + "tags": flattenTags(computeItem.Tags), + "tech_status": computeItem.TechStatus, + "total_disk_size": computeItem.TotalDiskSize, + "updated_by": computeItem.UpdatedBy, + "updated_time": computeItem.UpdatedTime, + "user_data": string(userData), + "user_managed": computeItem.UserManaged, + "vgpus": computeItem.VGPUs, + "vins_connected": computeItem.VINSConnected, "loader_type": computeItem.LoaderType, "boot_type": computeItem.BootType, "hot_resize": computeItem.HotResize, @@ -574,6 +569,7 @@ func flattenDisks(disks []compute.InfoDisk) []map[string]interface{} { // "bus_number": disk.BusNumber, "disk_id": disk.ID, // "pci_slot": disk.PCISlot, + "sep_id": disk.SepID, } res = append(res, temp) } @@ -690,7 +686,7 @@ func flattenPCIDevice(deviceList []compute.ItemPCIDevice) []map[string]interface "device_id": dev.ID, "name": dev.Name, "rg_id": dev.RGID, - "stack_id": dev.StackID, + "node_id": dev.NodeID, "status": dev.Status, "system_name": dev.SystemName, } @@ -809,7 +805,7 @@ func flattenDataCompute(d *schema.ResourceData, compFacts *compute.RecordCompute d.Set("numa_affinity", compFacts.NumaAffinity) d.Set("numa_node_id", compFacts.NumaNodeId) d.Set("os_users", flattenOSUsers(compFacts.OSUsers)) - d.Set("pinned", compFacts.PinnedToStack) + d.Set("pinned", compFacts.PinnedToNode) d.Set("preferred_cpu", compFacts.PreferredCPU) d.Set("qemu_guest", flattenQemuQuest(compFacts.QemuQuest)) d.Set("ram", compFacts.RAM) @@ -820,8 +816,8 @@ func flattenDataCompute(d *schema.ResourceData, compFacts *compute.RecordCompute d.Set("rg_id", compFacts.RGID) d.Set("rg_name", compFacts.RGName) d.Set("snap_sets", flattenSnapSets(compFacts.SnapSets)) - d.Set("stack_id", compFacts.StackID) - d.Set("stack_name", compFacts.StackName) + d.Set("node_id", compFacts.NodeID) + d.Set("node_name", compFacts.NodeName) d.Set("stateless_sep_id", compFacts.StatelessSEPID) d.Set("stateless_sep_type", compFacts.StatelessSEPType) d.Set("status", compFacts.Status) @@ -831,11 +827,9 @@ func flattenDataCompute(d *schema.ResourceData, compFacts *compute.RecordCompute d.Set("updated_time", compFacts.UpdatedTime) d.Set("user_data", string(userData)) d.Set("user_managed", compFacts.UserManaged) + d.Set("read_only", compFacts.ReadOnly) d.Set("vnc_password", compFacts.VNCPassword) d.Set("vgpus", flattenVGPUs(compFacts.VGPUs)) - //TODO - // d.Set("virtual_image_id", compFacts.VirtualImageID) - // d.Set("virtual_image_name", compFacts.VirtualImageName) d.Set("pci_devices", flattenPCI(*pciList)) d.Set("loader_type", compFacts.LoaderType) d.Set("boot_type", compFacts.BootType) @@ -872,6 +866,7 @@ func parseComputeInterfacesToNetworks(networks []interface{}, ifaces compute.Lis elem["ip_address"] = value.IPAddress elem["mac"] = value.MAC elem["mtu"] = value.MTU + elem["net_mask"] = value.NetMask elem["sdn_interface_id"] = value.SDNInterfaceID elem["weight"] = flattenNetworkWeight(networks, value.NetID, value.NetType) elem["enabled"] = value.Enabled @@ -900,6 +895,7 @@ func flattenDisk(diskList compute.ListDisks) []map[string]interface{} { "ckey": disk.CKey, "meta": flattens.FlattenMeta(disk.Meta), "account_id": disk.AccountID, + "blk_discard": disk.BLKDiscard, "boot_partition": disk.BootPartition, "bus_number": disk.BusNumber, "created_time": disk.CreatedTime, diff --git a/internal/service/cloudbroker/kvmvm/resource_compute.go b/internal/service/cloudbroker/kvmvm/resource_compute.go index 80f5c14a..a3bc60b7 100644 --- a/internal/service/cloudbroker/kvmvm/resource_compute.go +++ b/internal/service/cloudbroker/kvmvm/resource_compute.go @@ -73,8 +73,8 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf createReqX86.Pool = pool.(string) } - if stackID, ok := d.GetOk("stack_id"); ok { - createReqX86.StackID = uint64(stackID.(int)) + if nodeID, ok := d.GetOk("node_id"); ok { + createReqX86.NodeID = uint64(nodeID.(int)) } if ipaType, ok := d.GetOk("ipa_type"); ok { @@ -85,6 +85,10 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf createReqX86.BootDisk = uint64(bootSize.(int)) } + if bootDiskCache, ok := d.GetOk("boot_disk_cache"); ok { + createReqX86.BootDiskCache = bootDiskCache.(string) + } + if IS, ok := d.GetOk("is"); ok { createReqX86.IS = IS.(string) } @@ -93,6 +97,10 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf createReqX86.ZoneID = uint64(zoneID.(int)) } + if bootDiskBLKDiscard, ok := d.GetOk("boot_disk_blk_discard"); ok { + createReqX86.BootDiskBLKDiscard = bootDiskBLKDiscard.(bool) + } + createReqX86.Interfaces = make([]kvmx86.Interface, 0) if networks, ok := d.GetOk("network"); ok { @@ -126,6 +134,12 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf reqInterface.MTU = uint64(netInterfaceVal["mtu"].(int)) } + if reqInterface.NetType == "DPDK" || reqInterface.NetType == "VFNIC" { + if netMask, netMaskSet := netInterfaceVal["net_mask"]; netMaskSet { + reqInterface.NetMask = uint64(netMask.(int)) + } + } + ipaddr, ipSet := netInterfaceVal["ip_address"] if ipSet { reqInterface.IPAddr = ipaddr.(string) @@ -170,6 +184,12 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf if imageID, ok := diskVal["image_id"]; ok { reqDataDisk.ImageID = uint64(imageID.(int)) } + if cache, ok := diskVal["cache"]; ok { + reqDataDisk.Cache = cache.(string) + } + if blkDiscard, ok := diskVal["blk_discard"]; ok { + reqDataDisk.BLKDiscard = blkDiscard.(bool) + } disksX86 = append(disksX86, reqDataDisk) } @@ -328,6 +348,7 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf } if !cleanup { + if enabled, ok := d.GetOk("enabled"); ok { if enabled.(bool) { req := compute.EnableRequest{ComputeID: computeId} @@ -424,6 +445,9 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf if start, ok := d.GetOk("started"); ok && start.(bool) { req := compute.StartRequest{ComputeID: computeId} + if nodeID, ok := d.GetOk("node_id"); ok { + req.NodeID = uint64(nodeID.(int)) + } log.Debugf("resourceComputeCreate: starting Compute ID %d after completing its resource configuration", computeId) if _, err := c.CloudBroker().Compute().Start(ctx, req); err != nil { warnings.Add(err) @@ -436,19 +460,16 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf } } - if pin, ok := d.GetOk("pin_to_stack"); ok && pin.(bool) { + if pin, ok := d.GetOk("pin_to_node"); ok && pin.(bool) { start, _ := d.GetOk("started") - _, stackOk := d.GetOk("stack_id") + _, nodeOk := d.GetOk("node_id") - if !start.(bool) && !stackOk { - warnings.Add(errors.New("cannot pin to stack a VM, that is not started and stack_id is not set")) + if !start.(bool) && !nodeOk { + warnings.Add(errors.New("cannot pin to node a VM, that is not started and node_id is not set")) } else { - req := compute.PinToStackRequest{ - ComputeID: computeId, - } - - if stackID, ok := d.Get("stack_id").(int); ok { - req.TargetStackID = uint64(stackID) + req := compute.PinToNodeRequest{ + ComputeID: computeId, + TargetNodeID: uint64(d.Get("node_id").(int)), } if force, ok := d.Get("force_pin").(bool); ok { @@ -459,7 +480,7 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf req.AutoStart = autoStart } - _, err := c.CloudBroker().Compute().PinToStack(ctx, req) + _, err := c.CloudBroker().Compute().PinToNode(ctx, req) if err != nil { warnings.Add(err) } @@ -628,7 +649,7 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf } } - if !d.Get("pin_to_stack").(bool) && d.Get("auto_start_w_node").(bool) { + if !d.Get("pin_to_node").(bool) && d.Get("auto_start_w_node").(bool) { req := compute.UpdateRequest{ ComputeID: computeId, AutoStart: d.Get("auto_start_w_node").(bool), @@ -658,6 +679,14 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf } } + if readOnly, ok := d.GetOk("read_only"); ok { + if readOnly.(bool) { + if err := utilityComputeUpdateReadOnly(ctx, d, m); err != nil { + warnings.Add(err) + } + } + } + } log.Debugf("resourceComputeCreate: new Compute ID %d, name %s creation sequence complete", computeId, d.Get("name").(string)) @@ -805,6 +834,18 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf } } + if d.HasChange("boot_disk_cache") { + if err := utilityComputeUpdateBootDiskCache(ctx, d, m); err != nil { + return diag.FromErr(err) + } + } + + if d.HasChange("boot_disk_blk_discard") { + if err := utilityComputeUpdateBootDiskBLKDiscard(ctx, d, m); err != nil { + return diag.FromErr(err) + } + } + if d.HasChange("extra_disks") { err := utilityComputeExtraDisksConfigure(ctx, d, m, true) // pass do_delta = true to apply changes, if any if err != nil { @@ -812,8 +853,8 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf } } - if d.HasChange("pin_to_stack") { - if err := utilityComputePinToStack(ctx, d, m); err != nil { + if d.HasChange("pin_to_node") { + if err := utilityComputePinToNode(ctx, d, m); err != nil { return diag.FromErr(err) } } @@ -946,6 +987,12 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf } } + if d.HasChange("read_only") { + if err := utilityComputeUpdateReadOnly(ctx, d, m); err != nil { + return diag.FromErr(err) + } + } + return append(resourceComputeRead(ctx, d, m), warnings.Get()...) } @@ -980,12 +1027,12 @@ func ResourceCompute() *schema.Resource { SchemaVersion: 2, CustomizeDiff: func(ctx context.Context, diff *schema.ResourceDiff, i interface{}) error { - if diff.HasChanges() || diff.HasChanges("chipset", "pin_to_stack", "auto_start_w_node", "libvirt_settings", "network", "affinity_rules", "anti_affinity_rules", + if diff.HasChanges() || diff.HasChanges("chipset", "pin_to_node", "auto_start_w_node", "libvirt_settings", "network", "affinity_rules", "anti_affinity_rules", "extra_disks", "tags", "port_forwarding", "user_access", "snapshot", "pci_devices", "preferred_cpu", "security_groups") { diff.SetNewComputed("updated_time") diff.SetNewComputed("updated_by") } - if diff.HasChanges("pin_to_stack") { + if diff.HasChanges("pin_to_node") { diff.SetNewComputed("pinned") } if diff.HasChanges("started") { diff --git a/internal/service/cloudbroker/kvmvm/schema.go b/internal/service/cloudbroker/kvmvm/schema.go index 487846cb..69eb0152 100644 --- a/internal/service/cloudbroker/kvmvm/schema.go +++ b/internal/service/cloudbroker/kvmvm/schema.go @@ -228,6 +228,10 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, + "blk_discard": { + Type: schema.TypeBool, + Computed: true, + }, "boot_partition": { Type: schema.TypeInt, Computed: true, @@ -236,6 +240,10 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, + "cache": { + Type: schema.TypeString, + Computed: true, + }, "created_time": { Type: schema.TypeInt, Computed: true, @@ -939,11 +947,11 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema { }, }, }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Computed: true, }, - "stack_name": { + "node_name": { Type: schema.TypeString, Computed: true, }, @@ -1011,6 +1019,11 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "read_only": { + Type: schema.TypeBool, + Computed: true, + Description: "Shows if compute is locked to read-only operations.", + }, "vnc_password": { Type: schema.TypeString, Computed: true, @@ -1100,14 +1113,6 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema { }, }, }, - "virtual_image_id": { - Type: schema.TypeInt, - Computed: true, - }, - "virtual_image_name": { - Type: schema.TypeString, - Computed: true, - }, //extra parameters "boot_disk_size": { Type: schema.TypeInt, @@ -1181,7 +1186,7 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema { Optional: true, Description: "Find by tech status", }, - "stack_name": { + "node_name": { Type: schema.TypeString, Optional: true, Description: "Find by node name.", @@ -1196,10 +1201,10 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema { Optional: true, Description: "Find by IP address", }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Optional: true, - Description: "Find by stack ID", + Description: "Find by node ID", }, "cd_image_id": { Type: schema.TypeInt, @@ -1460,6 +1465,10 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, + "sep_id": { + Type: schema.TypeInt, + Computed: true, + }, }, }, }, @@ -1483,10 +1492,6 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "image_id": { - Type: schema.TypeInt, - Computed: true, - }, "interfaces": { Type: schema.TypeList, Computed: true, @@ -1829,11 +1834,11 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema { }, }, }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Computed: true, }, - "stack_name": { + "node_name": { Type: schema.TypeString, Computed: true, Description: "Find by node name.", @@ -1890,6 +1895,11 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "read_only": { + Type: schema.TypeBool, + Computed: true, + Description: "Shows if compute is in read-only mode.", + }, "vgpus": { Type: schema.TypeList, Computed: true, @@ -1901,10 +1911,6 @@ func dataSourceComputeListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "virtual_image_id": { - Type: schema.TypeInt, - Computed: true, - }, "loader_type": { Type: schema.TypeString, Computed: true, @@ -2238,10 +2244,6 @@ func dataSourceComputeListDeletedSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "image_id": { - Type: schema.TypeInt, - Computed: true, - }, "interfaces": { Type: schema.TypeList, Computed: true, @@ -2545,11 +2547,11 @@ func dataSourceComputeListDeletedSchemaMake() map[string]*schema.Schema { }, }, }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Computed: true, }, - "stack_name": { + "node_name": { Type: schema.TypeString, Computed: true, Description: "Find by node name.", @@ -2617,10 +2619,6 @@ func dataSourceComputeListDeletedSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "virtual_image_id": { - Type: schema.TypeInt, - Computed: true, - }, "loader_type": { Type: schema.TypeString, Computed: true, @@ -3180,7 +3178,7 @@ func dataSourceComputePCIDeviceListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Computed: true, }, @@ -3406,12 +3404,24 @@ func resourceComputeSchemaMake() map[string]*schema.Schema { Default: false, Description: "If True, the imageId, bootDisk, sepId, pool parameters are ignored and the compute is created without a boot disk in the stopped state.", }, + "boot_disk_blk_discard": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, "boot_disk_size": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "This compute instance boot disk size in GB. Make sure it is large enough to accomodate selected OS image.", }, + "boot_disk_cache": { + Type: schema.TypeString, + Optional: true, + Default: "none", + ValidateFunc: validation.StringInSlice([]string{"none", "writethrough"}, false), + Description: "Setting the boot disk caching mode", + }, "sep_id": { Type: schema.TypeInt, Optional: true, @@ -3447,11 +3457,11 @@ func resourceComputeSchemaMake() map[string]*schema.Schema { Default: 0, Description: "ID of CD-ROM live image to boot", }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Optional: true, Computed: true, - Description: "ID of stack to start compute", + Description: "ID of node to start compute", }, "is": { Type: schema.TypeString, @@ -3521,16 +3531,22 @@ func resourceComputeSchemaMake() map[string]*schema.Schema { DiffSuppressFunc: networkSubresIPAddreDiffSupperss, Description: "unique_identifier of LogicalPort on SDN side", }, - "enabled": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - Description: "network enable flag", - }, + "enabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "network enable flag", + }, + "net_mask": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Subnet mask, used only for DPDK and VFNIC network types", }, }, - Description: "Optional network connection(s) for this compute. You may specify several network blocks, one for each connection.", }, + Description: "Optional network connection(s) for this compute. You may specify several network blocks, one for each connection.", + }, "libvirt_settings": { Type: schema.TypeSet, @@ -3654,7 +3670,7 @@ func resourceComputeSchemaMake() map[string]*schema.Schema { }, "value": { Type: schema.TypeString, - Optional: true, + Required: true, Description: "value that must match the key to be taken into account when analyzing this rule", }, }, @@ -3695,7 +3711,7 @@ func resourceComputeSchemaMake() map[string]*schema.Schema { }, "value": { Type: schema.TypeString, - Optional: true, + Required: true, Description: "value that must match the key to be taken into account when analyzing this rule", }, }, @@ -3704,8 +3720,16 @@ func resourceComputeSchemaMake() map[string]*schema.Schema { "disks": { Type: schema.TypeList, Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "cache": { + Type: schema.TypeString, + Optional: true, + Default: "none", + ValidateFunc: validation.StringInSlice([]string{"none", "writethrough"}, false), + Description: "Setting the disk caching mode", + }, "disk_name": { Type: schema.TypeString, Required: true, @@ -3721,6 +3745,11 @@ func resourceComputeSchemaMake() map[string]*schema.Schema { Required: true, Description: "Storage policy id of disk. The rules of the specified storage policy will be used.", }, + "blk_discard": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, "sep_id": { Type: schema.TypeInt, Computed: true, @@ -3927,7 +3956,7 @@ func resourceComputeSchemaMake() map[string]*schema.Schema { }, }, }, - "pin_to_stack": { + "pin_to_node": { Type: schema.TypeBool, Optional: true, Default: false, @@ -4487,10 +4516,10 @@ func resourceComputeSchemaMake() map[string]*schema.Schema { }, }, }, - "stack_name": { + "node_name": { Type: schema.TypeString, Computed: true, - Description: "Name of the stack, on which VM started", + Description: "Name of the node, on which VM started", }, "stateless_sep_id": { Type: schema.TypeInt, @@ -4520,6 +4549,12 @@ func resourceComputeSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, + "read_only": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Sets read-only mode for this compute. Only data operations allowed when enabled.", + }, "vnc_password": { Type: schema.TypeString, Computed: true, @@ -4609,10 +4644,6 @@ func resourceComputeSchemaMake() map[string]*schema.Schema { }, }, }, - "virtual_image_id": { - Type: schema.TypeInt, - Computed: true, - }, "virtual_image_name": { Type: schema.TypeString, Computed: true, diff --git a/internal/service/cloudbroker/kvmvm/utility_compute.go b/internal/service/cloudbroker/kvmvm/utility_compute.go index d4c99998..c6343689 100644 --- a/internal/service/cloudbroker/kvmvm/utility_compute.go +++ b/internal/service/cloudbroker/kvmvm/utility_compute.go @@ -35,14 +35,17 @@ import ( "context" "errors" "fmt" + "regexp" "sort" "strconv" "strings" + "time" "github.com/hashicorp/go-cty/cty" log "github.com/sirupsen/logrus" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/compute" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/disks" + "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/tasks" "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -88,8 +91,8 @@ func utilityComputeStarted(ctx context.Context, d *schema.ResourceData, m interf if altBootId, ok := d.Get("alt_boot_id").(int); ok { req.AltBootID = uint64(altBootId) } - if stackId, ok := d.Get("stack_id").(int); ok { - req.StackID = uint64(stackId) + if nodeId, ok := d.Get("node_id").(int); ok { + req.NodeID = uint64(nodeId) } if _, err := c.CloudBroker().Compute().Start(ctx, req); err != nil { return err @@ -108,6 +111,28 @@ func utilityComputeStarted(ctx context.Context, d *schema.ResourceData, m interf return nil } +func utilityComputeUpdateReadOnly(ctx context.Context, d *schema.ResourceData, m interface{}) error { + c := m.(*controller.ControllerCfg) + + computeId, err := strconv.ParseUint(d.Id(), 10, 64) + if err != nil { + return err + } + + req := compute.ChangeReadOnlyRequest{ + ComputeID: computeId, + ReadOnly: d.Get("read_only").(bool), + } + + if _, err := c.CloudBroker().Compute().ChangeReadOnly(ctx, req); err != nil { + return err + } + + log.Debugf("resourceCompute: read_only=%t for Compute ID %d", req.ReadOnly, computeId) + + return nil +} + func utilityComputeResize(ctx context.Context, d *schema.ResourceData, m interface{}) error { c := m.(*controller.ControllerCfg) computeId, _ := strconv.ParseUint(d.Id(), 10, 64) @@ -235,6 +260,9 @@ func utilityComputeUpdateDisks(ctx context.Context, d *schema.ResourceData, m in resizedDisks := make([]interface{}, 0) renamedDisks := make([]interface{}, 0) changeStoragePolicyDisks := make([]interface{}, 0) + cacheUpdatedDisks := make([]interface{}, 0) + blkDiscardUpdatedDisks := make([]interface{}, 0) + migratedDisks := make([]interface{}, 0) presentNewDisks := make([]interface{}, 0) presentOldDisks := make([]interface{}, 0) @@ -280,9 +308,18 @@ func utilityComputeUpdateDisks(ctx context.Context, d *schema.ResourceData, m in if isRenameDisk(oldConv, el) { renamedDisks = append(renamedDisks, el) } - if isChangeStoragePolicy(oldConv, el) { + if isMigrateDisk(oldConv, el) { + migratedDisks = append(migratedDisks, el) + } else if isChangeStoragePolicy(oldConv, el) { changeStoragePolicyDisks = append(changeStoragePolicyDisks, el) } + if isChangeCacheDisk(oldConv, el) { + cacheUpdatedDisks = append(cacheUpdatedDisks, el) + } + + if isChangeBLKDiscardDisk(oldConv, el) { + blkDiscardUpdatedDisks = append(blkDiscardUpdatedDisks, el) + } } if len(deletedDisks) > 0 { @@ -332,6 +369,9 @@ func utilityComputeUpdateDisks(ctx context.Context, d *schema.ResourceData, m in if diskConv["image_id"].(int) != 0 { req.ImageID = uint64(diskConv["image_id"].(int)) } + if cacheVal, ok := diskConv["cache"].(string); ok { + req.Cache = cacheVal + } diskID, err := c.CloudBroker().Compute().DiskAdd(ctx, req) if err != nil { return err @@ -409,6 +449,58 @@ func utilityComputeUpdateDisks(ctx context.Context, d *schema.ResourceData, m in } } + if len(cacheUpdatedDisks) > 0 { + for _, disk := range cacheUpdatedDisks { + diskConv := disk.(map[string]interface{}) + if diskConv["disk_type"].(string) == "B" { + continue + } + + diskID := uint64(diskConv["disk_id"].(int)) + if diskID == 0 { + continue + } + + req := disks.UpdateRequest{ + DiskID: diskID, + Cache: diskConv["cache"].(string), + } + _, err := c.CloudBroker().Disks().Update(ctx, req) + if err != nil { + return err + } + } + } + + if len(blkDiscardUpdatedDisks) > 0 { + for _, disk := range blkDiscardUpdatedDisks { + diskConv := disk.(map[string]interface{}) + if diskConv["disk_type"].(string) == "B" { + continue + } + + diskID := uint64(diskConv["disk_id"].(int)) + if diskID == 0 { + continue + } + + req := disks.UpdateRequest{ + DiskID: diskID, + BLKDiscard: diskConv["blk_discard"].(bool), + } + _, err := c.CloudBroker().Disks().Update(ctx, req) + if err != nil { + return err + } + } + } + + if len(migratedDisks) > 0 { + if err := utilityComputeMigrateDisks(ctx, d, m, migratedDisks, oldConv); err != nil { + return err + } + } + for i := range presentNewDisks { newDisk := presentNewDisks[i].(map[string]interface{}) oldDisk := presentOldDisks[i].(map[string]interface{}) @@ -449,6 +541,56 @@ func utilityComputeUpdateDisks(ctx context.Context, d *schema.ResourceData, m in return nil } +func utilityComputeUpdateBootDiskCache(ctx context.Context, d *schema.ResourceData, m interface{}) error { + c := m.(*controller.ControllerCfg) + + newCache := d.Get("boot_disk_cache").(string) + + var bootDiskID uint64 + if v, ok := d.GetOk("boot_disk_id"); ok { + if id, ok := v.(int); ok { + bootDiskID = uint64(id) + } + } + + if bootDiskID == 0 { + return fmt.Errorf("cannot update boot_disk_cache: boot disk ID is unknown for compute %s", d.Id()) + } + + req := disks.UpdateRequest{ + DiskID: bootDiskID, + Cache: newCache, + } + + _, err := c.CloudBroker().Disks().Update(ctx, req) + return err +} + +func utilityComputeUpdateBootDiskBLKDiscard(ctx context.Context, d *schema.ResourceData, m interface{}) error { + c := m.(*controller.ControllerCfg) + + newBLKDiscard := d.Get("boot_disk_blk_discard").(bool) + + var bootDiskID uint64 + if v, ok := d.GetOk("boot_disk_id"); ok { + if id, ok := v.(int); ok { + bootDiskID = uint64(id) + } + } + + if bootDiskID == 0 { + return fmt.Errorf("cannot update boot_disk_cache: boot disk ID is unknown for compute %s", d.Id()) + } + + req := disks.UpdateRequest{ + DiskID: bootDiskID, + BLKDiscard: newBLKDiscard, + } + + _, err := c.CloudBroker().Disks().Update(ctx, req) + return err +} + func utilityComputeExtraDisksConfigure(ctx context.Context, d *schema.ResourceData, m interface{}, do_delta bool) error { c := m.(*controller.ControllerCfg) @@ -709,6 +851,12 @@ func utilityComputeNetworksConfigure(ctx context.Context, d *schema.ResourceData req.MTU = uint64(netData["mtu"].(int)) } + if req.NetType == "DPDK" || req.NetType == "VFNIC" { + if netMask, ok := netData["net_mask"].(int); ok && netMask > 0 { + req.NetMask = uint64(netMask) + } + } + if netData["sdn_interface_id"].(string) != "" { req.SDNInterfaceID = netData["sdn_interface_id"].(string) } @@ -1613,33 +1761,33 @@ func utilityComputeUpdateCD(ctx context.Context, d *schema.ResourceData, m inter return nil } -func utilityComputePinToStack(ctx context.Context, d *schema.ResourceData, m interface{}) error { +func utilityComputePinToNode(ctx context.Context, d *schema.ResourceData, m interface{}) error { c := m.(*controller.ControllerCfg) computeId, _ := strconv.ParseUint(d.Id(), 10, 64) - start, _ := d.GetOk("started") - _, stackOk := d.GetOk("stack_id") - - if !start.(bool) && !stackOk { - errors.New("cannot pin to stack a VM, that is not started and stack_id is not set") - } - - oldPin, newPin := d.GetChange("pin_to_stack") + oldPin, newPin := d.GetChange("pin_to_node") if oldPin.(bool) && !newPin.(bool) { - req := compute.UnpinFromStackRequest{ + req := compute.UnpinFromNodeRequest{ ComputeID: computeId, } - _, err := c.CloudBroker().Compute().UnpinFromStack(ctx, req) + _, err := c.CloudBroker().Compute().UnpinFromNode(ctx, req) if err != nil { return err } } if !oldPin.(bool) && newPin.(bool) { - req := compute.PinToStackRequest{ - ComputeID: computeId, - TargetStackID: uint64(d.Get("stack_id").(int)), + start, _ := d.GetOk("started") + _, nodeOk := d.GetOk("node_id") + + if !start.(bool) && !nodeOk { + return errors.New("cannot pin to node a VM, that is not started and node_id is not set") + } + + req := compute.PinToNodeRequest{ + ComputeID: computeId, + TargetNodeID: uint64(d.Get("node_id").(int)), } if force, ok := d.Get("force_pin").(bool); ok { @@ -1650,7 +1798,7 @@ func utilityComputePinToStack(ctx context.Context, d *schema.ResourceData, m int req.AutoStart = autoStart } - _, err := c.CloudBroker().Compute().PinToStack(ctx, req) + _, err := c.CloudBroker().Compute().PinToNode(ctx, req) if err != nil { return err } @@ -1905,6 +2053,30 @@ func isRenameDisk(els []interface{}, el interface{}) bool { return false } +func isChangeCacheDisk(els []interface{}, el interface{}) bool { + for _, elOld := range els { + elOldConv := elOld.(map[string]interface{}) + elConv := el.(map[string]interface{}) + if elOldConv["disk_id"].(int) == elConv["disk_id"].(int) && + elOldConv["cache"].(string) != elConv["cache"].(string) { + return true + } + } + return false +} + +func isChangeBLKDiscardDisk(els []interface{}, el interface{}) bool { + for _, elOld := range els { + elOldConv := elOld.(map[string]interface{}) + elConv := el.(map[string]interface{}) + if elOldConv["disk_id"].(int) == elConv["disk_id"].(int) && + elOldConv["blk_discard"].(bool) != elConv["blk_discard"].(bool) { + return true + } + } + return false +} + func isChangeStoragePolicy(els []interface{}, el interface{}) bool { for _, elOld := range els { elOldConv := elOld.(map[string]interface{}) @@ -1917,6 +2089,22 @@ func isChangeStoragePolicy(els []interface{}, el interface{}) bool { return false } +func isMigrateDisk(els []interface{}, el interface{}) bool { + for _, elOld := range els { + elOldConv := elOld.(map[string]interface{}) + elConv := el.(map[string]interface{}) + if elOldConv["disk_id"].(int) == elConv["disk_id"].(int) && + elOldConv["disk_id"].(int) != 0 { + sepIDChanged := elOldConv["sep_id"].(int) != elConv["sep_id"].(int) + poolChanged := elOldConv["pool"].(string) != elConv["pool"].(string) + if sepIDChanged || poolChanged { + return true + } + } + } + return false +} + func isContainsDisk(els []interface{}, el interface{}) bool { for _, elOld := range els { elOldConv := elOld.(map[string]interface{}) @@ -1948,6 +2136,105 @@ func isChangeNodesDisk(els []interface{}, elOld interface{}) (bool, interface{}) return false, nil } +func utilityComputeMigrateDisks(ctx context.Context, d *schema.ResourceData, m interface{}, migratedDisks, oldDisks []interface{}) error { + c := m.(*controller.ControllerCfg) + + for _, disk := range migratedDisks { + diskConv := disk.(map[string]interface{}) + + oldDiskID := uint64(diskConv["disk_id"].(int)) + if oldDiskID == 0 { + log.Debugf("utilityComputeMigrateDisks: skipping disk with id=0") + continue + } + + newSepID := uint64(diskConv["sep_id"].(int)) + newPool := diskConv["pool"].(string) + storagePolicyID := uint64(diskConv["storage_policy_id"].(int)) + + log.Debugf("utilityComputeMigrateDisks: migrating disk_id=%d to sep_id=%d, pool=%s", oldDiskID, newSepID, newPool) + + migrateReq := disks.MigrateRequest{ + DiskID: oldDiskID, + SEPID: newSepID, + PoolName: newPool, + StoragePolicyID: storagePolicyID, + } + + taskID, err := c.CloudBroker().Disks().Migrate(ctx, migrateReq) + if err != nil { + return fmt.Errorf("failed to start disk migration for disk_id=%d: %w", oldDiskID, err) + } + + log.Debugf("utilityComputeMigrateDisks: disk migration started, taskID=%s", taskID) + + newDiskID, err := utilityComputeWaitForMigrationTask(ctx, c, taskID, oldDiskID) + if err != nil { + return fmt.Errorf("disk migration task failed for disk_id=%d: %w", oldDiskID, err) + } + + log.Debugf("utilityComputeMigrateDisks: disk migration completed, old_disk_id=%d, new_disk_id=%d", oldDiskID, newDiskID) + + } + + return nil +} + +func utilityComputeWaitForMigrationTask(ctx context.Context, c *controller.ControllerCfg, taskID string, oldDiskID uint64) (uint64, error) { + + for { + + time.Sleep(15 * time.Second) + taskReq := tasks.GetRequest{ + AuditID: strings.Trim(taskID, `"`), + } + + taskInfo, err := c.CloudBroker().Tasks().Get(ctx, taskReq) + if err != nil { + return 0, fmt.Errorf("failed to get task status: %w", err) + } + + log.Debugf("utilityComputeWaitForMigrationTask: taskID=%s, completed=%t, status=%s", taskID, taskInfo.Completed, taskInfo.Status) + + if taskInfo.Completed { + if taskInfo.Error != "" { + return 0, fmt.Errorf("migration task failed with error: %s", taskInfo.Error) + } + + resultStr, err := taskInfo.Result.ToString() + if err != nil { + return 0, fmt.Errorf("failed to get task result: %w", err) + } + + log.Debugf("utilityComputeWaitForMigrationTask: migration result: %s", resultStr) + + newDiskID, err := extractNewDiskIDFromResult(resultStr) + if err != nil { + return 0, fmt.Errorf("failed to parse migration result: %w", err) + } + + return newDiskID, nil + } + } + +} + +func extractNewDiskIDFromResult(result string) (uint64, error) { + re := regexp.MustCompile(`Disk ID \d+ successfully migrated to Disk ID (\d+)`) + matches := re.FindStringSubmatch(result) + + if len(matches) < 2 { + return 0, fmt.Errorf("could not extract new disk ID from result: %s", result) + } + + newDiskID, err := strconv.ParseUint(matches[1], 10, 64) + if err != nil { + return 0, fmt.Errorf("failed to parse new disk ID: %w", err) + } + + return newDiskID, nil +} + func isContainsAR(els []interface{}, el interface{}) bool { for _, elOld := range els { elOldConv := elOld.(map[string]interface{}) diff --git a/internal/service/cloudbroker/kvmvm/utility_compute_list.go b/internal/service/cloudbroker/kvmvm/utility_compute_list.go index 53dd6fc8..26ca50ea 100644 --- a/internal/service/cloudbroker/kvmvm/utility_compute_list.go +++ b/internal/service/cloudbroker/kvmvm/utility_compute_list.go @@ -69,11 +69,11 @@ func utilityDataComputeListCheckPresence(ctx context.Context, d *schema.Resource if ipAddress, ok := d.GetOk("ip_address"); ok { req.IPAddress = ipAddress.(string) } - if stackID, ok := d.GetOk("stack_id"); ok { - req.StackID = stackID.(uint64) + if nodeID, ok := d.GetOk("node_id"); ok { + req.NodeID = nodeID.(uint64) } - if stackName, ok := d.GetOk("stack_name"); ok { - req.StackName = stackName.(string) + if nodeName, ok := d.GetOk("node_name"); ok { + req.NodeName = nodeName.(string) } if cdImageID, ok := d.GetOk("cd_image_id"); ok { req.CDImageID = cdImageID.(uint64) diff --git a/internal/service/cloudbroker/lb/schema.go b/internal/service/cloudbroker/lb/schema.go index d021d6aa..89efc98a 100644 --- a/internal/service/cloudbroker/lb/schema.go +++ b/internal/service/cloudbroker/lb/schema.go @@ -1301,6 +1301,7 @@ func lbResourceSchemaMake() map[string]*schema.Schema { "start": { Type: schema.TypeBool, Optional: true, + Default: true, }, "desc": { Type: schema.TypeString, diff --git a/internal/service/cloudbroker/node/flattens.go b/internal/service/cloudbroker/node/flattens.go index 892f3bdd..224f5520 100644 --- a/internal/service/cloudbroker/node/flattens.go +++ b/internal/service/cloudbroker/node/flattens.go @@ -43,9 +43,13 @@ import ( func flattenNode(d *schema.ResourceData, item *node.RecordNode) { log.Debugf("flattenNode: decoded node id %d", d.Get("node_id").(int)) + d.Set("auto_start", item.AutoStart) + d.Set("auto_start_count", item.AutoStartCount) d.Set("consumption", flattenConsumption(item.Consumption)) d.Set("cpu_info", flattenCpuInfo(item.CpuInfo)) d.Set("cpu_allocation_ratio", item.CPUAllocationRatio) + d.Set("mem_allocation_ratio", item.MemAllocationRatio) + d.Set("description", item.Description) d.Set("dpdk", flattenDPDKItem(item.DPDK)) d.Set("gid", item.GID) d.Set("ipaddr", item.IPAddr) @@ -54,12 +58,14 @@ func flattenNode(d *schema.ResourceData, item *node.RecordNode) { d.Set("need_reboot", item.NeedReboot) d.Set("net_addr", flattenGetNetAddr(item.NetAddr)) d.Set("network_mode", item.NetworkMode) + d.Set("openvswitch_bridges", item.OpenvSwitchBridges) d.Set("nic_info", flattenNicInfo(item.NicInfo)) d.Set("numa_topology", flattenNumaTopology(item.NumaTopology)) d.Set("reserved_cpus", flattenNodeItem(item.ReservedCPUs)) d.Set("roles", item.Roles) + d.Set("sdn_hypervisor_name", item.SDNHypervisorName) d.Set("sriov_enabled", item.SriovEnabled) - d.Set("stack_id", item.StackID) + d.Set("node_id", item.ID) d.Set("status", item.Status) d.Set("to_active", flattenRole(item.ToActive)) d.Set("to_installing", flattenRole(item.ToInstalling)) @@ -67,6 +73,7 @@ func flattenNode(d *schema.ResourceData, item *node.RecordNode) { d.Set("to_restricted", flattenRole(item.ToRestricted)) d.Set("version", item.Version) d.Set("zone_id", item.ZoneID) + d.Set("usable_cpus", item.UsableCPUs) } func flattenConsumption(info node.ConsumptionInfo) []map[string]interface{} { @@ -115,48 +122,57 @@ func flattenNodeList(nodes *node.ListNodes) []map[string]interface{} { res := make([]map[string]interface{}, 0, len(nodes.Data)) for _, item := range nodes.Data { temp := map[string]interface{}{ - "additional_pkgs": flattenNodeItem(item.AdditionalPkgs), - "cpu_info": flattenCpuInfo(item.CpuInfo), - "description": item.Description, - "dpdk": flattenDPDKItem(item.DPDK), - "gid": item.GID, - "guid": item.GUID, - "hostkey": item.HostKey, - "node_id": item.ID, - "ipaddr": item.IPAddr, - "isolated_cpus": flattenNodeItem(item.IsolatedCpus), - "lastcheck": item.LastCheck, - "machine_guid": item.MachineGUID, - "mainboard_sn": item.MainboardSN, - "memory": item.Memory, - "milestones": item.Milestones, - "model": item.Model, - "name": item.Name, - "need_reboot": item.NeedReboot, - "net_addr": flattenNetAddr(item.NetAddr), - "network_mode": item.NetworkMode, - "nic_info": flattenNicInfo(item.NicInfo), - "node_uuid": item.NodeUUID, - "numa_topology": flattenNumaTopology(item.NumaTopology), - "peer_backup": item.PeerBackup, - "peer_log": item.PeerLog, - "peer_stats": item.PeerStats, - "pgpus": item.Pgpus, - "public_keys": item.PublicKeys, - "release": item.Release, - "reserved_cpus": flattenNodeItem(item.ReservedCPUs), - "roles": item.Roles, - "sdn_hypervisor_name": item.SDNHypervisorName, - "seps": item.Seps, - "serial_num": item.SerialNum, - "sriov_enabled": item.SriovEnabled, - "stack_id": item.StackID, - "status": item.Status, - "tags": item.Tags, - "type": item.Type, - "uefi_firmware_file": item.UEFIFirmwareFile, - "version": item.Version, - "zone_id": item.ZoneID, + "additional_pkgs": flattenNodeItem(item.AdditionalPkgs), + "auto_start": item.AutoStart, + "auto_start_count": item.AutoStartCount, + "cpu_info": flattenCpuInfo(item.CpuInfo), + "description": item.Description, + "dpdk": flattenDPDKItem(item.DPDK), + "gid": item.GID, + "guid": item.GUID, + "hostkey": item.HostKey, + "node_id": item.ID, + "ipaddr": item.IPAddr, + "isolated_cpus": flattenNodeItem(item.IsolatedCpus), + "lastcheck": item.LastCheck, + "machine_guid": item.MachineGUID, + "mainboard_sn": item.MainboardSN, + "memory": item.Memory, + "milestones": item.Milestones, + "model": item.Model, + "name": item.Name, + "need_reboot": item.NeedReboot, + "net_addr": flattenNetAddr(item.NetAddr), + "network_mode": item.NetworkMode, + "nic_info": flattenNicInfo(item.NicInfo), + "node_uuid": item.NodeUUID, + "numa_topology": flattenNumaTopology(item.NumaTopology), + "peer_backup": item.PeerBackup, + "peer_log": item.PeerLog, + "peer_stats": item.PeerStats, + "pgpus": item.Pgpus, + "public_keys": item.PublicKeys, + "release": item.Release, + "reserved_cpus": flattenNodeItem(item.ReservedCPUs), + "roles": item.Roles, + "sdn_hypervisor_name": item.SDNHypervisorName, + "seps": item.Seps, + "serial_num": item.SerialNum, + "sriov_enabled": item.SriovEnabled, + "status": item.Status, + "tags": item.Tags, + "type": item.Type, + "uefi_firmware_file": item.UEFIFirmwareFile, + "usable_cpus": item.UsableCPUs, + "version": item.Version, + "zone_id": item.ZoneID, + "openvswitch_bridges": item.OpenvSwitchBridges, + "api_url": item.APIUrl, + "drivers": item.Drivers, + "old_compat_lvm_id": item.OldCompatLVMID, + "cpu_allocation_ratio": item.CPUAllocationRatio, + "mem_allocation_ratio": item.MemAllocationRatio, + "packages": flattenPackages(item.Packages), } res = append(res, temp) } @@ -250,6 +266,8 @@ func flattenCpuInfo(info node.CpuInfo) []map[string]interface{} { "clock_speed": info.ClockSpeed, "core_count": info.CoreCount, "phys_count": info.PhysCount, + "flags": info.Flags, + "model_name": info.ModelName, } res[0] = temp return res @@ -274,6 +292,20 @@ func flattenNodeItem(m []interface{}) []string { return output } +func flattenPackages(pkgs map[string]node.PackageInfo) []map[string]interface{} { + res := make([]map[string]interface{}, 0, len(pkgs)) + + for _, p := range pkgs { + temp := map[string]interface{}{ + "ver": p.Ver, + "size": p.InstalledSize, + } + res = append(res, temp) + } + + return res +} + func flattenDPDKItem(dpdk node.DPDK) []map[string]interface{} { res := make([]map[string]interface{}, 1) bridges := make([]map[string]interface{}, 1) diff --git a/internal/service/cloudbroker/node/schema.go b/internal/service/cloudbroker/node/schema.go index 9429fd08..c5611529 100644 --- a/internal/service/cloudbroker/node/schema.go +++ b/internal/service/cloudbroker/node/schema.go @@ -9,6 +9,14 @@ func dataSourceNodeSchemaMake() map[string]*schema.Schema { Required: true, Description: "node id", }, + "auto_start": { + Type: schema.TypeBool, + Computed: true, + }, + "auto_start_count": { + Type: schema.TypeInt, + Computed: true, + }, "consumption": { Type: schema.TypeList, Computed: true, @@ -102,11 +110,30 @@ func dataSourceNodeSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, + "flags": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "model_name": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, "cpu_allocation_ratio": { - Type: schema.TypeInt, + Type: schema.TypeFloat, + Computed: true, + }, + "mem_allocation_ratio": { + Type: schema.TypeFloat, + Computed: true, + }, + "description": { + Type: schema.TypeString, Computed: true, }, "dpdk": { @@ -203,10 +230,24 @@ func dataSourceNodeSchemaMake() map[string]*schema.Schema { }, }, }, + "usable_cpus": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, "network_mode": { Type: schema.TypeString, Computed: true, }, + "openvswitch_bridges": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, "nic_info": { Type: schema.TypeList, Computed: true, @@ -317,12 +358,12 @@ func dataSourceNodeSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, }, }, - "sriov_enabled": { - Type: schema.TypeBool, + "sdn_hypervisor_name": { + Type: schema.TypeString, Computed: true, }, - "stack_id": { - Type: schema.TypeInt, + "sriov_enabled": { + Type: schema.TypeBool, Computed: true, }, "status": { @@ -485,6 +526,22 @@ func dataSourceNodeListSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, }, }, + "api_url": { + Type: schema.TypeString, + Computed: true, + }, + "auto_start": { + Type: schema.TypeBool, + Computed: true, + }, + "auto_start_count": { + Type: schema.TypeInt, + Computed: true, + }, + "cpu_allocation_ratio": { + Type: schema.TypeFloat, + Computed: true, + }, "cpu_info": { Type: schema.TypeList, Computed: true, @@ -502,6 +559,17 @@ func dataSourceNodeListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, + "flags": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "model_name": { + Type: schema.TypeString, + Computed: true, + }, }, }, }, @@ -509,6 +577,13 @@ func dataSourceNodeListSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "drivers": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, "dpdk": { Type: schema.TypeList, Computed: true, @@ -600,6 +675,10 @@ func dataSourceNodeListSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "mem_allocation_ratio": { + Type: schema.TypeFloat, + Computed: true, + }, "memory": { Type: schema.TypeInt, Computed: true, @@ -662,6 +741,17 @@ func dataSourceNodeListSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "old_compat_lvm_id": { + Type: schema.TypeInt, + Computed: true, + }, + "openvswitch_bridges": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, "nic_info": { Type: schema.TypeList, Computed: true, @@ -762,6 +852,22 @@ func dataSourceNodeListSchemaMake() map[string]*schema.Schema { }, }, }, + "packages": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ver": { + Type: schema.TypeString, + Computed: true, + }, + "size": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, "peer_backup": { Type: schema.TypeInt, Computed: true, @@ -825,10 +931,6 @@ func dataSourceNodeListSchemaMake() map[string]*schema.Schema { Type: schema.TypeBool, Computed: true, }, - "stack_id": { - Type: schema.TypeInt, - Computed: true, - }, "status": { Type: schema.TypeString, Computed: true, @@ -848,6 +950,13 @@ func dataSourceNodeListSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Computed: true, }, + "usable_cpus": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, "version": { Type: schema.TypeString, Computed: true, diff --git a/internal/service/cloudbroker/pcidevice/flattens.go b/internal/service/cloudbroker/pcidevice/flattens.go index f88645c1..b5694484 100644 --- a/internal/service/cloudbroker/pcidevice/flattens.go +++ b/internal/service/cloudbroker/pcidevice/flattens.go @@ -4,14 +4,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" log "github.com/sirupsen/logrus" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/pcidevice" - "repository.basistech.ru/BASIS/terraform-provider-decort/internal/flattens" ) func flattenPcidevice(d *schema.ResourceData, pd *pcidevice.ItemPCIDevice) { log.Debugf("flattenPCIDevice: ID %d", pd.ID) - d.Set("ckey", pd.CKey) - d.Set("meta", flattens.FlattenMeta(pd.Meta)) d.Set("compute_id", pd.ComputeID) d.Set("description", pd.Description) d.Set("guid", pd.GUID) @@ -19,7 +16,7 @@ func flattenPcidevice(d *schema.ResourceData, pd *pcidevice.ItemPCIDevice) { d.Set("device_id", pd.ID) d.Set("name", pd.Name) d.Set("rg_id", pd.RGID) - d.Set("stack_id", pd.StackID) + d.Set("node_id", pd.NodeID) d.Set("status", pd.Status) d.Set("system_name", pd.SystemName) } @@ -30,8 +27,6 @@ func flattenPcideviceList(pl *pcidevice.ListPCIDevices) []map[string]interface{} res := make([]map[string]interface{}, 0, len(pl.Data)) for _, item := range pl.Data { temp := map[string]interface{}{ - "ckey": item.CKey, - "meta": flattens.FlattenMeta(item.Meta), "compute_id": item.ComputeID, "description": item.Description, "guid": item.GUID, @@ -39,7 +34,7 @@ func flattenPcideviceList(pl *pcidevice.ListPCIDevices) []map[string]interface{} "device_id": item.ID, "rg_id": item.RGID, "name": item.Name, - "stack_id": item.StackID, + "node_id": item.NodeID, "status": item.Status, "system_name": item.SystemName, } diff --git a/internal/service/cloudbroker/pcidevice/resource_check_input_vales.go b/internal/service/cloudbroker/pcidevice/resource_check_input_vales.go index 6921e8ef..692ef65d 100644 --- a/internal/service/cloudbroker/pcidevice/resource_check_input_vales.go +++ b/internal/service/cloudbroker/pcidevice/resource_check_input_vales.go @@ -44,14 +44,14 @@ import ( func checkParamsExistence(ctx context.Context, d *schema.ResourceData, c *controller.ControllerCfg) diag.Diagnostics { var errs []error - stackId := uint64(d.Get("stack_id").(int)) + nodeId := uint64(d.Get("node_id").(int)) rgId := uint64(d.Get("rg_id").(int)) if err := ic.ExistRG(ctx, rgId, c); err != nil { errs = append(errs, err) } - if err := ic.ExistStack(ctx, stackId, c); err != nil { + if err := ic.ExistNode(ctx, nodeId, c); err != nil { errs = append(errs, err) } diff --git a/internal/service/cloudbroker/pcidevice/resource_pcidevice.go b/internal/service/cloudbroker/pcidevice/resource_pcidevice.go index cd1232bf..7b6e6dae 100644 --- a/internal/service/cloudbroker/pcidevice/resource_pcidevice.go +++ b/internal/service/cloudbroker/pcidevice/resource_pcidevice.go @@ -56,7 +56,7 @@ func resourcePcideviceCreate(ctx context.Context, d *schema.ResourceData, m inte return diags } - createReq.StackID = uint64(d.Get("stack_id").(int)) + createReq.NodeID = uint64(d.Get("node_id").(int)) createReq.RGID = uint64(d.Get("rg_id").(int)) createReq.Name = d.Get("name").(string) createReq.HWPath = d.Get("hw_path").(string) diff --git a/internal/service/cloudbroker/pcidevice/schema.go b/internal/service/cloudbroker/pcidevice/schema.go index bfc8d84b..8dc82e8a 100644 --- a/internal/service/cloudbroker/pcidevice/schema.go +++ b/internal/service/cloudbroker/pcidevice/schema.go @@ -11,17 +11,6 @@ func dataSourcePcideviceSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Required: true, }, - "ckey": { - Type: schema.TypeString, - Computed: true, - }, - "meta": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, "compute_id": { Type: schema.TypeInt, Computed: true, @@ -46,7 +35,7 @@ func dataSourcePcideviceSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Computed: true, }, @@ -109,17 +98,6 @@ func dataSourcePcideviceListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Required: true, }, - "ckey": { - Type: schema.TypeString, - Computed: true, - }, - "meta": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, "compute_id": { Type: schema.TypeInt, Computed: true, @@ -144,7 +122,7 @@ func dataSourcePcideviceListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Computed: true, }, @@ -170,11 +148,11 @@ func dataSourcePcideviceListSchemaMake() map[string]*schema.Schema { func resourcePcideviceSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ - "stack_id": { + "node_id": { Type: schema.TypeInt, Required: true, ValidateFunc: validation.IntAtLeast(1), - Description: "stackId", + Description: "Node ID", }, "rg_id": { Type: schema.TypeInt, diff --git a/internal/service/cloudbroker/rg/flattens.go b/internal/service/cloudbroker/rg/flattens.go index 4162248c..cdc97aea 100644 --- a/internal/service/cloudbroker/rg/flattens.go +++ b/internal/service/cloudbroker/rg/flattens.go @@ -70,7 +70,6 @@ func flattenRgResourceLimits(rl rg.ResourceLimits) []map[string]interface{} { "cu_dm": rl.CUDM, "cu_i": rl.CUI, "cu_m": rl.CUM, - "cu_np": rl.CUNP, "gpu_units": rl.GPUUnits, "storage_policy": flattenRgStoragePolicy(rl.StoragePolicies), } @@ -160,7 +159,6 @@ func flattenRgUsageResource(d *schema.ResourceData, usage rg.Reservation) { d.Set("disk_size", usage.DiskSize) d.Set("disk_size_max", usage.DiskSizeMax) d.Set("extips", usage.ExtIPs) - d.Set("exttraffic", usage.ExtTraffic) d.Set("gpu", usage.GPU) d.Set("ram", usage.RAM) d.Set("seps", flattenRGSeps(usage.SEPs)) @@ -173,7 +171,6 @@ func flattenResource(resource rg.Reservation) []map[string]interface{} { "disk_size": resource.DiskSize, "disk_size_max": resource.DiskSizeMax, "extips": resource.ExtIPs, - "exttraffic": resource.ExtTraffic, "gpu": resource.GPU, "ram": resource.RAM, "seps": flattenRGSeps(resource.SEPs), diff --git a/internal/service/cloudbroker/rg/models.go b/internal/service/cloudbroker/rg/models.go index ea78cc2f..7b3841ae 100644 --- a/internal/service/cloudbroker/rg/models.go +++ b/internal/service/cloudbroker/rg/models.go @@ -36,7 +36,6 @@ type ResourceLimits struct { CUD float64 `json:"CU_D"` CUI float64 `json:"CU_I"` CUM float64 `json:"CU_M"` - CUNP float64 `json:"CU_NP"` GpuUnits float64 `json:"gpu_units"` } @@ -124,21 +123,19 @@ type UserAclRecord struct { } type QuotaRecord struct { // this is how quota is reported by /api/.../rg/get - Cpu float64 `json:"CU_C"` // CPU count in pcs - Ram float64 `json:"CU_M"` // RAM volume in MB, it is STILL reported as FLOAT - Disk float64 `json:"CU_D"` // Disk capacity in GB - ExtIPs float64 `json:"CU_I"` // Ext IPs count - ExtTraffic float64 `json:"CU_NP"` // Ext network traffic - GpuUnits float64 `json:"gpu_units"` // GPU count + Cpu float64 `json:"CU_C"` // CPU count in pcs + Ram float64 `json:"CU_M"` // RAM volume in MB, it is STILL reported as FLOAT + Disk float64 `json:"CU_D"` // Disk capacity in GB + ExtIPs float64 `json:"CU_I"` // Ext IPs count + GpuUnits float64 `json:"gpu_units"` // GPU count } type ResourceRecord struct { // this is how actual usage is reported by /api/.../rg/get - Cpu int `json:"cpu"` - Disk int `json:"disksize"` - ExtIPs int `json:"extips"` - ExtTraffic int `json:"exttraffic"` - Gpu int `json:"gpu"` - Ram int `json:"ram"` + Cpu int `json:"cpu"` + Disk int `json:"disksize"` + ExtIPs int `json:"extips"` + Gpu int `json:"gpu"` + Ram int `json:"ram"` } type UsageRecord struct { diff --git a/internal/service/cloudbroker/rg/quota_subresource.go b/internal/service/cloudbroker/rg/quota_subresource.go index c0c42932..946208fb 100644 --- a/internal/service/cloudbroker/rg/quota_subresource.go +++ b/internal/service/cloudbroker/rg/quota_subresource.go @@ -38,12 +38,11 @@ import ( func makeQuotaRecord(arg_list []interface{}) QuotaRecord { quota := QuotaRecord{ - Cpu: -1, - Ram: -1., // this is float64, but may change in the future - Disk: -1, - ExtTraffic: -1, - ExtIPs: -1, - GpuUnits: -1, + Cpu: -1, + Ram: -1., // this is float64, but may change in the future + Disk: -1, + ExtIPs: -1, + GpuUnits: -1, } subres_data := arg_list[0].(map[string]interface{}) @@ -59,10 +58,6 @@ func makeQuotaRecord(arg_list []interface{}) QuotaRecord { quota.Ram = subres_data["ram"].(float64) } - if subres_data["ext_traffic"].(int) > 0 { - quota.ExtTraffic = subres_data["ext_traffic"].(float64) - } - if subres_data["ext_ips"].(int) > 0 { quota.ExtIPs = subres_data["ext_ips"].(float64) } @@ -80,7 +75,6 @@ func parseQuota(quota rg.ResourceLimits) []interface{} { quota_map["cpu"] = quota.CUC quota_map["ram"] = quota.CUM quota_map["disk"] = quota.CuD - quota_map["ext_traffic"] = quota.CUNP quota_map["ext_ips"] = quota.CUI quota_map["gpu_units"] = quota.GPUUnits diff --git a/internal/service/cloudbroker/rg/resource_rg.go b/internal/service/cloudbroker/rg/resource_rg.go index ed8ff14e..5cc70d00 100644 --- a/internal/service/cloudbroker/rg/resource_rg.go +++ b/internal/service/cloudbroker/rg/resource_rg.go @@ -99,14 +99,6 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter req.MaxNumPublicIP = maxNumPublicIP } } - if resLimitsConv["cu_np"] != nil { - maxNP := int64(resLimitsConv["cu_np"].(float64)) - if maxNP == 0 { - req.MaxNetworkPeerTransfer = -1 - } else { - req.MaxNetworkPeerTransfer = maxNP - } - } } if owner, ok := d.GetOk("owner"); ok { @@ -423,14 +415,6 @@ func resourceResgroupUpdate(ctx context.Context, d *schema.ResourceData, m inter req.MaxNumPublicIP = maxNumPublicIP } } - if resLimitsConv["cu_np"] != nil { - maxNP := int64(resLimitsConv["cu_np"].(float64)) - if maxNP == 0 { - req.MaxNetworkPeerTransfer = -1 - } else { - req.MaxNetworkPeerTransfer = maxNP - } - } doGeneralUpdate = true } diff --git a/internal/service/cloudbroker/rg/schema.go b/internal/service/cloudbroker/rg/schema.go index 4d4943e9..b3deaa77 100644 --- a/internal/service/cloudbroker/rg/schema.go +++ b/internal/service/cloudbroker/rg/schema.go @@ -144,10 +144,6 @@ func dataSourceRgSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, @@ -435,10 +431,6 @@ func dataSourceRGResourceConsumptionGetSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -495,10 +487,6 @@ func dataSourceRGResourceConsumptionGetSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -559,10 +547,6 @@ func dataSourceRGResourceConsumptionGetSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, @@ -607,10 +591,6 @@ func dataSourceRGResourceConsumptionListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -667,10 +647,6 @@ func dataSourceRGResourceConsumptionListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -731,10 +707,6 @@ func dataSourceRGResourceConsumptionListSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, @@ -776,10 +748,6 @@ func dataSourceRgUsageSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Computed: true, }, - "exttraffic": { - Type: schema.TypeInt, - Computed: true, - }, "gpu": { Type: schema.TypeInt, Computed: true, @@ -1669,10 +1637,6 @@ func dataSourceRgListDeletedSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, @@ -1967,10 +1931,6 @@ func dataSourceRgListSchemaMake() map[string]*schema.Schema { Type: schema.TypeFloat, Computed: true, }, - "cu_np": { - Type: schema.TypeFloat, - Computed: true, - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, @@ -2309,12 +2269,6 @@ func resourceRgSchemaMake() map[string]*schema.Schema { Computed: true, Description: "MaxMemoryCapacity", }, - "cu_np": { - Type: schema.TypeFloat, - Optional: true, - Computed: true, - Description: "MaxNetworkPeerTransfer", - }, "gpu_units": { Type: schema.TypeFloat, Computed: true, diff --git a/internal/service/cloudbroker/sep/resource_sep.go b/internal/service/cloudbroker/sep/resource_sep.go index 44f8c08b..b4dd1967 100644 --- a/internal/service/cloudbroker/sep/resource_sep.go +++ b/internal/service/cloudbroker/sep/resource_sep.go @@ -69,20 +69,6 @@ func resourceSepCreate(ctx context.Context, d *schema.ResourceData, m interface{ req.Enable = enable.(bool) } - var consumedNIDs []uint64 - for _, item := range d.Get("consumed_by").(*schema.Set).List() { - consumedNIDs = append(consumedNIDs, uint64(item.(int))) - } - - req.ConsumerNIDs = consumedNIDs - - var providerNIDs []uint64 - for _, item := range d.Get("provided_by").([]interface{}) { - providerNIDs = append(providerNIDs, uint64(item.(int))) - } - - req.ProviderNIDs = providerNIDs - sepId, err := c.CloudBroker().SEP().Create(ctx, req) if err != nil { d.SetId("") @@ -126,6 +112,22 @@ func resourceSepCreate(ctx context.Context, d *schema.ResourceData, m interface{ } } + if consumedBy, ok := d.GetOk("consumed_by"); ok && consumedBy.(*schema.Set).Len() > 0 { + log.Debugf("resourceSepCreate, consumed_by: consumed_by=%v sep_id %d after completing its resource configuration", consumedBy, sepId) + err := resourceSepAddConsumerNodes(ctx, d, m) + if err != nil { + warnings.Add(err) + } + } + + if providedBy, ok := d.GetOk("provided_by"); ok && len(providedBy.([]interface{})) > 0 { + log.Debugf("resourceSepCreate, provided_by: provided_by=%v sep_id %d after completing its resource configuration", providedBy, sepId) + err := resourceSepAddProviderNodes(ctx, d, m) + if err != nil { + warnings.Add(err) + } + } + return append(resourceSepRead(ctx, d, m), warnings.Get()...) } @@ -483,6 +485,52 @@ func resourceSepUpdateProviders(ctx context.Context, d *schema.ResourceData, m i return nil } +func resourceSepAddConsumerNodes(ctx context.Context, d *schema.ResourceData, m interface{}) error { + log.Debugf("resourceSepAddConsumerNodes: called for %s, id: %d", d.Get("name").(string), d.Get("sep_id").(int)) + c := m.(*controller.ControllerCfg) + + var consumerNIDs []uint64 + for _, item := range d.Get("consumed_by").(*schema.Set).List() { + consumerNIDs = append(consumerNIDs, uint64(item.(int))) + } + + if len(consumerNIDs) > 0 { + reqAdd := sep.AddConsumerNodesRequest{ + SEPID: uint64(d.Get("sep_id").(int)), + ConsumerNIDs: consumerNIDs, + } + _, err := c.CloudBroker().SEP().AddConsumerNodes(ctx, reqAdd) + if err != nil { + return err + } + } + + return nil +} + +func resourceSepAddProviderNodes(ctx context.Context, d *schema.ResourceData, m interface{}) error { + log.Debugf("resourceSepAddProviderNodes: called for %s, id: %d", d.Get("name").(string), d.Get("sep_id").(int)) + c := m.(*controller.ControllerCfg) + + var providerNIDs []uint64 + for _, item := range d.Get("provided_by").([]interface{}) { + providerNIDs = append(providerNIDs, uint64(item.(int))) + } + + if len(providerNIDs) > 0 { + reqAdd := sep.AddProviderNodesRequest{ + SEPID: uint64(d.Get("sep_id").(int)), + ProviderNIDs: providerNIDs, + } + _, err := c.CloudBroker().SEP().AddProviderNodes(ctx, reqAdd) + if err != nil { + return err + } + } + + return nil +} + func ResourceSep() *schema.Resource { return &schema.Resource{ SchemaVersion: 1, diff --git a/internal/service/cloudbroker/sep/schema.go b/internal/service/cloudbroker/sep/schema.go index 9dbc8bf1..7bc4d83d 100644 --- a/internal/service/cloudbroker/sep/schema.go +++ b/internal/service/cloudbroker/sep/schema.go @@ -109,7 +109,7 @@ func dataSourceSepTemplateSchemaMake() map[string]*schema.Schema { "sep_type": { Type: schema.TypeString, Required: true, - ValidateFunc: validation.StringInSlice([]string{"hitachi", "dorado", "tatlin", "shared", "local", "des"}, false), + ValidateFunc: validation.StringInSlice([]string{"des", "hitachi", "dorado", "tatlin", "shared", "local", "ustor"}, false), Description: "type of sep", }, "lang": { @@ -305,6 +305,14 @@ func dataSourceSepListSchemaMake() map[string]*schema.Schema { Optional: true, Description: "page size", }, + "sep_ids": { + Type: schema.TypeList, + Optional: true, + Description: "sort by list of SEP identifiers", + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + }, "items": { Type: schema.TypeList, Computed: true, @@ -503,9 +511,10 @@ func resourceSepSchemaMake() map[string]*schema.Schema { Description: "SEP name", }, "type": { - Type: schema.TypeString, - Required: true, - Description: "type of storage", + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"des", "hitachi", "dorado", "tatlin", "shared", "local", "ustor"}, false), + Description: "type of storage", }, "access_to_pool": { Type: schema.TypeSet, diff --git a/internal/service/cloudbroker/sep/utility_sep_list.go b/internal/service/cloudbroker/sep/utility_sep_list.go index fd3e3cbb..24b3a461 100644 --- a/internal/service/cloudbroker/sep/utility_sep_list.go +++ b/internal/service/cloudbroker/sep/utility_sep_list.go @@ -76,6 +76,12 @@ func utilitySepListCheckPresence(ctx context.Context, d *schema.ResourceData, m if size, ok := d.GetOk("size"); ok { req.Size = uint64(size.(int)) } + if sepIds, ok := d.GetOk("sep_ids"); ok { + ids := sepIds.([]interface{}) + for _, id := range ids { + req.SepIDs = append(req.SepIDs, uint64(id.(int))) + } + } log.Debugf("utilitySepListCheckPresence: load image list") sepList, err := c.CloudBroker().SEP().List(ctx, req) diff --git a/internal/service/cloudbroker/stack/data_source_stack_list.go b/internal/service/cloudbroker/stack/data_source_stack_list.go deleted file mode 100644 index 21e87b29..00000000 --- a/internal/service/cloudbroker/stack/data_source_stack_list.go +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved. -Authors: -Petr Krutov, -Stanislav Solovev, -Sergey Kisil, - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud -Orchestration Technology) with Terraform by Hashicorp. - -Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort - -Please see README.md to learn where to place source code so that it -builds seamlessly. - -Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki -*/ - -package stack - -import ( - "context" - - "github.com/google/uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants" -) - -func dataSourceStackListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - stackList, err := utilityStackListCheckPresence(ctx, d, m) - if err != nil { - d.SetId("") - return diag.FromErr(err) - } - - id := uuid.New() - d.SetId(id.String()) - d.Set("items", flattenStacksList(stackList)) - d.Set("entry_count", stackList.EntryCount) - - return nil -} - -func DataSourceStacksList() *schema.Resource { - return &schema.Resource{ - SchemaVersion: 1, - - ReadContext: dataSourceStackListRead, - - Timeouts: &schema.ResourceTimeout{ - Read: &constants.Timeout30s, - Default: &constants.Timeout60s, - }, - - Schema: dataSourceStacksListSchemaMake(), - } -} diff --git a/internal/service/cloudbroker/stack/data_sourse_stack.go b/internal/service/cloudbroker/stack/data_sourse_stack.go deleted file mode 100644 index 5ca6ba9d..00000000 --- a/internal/service/cloudbroker/stack/data_sourse_stack.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved. -Authors: -Petr Krutov, -Stanislav Solovev, - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud -Orchestration Technology) with Terraform by Hashicorp. - -Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort - -Please see README.md to learn where to place source code so that it -builds seamlessly. - -Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki -*/ - -package stack - -import ( - "context" - "strconv" - - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants" -) - -func dataSourceStackRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - stack, err := utilityStackCheckPresence(ctx, d, m) - if err != nil { - d.SetId("") // ensure ID is empty in this case - return diag.FromErr(err) - } - - flattenStack(d, stack) - d.SetId(strconv.Itoa(d.Get("stack_id").(int))) - - return nil -} - -func DataSourceStack() *schema.Resource { - return &schema.Resource{ - SchemaVersion: 1, - - ReadContext: dataSourceStackRead, - - Timeouts: &schema.ResourceTimeout{ - Read: &constants.Timeout30s, - Default: &constants.Timeout60s, - }, - - Schema: dataSourceStackSchemaMake(), - } -} diff --git a/internal/service/cloudbroker/stack/flattens.go b/internal/service/cloudbroker/stack/flattens.go deleted file mode 100644 index c489b58e..00000000 --- a/internal/service/cloudbroker/stack/flattens.go +++ /dev/null @@ -1,204 +0,0 @@ -/* -Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved. -Authors: -Petr Krutov, -Stanislav Solovev, -Sergey Kisil, - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud -Orchestration Technology) with Terraform by Hashicorp. - -Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort - -Please see README.md to learn where to place source code so that it -builds seamlessly. - -Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki -*/ - -package stack - -import ( - log "github.com/sirupsen/logrus" - "strconv" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/stack" - "repository.basistech.ru/BASIS/terraform-provider-decort/internal/flattens" -) - -func flattenStack(d *schema.ResourceData, st *stack.InfoStack) { - log.Debugf("flattenStack: decoded Stack name %q / ID %d", - st.Name, st.ID) - - d.Set("ckey", st.Ckey) - d.Set("meta", flattens.FlattenMeta(st.Meta)) - d.Set("api_url", st.APIURL) - d.Set("api_key", st.Apikey) - d.Set("app_id", st.AppID) - d.Set("cpu_allocation_ratio", st.CPUAllocationRatio) - d.Set("description", st.Description) - d.Set("descr", st.Descr) - d.Set("drivers", st.Drivers) - d.Set("eco", flattenEco(st.Eco)) - d.Set("error", st.Error) - d.Set("gid", st.GID) - d.Set("guid", st.GUID) - d.Set("stack_id", st.ID) - d.Set("images", st.Images) - d.Set("login", st.Login) - d.Set("mem_allocation_ratio", st.MemAllocationRatio) - d.Set("name", st.Name) - d.Set("packages", flattenPackages(st.Packages)) - d.Set("passwd", st.Password) - d.Set("reference_id", st.ReferenceID) - d.Set("status", st.Status) - d.Set("type", st.Type) -} - -func flattenPackages(pg stack.Packages) []map[string]interface{} { - res := make([]map[string]interface{}, 0) - temp := map[string]interface{}{ - "libvirt_bin": flattenLibvirtBin(pg), - "libvirt_daemon": flattenLibvirtDaemon(pg), - "lvm2_lockd": flattenLvm2Lockd(pg), - "openvswitch_common": flattenOpenvswitchCommon(pg), - "openvswitch_switch": flattenOpenvswitchSwitch(pg), - "qemu_system_x86": flattenQemuSystemX86(pg), - "sanlock": flattenSanlock(pg), - } - res = append(res, temp) - return res -} - -func flattenLibvirtBin(lb stack.Packages) []map[string]interface{} { - res := make([]map[string]interface{}, 0) - temp := map[string]interface{}{ - "installed_size": lb.LibvirtBin.InstalledSize, - "ver": lb.LibvirtBin.Ver, - } - res = append(res, temp) - return res -} - -func flattenLibvirtDaemon(ld stack.Packages) []map[string]interface{} { - res := make([]map[string]interface{}, 0) - temp := map[string]interface{}{ - "installed_size": ld.LibvirtDaemon.InstalledSize, - "ver": ld.LibvirtDaemon.Ver, - } - res = append(res, temp) - return res -} - -func flattenLvm2Lockd(ll stack.Packages) []map[string]interface{} { - res := make([]map[string]interface{}, 0) - temp := map[string]interface{}{ - "installed_size": ll.Lvm2Lockd.InstalledSize, - "ver": ll.Lvm2Lockd.Ver, - } - res = append(res, temp) - return res -} - -func flattenOpenvswitchCommon(oc stack.Packages) []map[string]interface{} { - res := make([]map[string]interface{}, 0) - temp := map[string]interface{}{ - "installed_size": oc.OpenvswitchCommon.InstalledSize, - "ver": oc.OpenvswitchCommon.Ver, - } - res = append(res, temp) - return res -} - -func flattenOpenvswitchSwitch(os stack.Packages) []map[string]interface{} { - res := make([]map[string]interface{}, 0) - temp := map[string]interface{}{ - "installed_size": os.OpenvswitchSwitch.InstalledSize, - "ver": os.OpenvswitchSwitch.Ver, - } - res = append(res, temp) - return res -} - -func flattenQemuSystemX86(qs stack.Packages) []map[string]interface{} { - res := make([]map[string]interface{}, 0) - temp := map[string]interface{}{ - "installed_size": qs.QemuSystemX86.InstalledSize, - "ver": qs.QemuSystemX86.Ver, - } - res = append(res, temp) - return res -} - -func flattenSanlock(sl stack.Packages) []map[string]interface{} { - res := make([]map[string]interface{}, 0) - temp := map[string]interface{}{ - "installed_size": sl.Sanlock.InstalledSize, - "ver": sl.Sanlock.Ver, - } - res = append(res, temp) - return res -} - -func flattenEco(m interface{}) string { - switch d := m.(type) { - case string: - return d - case int: - return strconv.Itoa(d) - case int64: - return strconv.FormatInt(d, 10) - case float64: - return strconv.FormatInt(int64(d), 10) - default: - return "" - } -} - -func flattenStacksList(sl *stack.ListStacks) []map[string]interface{} { - res := make([]map[string]interface{}, 0, len(sl.Data)) - for _, item := range sl.Data { - temp := map[string]interface{}{ - "ckey": item.Ckey, - "meta": flattens.FlattenMeta(item.Meta), - "api_url": item.APIURL, - "api_key": item.Apikey, - "app_id": item.AppID, - "cpu_allocation_ratio": item.CPUAllocationRatio, - "description": item.Description, - "descr": item.Descr, - "drivers": item.Drivers, - "eco": flattenEco(item.Eco), - "error": item.Error, - "gid": item.GID, - "guid": item.GUID, - "stack_id": item.ID, - "images": item.Images, - "login": item.Login, - "mem_allocation_ratio": item.MemAllocationRatio, - "name": item.Name, - "packages": flattenPackages(item.Packages), - "passwd": item.Password, - "reference_id": item.ReferenceID, - "status": item.Status, - "type": item.Type, - } - res = append(res, temp) - } - return res -} diff --git a/internal/service/cloudbroker/stack/schema.go b/internal/service/cloudbroker/stack/schema.go deleted file mode 100644 index c2a9d899..00000000 --- a/internal/service/cloudbroker/stack/schema.go +++ /dev/null @@ -1,582 +0,0 @@ -package stack - -import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - -func dataSourceStackSchemaMake() map[string]*schema.Schema { - return map[string]*schema.Schema{ - "stack_id": { - Type: schema.TypeInt, - Required: true, - Description: "stack_id", - }, - "ckey": { - Type: schema.TypeString, - Computed: true, - Description: "ckey", - }, - "meta": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - Description: "meta", - }, - "api_url": { - Type: schema.TypeString, - Computed: true, - Description: "api_url", - }, - "api_key": { - Type: schema.TypeString, - Computed: true, - Description: "api_key", - }, - "app_id": { - Type: schema.TypeString, - Computed: true, - Description: "api_id", - }, - "cpu_allocation_ratio": { - Type: schema.TypeFloat, - Computed: true, - Description: "cpu_allocation_ratio", - }, - "description": { - Type: schema.TypeString, - Computed: true, - Description: "description", - }, - "descr": { - Type: schema.TypeString, - Computed: true, - Description: "descr", - }, - "drivers": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - Description: "drivers", - }, - "eco": { - Type: schema.TypeString, - Computed: true, - Description: "eco", - }, - "error": { - Type: schema.TypeInt, - Computed: true, - Description: "error", - }, - "gid": { - Type: schema.TypeInt, - Computed: true, - Description: "gid", - }, - "guid": { - Type: schema.TypeInt, - Computed: true, - Description: "guid", - }, - "images": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeInt, - }, - Description: "images", - }, - "login": { - Type: schema.TypeString, - Computed: true, - Description: "login", - }, - "mem_allocation_ratio": { - Type: schema.TypeFloat, - Computed: true, - Description: "mem_allocation_ratio", - }, - "name": { - Type: schema.TypeString, - Computed: true, - Description: "name", - }, - "packages": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "libvirt_bin": { - Type: schema.TypeList, - Computed: true, - Description: "libvirt_bin", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "libvirt_daemon": { - Type: schema.TypeList, - Computed: true, - Description: "libvirt_daemon", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "lvm2_lockd": { - Type: schema.TypeList, - Computed: true, - Description: "lvm2_lockd", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "openvswitch_common": { - Type: schema.TypeList, - Computed: true, - Description: "openvswitch_common", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "openvswitch_switch": { - Type: schema.TypeList, - Computed: true, - Description: "openvswitch_switch", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "qemu_system_x86": { - Type: schema.TypeList, - Computed: true, - Description: "qemu_system_x86", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "sanlock": { - Type: schema.TypeList, - Computed: true, - Description: "sanlock", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - }, - }, - }, - "passwd": { - Type: schema.TypeString, - Computed: true, - Description: "password", - }, - "reference_id": { - Type: schema.TypeString, - Computed: true, - Description: "reference_id", - }, - "status": { - Type: schema.TypeString, - Computed: true, - Description: "status", - }, - "type": { - Type: schema.TypeString, - Computed: true, - Description: "type", - }, - } -} - -func dataSourceStacksListSchemaMake() map[string]*schema.Schema { - return map[string]*schema.Schema{ - "by_id": { - Type: schema.TypeInt, - Optional: true, - Description: "by_id", - }, - "name": { - Type: schema.TypeString, - Optional: true, - Description: "name", - }, - "type": { - Type: schema.TypeString, - Optional: true, - Description: "type", - }, - "status": { - Type: schema.TypeString, - Optional: true, - Description: "type", - }, - "sort_by": { - Type: schema.TypeString, - Optional: true, - Description: "sort by one of supported fields, format +|-(field)", - }, - "page": { - Type: schema.TypeInt, - Optional: true, - Description: "page number", - }, - "size": { - Type: schema.TypeInt, - Optional: true, - Description: "page size", - }, - "items": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "stack_id": { - Type: schema.TypeInt, - Required: true, - Description: "stack_id", - }, - "ckey": { - Type: schema.TypeString, - Computed: true, - Description: "ckey", - }, - "meta": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - Description: "meta", - }, - "api_url": { - Type: schema.TypeString, - Computed: true, - Description: "api_url", - }, - "api_key": { - Type: schema.TypeString, - Computed: true, - Description: "api_key", - }, - "app_id": { - Type: schema.TypeString, - Computed: true, - Description: "api_id", - }, - "cpu_allocation_ratio": { - Type: schema.TypeFloat, - Computed: true, - Description: "cpu_allocation_ratio", - }, - "description": { - Type: schema.TypeString, - Computed: true, - Description: "description", - }, - "descr": { - Type: schema.TypeString, - Computed: true, - Description: "descr", - }, - "drivers": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - Description: "drivers", - }, - "eco": { - Type: schema.TypeString, - Computed: true, - Description: "eco", - }, - "error": { - Type: schema.TypeInt, - Computed: true, - Description: "error", - }, - "gid": { - Type: schema.TypeInt, - Computed: true, - Description: "gid", - }, - "guid": { - Type: schema.TypeInt, - Computed: true, - Description: "guid", - }, - "images": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeInt, - }, - Description: "images", - }, - "login": { - Type: schema.TypeString, - Computed: true, - Description: "login", - }, - "mem_allocation_ratio": { - Type: schema.TypeFloat, - Computed: true, - Description: "mem_allocation_ratio", - }, - "name": { - Type: schema.TypeString, - Computed: true, - Description: "name", - }, - "packages": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "libvirt_bin": { - Type: schema.TypeList, - Computed: true, - Description: "libvirt_bin", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "libvirt_daemon": { - Type: schema.TypeList, - Computed: true, - Description: "libvirt_daemon", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "lvm2_lockd": { - Type: schema.TypeList, - Computed: true, - Description: "lvm2_lockd", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "openvswitch_common": { - Type: schema.TypeList, - Computed: true, - Description: "openvswitch_common", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "openvswitch_switch": { - Type: schema.TypeList, - Computed: true, - Description: "openvswitch_switch", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "qemu_system_x86": { - Type: schema.TypeList, - Computed: true, - Description: "qemu_system_x86", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - "sanlock": { - Type: schema.TypeList, - Computed: true, - Description: "sanlock", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "installed_size": { - Type: schema.TypeString, - Computed: true, - Description: "installed_size", - }, - "ver": { - Type: schema.TypeString, - Computed: true, - Description: "ver", - }, - }, - }, - }, - }, - }, - }, - "passwd": { - Type: schema.TypeString, - Computed: true, - Description: "password", - }, - "reference_id": { - Type: schema.TypeString, - Computed: true, - Description: "reference_id", - }, - "status": { - Type: schema.TypeString, - Computed: true, - Description: "status", - }, - "type": { - Type: schema.TypeString, - Computed: true, - Description: "type", - }, - }, - }, - Description: "items of stacks list", - }, - "entry_count": { - Type: schema.TypeInt, - Computed: true, - Description: "entry_count", - }, - } -} diff --git a/internal/service/cloudbroker/stack/utility_stack.go b/internal/service/cloudbroker/stack/utility_stack.go deleted file mode 100644 index e51b8d48..00000000 --- a/internal/service/cloudbroker/stack/utility_stack.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved. -Authors: -Petr Krutov, -Stanislav Solovev, -Sergey Kisil, - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud -Orchestration Technology) with Terraform by Hashicorp. - -Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort - -Please see README.md to learn where to place source code so that it -builds seamlessly. - -Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki -*/ - -package stack - -import ( - "context" - "strconv" - - log "github.com/sirupsen/logrus" - "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/stack" - "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func utilityStackCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*stack.InfoStack, error) { - c := m.(*controller.ControllerCfg) - req := stack.GetRequest{} - - if d.Id() != "" { - id, _ := strconv.ParseUint(d.Id(), 10, 64) - req.StackId = id - } else { - req.StackId = uint64(d.Get("stack_id").(int)) - } - - log.Debugf("utilityStackCheckPresence: load stack") - stackInfo, err := c.CloudBroker().Stack().Get(ctx, req) - if err != nil { - return nil, err - } - - return stackInfo, nil -} diff --git a/internal/service/cloudbroker/stack/utility_stack_list.go b/internal/service/cloudbroker/stack/utility_stack_list.go deleted file mode 100644 index 6893798b..00000000 --- a/internal/service/cloudbroker/stack/utility_stack_list.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved. -Authors: -Petr Krutov, -Stanislav Solovev, -Sergey Kisil, - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud -Orchestration Technology) with Terraform by Hashicorp. - -Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort - -Please see README.md to learn where to place source code so that it -builds seamlessly. - -Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki -*/ - -package stack - -import ( - "context" - - log "github.com/sirupsen/logrus" - "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/stack" - "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func utilityStackListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*stack.ListStacks, error) { - c := m.(*controller.ControllerCfg) - req := stack.ListRequest{} - - if ByID, ok := d.GetOk("by_id"); ok { - req.ByID = uint64(ByID.(int)) - } - if Name, ok := d.GetOk("name"); ok { - req.Name = Name.(string) - } - if Type, ok := d.GetOk("type"); ok { - req.Type = Type.(string) - } - if Status, ok := d.GetOk("status"); ok { - req.Status = Status.(string) - } - if sortBy, ok := d.GetOk("sort_by"); ok { - req.SortBy = sortBy.(string) - } - if Page, ok := d.GetOk("page"); ok { - req.Page = uint64(Page.(int)) - } - if Size, ok := d.GetOk("size"); ok { - req.Size = uint64(Size.(int)) - } - - log.Debugf("utilityStackListCheckPresence: load stack list") - stackList, err := c.CloudBroker().Stack().List(ctx, req) - if err != nil { - return nil, err - } - - return stackList, nil -} diff --git a/internal/service/cloudbroker/stpolicy/flattens.go b/internal/service/cloudbroker/stpolicy/flattens.go index 4308484a..78bfc471 100644 --- a/internal/service/cloudbroker/stpolicy/flattens.go +++ b/internal/service/cloudbroker/stpolicy/flattens.go @@ -20,9 +20,10 @@ func flattenAccessSEPPools(accessSEPPools stpolicy.ListAccessSEPPools) []map[str res := make([]map[string]interface{}, 0, len(accessSEPPools)) for _, asp := range accessSEPPools { temp := map[string]interface{}{ - "sep_id": asp.SEPID, - "sep_name": asp.Name, - "pool_names": asp.PoolNames, + "sep_id": asp.SEPID, + "sep_name": asp.Name, + "pool_names": asp.PoolNames, + "sep_tech_status": asp.SepTechStatus, } res = append(res, temp) diff --git a/internal/service/cloudbroker/stpolicy/schema.go b/internal/service/cloudbroker/stpolicy/schema.go index f7c018b9..9b232063 100644 --- a/internal/service/cloudbroker/stpolicy/schema.go +++ b/internal/service/cloudbroker/stpolicy/schema.go @@ -1,6 +1,9 @@ package stpolicy -import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +import ( + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" +) func resourceStoragePolicySchemaMake() map[string]*schema.Schema { res := map[string]*schema.Schema{ @@ -21,6 +24,10 @@ func resourceStoragePolicySchemaMake() map[string]*schema.Schema { Type: schema.TypeString, Required: true, }, + "sep_name": { + Type: schema.TypeString, + Computed: true, + }, "sep_id": { Type: schema.TypeInt, Required: true, @@ -114,6 +121,10 @@ func dataSourceStoragePolicySchemaMake() map[string]*schema.Schema { Type: schema.TypeString, }, }, + "sep_name": { + Type: schema.TypeString, + Computed: true, + }, "sep_id": { Type: schema.TypeInt, Computed: true, @@ -194,6 +205,11 @@ func dataSourceStoragePolicyListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Optional: true, }, + "sep_tech_status": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"ENABLED", "DISABLED"}, true), + }, "pool_name": { Type: schema.TypeString, Optional: true, @@ -240,11 +256,15 @@ func dataSourceStoragePolicyListSchemaMake() map[string]*schema.Schema { Type: schema.TypeString, }, }, + "sep_name": { + Type: schema.TypeString, + Computed: true, + }, "sep_id": { Type: schema.TypeInt, Computed: true, }, - "sep_name": { + "sep_tech_status": { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/cloudbroker/stpolicy/utility_storage_policy_list.go b/internal/service/cloudbroker/stpolicy/utility_storage_policy_list.go index e890eab2..fac2517e 100644 --- a/internal/service/cloudbroker/stpolicy/utility_storage_policy_list.go +++ b/internal/service/cloudbroker/stpolicy/utility_storage_policy_list.go @@ -55,6 +55,10 @@ func utilityStoragePolicyListCheckPresence(ctx context.Context, d *schema.Resour req.SepID = uint64(SEPID.(int)) } + if SEPtechstatus, ok := d.GetOk("sep_tech_status"); ok { + req.SepTechStatus = SEPtechstatus.(string) + } + if poolName, ok := d.GetOk("pool_name"); ok { req.PoolName = poolName.(string) } diff --git a/internal/service/cloudbroker/trunk/flattens.go b/internal/service/cloudbroker/trunk/flattens.go index b7591780..49510cf9 100644 --- a/internal/service/cloudbroker/trunk/flattens.go +++ b/internal/service/cloudbroker/trunk/flattens.go @@ -40,6 +40,7 @@ func flattenTrunk(d *schema.ResourceData, trunkItem *trunk.ItemTrunk) { d.Set("account_ids", trunkItem.AccountIDs) d.Set("ovs_bridge", trunkItem.OVSBridge) d.Set("native_vlan_id", trunkItem.NativeVLANID) + d.Set("mtu", trunkItem.MTU) d.Set("status", trunkItem.Status) d.Set("trunk_tags", trunkItem.TrunkTags) d.Set("created_at", trunkItem.CreatedAt) @@ -66,6 +67,7 @@ func flattenTrunkList(trunkList *trunk.ListTrunks) []map[string]interface{} { "name": trunkItem.Name, "native_vlan_id": trunkItem.NativeVLANID, "ovs_bridge": trunkItem.OVSBridge, + "mtu": trunkItem.MTU, "status": trunkItem.Status, "trunk_tags": trunkItem.TrunkTags, "updated_at": trunkItem.UpdatedAt, diff --git a/internal/service/cloudbroker/trunk/resource_trunk.go b/internal/service/cloudbroker/trunk/resource_trunk.go index b9bdc867..5e4eff96 100644 --- a/internal/service/cloudbroker/trunk/resource_trunk.go +++ b/internal/service/cloudbroker/trunk/resource_trunk.go @@ -37,6 +37,10 @@ func resourceTrunkCreate(ctx context.Context, d *schema.ResourceData, m interfac createReq.Description = description.(string) } + if mtu, ok := d.GetOk("mtu"); ok { + createReq.MTU = uint64(mtu.(int)) + } + accountIDs := make([]uint64, 0) if accountAccess, ok := d.GetOk("account_ids"); ok { @@ -108,11 +112,19 @@ func resourceTrunkUpdate(ctx context.Context, d *schema.ResourceData, m interfac return diag.FromErr(err) } - if d.HasChanges("name", "trunk_tags", "description", "native_vlan_id") { + if d.HasChanges("name", "trunk_tags", "description", "native_vlan_id", "mtu") { req := trunk.UpdateRequest{ - TrunkID: uint64(id), - Name: d.Get("name").(string), - TrunkTags: d.Get("trunk_tags").(string), + TrunkID: uint64(id), + } + + if d.HasChange("name") { + name := d.Get("name").(string) + req.Name = name + } + + if d.HasChange("trunk_tags") { + trunkTags := d.Get("trunk_tags").(string) + req.TrunkTags = trunkTags } if d.HasChange("description") { @@ -125,6 +137,11 @@ func resourceTrunkUpdate(ctx context.Context, d *schema.ResourceData, m interfac req.NativeVLANID = nativeVLANID } + if d.HasChange("mtu") { + mtu := d.Get("mtu").(int) + req.MTU = uint64(mtu) + } + if _, err := c.CloudBroker().Trunk().Update(ctx, req); err != nil { return diag.FromErr(err) } diff --git a/internal/service/cloudbroker/trunk/schema.go b/internal/service/cloudbroker/trunk/schema.go index a22ab4e7..a23264ce 100644 --- a/internal/service/cloudbroker/trunk/schema.go +++ b/internal/service/cloudbroker/trunk/schema.go @@ -62,6 +62,12 @@ func resourceTrunkSchemaMake() map[string]*schema.Schema { Computed: true, Description: "MAC address", }, + "mtu": { + Type: schema.TypeInt, + Optional: true, + Default: 1500, + Description: "Maximum Transmission Unit", + }, "status": { Type: schema.TypeString, Computed: true, @@ -147,6 +153,11 @@ func dataSourceTrunkSchemaMake() map[string]*schema.Schema { Computed: true, Description: "Native VLAN ID", }, + "mtu": { + Type: schema.TypeInt, + Computed: true, + Description: "Maximum Transmission Unit", + }, "status": { Type: schema.TypeString, Computed: true, @@ -303,6 +314,11 @@ func dataSourceTrunkListSchemaMake() map[string]*schema.Schema { Computed: true, Description: "OVS bridge name", }, + "mtu": { + Type: schema.TypeInt, + Computed: true, + Description: "Maximum Transmission Unit", + }, "status": { Type: schema.TypeString, Computed: true, diff --git a/internal/service/cloudbroker/user/flattens.go b/internal/service/cloudbroker/user/flattens.go index 8c3de595..1cf52733 100644 --- a/internal/service/cloudbroker/user/flattens.go +++ b/internal/service/cloudbroker/user/flattens.go @@ -85,7 +85,7 @@ func flattenUserResource(d *schema.ResourceData, details *user.ItemUser) { d.Set("data", details.Data) d.Set("description", details.Description) d.Set("domain", details.Domain) - d.Set("emailaddress", details.Emails) + d.Set("emailaddress", details.Emails[0]) d.Set("gid", details.GID) d.Set("groups", details.Groups) d.Set("guid", details.GUID) diff --git a/internal/service/cloudbroker/user/old_schemas.go b/internal/service/cloudbroker/user/old_schemas.go new file mode 100644 index 00000000..59d31e7e --- /dev/null +++ b/internal/service/cloudbroker/user/old_schemas.go @@ -0,0 +1,156 @@ +package user + +import ( + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" +) + +func resourceUserV1() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "username": { + Type: schema.TypeString, + Required: true, + Description: "ID of user", + }, + "emailaddress": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "Email address of the user", + }, + "password": { + Type: schema.TypeString, + Default: "strongpassword", + Optional: true, + Description: "password of user", + }, + "provider_name": { + Type: schema.TypeString, + Optional: true, + Description: "provider", + ValidateFunc: validation.StringInSlice([]string{"bvs", "decs3o"}, false), + }, + "groups": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "list of groups this user belongs to", + }, + "ckey": { + Type: schema.TypeString, + Computed: true, + Description: "ckey", + }, + "meta": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "meta", + }, + "active": { + Type: schema.TypeBool, + Computed: true, + Description: "active", + }, + "apiaccess": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Description: "list of apiaccess groups this user belongs to", + }, + "blocked": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "is the user blocked", + }, + "authkey": { + Type: schema.TypeString, + Computed: true, + Description: "authkey", + }, + "auth_keys": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "authkeys", + }, + "data": { + Type: schema.TypeString, + Computed: true, + Description: "data", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "description", + }, + "domain": { + Type: schema.TypeString, + Computed: true, + Description: "domain", + }, + "gid": { + Type: schema.TypeInt, + Computed: true, + Description: "gid", + }, + "guid": { + Type: schema.TypeString, + Computed: true, + Description: "guid", + }, + "last_check": { + Type: schema.TypeInt, + Computed: true, + Description: "last_check", + }, + "mobile": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "mobile", + }, + "protected": { + Type: schema.TypeBool, + Computed: true, + Description: "protected", + }, + "roles": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "roles", + }, + "service_account": { + Type: schema.TypeBool, + Computed: true, + Description: "service_account", + }, + "xmpp": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "xmpp", + }, + }, + } +} diff --git a/internal/service/cloudbroker/user/resource_user.go b/internal/service/cloudbroker/user/resource_user.go index a86ee35b..23169725 100644 --- a/internal/service/cloudbroker/user/resource_user.go +++ b/internal/service/cloudbroker/user/resource_user.go @@ -19,18 +19,11 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, m interface username := d.Get("username").(string) - emails := d.Get("emailaddress").([]interface{}) - - emailAddress := make([]string, 0, len(emails)) - - for _, v := range emails { - - emailAddress = append(emailAddress, v.(string)) - } + email := d.Get("emailaddress").(string) createReq := user.CreateRequest{ Username: username, - EmailAddress: emailAddress, + EmailAddress: email, } if passwd, ok := d.GetOk("password"); ok { @@ -144,7 +137,7 @@ func resourceUserDelete(ctx context.Context, d *schema.ResourceData, m interface func ResourceUser() *schema.Resource { return &schema.Resource{ - SchemaVersion: 1, + SchemaVersion: 2, CreateContext: resourceUserCreate, ReadContext: resourceUserRead, @@ -163,6 +156,14 @@ func ResourceUser() *schema.Resource { Default: &constants.Timeout600s, }, + StateUpgraders: []schema.StateUpgrader{ + { + Version: 1, + Type: resourceUserV1().CoreConfigSchema().ImpliedType(), + Upgrade: resourceUserUpgradeV1, + }, + }, + Schema: resourceUserSchemaMake(), } } diff --git a/internal/service/cloudbroker/user/schema.go b/internal/service/cloudbroker/user/schema.go index 164581c3..157d6586 100644 --- a/internal/service/cloudbroker/user/schema.go +++ b/internal/service/cloudbroker/user/schema.go @@ -167,6 +167,11 @@ func dataSourceUserGetAuditSchemaMake() map[string]*schema.Schema { Optional: true, Description: "find all audits after point in time (unixtime)", }, + "sort_by": { + Type: schema.TypeString, + Optional: true, + Description: "sort by one of supported fields, format ±", + }, "timestamp_to": { Type: schema.TypeInt, Optional: true, @@ -416,12 +421,9 @@ func resourceUserSchemaMake() map[string]*schema.Schema { Description: "ID of user", }, "emailaddress": { - Type: schema.TypeList, - Required: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - Description: "email addresses of the user", + Type: schema.TypeString, + Required: true, + Description: "email address of the user", }, "password": { Type: schema.TypeString, diff --git a/internal/service/cloudbroker/user/state_upgrader.go b/internal/service/cloudbroker/user/state_upgrader.go new file mode 100644 index 00000000..35021d33 --- /dev/null +++ b/internal/service/cloudbroker/user/state_upgrader.go @@ -0,0 +1,20 @@ +package user + +import ( + "context" + + log "github.com/sirupsen/logrus" +) + +func resourceUserUpgradeV1(ctx context.Context, rawState map[string]interface{}, meta any) (map[string]interface{}, error) { + log.Debug("resourceUserUpgradeV1: upgrading state from list to string") + + if oldVal, ok := rawState["emailaddress"].([]interface{}); ok && len(oldVal) > 0 { + if firstEmail, ok := oldVal[0].(string); ok { + rawState["emailaddress"] = firstEmail + log.Debugf("resourceUserUpgradeV1: converted emailaddress from list to string: %s", firstEmail) + } + } + + return rawState, nil +} diff --git a/internal/service/cloudbroker/user/utility_user_get_audit.go b/internal/service/cloudbroker/user/utility_user_get_audit.go index 74481b32..709c49d8 100644 --- a/internal/service/cloudbroker/user/utility_user_get_audit.go +++ b/internal/service/cloudbroker/user/utility_user_get_audit.go @@ -60,6 +60,9 @@ func utilityUserGetAuditCheckPresence(ctx context.Context, d *schema.ResourceDat if timestampTo, ok := d.GetOk("timestamp_to"); ok { req.TimestampTo = uint64(timestampTo.(int)) } + if sortBy, ok := d.GetOk("sort_by"); ok { + req.SortBy = sortBy.(string) + } if Page, ok := d.GetOk("page"); ok { req.Page = uint64(Page.(int)) diff --git a/internal/service/cloudbroker/vins/flattens.go b/internal/service/cloudbroker/vins/flattens.go index cca6e405..c9f0da4a 100644 --- a/internal/service/cloudbroker/vins/flattens.go +++ b/internal/service/cloudbroker/vins/flattens.go @@ -156,7 +156,7 @@ func flattenVinsVNFDev(vd vins.VNFDev) []map[string]interface{} { "type": vd.Type, "vnc_password": vd.VNCPassword, "vins": vd.VINS, - "zone_id": vd.ZoneID, + "zone_id": vd.ZoneID, } res = append(res, temp) return res @@ -416,10 +416,10 @@ func flattenVinsMGMT(m vins.MGMT) []map[string]interface{} { func flattenVinsResources(r vins.Resources) []map[string]interface{} { res := make([]map[string]interface{}, 0) temp := map[string]interface{}{ - "cpu": r.CPU, - "ram": r.RAM, - "stack_id": r.StackID, - "uuid": r.UUID, + "cpu": r.CPU, + "ram": r.RAM, + "node_id": r.NodeID, + "uuid": r.UUID, } res = append(res, temp) return res diff --git a/internal/service/cloudbroker/vins/schema.go b/internal/service/cloudbroker/vins/schema.go index 005644a7..b1324032 100644 --- a/internal/service/cloudbroker/vins/schema.go +++ b/internal/service/cloudbroker/vins/schema.go @@ -94,10 +94,10 @@ func dataSourceVinsSchemaMake() map[string]*schema.Schema { Computed: true, Description: "ram", }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Computed: true, - Description: "stack id", + Description: "node id", }, "uuid": { Type: schema.TypeString, @@ -2322,10 +2322,10 @@ func resourceVinsSchemaMake() map[string]*schema.Schema { Computed: true, Description: "ram", }, - "stack_id": { + "node_id": { Type: schema.TypeInt, Computed: true, - Description: "stack id", + Description: "node id", }, "uuid": { Type: schema.TypeString, diff --git a/internal/service/cloudbroker/zone/data_source_zone.go b/internal/service/cloudbroker/zone/data_source_zone.go index 788a21fe..cf5ac633 100644 --- a/internal/service/cloudbroker/zone/data_source_zone.go +++ b/internal/service/cloudbroker/zone/data_source_zone.go @@ -58,6 +58,10 @@ func dataSourceZoneSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Required: true, }, + "auto_start": { + Type: schema.TypeBool, + Computed: true, + }, "guid": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudbroker/zone/data_source_zone_list.go b/internal/service/cloudbroker/zone/data_source_zone_list.go index 0ef22887..6b5c75df 100644 --- a/internal/service/cloudbroker/zone/data_source_zone_list.go +++ b/internal/service/cloudbroker/zone/data_source_zone_list.go @@ -115,6 +115,10 @@ func dataSourceZoneListSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, Required: true, }, + "auto_start": { + Type: schema.TypeBool, + Computed: true, + }, "guid": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudbroker/zone/flattens.go b/internal/service/cloudbroker/zone/flattens.go index 7f933424..a439331f 100644 --- a/internal/service/cloudbroker/zone/flattens.go +++ b/internal/service/cloudbroker/zone/flattens.go @@ -59,6 +59,7 @@ func flattenZone(d *schema.ResourceData, item *zone.RecordZone) error { d.Set("lb_ids", item.LBIDs) d.Set("bservice_ids", item.BserviceIDs) d.Set("k8s_ids", item.K8SIDs) + d.Set("auto_start", item.AutoStart) log.Debugf("flattenZone: decoded RecordZone name %q / ID %d, complete", item.Name, item.ID) @@ -80,6 +81,7 @@ func flattenZoneList(zone *zone.ListZones) []map[string]interface{} { "created_time": zone.CreatedTime, "updated_time": zone.UpdatedTime, "node_ids": zone.NodeIDs, + "auto_start": zone.AutoStart, } res = append(res, temp) } diff --git a/internal/service/cloudbroker/zone/resource_zone.go b/internal/service/cloudbroker/zone/resource_zone.go index 688dd0a4..33eec6f4 100644 --- a/internal/service/cloudbroker/zone/resource_zone.go +++ b/internal/service/cloudbroker/zone/resource_zone.go @@ -56,6 +56,10 @@ func resourceZoneCreate(ctx context.Context, d *schema.ResourceData, m interface Name: zoneName, } + if aS, ok := d.GetOk("auto_start"); ok { + req.AutoStart = aS.(bool) + } + if desc, ok := d.GetOk("description"); ok { req.Description = desc.(string) } @@ -113,7 +117,7 @@ func resourceZoneUpdate(ctx context.Context, d *schema.ResourceData, m interface log.Debugf("resourceZoneUpdate: called Zone with id %d", zoneID) - if d.HasChanges("name", "description", "node_ids") { + if d.HasChanges("name", "description", "node_ids", "auto_start") { if err := utilityZoneUpdate(ctx, d, m, zoneID); err != nil { return diag.FromErr(err) } @@ -193,6 +197,11 @@ func resourceZoneSchemaMake() map[string]*schema.Schema { Type: schema.TypeInt, }, }, + "auto_start": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, "zone_id": { Type: schema.TypeInt, Computed: true, diff --git a/internal/service/cloudbroker/zone/utility_zone.go b/internal/service/cloudbroker/zone/utility_zone.go index 73055cab..7c4dc595 100644 --- a/internal/service/cloudbroker/zone/utility_zone.go +++ b/internal/service/cloudbroker/zone/utility_zone.go @@ -65,7 +65,7 @@ func utilityZoneCheckPresence(ctx context.Context, d *schema.ResourceData, m int func utilityZoneUpdate(ctx context.Context, d *schema.ResourceData, m interface{}, zoneID uint64) error { c := m.(*controller.ControllerCfg) - if d.HasChanges("name", "description") { + if d.HasChanges("name", "description", "auto_start") { req := zone.UpdateRequest{ ID: zoneID, } @@ -77,6 +77,10 @@ func utilityZoneUpdate(ctx context.Context, d *schema.ResourceData, m interface{ req.Description = d.Get("description").(string) } + if d.HasChange("auto_start") { + req.AutoStart = d.Get("auto_start").(bool) + } + _, err := c.CloudBroker().Zone().Update(ctx, req) if err != nil { return err diff --git a/samples/README.md b/samples/README.md index bbfca80b..3de8b26c 100644 --- a/samples/README.md +++ b/samples/README.md @@ -91,8 +91,7 @@ - security_group_list - sep_and_pools_available_list - snapshot_list - - stack - - stack_list + - storage_policy - storage_policy_list - trunk @@ -184,7 +183,6 @@ - cb_grid_post_status - cb_image - cb_image_list - - cb_image_list_stacks - cb_k8ci - cb_k8ci_list - cb_k8ci_list_deleted @@ -241,8 +239,6 @@ - cb_sep_disk_list - cb_sep_list - cb_sep_pool - - cb_stack - - cb_stack_list - cb_storage_policy - cb_storage_policy_list - cb_trunk diff --git a/samples/cloudapi/account/data_account_consumed_units_by_type/main.tf b/samples/cloudapi/account/data_account_consumed_units_by_type/main.tf index 3868713d..d74264f0 100644 --- a/samples/cloudapi/account/data_account_consumed_units_by_type/main.tf +++ b/samples/cloudapi/account/data_account_consumed_units_by_type/main.tf @@ -44,7 +44,6 @@ data "decort_account_consumed_units_by_type" "acubt" { #CU_M - кол-во RAM, в МБ #CU_D - кол-во используемой дисковой памяти, в ГБ #CU_I - кол-во публичных ip адресов - #CU_NP - кол-во полученного/отданного трафика, в ГБ #CU_DM - кол-во доступной дисковой памяти, в ГБ #gpu_units - кол-во GPU cu_type = "CU_C" diff --git a/samples/cloudapi/account/resource_account/main.tf b/samples/cloudapi/account/resource_account/main.tf index c8a60ad2..a82fdead 100644 --- a/samples/cloudapi/account/resource_account/main.tf +++ b/samples/cloudapi/account/resource_account/main.tf @@ -113,12 +113,6 @@ resource "decort_account" "a" { #если установлена -1 - кол-во неограничено #cu_i = 2 - #ограничения на кол-во передачи данных, в ГБ - #опциональный параметр - #тип - целое число - #если установлена -1 - кол-во неограничено - #cu_np = 2 - #кол-во графических процессоров #опциональный параметр #тип - целое число diff --git a/samples/cloudapi/bservice/resource_bservice_group/main.tf b/samples/cloudapi/bservice/resource_bservice_group/main.tf index 8487bf6d..e232d242 100644 --- a/samples/cloudapi/bservice/resource_bservice_group/main.tf +++ b/samples/cloudapi/bservice/resource_bservice_group/main.tf @@ -130,11 +130,11 @@ resource "decort_bservice_group" "bsg" { #чипсет для добавляемых виртуальных машин #возможные значения - i440fx, Q35 - #по умолчанию - i440fx + #по умолчанию - Q35 #опциональный параметр #тип - строка #используется при создании - #chipset = "i440fx" + #chipset = "Q35" #id групп родителей #опциональный параметр @@ -177,14 +177,6 @@ resource "decort_bservice_group" "bsg" { #используется при обновлении #по умолчанию - "RELATIVE" #mode = "RELATIVE" - - #драйвер - #опциональный параметр - #возможные значения - "KVM_X86" - #тип - строка - #используется при создании - #по умолчанию - "KVM_X86" - #driver = "KVM_X86" } output "test" { diff --git a/samples/cloudapi/disk/resource_disk/main.tf b/samples/cloudapi/disk/resource_disk/main.tf index 184abb78..fe9339ce 100644 --- a/samples/cloudapi/disk/resource_disk/main.tf +++ b/samples/cloudapi/disk/resource_disk/main.tf @@ -66,9 +66,18 @@ resource "decort_disk" "acl" { #флаг, отвечающий за доступность диска другим ресурсам #опциональный параметр #тип - строка + #возможные значенния - "none", "writethrough" #используется при создании и обновлении #shareable = false + #установка режима кэширования + #опциональный параметр + #тип - строка + #возможные значенния - "none", "writethrough" + #значение по умолчанию - none + #используется при создании + #cache = "none" + } output "test" { diff --git a/samples/cloudapi/flipgroup/data_flipgroup_list/main.tf b/samples/cloudapi/flipgroup/data_flipgroup_list/main.tf index 59c61b4b..3be25dac 100644 --- a/samples/cloudapi/flipgroup/data_flipgroup_list/main.tf +++ b/samples/cloudapi/flipgroup/data_flipgroup_list/main.tf @@ -57,12 +57,6 @@ data "decort_flipgroup_list" "fg" { #тип - строка #by_ip = "1.1.1.1.1" - #фильтр по id ресурсной группы - #опциональный параметр - #тип - целое число - #если не задан - выводятся все доступные данные - #rg_id = 11111 - #сортировка по одному из поддерживаемых полей #опциональный параметр #тип - строка diff --git a/samples/cloudapi/k8s/resource_k8s/main.tf b/samples/cloudapi/k8s/resource_k8s/main.tf index 37b33bcf..302abb99 100644 --- a/samples/cloudapi/k8s/resource_k8s/main.tf +++ b/samples/cloudapi/k8s/resource_k8s/main.tf @@ -167,7 +167,9 @@ resource "decort_k8s" "cluster" { #тип эмулируемой системы #опциональный параметр #тип - строка - #chipset = "i440fx" + #возможные значения: "i440fx", "Q35" + #по умолчанию - Q35 + #chipset = "Q35" #} #далее можно создавать произвольное кол-во дополнительных worker групп @@ -211,7 +213,9 @@ resource "decort_k8s" "cluster" { #тип эмулируемой системы #опциональный параметр #тип - строка - #chipset = "i440fx" + #возможные значения: "i440fx", "Q35" + #по умолчанию - Q35 + #chipset = "Q35" #список лейблов #опциональный параметр @@ -329,8 +333,10 @@ resource "decort_k8s" "cluster" { #тип эмулируемой системы #опциональный параметр #тип - строка + #возможные значения: "i440fx", "Q35" + #по умолчанию - Q35 #используется при создании - #chipset = "i440fx" + #chipset = "Q35" #запуск,остановка кластера #опциональный параметр diff --git a/samples/cloudapi/k8s/resource_k8s_wg/main.tf b/samples/cloudapi/k8s/resource_k8s_wg/main.tf index 544e3606..e337d0a1 100644 --- a/samples/cloudapi/k8s/resource_k8s_wg/main.tf +++ b/samples/cloudapi/k8s/resource_k8s_wg/main.tf @@ -72,8 +72,10 @@ resource "decort_k8s_wg" "wg" { #тип эмулируемой системы #опциональный параметр #тип - строка + #возможные значения: "i440fx", "Q35" + #по умолчанию - Q35 #используется при создании - #chipset = "i440fx" + #chipset = "Q35" #размер загрузочного диска для worker node, в ГБ #опциональный параметр diff --git a/samples/cloudapi/kvmvm/resource_kvmvm/main.tf b/samples/cloudapi/kvmvm/resource_kvmvm/main.tf index 454ac4b0..08dab2e2 100644 --- a/samples/cloudapi/kvmvm/resource_kvmvm/main.tf +++ b/samples/cloudapi/kvmvm/resource_kvmvm/main.tf @@ -221,7 +221,7 @@ resource "decort_kvmvm" "comp" { #key = "testkey" #ключ правила - #опциональный параметр + #обязательный параметр #тип - строка #value = "testvalue" #} @@ -256,7 +256,7 @@ resource "decort_kvmvm" "comp" { #key = "testkey" #ключ правила - #опциональный параметр + #обязательный параметр #тип -строка #value = "testvalue" #} @@ -341,6 +341,12 @@ resource "decort_kvmvm" "comp" { #опциональный параметр #тип - булев #enabled = true + + #маска подсети + #используется только с сетями типа "DPDK" и "VFNIC" + #опциональный параметр + #тип - целое число + #net_mask = 32 #} #группы безопасности @@ -473,14 +479,14 @@ resource "decort_kvmvm" "comp" { #cdrom_id = 344 #} - #добавить компьют на стэк + #добавить компьют на ноду #опциональный параметр #тип - булев #используется при создании и обновлении - #pin_to_stack = true + #pin_to_node = true #список ядер для использования в механизме vcpupinning. Количество указанных ядер должно быть равно количеству виртуальных процессоров ВМ - #игнорируется если cpu_pin=false или pin_to_stack=false + #игнорируется если cpu_pin=false или pin_to_node=false #опциональный параметр #тип - массив целых чисел #используется при создании и обновлении diff --git a/samples/cloudapi/lb/resource_lb/main.tf b/samples/cloudapi/lb/resource_lb/main.tf index c88f03d8..1cf821d1 100644 --- a/samples/cloudapi/lb/resource_lb/main.tf +++ b/samples/cloudapi/lb/resource_lb/main.tf @@ -58,13 +58,13 @@ resource "decort_lb" "lb" { #vins_id = 758 #флаг запуска load balancer - #обязательный параметр + #опциональный параметр #если load balancer был в статусе "stopped" (start = false), #то для успешного старта, он должен быть доступен (enable = true) #по умолчанию - true #тип - булев #используется при создании и обновлении - start = true + #start = true #создать схему отказоустойчивой LB #опциональный параметр diff --git a/samples/cloudapi/rg/resource_rg/main.tf b/samples/cloudapi/rg/resource_rg/main.tf index 0974d0db..994d1853 100644 --- a/samples/cloudapi/rg/resource_rg/main.tf +++ b/samples/cloudapi/rg/resource_rg/main.tf @@ -154,12 +154,6 @@ resource "decort_resgroup" "rg" { #тип - целое число #disk = 180 - #максимальное количество отправленных/полученных сетевых узлов - #опциональный параметр - #по умолчанию: -1 - #тип - целое число - #ext_traffic = 21 - #максимальное количество назначенных общедоступных IP-адресов #опциональный параметр #по умолчанию: -1 diff --git a/samples/cloudapi/stack/data_stack/main.tf b/samples/cloudapi/stack/data_stack/main.tf deleted file mode 100644 index c22c3957..00000000 --- a/samples/cloudapi/stack/data_stack/main.tf +++ /dev/null @@ -1,38 +0,0 @@ -/* -Пример использования -Получение stack по его id -*/ - -#Раскомментируйте этот код, -#и внесите необходимые правки в версию и путь, -#чтобы работать с установленным вручную (не через hashicorp provider registry) провайдером -/* -terraform { - required_providers { - decort = { - source = "basis/decort/decort" - version = "" - } - } -} -*/ - -provider "decort" { - authenticator = "decs3o" - #controller_url = - controller_url = "https://ds1.digitalenergy.online" - #oauth2_url = - oauth2_url = "https://sso.digitalenergy.online" - allow_unverified_ssl = true -} - -data "decort_stack" "stack" { - #идентификатор стека - #обязательный параметр - #тип - целое число - stack_id = 2 -} - -output "test" { - value = data.decort_stack.stack -} diff --git a/samples/cloudapi/stack/data_stack_list/main.tf b/samples/cloudapi/stack/data_stack_list/main.tf deleted file mode 100644 index 9b915975..00000000 --- a/samples/cloudapi/stack/data_stack_list/main.tf +++ /dev/null @@ -1,71 +0,0 @@ -/* -Пример использования -Получение списка stack -*/ - -#Раскомментируйте этот код, -#и внесите необходимые правки в версию и путь, -#чтобы работать с установленным вручную (не через hashicorp provider registry) провайдером -/* -terraform { - required_providers { - decort = { - source = "basis/decort/decort" - version = "" - } - } -} -*/ - -provider "decort" { - authenticator = "decs3o" - #controller_url = - controller_url = "https://ds1.digitalenergy.online" - #oauth2_url = - oauth2_url = "https://sso.digitalenergy.online" - allow_unverified_ssl = true -} -data "decort_stack_list" "stack_list" { - #фильтрация списка для получения информации о конкретном stack по его id - #опциональный параметр - #тип - целое число - #by_id = 2 - - #фильтрация списка для получения информации о конкретном stack по его имени - #опциональный параметр - #тип - строка - #name = "alpha-cpu-04" - - #фильтрация списка для получения информации о конкретном stack по его типу - #опциональный параметр - #тип - строка - #type = "KVM" - - #фильтрация списка для получения информации о конкретном stack по его статусу - #опциональный параметр - #тип - строка - #status = "ENABLED" - - #сортировка по одному из поддерживаемых полей - #опциональный параметр - #тип - строка - #формат - "+поле" по возрастанию / "-поле" по убыванию - #sort_by = "+name" - - #номер страницы для отображения - #опциональный параметр - #тип - целое число - #если не задан - выводятся все доступные данные - #page = 2 - - #размер страницы - #опциональный параметр - #тип - целое число - #если не задан - выводятся все доступные данные - #size = 3 -} - -output "test" { - value = data.decort_stack_list.stack_list -} - diff --git a/samples/cloudapi/stpolicy/data_storage_policy_list/main.tf b/samples/cloudapi/stpolicy/data_storage_policy_list/main.tf index d986dca9..5fed6ea3 100644 --- a/samples/cloudapi/stpolicy/data_storage_policy_list/main.tf +++ b/samples/cloudapi/stpolicy/data_storage_policy_list/main.tf @@ -87,6 +87,12 @@ data "decort_storage_policy_list" "lsp" { #опциональный параметр #тип - строка #pool_name = "name" + + #сортировка по статусу SEP + #опциональный параметр + #тип - строка + #возможные значения - ENABLED, DISABLED + #sep_tech_status = "ENABLED" } output "test" { diff --git a/samples/cloudbroker/account/resource_account/main.tf b/samples/cloudbroker/account/resource_account/main.tf index dfe0d706..c17c8ed9 100644 --- a/samples/cloudbroker/account/resource_account/main.tf +++ b/samples/cloudbroker/account/resource_account/main.tf @@ -104,12 +104,6 @@ resource "decort_cb_account" "acc" { #если установлена -1 - кол-во неограничено #cu_i = 2 - #ограничения на кол-во передачи данных, в ГБ - #опциональный параметр - #тип - целое число - #если установлена -1 - кол-во неограничено - #cu_np = 2 - #кол-во графических процессоров #опциональный параметр #тип - целое число diff --git a/samples/cloudbroker/disk/resource_disk/main.tf b/samples/cloudbroker/disk/resource_disk/main.tf index 59171bc9..5dd84e60 100644 --- a/samples/cloudbroker/disk/resource_disk/main.tf +++ b/samples/cloudbroker/disk/resource_disk/main.tf @@ -98,6 +98,13 @@ resource "decort_cb_disk" "my_disk01" { #используется при создании и обновлении #shareable = true + #установка режима кэширования + #опциональный параметр + #тип - строка + #значение по умолчанию - none + #используется при создании и обновлении + #cache = "none" + #флаг отсоединения диска от машины перед удалением #опциональный параметр #тип - булев @@ -124,6 +131,13 @@ resource "decort_cb_disk" "my_disk01" { #write_iops_sec = 0 #write_iops_sec_max = 0 #} + + #включение режима unmap для диска + #опциональный параметр + #тип - булев + #по умолчанию - false + #используется при создании и обновлении + #blk_discard = false } output "test" { diff --git a/samples/cloudbroker/extnet/resource_extnet/main.tf b/samples/cloudbroker/extnet/resource_extnet/main.tf index caf7b7ca..15504c78 100644 --- a/samples/cloudbroker/extnet/resource_extnet/main.tf +++ b/samples/cloudbroker/extnet/resource_extnet/main.tf @@ -210,7 +210,7 @@ resource "decort_cb_extnet" "new_extnet" { #ips = ["192.168.10.10", "192.168.10.20"] #} - #id stack на который происходит миграция + #id node на который происходит миграция #опциональный параметр #тип - целое число #используется при обновлении diff --git a/samples/cloudbroker/image/data_image_list_stacks/main.tf b/samples/cloudbroker/image/data_image_list_stacks/main.tf deleted file mode 100644 index 1d2c0443..00000000 --- a/samples/cloudbroker/image/data_image_list_stacks/main.tf +++ /dev/null @@ -1,76 +0,0 @@ -/* -Данный datasource является **deprecated** и будет удалён в следующих версиях. -*/ - -/* -Пример использования -Получение списка stack по id образа -*/ - -#Раскомментируйте этот код, -#и внесите необходимые правки в версию и путь, -#чтобы работать с установленным вручную (не через hashicorp provider registry) провайдером -/* -terraform { - required_providers { - decort = { - source = "basis/decort/decort" - version = "" - } - } -} -*/ - -provider "decort" { - authenticator = "decs3o" - #controller_url = - controller_url = "https://ds1.digitalenergy.online" - #oauth2_url = - oauth2_url = "https://sso.digitalenergy.online" - allow_unverified_ssl = true -} - -data "decort_cb_image_list_stacks" "im" { - #id образа - #обязательный параметр - #тип - целое число - image_id = 6040 - - #фильтр по имени образа - #опциональный параметр - #тип - строка - #name = "test" - - #фильтр по статусу - #опциональный параметр - #тип - строка - #status = "ENABLED" - - #фильтр по типу образа - #опциональный параметр - #тип - строка - #type_image = "cdrom" - - #сортировка по одному из поддерживаемых полей - #опциональный параметр - #формат - "+поле" по возрастанию / "-поле" по убыванию - #тип - строка - #sort_by = "+name" - - #номер страницы для отображения - #опциональный параметр - #если не задан - отображается вся доступная информация - #тип - целое число - #page = 2 - - #количество отображаемых объектов на странице - #опциональный параметр - #если не задан - отображается вся доступная информация - #тип - целое число - #size = 3 - -} - -output "test" { - value = data.decort_cb_image_list_stacks.im -} diff --git a/samples/cloudbroker/k8s/resource_k8s_cp/main.tf b/samples/cloudbroker/k8s/resource_k8s_cp/main.tf index fa58b6bc..4249f4b6 100644 --- a/samples/cloudbroker/k8s/resource_k8s_cp/main.tf +++ b/samples/cloudbroker/k8s/resource_k8s_cp/main.tf @@ -211,8 +211,10 @@ resource "decort_cb_k8s_cp" "cp" { #тип эмулируемой системы #опциональный параметр #тип - строка + #возможные значения: "i440fx", "Q35" + #по умолчанию - Q35 #используется при создании - #chipset = "i440fx" + #chipset = "Q35" #пользовательские значения sysctl для LB #опциональный параметр diff --git a/samples/cloudbroker/k8s/resource_k8s_wg/main.tf b/samples/cloudbroker/k8s/resource_k8s_wg/main.tf index e32c6213..38c1e350 100644 --- a/samples/cloudbroker/k8s/resource_k8s_wg/main.tf +++ b/samples/cloudbroker/k8s/resource_k8s_wg/main.tf @@ -114,8 +114,10 @@ resource "decort_cb_k8s_wg" "wg" { #тип эмулируемой системы #опциональный параметр #тип - строка + #возможные значения: "i440fx", "Q35" + #по умолчанию - Q35 #используется при создании - #chipset = "i440fx" + #chipset = "Q35" } diff --git a/samples/cloudbroker/kvmvm/data_kvmvm_list/main.tf b/samples/cloudbroker/kvmvm/data_kvmvm_list/main.tf index ec392940..1a9f3695 100644 --- a/samples/cloudbroker/kvmvm/data_kvmvm_list/main.tf +++ b/samples/cloudbroker/kvmvm/data_kvmvm_list/main.tf @@ -56,10 +56,10 @@ data "decort_cb_kvmvm_list" "compute_list" { #тип - строка #tech_status = "STOPPED" - #фильтр по названию вычислительного узла + #фильтр по названию ноды #опциональный параметр #тип - строка - #stack_name = "stack_name" + #node_name = "node_name" #фильтр по статусу #опциональный параметр @@ -71,10 +71,10 @@ data "decort_cb_kvmvm_list" "compute_list" { #тип - строка #ip_address = "test" - #фильтр по stack id + #фильтр по node id #опциональный параметр #тип - целое число - #stack_id = 123 + #node_id = 123 #фильтр по cd image id #опциональный параметр diff --git a/samples/cloudbroker/kvmvm/resource_kvmvm/main.tf b/samples/cloudbroker/kvmvm/resource_kvmvm/main.tf index 59c3b3fb..81823b26 100644 --- a/samples/cloudbroker/kvmvm/resource_kvmvm/main.tf +++ b/samples/cloudbroker/kvmvm/resource_kvmvm/main.tf @@ -65,8 +65,9 @@ resource "decort_cb_kvmvm" "comp" { #опциональный параметр #тип - строка #возможные значения: "i440fx", "Q35" + #по умолчанию - Q35 #используется при создании и обновлении - #chipset = "i440fx" + #chipset = "Q35" #id образа диска для создания compute #опциональный параметр @@ -88,6 +89,14 @@ resource "decort_cb_kvmvm" "comp" { #используется при создании и обновлении #boot_disk_size = 20 + #установка режима кэширования для загрузочного диска + #опциональный параметр + #тип - строка + #значение по умолчанию - none + #возможные варианты: "none" или "writethrough" + #используется при создании и обновлении + #boot_disk_cache = "none" + #id сепа для boot диска #опциональный параметр #тип - целое число @@ -112,11 +121,11 @@ resource "decort_cb_kvmvm" "comp" { #используется при создании и обновлении #description = "test update description in tf words update" - #stack id + #node id #опциональный параметр #тип - целое число #используется при создании - #stack_id = 1 + #node_id = 1 #id образа CD-ROM для загрузки #опциональный параметр @@ -146,7 +155,16 @@ resource "decort_cb_kvmvm" "comp" { #используется при создании и обновлении #hp_backed = true + #установка режима "только для чтения", который позволяет лишь получать информацию о ВМ, ничего в ней не менять + #опциональный параметр + #тип - булев + #значение по умолчанию - false + #используется при создании и обновлении + #read_only = false + #создание и добавление диска для compute + #при изменении параметров `pool` и `sep_id` для обновления ресурса может возникнуть необходимость синхронизации + #состояния при помощи команды `terraform refresh` #опциональный параметр #тип - список дисков #используется при создании и обновлении @@ -166,6 +184,13 @@ resource "decort_cb_kvmvm" "comp" { #тип - целое число #storage_policy_id = 1 + #установка режима кэширования + #опциональный параметр + #тип - строка + #значение по умолчанию - none + #возможные варианты: "none" или "writethrough" + #cache = "none" + #тип диска #опциональный параметр #тип - строка @@ -198,6 +223,12 @@ resource "decort_cb_kvmvm" "comp" { #опциональный параметр #тип - булев #permanently = false + + #включение режима unmap для диска + #опциональный параметр + #тип - булев + #по умолчанию - false + #blk_discard = false #} #правила affinity @@ -230,7 +261,7 @@ resource "decort_cb_kvmvm" "comp" { #key = "testkey" #ключ правила - #опциональный параметр + #обязательный параметр #тип - строка #value = "testvalue" #} @@ -265,7 +296,7 @@ resource "decort_cb_kvmvm" "comp" { #key = "testkey" #ключ правила - #опциональный параметр + #обязательный параметр #тип - строка #value = "testvalue" #} @@ -355,6 +386,12 @@ resource "decort_cb_kvmvm" "comp" { #опциональный параметр #тип - булев #enabled = true + + #маска подсети + #используется только с сетями типа "DPDK" и "VFNIC" + #опциональный параметр + #тип - целое число + #net_mask = 32 #} #группы безопасности @@ -487,14 +524,14 @@ resource "decort_cb_kvmvm" "comp" { #cdrom_id = 344 #} - #добавить компьют на стэк + #добавить компьют на ноду #опциональный параметр #тип - булев #используется при создании и обновлении - #pin_to_stack = true + #pin_to_node = true #список ядер для использования в механизме vcpupinning. Количество указанных ядер должно быть равно количеству виртуальных процессоров ВМ - #игнорируется если cpu_pin=false или pin_to_stack=false + #игнорируется если cpu_pin=false или pin_to_node=false #опциональный параметр #тип - массив целых чисел #используется при создании и обновлении @@ -506,7 +543,7 @@ resource "decort_cb_kvmvm" "comp" { #используется при создании и обновлении #auto_start_w_node = true - #флаг для принудительного добавления компьюта на стэк + #флаг для принудительного добавления компьюта на ноду #опциональный параметр #тип - булев #используется при создании и обновлении @@ -661,7 +698,14 @@ resource "decort_cb_kvmvm" "comp" { #опциональный параметр #тип - строка #используется при создании и обновлении - #os_version = "name" + #os_version = "name" + + #включение режима unmap для boot диска + #опциональный параметр + #тип - булев + #по умолчанию - false + #используется при создании и обновлении + #boot_disk_blk_discard = false } output "test" { diff --git a/samples/cloudbroker/lb/resource_lb/main.tf b/samples/cloudbroker/lb/resource_lb/main.tf index 741acd50..ab440481 100644 --- a/samples/cloudbroker/lb/resource_lb/main.tf +++ b/samples/cloudbroker/lb/resource_lb/main.tf @@ -58,7 +58,7 @@ resource "decort_cb_lb" "lb" { #vins_id = 758 #флаг запуска load balancer - #обязательный параметр + #опциональный параметр #если load balancer был в статусе "stopped" (start = false), #то для успешного старта, он должен быть доступен (enable = true) #по умолчанию - true diff --git a/samples/cloudbroker/pcidevice/resource_pcidevice/main.tf b/samples/cloudbroker/pcidevice/resource_pcidevice/main.tf index 60c2cb76..4b799f9d 100644 --- a/samples/cloudbroker/pcidevice/resource_pcidevice/main.tf +++ b/samples/cloudbroker/pcidevice/resource_pcidevice/main.tf @@ -55,11 +55,11 @@ resource "decort_cb_pcidevice" "pd" { #используется при создании rg_id = 1111 - #id стака устройства + #id ноды устройства #обязательный параметр #тип - целое число #используется при создании - stack_id = 11 + node_id = 11 #доступность устройства #опциональный параметр diff --git a/samples/cloudbroker/rg/resource_rg/main.tf b/samples/cloudbroker/rg/resource_rg/main.tf index 77a20144..3848d083 100644 --- a/samples/cloudbroker/rg/resource_rg/main.tf +++ b/samples/cloudbroker/rg/resource_rg/main.tf @@ -73,11 +73,6 @@ resource "decort_cb_rg" "rg" { #опциональный параметр #тип - целое число #cu_m = 12 - - #максимальный пиринг отправленных/принятых сетевых передач - #опциональный параметр - #тип - целое число - #cu_np = 12 #} #имя владельца ресурсной группы diff --git a/samples/cloudbroker/sep/data_sep_list/main.tf b/samples/cloudbroker/sep/data_sep_list/main.tf index 750aa6b3..0a6b8669 100644 --- a/samples/cloudbroker/sep/data_sep_list/main.tf +++ b/samples/cloudbroker/sep/data_sep_list/main.tf @@ -77,6 +77,11 @@ data "decort_cb_sep_list" "sl" { #опциональный параметр #тип - целое число #size = 2 + + #сортировка по списку идентификаторов SEP + #опциональный параметр + #тип - массив целых чисел + #sep_ids = [2, 4, 5] } output "test" { diff --git a/samples/cloudbroker/sep/data_sep_template/main.tf b/samples/cloudbroker/sep/data_sep_template/main.tf index b2d8ec36..666ffb1f 100644 --- a/samples/cloudbroker/sep/data_sep_template/main.tf +++ b/samples/cloudbroker/sep/data_sep_template/main.tf @@ -28,7 +28,7 @@ provider "decort" { data "decort_cb_sep_template" "compute_template" { #тип сеп - #возможные значения - hitachi, dorado, tatlin, shared, local, des + #возможные значения - des, hitachi, dorado, tatlin, shared, local, ustor #обязательный параметр #тип - строка sep_type = "dorado" diff --git a/samples/cloudbroker/sep/resource_sep/main.tf b/samples/cloudbroker/sep/resource_sep/main.tf index ca8342a3..4bc5c21d 100644 --- a/samples/cloudbroker/sep/resource_sep/main.tf +++ b/samples/cloudbroker/sep/resource_sep/main.tf @@ -44,7 +44,7 @@ resource "decort_cb_sep" "s" { #тип sep #обязательный параметр - #возможные значения - des, dorado, tatlin, hitachi, ovs, local, shared + #возможные значения - des, dorado, tatlin, hitachi, local, shared, ustor #тип - строка #используется при создании type = "des" diff --git a/samples/cloudbroker/stack/data_stack/main.tf b/samples/cloudbroker/stack/data_stack/main.tf deleted file mode 100644 index dfc5427a..00000000 --- a/samples/cloudbroker/stack/data_stack/main.tf +++ /dev/null @@ -1,39 +0,0 @@ -/* -Пример использования -Получение стека по id -*/ - -#Раскомментируйте этот код, -#и внесите необходимые правки в версию и путь, -#чтобы работать с установленным вручную (не через hashicorp provider registry) провайдером -/* -terraform { - required_providers { - decort = { - source = "basis/decort/decort" - version = "" - } - } -} -*/ - -provider "decort" { - authenticator = "decs3o" - #controller_url = - controller_url = "https://ds1.digitalenergy.online" - #oauth2_url = - oauth2_url = "https://sso.digitalenergy.online" - allow_unverified_ssl = true -} - -data "decort_cb_stack" "stack" { - #id стека - #обязательный параметр - #тип - целое число - stack_id = 1 - -} - -output "test" { - value = data.decort_cb_stack.stack -} diff --git a/samples/cloudbroker/stack/data_stack_list/main.tf b/samples/cloudbroker/stack/data_stack_list/main.tf deleted file mode 100644 index 24048f20..00000000 --- a/samples/cloudbroker/stack/data_stack_list/main.tf +++ /dev/null @@ -1,70 +0,0 @@ -/* -Пример использования -Получение списка стеков -*/ - -#Раскомментируйте этот код, -#и внесите необходимые правки в версию и путь, -#чтобы работать с установленным вручную (не через hashicorp provider registry) провайдером -/* -terraform { - required_providers { - decort = { - source = "basis/decort/decort" - version = "" - } - } -} -*/ - -provider "decort" { - authenticator = "decs3o" - #controller_url = - controller_url = "https://ds1.digitalenergy.online" - #oauth2_url = - oauth2_url = "https://sso.digitalenergy.online" - allow_unverified_ssl = true -} - -data "decort_cb_stack_list" "sl" { - #фильтр стеков по id - #опциональный параметр - #тип - целое число - #by_id = 111 - - #фильтр по имени стека - #опциональный параметр - #тип - строка - #name = "name" - - #фильтр по типу - #опциональный параметр - #тип - строка - #type = "type" - - #фильтр по статусу - #опциональный параметр - #тип - строка - #status = "status" - - #сортировка по одному из поддерживаемых полей - #опциональный параметр - #тип - строка - #формат - "+поле" по возрастанию / "-поле" по убыванию - #sort_by = "+name" - - #номер страницы для отображения - #опциональный параметр - #тип - целое число - #page = 2 - - #размер страницы - #опциональный параметр - #тип - целое число - #size = 3 - -} - -output "test" { - value = data.decort_cb_stack_list.sl -} diff --git a/samples/cloudbroker/stpolicy/data_storage_policy_list/main.tf b/samples/cloudbroker/stpolicy/data_storage_policy_list/main.tf index 1c0ed906..8eb5487a 100644 --- a/samples/cloudbroker/stpolicy/data_storage_policy_list/main.tf +++ b/samples/cloudbroker/stpolicy/data_storage_policy_list/main.tf @@ -87,7 +87,12 @@ data "decort_cb_storage_policy_list" "lsp" { #опциональный параметр #тип - строка #pool_name = "name" - + + #сортировка по статусу SEP + #опциональный параметр + #тип - строка + #возможные значения - ENABLED, DISABLED + #sep_tech_status = "ENABLED" } output "test" { diff --git a/samples/cloudbroker/trunk/resource_trunk/main.tf b/samples/cloudbroker/trunk/resource_trunk/main.tf index 8516f752..f354e685 100644 --- a/samples/cloudbroker/trunk/resource_trunk/main.tf +++ b/samples/cloudbroker/trunk/resource_trunk/main.tf @@ -73,6 +73,13 @@ resource "decort_cb_trunk" "name" { #используется при создании и обновлении #по умолчанию - true #enable = true + + #максимальная единица передачи + #опциональный параметр + #тип - целое число + #используется при создании и обновлении + #по умолчанию - 1500 + #mtu = 1500 } output "test" { diff --git a/samples/cloudbroker/user/data_user_get_audit/main.tf b/samples/cloudbroker/user/data_user_get_audit/main.tf index 8e463f48..af4e0e5b 100644 --- a/samples/cloudbroker/user/data_user_get_audit/main.tf +++ b/samples/cloudbroker/user/data_user_get_audit/main.tf @@ -53,6 +53,13 @@ data "decort_cb_user_get_audit" "audits" { #тип - целое число #timestamp_to = 123456 + #сортировка по одному из поддерживаемых полей + #опциональный параметр + #формат - "+поле" по возрастанию / "-поле" по убыванию + #значение по умолчанию - -timestamp + #тип - строка + #sort_by = "-timestamp" + #номер страницы для отображения #опциональный параметр #тип - целое число diff --git a/samples/cloudbroker/user/resource_user/main.tf b/samples/cloudbroker/user/resource_user/main.tf index 82baf397..039810d5 100644 --- a/samples/cloudbroker/user/resource_user/main.tf +++ b/samples/cloudbroker/user/resource_user/main.tf @@ -39,9 +39,9 @@ resource "decort_cb_user" "user" { #email адрес пользователя #обязательный параметр - #тип - массив строк + #тип - строка #используется при создании - emailaddress = ["user1@example.com"] + emailaddress = "user1@example.com" #пароль пользователя #значение по умолчанию – strongpassword diff --git a/samples/cloudbroker/zone/resource_zone/main.tf b/samples/cloudbroker/zone/resource_zone/main.tf index b68b115e..e38b7b0e 100644 --- a/samples/cloudbroker/zone/resource_zone/main.tf +++ b/samples/cloudbroker/zone/resource_zone/main.tf @@ -49,6 +49,13 @@ resource "decort_cb_zone" "zone" { #тип - массив целых чисел #используется при создании и обновлении #node_ids = [1,2,3] + + #автостарт ноды + #опциональный параметр + #тип - булев + #по умолчанию - false + #используется при создании и обновлении + #auto_start = false } output "test" {