diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a6dd7a..2e947d4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,13 +1,110 @@
-## Version 1.2.2
+## Version 1.3.0
-### Исправлено
+### Добавлено
+
+#### account
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BATF-900 | Опциональное поле `desc` в resource `dynamix_account` |
+| BATF-900 | Вычисляемое поле `desc` в datasource `dynamix_account_list`, `dynamix_account_deleted_list`, `dynamix_account` и `dynamix_account_rg_list` |
+| BATF-904 | Опциональное поле `reason` в resource `dynamix_account` |
#### bservice
| Идентификатор
задачи | Описание |
| --- | --- |
-| BATF-879 | Исправлена работа resources `dynamix_bservice` и `dynamix_bservice_group` в cloudapi/bservice |
+| BATF-905 | Опциональное поле `chipset` в resource `dynamix_bservice_group` |
+| BATF-906 | Вычисляемое поле `chipset` в datasource `dynamix_bservice_group` |
+
+#### disks
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BATF-914 | Вычисляемые поля `size_available`, `updated_by`, `deleted_by`, `created_by`, `updated_time` и `milestones` в datasource `dynamix_disk_list` и `dynamix_disk_list_deleted` |
+| BATF-914 | Вычисляемые поля `size_available`, `updated_by`, `deleted_by`, `created_by`, `updated_time`, `machine_id`, `machine_name` и `milestones` в datasource `dynamix_disk` |
+| BATF-914 | Вычисляемые поля `machine_id`, `machine_name`, `updated_by`, `deleted_by`, `created_by` и `updated_time` в resource `dynamix_disk` |
+
+#### extnet
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BATF-907 | Опциональное поле `ovs_bridge` в datasource `dynamix_extnet_list` |
+| BATF-911 | Вычисляемое поле `ntp` в datasource `dynamix_extnet` |
+
+#### image
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BATF-903 | Вычисляемое поле `snapshot_id` в datasource `dynamix_image` и resource `dynamix_image` |
+| BATF-942 | Вычисляемое поле `snapshot_id` в resource `resource_image` |
+| BATF-942 | Вычисляемые поля `cd_presented_to`, `snapshot_id` и `network_interface_naming` в resource `resource_image_virtual` |
+
+#### k8s
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BATF-900 | Вычисляемое поле `desc` в datasource `dynamix_k8s` |
+
+#### kvmvm
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BATF-901 | Опциональные поля `loader_type`, `boot_type`, `hot_resize`, `network_interface_naming` в resource `dynamix_kvmvm` |
+| BATF-901 | Вычисляемые поля `loader_type`, `boot_type`, `hot_resize`, `network_interface_naming` в datasources `dynamix_kvmvm`, `dynamix_kvmvm_list`, `dynamix_kvmvm_list_deleted` |
+| BATF-913 | Вычисляемое поле `size_available` в datasource `dynamix_kvmvm` |
+| BATF-954 | Опциональное поле `snapshot_delete_async` в resource `dynamix_kvmvm` |
+
+#### rg
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BATF-945 | Вычисляемые поля `created_by` и `created_time` в resource `dynamix_resgroup` |
#### vins
| Идентификатор
задачи | Описание |
| --- | --- |
-| BATF-877 | Исправлена ошибка записи state в resource `dynamix_vins` в cloudapi/vins |
\ No newline at end of file
+| BATF-898 | Опциональное поле `status` в datasource `dynamix_vins_list` в cloudapi/vins |
+
+
+### Удалено
+
+#### kvmvm
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BATF-938 | Опциональное поле `stateless`, `cd` в resource `dynamix_kvmvm` |
+
+#### rg
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BATF-910 | Опциональное поле `register_computes` в resource `resource_rg` |
+| BATF-910 | Вычисляемое поле `register_computes` в datasource `rdata_rg`, `rdata_rg_list` и `rdata_rg_list_deleted` |
+| BATF-912 | Опциональные поля `auto_start` и `data_disks` resource `dynamix_account` |
+
+### Исправлено
+
+#### общие изменения
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BATF-883 | Исправлены некорректные импорты имеющихся ресурсов |
+| BATF-984 | Установлены значения по умолчанию для булевых полех в имеющихся ресурсов |
+
+#### disks
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BATF-899 | Изменен тип поля `type` с Optional на Computed в resource `dynamix_disk` |
+| BATF-902 | Изменен тип поля `present_to` с []int на map[string]int в datasources `dynamix_disk`, `dynamix_disk_list`, `dynamix_disk_list_deleted`, `dynamix_disk_replication`, в resources `dynamix_disk`, `dynamix_disk_replication` |
+| BATF-908 | Изменен тип поля `gid` с Required на Computed в resource `dynamix_disk` |
+| BATF-988 | Изменен тип поля `images` c []string на []int в resources `dynamix_disk`, `dynamix_disk_replication` |
+| BATF-988 | Изменен тип поля `images` c []string на []int в datasources `dynamix_disk`, `dynamix_disk_list`, `dynamix_disk_replication`, `dynamix_disk_list_deleted`, `dynamix_disk_list_unattached` |
+
+#### image
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BATF-902 | Изменен тип поля `present_to` с []int на map[string]int в datasource `dynamix_image`, resource `dynamix_virtual_image`, `dynamix_image` |
+| BATF-915 | Изменено возможное значение поля `image_type` c `other` на `unknown` в resource `dynamix_image` |
+
+#### kvmvm
+| Идентификатор
задачи | Описание |
+| --- | --- |
+| BATF-902 | Изменен тип поля `present_to` с []int на map[string]int в datasources `dynamix_kvmvm`, resource `dynamix_kvmvm` |
+| BATF-948 | Изменен тип поля `mac` в блоке `network` с `computed` на `optional` в resource `dynamix_kvmvm` |
+| BATF-938 | Исправлен импорт опциональных и обязательных значений в resource `dynamix_kvmvm` |
+| BATF-938 | Изменен тип поля `cd_image_id` с `computed` на `optional` в resource `dynamix_kvmvm` |
+| BATF-920 | Рестарт виртуальной машины при отключении дисков в resource `dynamix_kvmvm` |
+| BATF-938 | Сняты ограничения по количеству дисков и сетей в resource `dynamix_kvmvm` |
+| BATF-931 | Изменен тип поля `vgpus` с []int на []struct в resource `dynamix_kvmvm` и в datasource `dynamix_kvmvm`|
+| BATF-988 | Изменен тип поля `images` c []string на []int в resource `dynamix_kvmvm` |
+
diff --git a/Makefile b/Makefile
index 71549bb..9a12e3d 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ ZIPDIR = ./zip
BINARY=${NAME}
WORKPATH= ./examples/terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${SECONDNAMESPACE}/${VERSION}/${OS_ARCH}
MAINPATH = ./cmd/dynamix/
-VERSION=1.2.2
+VERSION=1.3.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 436a472..83d69ff 100644
--- a/README.md
+++ b/README.md
@@ -11,8 +11,8 @@
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Single (единичная структура):
-| Название ресурса | Поля схемы |
-|--------------------------|-------------------|
+| Название ресурса | Поля схемы |
+|------------------|------------|
| data source dynamix_account_resource_consumption_list | consumed, reserved |
| data source dynamix_account_resource_consumption_get | consumed, reserved, resource_limits |
| data source dynamix_account_rg_list | computes, reserved, resource_limits, limits, reserved |
@@ -27,75 +27,75 @@
#### Ресурсная группа bservice
-Удалено поле `service_id` для импорта `resource dynamix_bservice` , теперь необходимо передавать `service_id`, при импорте например `terraform import dynamix_bservice.bs 5`
+Удалено поле `service_id` для импорта `resource dynamix_bservice`, теперь необходимо передавать `service_id`, при импорте например `terraform import dynamix_bservice.bs 5`
-Удалено поле `compgroup_id` для импорта `resource dynamix_bservice` , теперь необходимо использовать связку `bservice_id#compgroup_id`, например `terraform import dynamix_bservice_group.bsg 5#10`
+Удалено поле `compgroup_id` для импорта `resource dynamix_bservice`, теперь необходимо использовать связку `bservice_id#compgroup_id`, например `terraform import dynamix_bservice_group.bsg 5#10`
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Set:
-| Название ресурса | Поля схемы |
-|--------------------------|-------------------|
+| Название ресурса | Поля схемы |
+|------------------|------------|
| resource dynamix_bservice | snapshots |
#### Ресурсная группа disks
-| Название ресурса | Поля схемы | Изменение по сравнению с terraform-provider-decort | Комментарий |
-|------------------------------------------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| resource dynamix_disk | iotune, shareable | Если при создании ресурса диска операция настроки лимитов (поле iotune) и/или операция поделиться диском (поле shareable) выполняются некорректно, теперь ресурс создается с предупреждениями (Warnings). Ранее ресурс создавался с ошибками (Errors). | Данное изменение касается только создания ресурса. Обновление ресурса проходит также: если операция изменения iotune и/или shareable выполняется некорректно, возвращаются ошибки (Errors). |
-| resource dynamix_disk | - | Операция автоматического восстановления диска (для диска, находящегося в корзине) теперь происходит при чтении ресурса. Ранее она происходила при обновлении ресурса. | |
-| data source dynamix_disk_list_unattached | ckey, meta | Изменилось названия поля с "_ckey" на "ckey" и с "_meta" на "meta". | |
+| Название ресурса | Поля схемы | Изменение по сравнению с terraform-provider-decort | Комментарий |
+|------------------|------------|---------------------------------------------------|-------------|
+| resource dynamix_disk | iotune, shareable | Если при создании ресурса диска операция настроки лимитов (поле iotune) и/или операция поделиться диском (поле shareable) выполняются некорректно, теперь ресурс создается с предупреждениями (Warnings). Ранее ресурс создавался с ошибками (Errors). | Данное изменение касается только создания ресурса. Обновление ресурса проходит также: если операция изменения iotune и/или shareable выполняется некорректно, возвращаются ошибки (Errors). |
+| resource dynamix_disk | - | Операция автоматического восстановления диска (для диска, находящегося в корзине) теперь происходит при чтении ресурса. Ранее она происходила при обновлении ресурса. | |
+| data source dynamix_disk_list_unattached | ckey, meta | Изменилось названия поля с "_ckey" на "ckey" и с "_meta" на "meta". | |
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Single (единичная структура):
-| Название ресурса | Поля схемы |
-|------------------------------------------|------------|
-| data source dynamix_disk_list_unattached | iotune |
-| data source dynamix_disk | iotune |
-| data source dynamix_disk_list | iotune |
-| data source dynamix_disk_list_deleted | iotune |
-| resource dynamix_disk | iotune |
+| Название ресурса | Поля схемы |
+|------------------|------------|
+| data source dynamix_disk_list_unattached | iotune |
+| data source dynamix_disk | iotune |
+| data source dynamix_disk_list | iotune |
+| data source dynamix_disk_list_deleted | iotune |
+| resource dynamix_disk | iotune |
#### Ресурсная группа rg
-| Название ресурса | Поля схемы | Изменение по сравнению с terraform-provider-decort | Комментарий |
-|--------------------------------|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| resource dynamix_resgroup | def_net_type | Поле def_net_type теперь только Optional (не Computed). Если не задан блок def_net, оно отображает текущий статус def_net_type. В случае если задан блок def_net, то текущий тип сети по умолчанию находится в поле def_net.net_type. | При другой реализации возникают ошибки, т.к. к вычисляемому полю def_net_type обращаются сразу две разные структуры, и фреймворк выдает ошибку при несовпадении плана и платформы, что неизбежно, когда к полю обращаются две разные структуры. |
-| resource dynamix_resgroup | def_net, access, quota | Блоки def_net, access, quota стали атрибутами. При конфигурации ресурса задаются как атрибуты (через знак равно).
Стало: def_net = {}.
Было: def_net {}. | |
-| resource dynamix_resgroup | force, permanently | Новые дефолтные значения: true.
Старые дефолтные значения: false. | |
-| resource dynamix_resgroup | restore | Новое дефолтное значение: true. | |
-| data source dynamix_rg_usage | seps | Изменилась внутренняя структура списка seps
Было: sep_id (string), map (map[string]string).
Стало: sed_id (string), data_name (string), disk_size (float64), disk_size_max (float64) | Теперь структура seps аналогична таковой для data sources dynamix_rg_get_resource-consumption, dynamix_rg_resource_consumption_list. |
-| data source dynamix_rg_list_lb | acl | Удалено вычисляемое поле acl. | Причина: несоответствие типов acl в terraform-provider-decort и ACL в sdk. |
+| Название ресурса | Поля схемы | Изменение по сравнению с terraform-provider-decort | Комментарий |
+|------------------|------------|---------------------------------------------------|-------------|
+| resource dynamix_resgroup | def_net_type | Поле def_net_type теперь только Optional (не Computed). Если не задан блок def_net, оно отображает текущий статус def_net_type. В случае если задан блок def_net, то текущий тип сети по умолчанию находится в поле def_net.net_type. | При другой реализации возникают ошибки, т.к. к вычисляемому полю def_net_type обращаются сразу две разные структуры, и фреймворк выдает ошибку при несовпадении плана и платформы, что неизбежно, когда к полю обращаются две разные структуры. |
+| resource dynamix_resgroup | def_net, access, quota | Блоки def_net, access, quota стали атрибутами. При конфигурации ресурса задаются как атрибуты (через знак равно).
Стало: def_net = {}.
Было: def_net {}. | |
+| resource dynamix_resgroup | force, permanently | Новые дефолтные значения: true.
Старые дефолтные значения: false. | |
+| resource dynamix_resgroup | restore | Новое дефолтное значение: true. | |
+| data source dynamix_rg_usage | seps | Изменилась внутренняя структура списка seps
Было: sep_id (string), map (map[string]string).
Стало: sed_id (string), data_name (string), disk_size (float64), disk_size_max (float64) | Теперь структура seps аналогична таковой для data sources dynamix_rg_get_resource-consumption, dynamix_rg_resource_consumption_list. |
+| data source dynamix_rg_list_lb | acl | Удалено вычисляемое поле acl. | Причина: несоответствие типов acl в terraform-provider-decort и ACL в sdk. |
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Single (единичная структура):
-| Название ресурса | Поля схемы |
-|--------------------------------------------------|------------------------------------------------------------------------|
-| data source dynamix_rg_resource_consumption_list | consumed, reserved, resource_limits |
-| data source dynamix_rg | resource_limits |
-| data source dynamix_rg_get_resource_consumption | consumed, reserved, resource_limits |
-| data source dynamix_rg_list | resource_limits |
-| data source dynamix_rg_list_deleted | resource_limits |
-| data source dynamix_rg_list_lb | server_default_settings, server_settings, primary_node, secondary_node |
-| resource dynamix_resgroup | quota, def_net |
+| Название ресурса | Поля схемы |
+|------------------|------------|
+| data source dynamix_rg_resource_consumption_list | consumed, reserved, resource_limits |
+| data source dynamix_rg | resource_limits |
+| data source dynamix_rg_get_resource_consumption | consumed, reserved, resource_limits |
+| data source dynamix_rg_list | resource_limits |
+| data source dynamix_rg_list_deleted | resource_limits |
+| data source dynamix_rg_list_lb | server_default_settings, server_settings, primary_node, secondary_node |
+| resource dynamix_resgroup | quota, def_net |
#### Внешние сети extnet
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Single (единичная структура):
-| Название ресурса | Поля схемы |
-|----------------------------|-------------------|
+| Название ресурса | Поля схемы |
+|------------------|------------|
| data source dynamix_extnet | default_qos, vnfs |
#### Кластеры k8s
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Single (единичная структура):
-| Название ресурса | Поля схемы |
-|--------------------------------------|-----------------|
-| data source dynamix_k8s | acl, masters |
-| data source dynamix_k8s_list | service_account |
+| Название ресурса | Поля схемы |
+|------------------|------------|
+| data source dynamix_k8s | acl, masters |
+| data source dynamix_k8s_list | service_account |
| data source dynamix_k8s_list_deleted | service_account |
-| resource dynamix_k8s_cp | acl |
+| resource dynamix_k8s_cp | acl |
#### Образы image
@@ -103,42 +103,45 @@
#### Внутренние сети vins
-| Название ресурса | Поля схемы | Изменение по сравнению с terraform-provider-decort | Комментарий |
-|--------------------------|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
-| data source dynamix_vins | ckey | Название вычисляемых полей изменено с "_ckey" на "ckey". | Переименование связано с ограничениями terraform framework. |
-| resource dynamix_vins | ckey | Название вычисляемых полей изменено с "_ckey" на "ckey". | Переименование связано с ограничениями terraform framework. |
-| resource dynamix_vins | ext_net_id, ext_ip_addr | Удалены вычисляемые поля ext_net_id и ext_ip_addr. | При создании и изменении внешних сетей используется блок ext_net {ext_net_id int; ext_net_ip string}. |
-| resource dynamix_vins | force, permanently | Новые дефолтные значения: true.
Старые дефолтные значения: false. | |
-| resource dynamix_vins | restore | Новое дефолтное значение: true. | |
-| resource dynamix_vins | - | Если при обновлении ресурса vins какая-либо операция (изменение полей/блоков enable, ext_net, ip, nat_rule, vnfdev_restart, vnfdev_redeploy) не может быть выполнена, возвращаются ошибки (Errors). | Ранее ресурс изменялся с предупреждениями (Warnings). |
-| resource dynamix_vins | nat_rule | В блоке nat_rule поля int_ip и ext_port_start стали обязательными. Ранее были опциональными. | |
+| Название ресурса | Поля схемы | Изменение по сравнению с terraform-provider-decort | Комментарий |
+|------------------|------------|---------------------------------------------------|-------------|
+| data source dynamix_vins | ckey | Название вычисляемых полей изменено с "_ckey" на "ckey". | Переименование связано с ограничениями terraform framework. |
+| resource dynamix_vins | ckey | Название вычисляемых полей изменено с "_ckey" на "ckey". | Переименование связано с ограничениями terraform framework. |
+| resource dynamix_vins | ext_net_id, ext_ip_addr | Удалены вычисляемые поля ext_net_id и ext_ip_addr. | При создании и изменении внешних сетей используется блок ext_net {ext_net_id int; ext_net_ip string}. |
+| resource dynamix_vins | force, permanently | Новые дефолтные значения: true.
Старые дефолтные значения: false. | |
+| resource dynamix_vins | restore | Новое дефолтное значение: true. | |
+| resource dynamix_vins | - | Если при обновлении ресурса vins какая-либо операция (изменение полей/блоков enable, ext_net, ip, nat_rule, vnfdev_restart, vnfdev_redeploy) не может быть выполнена, возвращаются ошибки (Errors). | Ранее ресурс изменялся с предупреждениями (Warnings). |
+| resource dynamix_vins | nat_rule | В блоке nat_rule поля int_ip и ext_port_start стали обязательными. Ранее были опциональными. | |
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Single (единичная структура):
-| Название ресурса | Поля схемы |
-|--------------------------|----------------------------------------------------------------------------------------------------|
-| data source dynamix_vins | vnf_dev, config, mgmt, resources, qos, default_qos, vnfs, dhcp, devices, primary, gw, nat |
-| resource dynamix_vins | ext_net, vnf_dev, config, mgmt, resources, qos, default_qos, vnfs, dhcp, devices, primary, gw, nat |
+| Название ресурса | Поля схемы |
+|------------------|------------|
+| data source dynamix_vins | vnf_dev, config, mgmt, resources, qos, default_qos, vnfs, dhcp, devices, primary, gw, nat,libvirt_settings |
+| resource dynamix_vins | ext_net, vnf_dev, config, mgmt, resources, qos, default_qos, vnfs, dhcp, devices, primary, gw, nat, libvirt_settings |
#### Виртуальные машины KVM KVMVM
-| Название ресурса | Поля схемы | Изменение по сравнению с terraform-provider-decort | Комментарий |
-|------------------------|-------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|
-| resource dynamix_kvmvm | disks | Поле удалено | Исключено дублирование работы с дисками, которое можно производить при помощи ресурса dynamix_disk |
-| resource dynamix_kvmvm | affinity_rules, anti_affinity_rules | Изменен тип с List на Set | |
-| resource dynamix_kvmvm | force, permanently | Новые дефолтные значения: true.
Старые дефолтные значения: false. | |
-| resource dynamix_kvmvm | restore | Новое дефолтное значение: true. | |
-| resource dynamix_kvmvm | - | Операция автоматического восстановления диска (для диска, находящегося в корзине) теперь происходит при чтении ресурса. Ранее она происходила при обновлении ресурса. | |
+| Название ресурса | Поля схемы | Изменение по сравнению с terraform-provider-decort | Комментарий |
+|------------------|------------|---------------------------------------------------|-------------|
+| resource dynamix_kvmvm | disks | Поле удалено | Исключено дублирование работы с дисками, которое можно производить при помощи ресурса dynamix_disk |
+| resource dynamix_kvmvm | affinity_rules, anti_affinity_rules | Изменен тип с List на Set | |
+| resource dynamix_kvmvm | force, permanently | Новые дефолтные значения: true.
Старые дефолтные значения: false. | |
+| resource dynamix_kvmvm | restore | Новое дефолтное значение: true. | |
+| resource dynamix_kvmvm | acl | Добавлен новый атрибут с вложенной | |
+| resource dynamix_kvmvm | image_name | Добавлен новый атрибут | |
+| resource dynamix_kvmvm | user_data | Добавлен новый атрибут | |
+| resource dynamix_kvmvm | - | Операция автоматического восстановления диска (для диска, находящегося в корзине) теперь происходит при чтении ресурса. Ранее она происходила при обновлении ресурса. | |
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Single (единичная структура):
-| Название ресурса | Поля схемы |
-|----------------------------------------|---------------------------------------------------------|
-| data source dynamix_kvmvm | acl, iotune, replication, qos |
-| data source dynamix_kvmvm_list | qos |
-| data source dynamix_kvmvm_list_deleted | qos |
-| data source dynamix_kvmvm_user_list | items |
-| resource dynamix_kvmvm | rollback, cd, boot_disk, acl, qos, iotune, replication |
+| Название ресурса | Поля схемы |
+|------------------|------------|
+| data source dynamix_kvmvm | acl, iotune, replication, qos, libvirt_settings |
+| data source dynamix_kvmvm_list | qos, libvirt_settings |
+| data source dynamix_kvmvm_list_deleted | qos, libvirt_settings |
+| data source dynamix_kvmvm_user_list | items |
+| resource dynamix_kvmvm | rollback, cd, boot_disk, acl, qos, iotune, replication, libvirt_settings |
#### Балансировщики нагрузок lb
@@ -146,13 +149,13 @@
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Single (единичная структура):
-| Название ресурса | Поля схемы |
-|-------------------------------------|------------------------------------------------------------------------|
-| data source dynamix_lb | server_default_settings, server_settings, primary_node, secondary_node |
-| data source dynamix_lb_list | server_default_settings, server_settings, primary_node, secondary_node |
+| Название ресурса | Поля схемы |
+|------------------|------------|
+| data source dynamix_lb | server_default_settings, server_settings, primary_node, secondary_node |
+| data source dynamix_lb_list | server_default_settings, server_settings, primary_node, secondary_node |
| data source dynamix_lb_list_deleted | server_default_settings, server_settings, primary_node, secondary_node |
-| resource dynamix_lb | server_default_settings, server_settings, primary_node, secondary_node |
-| resource dynamix_lb_backend | server_settings |
+| resource dynamix_lb | server_default_settings, server_settings, primary_node, secondary_node |
+| resource dynamix_lb_backend | server_settings |
### Административная группа API
@@ -160,8 +163,8 @@
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Single (единичная структура):
-| Название ресурса | Поля схемы |
-|--------------------------|-------------------|
+| Название ресурса | Поля схемы |
+|------------------|------------|
| data source dynamix_cb_account_resource_consumption_list | consumed, reserved |
| data source dynamix_cb_account_resource_consumption_get | consumed, reserved, resource_limits |
| data source dynamix_cb_account_rg_list | computes, reserved, resource_limits, limits, reserved |
@@ -172,22 +175,22 @@
| data source dynamix_cb_disk_replication | iotune, replication |
| data source dynamix_cb_disk | iotune |
| resource dynamix_cb_disk_replication | iotune, replication |
-| resource dynamix_cb_disk | iotune | |
+| resource dynamix_cb_disk | iotune |
#### Диски disks
-| Название ресурса | Поля схемы | Изменение по сравнению с terraform-provider-decort | Комментарий |
-|------------------------------------------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| resource dynamix_cb_disk | iotune, shareable | Если при создании ресурса диска операция настроки лимитов (поле iotune) и/или операция поделиться диском (поле shareable) выполняются некорректно, теперь ресурс создается с предупреждениями (Warnings). Ранее ресурс создавался с ошибками (Errors). | Данное изменение касается только создания ресурса. Обновление ресурса проходит также: если операция изменения iotune и/или shareable выполняется некорректно, возвращаются ошибки (Errors). |
-| resource dynamix_cb_disk | - | Операция автоматического восстановления диска (для диска, находящегося в корзине) теперь происходит при чтении ресурса. Ранее она происходила при обновлении ресурса. | |
-| data source dynamix_cb_disk_list_unattached | ckey, meta | Изменилось названия поля с "_ckey" на "ckey" и с "_meta" на "meta". | |
+| Название ресурса | Поля схемы | Изменение по сравнению с terraform-provider-decort | Комментарий |
+|------------------|------------|---------------------------------------------------|-------------|
+| resource dynamix_cb_disk | iotune, shareable | Если при создании ресурса диска операция настроки лимитов (поле iotune) и/или операция поделиться диском (поле shareable) выполняются некорректно, теперь ресурс создается с предупреждениями (Warnings). Ранее ресурс создавался с ошибками (Errors). | Данное изменение касается только создания ресурса. Обновление ресурса проходит также: если операция изменения iotune и/или shareable выполняется некорректно, возвращаются ошибки (Errors). |
+| resource dynamix_cb_disk | - | Операция автоматического восстановления диска (для диска, находящегося в корзине) теперь происходит при чтении ресурса. Ранее она происходила при обновлении ресурса. | |
+| data source dynamix_cb_disk_list_unattached | ckey, meta | Изменилось названия поля с "_ckey" на "ckey" и с "_meta" на "meta". | |
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Single (единичная структура):
-| Название ресурса | Поля схемы |
-|------------------------------------------|------------|
-| data source dynamix_cb_disk_list_unattached | iotune |
-| data source dynamix_cb_disk | iotune |
-| data source dynamix_cb_disk_list | iotune |
-| data source dynamix_cb_disk_list_deleted | iotune |
-| resource dynamix_cb_disk | iotune |
\ No newline at end of file
+| Название ресурса | Поля схемы |
+|------------------|------------|
+| data source dynamix_cb_disk_list_unattached | iotune |
+| data source dynamix_cb_disk | iotune |
+| data source dynamix_cb_disk_list | iotune |
+| data source dynamix_cb_disk_list_deleted | iotune |
+| resource dynamix_cb_disk | iotune |
\ No newline at end of file
diff --git a/docs/data-sources/account.md b/docs/data-sources/account.md
index 25ddbc7..ab27550 100644
--- a/docs/data-sources/account.md
+++ b/docs/data-sources/account.md
@@ -40,6 +40,7 @@ description: |-
- `deactivation_time` (Number)
- `deleted_by` (String)
- `deleted_time` (Number)
+- `desc` (String)
- `displayname` (String)
- `guid` (Number)
- `id` (String) The ID of this resource.
diff --git a/docs/data-sources/account_list_deleted.md b/docs/data-sources/account_deleted_list.md
similarity index 92%
rename from docs/data-sources/account_list_deleted.md
rename to docs/data-sources/account_deleted_list.md
index 4d4f9af..c854aa5 100644
--- a/docs/data-sources/account_list_deleted.md
+++ b/docs/data-sources/account_deleted_list.md
@@ -1,12 +1,12 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
-page_title: "dynamix_account_list_deleted Data Source - terraform-provider-dynamix"
+page_title: "dynamix_account_deleted_list Data Source - terraform-provider-dynamix"
subcategory: ""
description: |-
---
-# dynamix_account_list_deleted (Data Source)
+# dynamix_account_deleted_list (Data Source)
@@ -50,6 +50,7 @@ Read-Only:
- `compute_features` (List of String)
- `created_time` (Number)
- `deleted_time` (Number)
+- `desc` (String)
- `status` (String)
- `updated_time` (Number)
diff --git a/docs/data-sources/account_list.md b/docs/data-sources/account_list.md
index eb39166..181ef26 100644
--- a/docs/data-sources/account_list.md
+++ b/docs/data-sources/account_list.md
@@ -51,6 +51,7 @@ Read-Only:
- `compute_features` (List of String)
- `created_time` (Number)
- `deleted_time` (Number)
+- `desc` (String)
- `status` (String)
- `updated_time` (Number)
diff --git a/docs/data-sources/account_rg_list.md b/docs/data-sources/account_rg_list.md
index b87caba..71f52ec 100644
--- a/docs/data-sources/account_rg_list.md
+++ b/docs/data-sources/account_rg_list.md
@@ -55,6 +55,7 @@ Read-Only:
- `created_time` (Number)
- `deleted_by` (String)
- `deleted_time` (Number)
+- `desc` (String)
- `milestones` (Number)
- `resources` (Attributes) (see [below for nested schema](#nestedatt--items--resources))
- `rg_id` (Number)
diff --git a/docs/data-sources/bservice_group.md b/docs/data-sources/bservice_group.md
index cbc2611..64951d4 100644
--- a/docs/data-sources/bservice_group.md
+++ b/docs/data-sources/bservice_group.md
@@ -70,6 +70,7 @@ Optional:
Read-Only:
+- `chipset` (String)
- `id` (Number)
- `ip_addresses` (List of String)
- `name` (String)
diff --git a/docs/data-sources/disk.md b/docs/data-sources/disk.md
index a3d574b..5515792 100644
--- a/docs/data-sources/disk.md
+++ b/docs/data-sources/disk.md
@@ -29,7 +29,9 @@ description: |-
- `account_name` (String)
- `acl` (String)
- `computes` (Attributes List) (see [below for nested schema](#nestedatt--computes))
+- `created_by` (String)
- `created_time` (Number)
+- `deleted_by` (String)
- `deleted_time` (Number)
- `desc` (String)
- `destruction_time` (Number)
@@ -38,14 +40,17 @@ description: |-
- `gid` (Number)
- `id` (String) The ID of this resource.
- `image_id` (Number)
-- `images` (List of String)
+- `images` (List of Number)
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--iotune))
+- `machine_id` (Number)
+- `machine_name` (String)
+- `milestones` (Number)
- `order` (Number)
- `params` (String)
- `parent_id` (Number)
- `pci_slot` (Number)
- `pool` (String)
-- `present_to` (List of Number)
+- `present_to` (Map of Number)
- `purge_time` (Number)
- `res_id` (String)
- `res_name` (String)
@@ -53,12 +58,15 @@ description: |-
- `sep_id` (Number)
- `sep_type` (String)
- `shareable` (Boolean)
+- `size_available` (Number)
- `size_max` (Number)
- `size_used` (Number)
- `snapshots` (Attributes List) (see [below for nested schema](#nestedatt--snapshots))
- `status` (String)
- `tech_status` (String)
- `type` (String)
+- `updated_by` (String)
+- `updated_time` (Number)
- `vmid` (Number)
diff --git a/docs/data-sources/disk_list.md b/docs/data-sources/disk_list.md
index c06faa4..72af959 100644
--- a/docs/data-sources/disk_list.md
+++ b/docs/data-sources/disk_list.md
@@ -55,7 +55,9 @@ Read-Only:
- `account_name` (String)
- `acl` (String)
- `computes` (Attributes List) (see [below for nested schema](#nestedatt--items--computes))
+- `created_by` (String)
- `created_time` (Number)
+- `deleted_by` (String)
- `deleted_time` (Number)
- `desc` (String)
- `destruction_time` (Number)
@@ -64,16 +66,17 @@ Read-Only:
- `disk_name` (String)
- `gid` (Number)
- `image_id` (Number)
-- `images` (List of String)
+- `images` (List of Number)
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--items--iotune))
- `machine_id` (Number)
- `machine_name` (String)
+- `milestones` (Number)
- `order` (Number)
- `params` (String)
- `parent_id` (Number)
- `pci_slot` (Number)
- `pool` (String)
-- `present_to` (List of Number)
+- `present_to` (Map of Number)
- `purge_time` (Number)
- `res_id` (String)
- `res_name` (String)
@@ -81,12 +84,15 @@ Read-Only:
- `sep_id` (Number)
- `sep_type` (String)
- `shareable` (Boolean)
+- `size_available` (Number)
- `size_max` (Number)
- `size_used` (Number)
- `snapshots` (Attributes List) (see [below for nested schema](#nestedatt--items--snapshots))
- `status` (String)
- `tech_status` (String)
- `type` (String)
+- `updated_by` (String)
+- `updated_time` (Number)
- `vmid` (Number)
diff --git a/docs/data-sources/disk_list_deleted.md b/docs/data-sources/disk_list_deleted.md
index 986ac06..b57697d 100644
--- a/docs/data-sources/disk_list_deleted.md
+++ b/docs/data-sources/disk_list_deleted.md
@@ -52,7 +52,9 @@ Read-Only:
- `account_name` (String)
- `acl` (String)
- `computes` (Attributes List) (see [below for nested schema](#nestedatt--items--computes))
+- `created_by` (String)
- `created_time` (Number)
+- `deleted_by` (String)
- `deleted_time` (Number)
- `desc` (String)
- `destruction_time` (Number)
@@ -61,16 +63,17 @@ Read-Only:
- `disk_name` (String)
- `gid` (Number)
- `image_id` (Number)
-- `images` (List of String)
+- `images` (List of Number)
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--items--iotune))
- `machine_id` (Number)
- `machine_name` (String)
+- `milestones` (Number)
- `order` (Number)
- `params` (String)
- `parent_id` (Number)
- `pci_slot` (Number)
- `pool` (String)
-- `present_to` (List of Number)
+- `present_to` (Map of Number)
- `purge_time` (Number)
- `res_id` (String)
- `res_name` (String)
@@ -78,12 +81,15 @@ Read-Only:
- `sep_id` (Number)
- `sep_type` (String)
- `shareable` (Boolean)
+- `size_available` (Number)
- `size_max` (Number)
- `size_used` (Number)
- `snapshots` (Attributes List) (see [below for nested schema](#nestedatt--items--snapshots))
- `status` (String)
- `tech_status` (String)
- `type` (String)
+- `updated_by` (String)
+- `updated_time` (Number)
- `vmid` (Number)
diff --git a/docs/data-sources/disk_list_unattached.md b/docs/data-sources/disk_list_unattached.md
index 90a0eaf..8bf1a36 100644
--- a/docs/data-sources/disk_list_unattached.md
+++ b/docs/data-sources/disk_list_unattached.md
@@ -64,7 +64,7 @@ Read-Only:
- `gid` (Number)
- `guid` (Number)
- `image_id` (Number)
-- `images` (List of String)
+- `images` (List of Number)
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--items--iotune))
- `iqn` (String)
- `login` (String)
diff --git a/docs/data-sources/disk_replication.md b/docs/data-sources/disk_replication.md
index e2c7abb..567a4b4 100644
--- a/docs/data-sources/disk_replication.md
+++ b/docs/data-sources/disk_replication.md
@@ -38,14 +38,14 @@ description: |-
- `disk_name` (String)
- `gid` (Number)
- `image_id` (Number)
-- `images` (List of String)
+- `images` (List of Number)
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--iotune))
- `order` (Number)
- `params` (String)
- `parent_id` (Number)
- `pci_slot` (Number)
- `pool` (String)
-- `present_to` (List of Number)
+- `present_to` (Map of Number)
- `purge_time` (Number)
- `replication` (Attributes) (see [below for nested schema](#nestedatt--replication))
- `res_id` (String)
diff --git a/docs/data-sources/extnet.md b/docs/data-sources/extnet.md
index c762b2a..2863b76 100644
--- a/docs/data-sources/extnet.md
+++ b/docs/data-sources/extnet.md
@@ -43,6 +43,7 @@ description: |-
- `net_name` (String)
- `network` (String)
- `network_id` (Number)
+- `ntp` (List of String)
- `pre_reservations_num` (Number)
- `prefix` (Number)
- `pri_vnf_dev_id` (Number)
diff --git a/docs/data-sources/extnet_list.md b/docs/data-sources/extnet_list.md
index 85fcbea..ac91a11 100644
--- a/docs/data-sources/extnet_list.md
+++ b/docs/data-sources/extnet_list.md
@@ -21,6 +21,7 @@ description: |-
- `by_id` (Number) find by id
- `name` (String) find by name
- `network` (String) find by network ip address
+- `ovs_bridge` (String) find by ovs_bridge
- `page` (Number) page number
- `size` (Number) page size
- `sort_by` (String) sort by one of supported fields, format +|-(field)
diff --git a/docs/data-sources/image.md b/docs/data-sources/image.md
index 7d1822d..ef098fd 100644
--- a/docs/data-sources/image.md
+++ b/docs/data-sources/image.md
@@ -51,7 +51,7 @@ description: |-
- `network_interface_naming` (String)
- `password` (String)
- `pool_name` (String)
-- `present_to` (List of Number)
+- `present_to` (Map of Number)
- `provider_name` (String)
- `purge_attempts` (Number)
- `res_id` (String)
@@ -59,6 +59,7 @@ description: |-
- `sep_id` (Number)
- `shared_with` (List of Number)
- `size` (Number)
+- `snapshot_id` (String)
- `status` (String)
- `tech_status` (String)
- `unc_path` (String)
diff --git a/docs/data-sources/k8s.md b/docs/data-sources/k8s.md
index 09a2240..eecb826 100644
--- a/docs/data-sources/k8s.md
+++ b/docs/data-sources/k8s.md
@@ -34,6 +34,7 @@ description: |-
- `created_time` (Number)
- `deleted_by` (String)
- `deleted_time` (Number)
+- `desc` (String)
- `extnet_id` (Number)
- `extnet_only` (Boolean)
- `ha_mode` (Boolean)
diff --git a/docs/data-sources/kvmvm.md b/docs/data-sources/kvmvm.md
index 8a148c6..95af40f 100644
--- a/docs/data-sources/kvmvm.md
+++ b/docs/data-sources/kvmvm.md
@@ -35,6 +35,7 @@ description: |-
- `arch` (String)
- `auto_start_w_node` (Boolean)
- `boot_order` (List of String)
+- `boot_type` (String)
- `bootdisk_size` (Number)
- `cd_image_id` (Number)
- `chipset` (String)
@@ -54,11 +55,13 @@ description: |-
- `driver` (String)
- `gid` (Number)
- `guid` (Number)
+- `hot_resize` (Boolean)
- `hp_backed` (Boolean)
- `id` (String) The ID of this resource.
- `image_id` (Number)
- `image_name` (String)
- `interfaces` (Attributes List) (see [below for nested schema](#nestedatt--interfaces))
+- `loader_type` (String)
- `lock_status` (String)
- `manager_id` (Number)
- `manager_type` (String)
@@ -71,6 +74,7 @@ description: |-
- `natable_vins_network` (String)
- `natable_vins_network_name` (String)
- `need_reboot` (Boolean)
+- `network_interface_naming` (String)
- `numa_affinity` (String)
- `numa_node_id` (Number)
- `os_users` (Attributes List) (see [below for nested schema](#nestedatt--os_users))
@@ -94,7 +98,7 @@ description: |-
- `updated_time` (Number)
- `user_data` (String)
- `user_managed` (Boolean)
-- `vgpus` (List of Number)
+- `vgpus` (Attributes List) (see [below for nested schema](#nestedatt--vgpus))
- `virtual_image_id` (Number)
- `virtual_image_name` (String)
- `vnc_password` (String)
@@ -213,7 +217,7 @@ Read-Only:
- `passwd` (String)
- `pci_slot` (Number)
- `pool` (String)
-- `present_to` (List of Number)
+- `present_to` (Map of Number)
- `purge_time` (Number)
- `reality_device_number` (Number)
- `reference_id` (String)
@@ -222,6 +226,7 @@ Read-Only:
- `role` (String)
- `sep_id` (Number)
- `shareable` (Boolean)
+- `size_available` (Number)
- `size_max` (Number)
- `size_used` (Number)
- `snapshots` (Attributes List) (see [below for nested schema](#nestedatt--disks--snapshots))
@@ -352,3 +357,29 @@ Read-Only:
- `guid` (String)
- `label` (String)
- `timestamp` (Number)
+
+
+
+### Nested Schema for `vgpus`
+
+Read-Only:
+
+- `account_id` (Number)
+- `bus_number` (Number)
+- `created_time` (Number)
+- `deleted_time` (Number)
+- `gid` (Number)
+- `guid` (Number)
+- `id` (Number)
+- `last_claimed_by` (Number)
+- `last_update_time` (Number)
+- `mode` (String)
+- `pci_slot` (Number)
+- `pgpuid` (Number)
+- `profile_id` (Number)
+- `ram` (Number)
+- `reference_id` (String)
+- `rg_id` (Number)
+- `status` (String)
+- `type` (String)
+- `vmid` (Number)
diff --git a/docs/data-sources/kvmvm_list.md b/docs/data-sources/kvmvm_list.md
index d6145b6..3d058ca 100644
--- a/docs/data-sources/kvmvm_list.md
+++ b/docs/data-sources/kvmvm_list.md
@@ -63,6 +63,7 @@ Read-Only:
- `arch` (String)
- `auto_start_w_node` (Boolean)
- `boot_order` (List of String)
+- `boot_type` (String)
- `bootdisk_size` (Number)
- `cd_image_id` (Number)
- `chipset` (String)
@@ -83,9 +84,11 @@ Read-Only:
- `driver` (String)
- `gid` (Number)
- `guid` (Number)
+- `hot_resize` (Boolean)
- `hp_backed` (Boolean)
- `image_id` (Number)
- `interfaces` (Attributes List) (see [below for nested schema](#nestedatt--items--interfaces))
+- `loader_type` (String)
- `lock_status` (String)
- `manager_id` (Number)
- `manager_type` (String)
@@ -93,6 +96,7 @@ Read-Only:
- `milestones` (Number)
- `name` (String)
- `need_reboot` (Boolean)
+- `network_interface_naming` (String)
- `numa_affinity` (String)
- `numa_node_id` (Number)
- `pinned` (Boolean)
diff --git a/docs/data-sources/kvmvm_list_deleted.md b/docs/data-sources/kvmvm_list_deleted.md
index 8ec9247..f414307 100644
--- a/docs/data-sources/kvmvm_list_deleted.md
+++ b/docs/data-sources/kvmvm_list_deleted.md
@@ -61,6 +61,7 @@ Read-Only:
- `arch` (String)
- `auto_start_w_node` (Boolean)
- `boot_order` (List of String)
+- `boot_type` (String)
- `bootdisk_size` (Number)
- `cd_image_id` (Number)
- `chipset` (String)
@@ -81,9 +82,11 @@ Read-Only:
- `driver` (String)
- `gid` (Number)
- `guid` (Number)
+- `hot_resize` (Boolean)
- `hp_backed` (Boolean)
- `image_id` (Number)
- `interfaces` (Attributes List) (see [below for nested schema](#nestedatt--items--interfaces))
+- `loader_type` (String)
- `lock_status` (String)
- `manager_id` (Number)
- `manager_type` (String)
@@ -91,6 +94,7 @@ Read-Only:
- `milestones` (Number)
- `name` (String)
- `need_reboot` (Boolean)
+- `network_interface_naming` (String)
- `numa_affinity` (String)
- `numa_node_id` (Number)
- `pinned` (Boolean)
diff --git a/docs/data-sources/resgroup.md b/docs/data-sources/resgroup.md
index 061c27b..5b05deb 100644
--- a/docs/data-sources/resgroup.md
+++ b/docs/data-sources/resgroup.md
@@ -46,7 +46,6 @@ description: |-
- `lock_status` (String)
- `milestones` (Number)
- `name` (String)
-- `register_computes` (Boolean)
- `res_types` (List of String)
- `resource_limits` (Attributes) (see [below for nested schema](#nestedatt--resource_limits))
- `secret` (String)
diff --git a/docs/data-sources/rg_list.md b/docs/data-sources/rg_list.md
index de42012..7c8e74a 100644
--- a/docs/data-sources/rg_list.md
+++ b/docs/data-sources/rg_list.md
@@ -69,7 +69,6 @@ Read-Only:
- `lock_status` (String)
- `milestones` (Number)
- `name` (String)
-- `register_computes` (Boolean)
- `resource_limits` (Attributes) (see [below for nested schema](#nestedatt--items--resource_limits))
- `resource_types` (List of String)
- `rg_id` (Number)
diff --git a/docs/data-sources/rg_list_deleted.md b/docs/data-sources/rg_list_deleted.md
index 875868c..a31487b 100644
--- a/docs/data-sources/rg_list_deleted.md
+++ b/docs/data-sources/rg_list_deleted.md
@@ -67,7 +67,6 @@ Read-Only:
- `lock_status` (String)
- `milestones` (Number)
- `name` (String)
-- `register_computes` (Boolean)
- `resource_limits` (Attributes) (see [below for nested schema](#nestedatt--items--resource_limits))
- `resource_types` (List of String)
- `rg_id` (Number)
diff --git a/docs/data-sources/vins_list.md b/docs/data-sources/vins_list.md
index e1b93fb..945d530 100644
--- a/docs/data-sources/vins_list.md
+++ b/docs/data-sources/vins_list.md
@@ -26,6 +26,7 @@ description: |-
- `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
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
- `vnf_dev_id` (Number) Filter by VNF Device id
diff --git a/docs/resources/account.md b/docs/resources/account.md
index 79e2287..fa80e0c 100644
--- a/docs/resources/account.md
+++ b/docs/resources/account.md
@@ -18,18 +18,18 @@ description: |-
### Required
- `account_name` (String) name of the account
-- `username` (String) username of owner the account
### Optional
-- `emailaddress` (String) email
+- `desc` (String) description of the account
- `enable` (Boolean) enable/disable account
- `permanently` (Boolean) whether to completely delete the account
+- `reason` (String) reason to disable
- `resource_limits` (Attributes) (see [below for nested schema](#nestedatt--resource_limits))
- `restore` (Boolean) restore a deleted account
- `send_access_emails` (Boolean) if true send emails when a user is granted access to resources
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
-- `users` (Attributes List) (see [below for nested schema](#nestedatt--users))
+- `users` (Attributes Set) (see [below for nested schema](#nestedatt--users))
### Read-Only
diff --git a/docs/resources/bservice_group.md b/docs/resources/bservice_group.md
index a762636..8189c3f 100644
--- a/docs/resources/bservice_group.md
+++ b/docs/resources/bservice_group.md
@@ -28,6 +28,7 @@ description: |-
### Optional
+- `chipset` (String) Type of the emulated system, Q35 or i440fx
- `cloud_init` (String)
- `compgroup_id` (Number)
- `extnets` (List of Number)
@@ -83,6 +84,7 @@ Optional:
Read-Only:
+- `chipset` (String) Type of the emulated system, Q35 or i440fx
- `id` (Number)
- `ip_addresses` (List of String)
- `name` (String)
diff --git a/docs/resources/disk.md b/docs/resources/disk.md
index 6970301..0776fae 100644
--- a/docs/resources/disk.md
+++ b/docs/resources/disk.md
@@ -19,7 +19,6 @@ description: |-
- `account_id` (Number) ID of the account
- `disk_name` (String) Iname of disk
-- `gid` (Number) ID of the grid (platform)
- `size_max` (Number) size in GB, default is 10
### Optional
@@ -32,27 +31,31 @@ description: |-
- `sep_id` (Number) Storage endpoint provider ID to create disk
- `shareable` (Boolean) share disk
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
-- `type` (String) (B;D;T) B=Boot;D=Data;T=Temp
### Read-Only
- `account_name` (String)
- `acl` (String)
- `computes` (Attributes List) (see [below for nested schema](#nestedatt--computes))
+- `created_by` (String)
- `created_time` (Number)
+- `deleted_by` (String)
- `deleted_time` (Number)
- `destruction_time` (Number)
- `devicename` (String)
- `disk_id` (Number)
+- `gid` (Number) ID of the grid (platform)
- `id` (String) The ID of this resource.
- `image_id` (Number)
-- `images` (List of String)
+- `images` (List of Number)
- `last_updated` (String) Timestamp of the last Terraform update of the disk resource.
+- `machine_id` (Number)
+- `machine_name` (String)
- `order` (Number)
- `params` (String)
- `parent_id` (Number)
- `pci_slot` (Number)
-- `present_to` (List of Number)
+- `present_to` (Map of Number)
- `purge_time` (Number)
- `res_id` (String)
- `res_name` (String)
@@ -62,6 +65,9 @@ description: |-
- `snapshots` (Attributes List) (see [below for nested schema](#nestedatt--snapshots))
- `status` (String)
- `tech_status` (String)
+- `type` (String) (B;D;T) B=Boot;D=Data;T=Temp
+- `updated_by` (String)
+- `updated_time` (Number)
- `vmid` (Number)
diff --git a/docs/resources/disk_replication.md b/docs/resources/disk_replication.md
index 106ff0f..7aedf38 100644
--- a/docs/resources/disk_replication.md
+++ b/docs/resources/disk_replication.md
@@ -45,14 +45,14 @@ description: |-
- `gid` (Number)
- `id` (String) The ID of this resource.
- `image_id` (Number)
-- `images` (List of String)
+- `images` (List of Number)
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--iotune))
- `order` (Number)
- `params` (String)
- `parent_id` (Number)
- `pci_slot` (Number)
- `pool` (String)
-- `present_to` (List of Number)
+- `present_to` (Map of Number)
- `purge_time` (Number)
- `replica_disk_id` (Number)
- `replication` (Attributes) (see [below for nested schema](#nestedatt--replication))
diff --git a/docs/resources/image.md b/docs/resources/image.md
index b30d624..89380b1 100644
--- a/docs/resources/image.md
+++ b/docs/resources/image.md
@@ -21,7 +21,7 @@ description: |-
- `boot_type` (String) Boot type of image bios or uefi
- `drivers` (List of String) List of types of compute suitable for image. Example: [ "KVM_X86" ]
- `image_name` (String) Name of the rescue disk
-- `image_type` (String) Image type linux, windows or other
+- `image_type` (String) Image type linux, windows or unknown
- `url` (String) URL where to download media from
### Optional
@@ -56,13 +56,14 @@ description: |-
- `link_to` (Number)
- `milestones` (Number)
- `network_interface_naming` (String)
-- `present_to` (List of Number)
+- `present_to` (Map of Number)
- `provider_name` (String)
- `purge_attempts` (Number)
- `res_id` (String)
- `rescuecd` (Boolean)
- `shared_with` (List of Number)
- `size` (Number)
+- `snapshot_id` (String)
- `status` (String)
- `tech_status` (String)
- `unc_path` (String)
diff --git a/docs/resources/image_virtual.md b/docs/resources/image_virtual.md
index 551b1fe..fd9dd43 100644
--- a/docs/resources/image_virtual.md
+++ b/docs/resources/image_virtual.md
@@ -31,6 +31,7 @@ description: |-
- `architecture` (String)
- `boot_type` (String)
- `bootable` (Boolean)
+- `cd_presented_to` (String)
- `ckey` (String)
- `compute_ci_id` (Number)
- `deleted_time` (Number)
@@ -47,9 +48,10 @@ description: |-
- `last_modified` (Number)
- `last_updated` (String) Timestamp of the last Terraform update of the order.
- `milestones` (Number)
+- `network_interface_naming` (String)
- `password` (String)
- `pool_name` (String)
-- `present_to` (List of Number)
+- `present_to` (Map of Number)
- `provider_name` (String)
- `purge_attempts` (Number)
- `res_id` (String)
@@ -57,6 +59,7 @@ description: |-
- `sep_id` (Number)
- `shared_with` (List of Number)
- `size` (Number)
+- `snapshot_id` (String)
- `status` (String)
- `tech_status` (String)
- `unc_path` (String)
diff --git a/docs/resources/k8s_wg.md b/docs/resources/k8s_wg.md
index ab9bead..9c96638 100644
--- a/docs/resources/k8s_wg.md
+++ b/docs/resources/k8s_wg.md
@@ -32,7 +32,6 @@ description: |-
- `ram` (Number) Worker node RAM in MB.
- `taints` (List of String)
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
-- `worker_chipset` (String) Type of the emulated system of worker nodes
- `worker_sep_id` (Number)
- `worker_sep_pool` (String)
diff --git a/docs/resources/kvmvm.md b/docs/resources/kvmvm.md
index 417b778..49dc2a1 100644
--- a/docs/resources/kvmvm.md
+++ b/docs/resources/kvmvm.md
@@ -28,26 +28,28 @@ description: |-
- `affinity_label` (String) Set affinity label for compute
- `affinity_rules` (Attributes Set) (see [below for nested schema](#nestedatt--affinity_rules))
- `anti_affinity_rules` (Attributes Set) (see [below for nested schema](#nestedatt--anti_affinity_rules))
-- `auto_start` (Boolean) Flag for redeploy compute
- `auto_start_w_node` (Boolean) Flag for start compute after node exits from MAINTENANCE state
- `boot_disk_size` (Number) This compute instance boot disk size in GB. Make sure it is large enough to accomodate selected OS image.
-- `cd` (Attributes) (see [below for nested schema](#nestedatt--cd))
+- `boot_type` (String) Type of image upload
+- `cd_image_id` (Number)
- `chipset` (String) Type of the emulated system, Q35 or i440fx
- `cloud_init` (String) Optional cloud_init parameters. Applied when creating new compute instance only, ignored in all other cases.
- `cpu_pin` (Boolean) Run VM on dedicated CPUs. To use this feature, the system must be pre-configured by allocating CPUs on the physical node.
- `custom_fields` (String) custom fields for Compute. Must be dict
-- `data_disks` (String) Flag for redeploy compute
- `description` (String) Optional text description of this compute instance.
- `detach_disks` (Boolean)
- `enabled` (Boolean) If true - enable compute, else - disable
- `extra_disks` (Set of Number) Optional list of IDs of extra disks to attach to this compute. You may specify several extra disks.
- `force_resize` (Boolean) Flag for resize compute
- `force_stop` (Boolean) Flag for redeploy compute
+- `hot_resize` (Boolean) Changing the size of a VM
- `hp_backed` (Boolean) Use Huge Pages to allocate RAM of the virtual machine. The system must be pre-configured by allocating Huge Pages on the physical node.
- `image_id` (Number) ID of the OS image to base this compute instance on.
- `ipa_type` (String) compute purpose
- `is` (String) system name
+- `loader_type` (String) Type of VM
- `network` (Attributes Set) Optional network connection(s) for this compute. You may specify several network blocks, one for each connection. (see [below for nested schema](#nestedatt--network))
+- `network_interface_naming` (String) Name of the network interface
- `numa_affinity` (String) Rule for VM placement with NUMA affinity.
- `pause` (Boolean)
- `pci_devices` (Set of Number) ID of the connected pci devices
@@ -61,8 +63,8 @@ description: |-
- `rollback` (Attributes) (see [below for nested schema](#nestedatt--rollback))
- `sep_id` (Number) ID of SEP to create bootDisk on. Uses image's sepId if not set.
- `snapshot` (Attributes Set) (see [below for nested schema](#nestedatt--snapshot))
+- `snapshot_delete_async` (Boolean) Flag for deleting snapshots asynchronously
- `started` (Boolean) Is compute started.
-- `stateless` (Boolean) Compute will be stateless (SVA_KVM_X86) if set to True
- `tags` (Attributes Set) (see [below for nested schema](#nestedatt--tags))
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
- `user_access` (Attributes Set) (see [below for nested schema](#nestedatt--user_access))
@@ -78,7 +80,6 @@ description: |-
- `boot_disk` (Attributes) (see [below for nested schema](#nestedatt--boot_disk))
- `boot_disk_id` (Number)
- `boot_order` (List of String)
-- `cd_image_id` (Number)
- `clone_reference` (Number)
- `clones` (List of Number)
- `compute_id` (Number)
@@ -122,7 +123,7 @@ description: |-
- `updated_time` (Number)
- `user_data` (String)
- `user_managed` (Boolean)
-- `vgpus` (List of Number)
+- `vgpus` (Attributes List) (see [below for nested schema](#nestedatt--vgpus))
- `virtual_image_id` (Number)
- `virtual_image_name` (String)
- `vnc_password` (String)
@@ -157,14 +158,6 @@ Optional:
- `value` (String) value that must match the key to be taken into account when analyzing this rule
-
-### Nested Schema for `cd`
-
-Required:
-
-- `cdrom_id` (Number)
-
-
### Nested Schema for `network`
@@ -176,13 +169,10 @@ Required:
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
- `weight` (Number) Weight the network if you need to sort network list, the smallest attach first. zero or null weight attach last
-Read-Only:
-
-- `mac` (String) MAC address associated with this connection. MAC address is assigned automatically.
-
### Nested Schema for `port_forwarding`
@@ -301,7 +291,6 @@ Read-Only:
- `acl` (String)
- `boot_partition` (Number)
- `bus_number` (Number)
-- `ckey` (String)
- `created_time` (Number)
- `deleted_time` (Number)
- `desc` (String)
@@ -311,7 +300,7 @@ Read-Only:
- `gid` (Number)
- `guid` (Number)
- `image_id` (Number)
-- `images` (List of String)
+- `images` (List of Number)
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--boot_disk--iotune))
- `iqn` (String)
- `login` (String)
@@ -323,7 +312,7 @@ Read-Only:
- `passwd` (String)
- `pci_slot` (Number)
- `pool` (String)
-- `present_to` (List of Number)
+- `present_to` (Map of Number)
- `purge_time` (Number)
- `reality_device_number` (Number)
- `reference_id` (String)
@@ -397,7 +386,6 @@ Read-Only:
- `acl` (String)
- `boot_partition` (Number)
- `bus_number` (Number)
-- `ckey` (String)
- `created_time` (Number)
- `deleted_time` (Number)
- `desc` (String)
@@ -407,7 +395,7 @@ Read-Only:
- `gid` (Number)
- `guid` (Number)
- `image_id` (Number)
-- `images` (List of String)
+- `images` (List of Number)
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--disks--iotune))
- `iqn` (String)
- `login` (String)
@@ -419,7 +407,7 @@ Read-Only:
- `passwd` (String)
- `pci_slot` (Number)
- `pool` (String)
-- `present_to` (List of Number)
+- `present_to` (Map of Number)
- `purge_time` (Number)
- `reality_device_number` (Number)
- `reference_id` (String)
@@ -558,3 +546,29 @@ Read-Only:
- `guid` (String)
- `label` (String)
- `timestamp` (Number)
+
+
+
+### Nested Schema for `vgpus`
+
+Read-Only:
+
+- `account_id` (Number)
+- `bus_number` (Number)
+- `created_time` (Number)
+- `deleted_time` (Number)
+- `gid` (Number)
+- `guid` (Number)
+- `id` (Number)
+- `last_claimed_by` (Number)
+- `last_update_time` (Number)
+- `mode` (String)
+- `pci_slot` (Number)
+- `pgpuid` (Number)
+- `profile_id` (Number)
+- `ram` (Number)
+- `reference_id` (String)
+- `rg_id` (Number)
+- `status` (String)
+- `type` (String)
+- `vmid` (Number)
diff --git a/docs/resources/resgroup.md b/docs/resources/resgroup.md
index 49228b8..4326c27 100644
--- a/docs/resources/resgroup.md
+++ b/docs/resources/resgroup.md
@@ -23,7 +23,7 @@ description: |-
### Optional
-- `access` (Attributes List) Grant/revoke user or group access to the Resource group as specified (see [below for nested schema](#nestedatt--access))
+- `access` (Attributes Set) Grant/revoke user or group access to the Resource group as specified (see [below for nested schema](#nestedatt--access))
- `def_net` (Attributes) Set default network for attach associated VMs (see [below for nested schema](#nestedatt--def_net))
- `def_net_type` (String) type of the default network for this RG. VMs created in this RG will be by default connected to this network. Allowed values are PRIVATE, PUBLIC, NONE.
- `description` (String) User-defined text description of this resource group.
@@ -35,7 +35,6 @@ description: |-
- `owner` (String) username - owner of this RG. Leave blank to set current user as owner
- `permanently` (Boolean) Set to True if you want force delete non-empty RG
- `quota` (Attributes) Quota settings for this resource group. (see [below for nested schema](#nestedatt--quota))
-- `register_computes` (Boolean) Register computes in registration system
- `restore` (Boolean)
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
- `uniq_pools` (List of String) List of strings with pools. Applies only when updating
@@ -47,6 +46,8 @@ description: |-
- `compute_features` (List of String)
- `cpu_allocation_parameter` (String)
- `cpu_allocation_ratio` (Number)
+- `created_by` (String)
+- `created_time` (Number)
- `def_net_id` (Number)
- `deleted_by` (String)
- `deleted_time` (Number)
diff --git a/go.mod b/go.mod
index 62dd15d..30f43c5 100644
--- a/go.mod
+++ b/go.mod
@@ -9,7 +9,7 @@ require (
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/sirupsen/logrus v1.9.3
- repository.basistech.ru/BASIS/decort-golang-sdk v1.10.2
+ repository.basistech.ru/BASIS/decort-golang-sdk v1.11.5
)
require (
diff --git a/go.sum b/go.sum
index c91c204..a18cdb2 100644
--- a/go.sum
+++ b/go.sum
@@ -100,5 +100,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
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.10.2 h1:sA/ZngL4xvkyz8lVGkqbi2RBi4CrHJjho2WV21KX918=
-repository.basistech.ru/BASIS/decort-golang-sdk v1.10.2/go.mod h1:OaUynHHuSjWMzpfyoL4au6oLcUogqUkPPBKA15pbHWo=
+repository.basistech.ru/BASIS/decort-golang-sdk v1.11.4 h1:OEFgSEGjzut+vVMGeNgoNq3dtk63FbXB6yGLTywtAas=
+repository.basistech.ru/BASIS/decort-golang-sdk v1.11.4/go.mod h1:OaUynHHuSjWMzpfyoL4au6oLcUogqUkPPBKA15pbHWo=
+repository.basistech.ru/BASIS/decort-golang-sdk v1.11.5 h1:gZEH9+qdulvrPQFLMQOxcY97ef9BlYRuItDYMYf5d4U=
+repository.basistech.ru/BASIS/decort-golang-sdk v1.11.5/go.mod h1:OaUynHHuSjWMzpfyoL4au6oLcUogqUkPPBKA15pbHWo=
diff --git a/internal/constants/constants.go b/internal/constants/constants.go
index 93f5767..66ca26e 100644
--- a/internal/constants/constants.go
+++ b/internal/constants/constants.go
@@ -6,12 +6,6 @@ const LimitMaxVinsPerResgroup = 4
// MaxSshKeysPerCompute sets maximum number of user:ssh_key pairs to authorize when creating new compute
const MaxSshKeysPerCompute = 12
-// MaxExtraDisksPerCompute sets maximum number of extra disks that can be added when creating new compute
-const MaxExtraDisksPerCompute = 12
-
-// MaxNetworksPerCompute sets maximum number of vNICs per compute
-const MaxNetworksPerCompute = 8
-
// MaxCpusPerCompute sets maximum number of vCPUs per compute
const MaxCpusPerCompute = 128
diff --git a/internal/flattens/flatten_simple_type.go b/internal/flattens/flatten_simple_type.go
index 267248c..4c3f0b6 100644
--- a/internal/flattens/flatten_simple_type.go
+++ b/internal/flattens/flatten_simple_type.go
@@ -17,3 +17,12 @@ func FlattenSimpleTypeToList(ctx context.Context, elementType attr.Type, element
}
return res
}
+
+// FlattenSimpleTypeToSet convert a slice of simple type to a types.Set
+func FlattenSimpleTypeToSet(ctx context.Context, elementType attr.Type, elements any) types.Set {
+ res, diags := types.SetValueFrom(ctx, elementType, elements)
+ if diags != nil {
+ tflog.Error(ctx, fmt.Sprint("Error FlattenSimpleTypeToSet", diags))
+ }
+ return res
+}
diff --git a/internal/service/cloudapi/account/data_source_account_list_deleted.go b/internal/service/cloudapi/account/data_source_account_deleted_list.go
similarity index 98%
rename from internal/service/cloudapi/account/data_source_account_list_deleted.go
rename to internal/service/cloudapi/account/data_source_account_deleted_list.go
index 4392cac..96ae4d9 100644
--- a/internal/service/cloudapi/account/data_source_account_list_deleted.go
+++ b/internal/service/cloudapi/account/data_source_account_deleted_list.go
@@ -76,7 +76,7 @@ func (d *dataSourceAccountListDeleted) Schema(ctx context.Context, _ datasource.
}
func (d *dataSourceAccountListDeleted) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
- resp.TypeName = req.ProviderTypeName + "_account_list_deleted"
+ resp.TypeName = req.ProviderTypeName + "_account_deleted_list"
}
// Configure adds the provider configured client to the data source.
diff --git a/internal/service/cloudapi/account/flattens/flatten_data_source_account.go b/internal/service/cloudapi/account/flattens/flatten_data_source_account.go
index 9d3a3d3..3ea64fd 100644
--- a/internal/service/cloudapi/account/flattens/flatten_data_source_account.go
+++ b/internal/service/cloudapi/account/flattens/flatten_data_source_account.go
@@ -51,6 +51,7 @@ func AccountDataSource(ctx context.Context, state *models.DataSourceAccountModel
DeactivationTime: types.Float64Value(recordAccount.DeactivationTime),
DeletedBy: types.StringValue(recordAccount.DeletedBy),
DeletedTime: types.Int64Value(int64(recordAccount.DeletedTime)),
+ Desc: types.StringValue(recordAccount.Description),
DisplayName: types.StringValue(recordAccount.DisplayName),
GUID: types.Int64Value(int64(recordAccount.GUID)),
Machines: flattenMachines(ctx, recordAccount.Machines),
diff --git a/internal/service/cloudapi/account/flattens/flatten_data_source_account_list.go b/internal/service/cloudapi/account/flattens/flatten_data_source_account_list.go
index 24d5ec1..9280167 100644
--- a/internal/service/cloudapi/account/flattens/flatten_data_source_account_list.go
+++ b/internal/service/cloudapi/account/flattens/flatten_data_source_account_list.go
@@ -52,6 +52,7 @@ func AccountListDataSource(ctx context.Context, state *models.DataSourceAccountL
AccountName: types.StringValue(item.Name),
Status: types.StringValue(item.Status),
UpdatedTime: types.Int64Value(int64(item.UpdatedTime)),
+ Desc: types.StringValue(item.Description),
}
i.ComputeFeatures, diags = types.ListValueFrom(ctx, types.StringType, item.ComputeFeatures)
if diags.HasError() {
diff --git a/internal/service/cloudapi/account/flattens/flatten_data_source_account_list_deleted.go b/internal/service/cloudapi/account/flattens/flatten_data_source_account_list_deleted.go
index a6a43d8..18e0f20 100644
--- a/internal/service/cloudapi/account/flattens/flatten_data_source_account_list_deleted.go
+++ b/internal/service/cloudapi/account/flattens/flatten_data_source_account_list_deleted.go
@@ -48,6 +48,7 @@ func AccountListDeletedDataSource(ctx context.Context, state *models.DataSourceA
i := models.ItemAccountListDeletedModel{
CreatedTime: types.Int64Value(int64(item.CreatedTime)),
DeletedTime: types.Int64Value(int64(item.DeletedTime)),
+ Desc: types.StringValue(item.Description),
AccountID: types.Int64Value(int64(item.ID)),
AccountName: types.StringValue(item.Name),
Status: types.StringValue(item.Status),
diff --git a/internal/service/cloudapi/account/flattens/flatten_data_source_account_rg_list.go b/internal/service/cloudapi/account/flattens/flatten_data_source_account_rg_list.go
index 7b504d8..2068ba6 100644
--- a/internal/service/cloudapi/account/flattens/flatten_data_source_account_rg_list.go
+++ b/internal/service/cloudapi/account/flattens/flatten_data_source_account_rg_list.go
@@ -90,6 +90,7 @@ func AccountRGListDataSource(ctx context.Context, state *models.DataSourceAccoun
CreatedTime: types.Int64Value(int64(item.CreatedTime)),
DeletedBy: types.StringValue(item.DeletedBy),
DeletedTime: types.Int64Value(int64(item.DeletedTime)),
+ Desc: types.StringValue(item.Description),
RGID: types.Int64Value(int64(item.RGID)),
Milestones: types.Int64Value(int64(item.Milestones)),
RGName: types.StringValue(item.RGName),
diff --git a/internal/service/cloudapi/account/flattens/flatten_resource_account.go b/internal/service/cloudapi/account/flattens/flatten_resource_account.go
index 12e2b35..9b58919 100644
--- a/internal/service/cloudapi/account/flattens/flatten_resource_account.go
+++ b/internal/service/cloudapi/account/flattens/flatten_resource_account.go
@@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
+ "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/flattens"
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/types"
@@ -47,13 +48,13 @@ func AccountResource(ctx context.Context, state *models.ResourceAccountModel, c
*state = models.ResourceAccountModel{
// request fields
AccountName: types.StringValue(recordAccount.Name),
- Username: state.Username,
- EmailAddress: state.EmailAddress,
- SendAccessEmails: state.SendAccessEmails,
- Users: state.Users,
+ SendAccessEmails: types.BoolValue(recordAccount.SendAccessEmails),
+ Users: flattenUsers(ctx, recordAccount.ACL),
Restore: state.Restore,
Permanently: state.Permanently,
+ Desc: types.StringValue(recordAccount.Description),
Enable: state.Enable,
+ Reason: state.Reason,
ResourceLimits: flattenResourceLimitsInAccountResource(ctx, recordAccount.ResourceLimits, state),
Timeouts: state.Timeouts,
@@ -67,6 +68,7 @@ func AccountResource(ctx context.Context, state *models.ResourceAccountModel, c
Company: types.StringValue(recordAccount.Company),
CompanyURL: types.StringValue(recordAccount.CompanyURL),
Computes: flattenComputes(ctx, recordAccount.Computes),
+ ComputeFeatures: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordAccount.ComputeFeatures),
CPUAllocationParameter: types.StringValue(recordAccount.CPUAllocationParameter),
CPUAllocationRatio: types.Float64Value(recordAccount.CPUAllocationRatio),
CreatedBy: types.StringValue(recordAccount.CreatedBy),
@@ -74,23 +76,22 @@ func AccountResource(ctx context.Context, state *models.ResourceAccountModel, c
DeactivationTime: types.Float64Value(recordAccount.DeactivationTime),
DeletedBy: types.StringValue(recordAccount.DeletedBy),
DeletedTime: types.Int64Value(int64(recordAccount.DeletedTime)),
- DisplayName: types.StringValue(recordAccount.DisplayName),
- GUID: types.Int64Value(int64(recordAccount.GUID)),
- Machines: flattenMachines(ctx, recordAccount.Machines),
- Status: types.StringValue(recordAccount.Status),
- UpdatedTime: types.Int64Value(int64(recordAccount.UpdatedTime)),
- Version: types.Int64Value(int64(recordAccount.Version)),
- VINSes: types.Int64Value(int64(recordAccount.VINSes)),
+ //Description: types.StringValue(recordAccount.Description),
+ DisplayName: types.StringValue(recordAccount.DisplayName),
+ GUID: types.Int64Value(int64(recordAccount.GUID)),
+ Machines: flattenMachines(ctx, recordAccount.Machines),
+ Status: types.StringValue(recordAccount.Status),
+ UpdatedTime: types.Int64Value(int64(recordAccount.UpdatedTime)),
+ Version: types.Int64Value(int64(recordAccount.Version)),
+ VINS: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordAccount.VINS),
+ VINSes: types.Int64Value(int64(recordAccount.VINSes)),
}
- state.VINS, diags = types.ListValueFrom(ctx, types.Int64Type, recordAccount.VINS)
- if diags.HasError() {
- tflog.Error(ctx, fmt.Sprint("flattens.AccountResource: cannot flatten recordAccount.VINS to state.VINS", diags))
- }
-
- state.ComputeFeatures, diags = types.ListValueFrom(ctx, types.StringType, recordAccount.ComputeFeatures)
- if diags.HasError() {
- tflog.Error(ctx, fmt.Sprint("flattens.AccountResource: cannot flatten recordAccount.ComputeFeatures to state.ComputeFeatures", diags))
+ if state.Enable == types.BoolNull() {
+ state.Enable = types.BoolValue(false)
+ if recordAccount.Status == "CONFIRMED" {
+ state.Enable = types.BoolValue(true)
+ }
}
tflog.Info(ctx, "flattens.AccountResource: after flatten", map[string]any{"account_id": state.Id.ValueString()})
@@ -137,3 +138,30 @@ func flattenResourceLimitsInAccountResource(ctx context.Context, limits account.
tflog.Info(ctx, "End flattenResourceLimitsInAccountResource")
return res
}
+
+func flattenUsers(ctx context.Context, aclList []account.RecordACL) types.Set {
+ tflog.Info(ctx, "Start flattenUsers")
+ tempSlice := make([]types.Object, 0, len(aclList))
+ for i, item := range aclList {
+ if i == 0 {
+ continue
+ }
+ temp := models.UsersModel{
+ UserID: types.StringValue(item.UgroupID),
+ AccessType: types.StringValue(item.Rights),
+ }
+ obj, diags := types.ObjectValueFrom(ctx, models.ItemUsersResource, temp)
+ if diags != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenUsers struct to obj", diags))
+ }
+ tempSlice = append(tempSlice, obj)
+ }
+
+ res, diags := types.SetValueFrom(ctx, types.ObjectType{AttrTypes: models.ItemUsersResource}, tempSlice)
+ if diags != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenUsers", diags))
+ }
+
+ tflog.Info(ctx, "End flattenUsers")
+ return res
+}
diff --git a/internal/service/cloudapi/account/models/model_data_source_account.go b/internal/service/cloudapi/account/models/model_data_source_account.go
index 9b0ba78..039871f 100644
--- a/internal/service/cloudapi/account/models/model_data_source_account.go
+++ b/internal/service/cloudapi/account/models/model_data_source_account.go
@@ -27,6 +27,7 @@ type DataSourceAccountModel struct {
DeactivationTime types.Float64 `tfsdk:"deactivation_time"`
DeletedBy types.String `tfsdk:"deleted_by"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
+ Desc types.String `tfsdk:"desc"`
DisplayName types.String `tfsdk:"displayname"`
GUID types.Int64 `tfsdk:"guid"`
Machines types.Object `tfsdk:"machines"`
diff --git a/internal/service/cloudapi/account/models/model_data_source_account_list.go b/internal/service/cloudapi/account/models/model_data_source_account_list.go
index dc8d258..d6aa141 100644
--- a/internal/service/cloudapi/account/models/model_data_source_account_list.go
+++ b/internal/service/cloudapi/account/models/model_data_source_account_list.go
@@ -31,6 +31,7 @@ type ItemAccountListModel struct {
Status types.String `tfsdk:"status"`
UpdatedTime types.Int64 `tfsdk:"updated_time"`
ComputeFeatures types.List `tfsdk:"compute_features"`
+ Desc types.String `tfsdk:"desc"`
}
type RecordACLModel struct {
diff --git a/internal/service/cloudapi/account/models/model_data_source_account_list_deleted.go b/internal/service/cloudapi/account/models/model_data_source_account_list_deleted.go
index ba613d8..271d36c 100644
--- a/internal/service/cloudapi/account/models/model_data_source_account_list_deleted.go
+++ b/internal/service/cloudapi/account/models/model_data_source_account_list_deleted.go
@@ -25,6 +25,7 @@ type ItemAccountListDeletedModel struct {
ACL []RecordACLModel `tfsdk:"acl"`
CreatedTime types.Int64 `tfsdk:"created_time"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
+ Desc types.String `tfsdk:"desc"`
AccountID types.Int64 `tfsdk:"account_id"`
AccountName types.String `tfsdk:"account_name"`
Status types.String `tfsdk:"status"`
diff --git a/internal/service/cloudapi/account/models/model_data_source_account_rg_list.go b/internal/service/cloudapi/account/models/model_data_source_account_rg_list.go
index 2c9430d..2fb7456 100644
--- a/internal/service/cloudapi/account/models/model_data_source_account_rg_list.go
+++ b/internal/service/cloudapi/account/models/model_data_source_account_rg_list.go
@@ -31,6 +31,7 @@ type ItemAccountRGModel struct {
CreatedTime types.Int64 `tfsdk:"created_time"`
DeletedBy types.String `tfsdk:"deleted_by"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
+ Desc types.String `tfsdk:"desc"`
RGID types.Int64 `tfsdk:"rg_id"`
Milestones types.Int64 `tfsdk:"milestones"`
RGName types.String `tfsdk:"rg_name"`
diff --git a/internal/service/cloudapi/account/models/model_resource_account.go b/internal/service/cloudapi/account/models/model_resource_account.go
index 19f3a01..f5d821d 100644
--- a/internal/service/cloudapi/account/models/model_resource_account.go
+++ b/internal/service/cloudapi/account/models/model_resource_account.go
@@ -9,17 +9,16 @@ import (
type ResourceAccountModel struct {
// request fields - required
AccountName types.String `tfsdk:"account_name"`
- Username types.String `tfsdk:"username"`
// request fields - optional
- EmailAddress types.String `tfsdk:"emailaddress"`
SendAccessEmails types.Bool `tfsdk:"send_access_emails"`
- Users types.List `tfsdk:"users"`
+ Users types.Set `tfsdk:"users"`
Restore types.Bool `tfsdk:"restore"`
Permanently types.Bool `tfsdk:"permanently"`
Enable types.Bool `tfsdk:"enable"`
ResourceLimits types.Object `tfsdk:"resource_limits"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
+ Desc types.String `tfsdk:"desc"`
// response fields
Id types.String `tfsdk:"id"`
@@ -42,6 +41,7 @@ type ResourceAccountModel struct {
DisplayName types.String `tfsdk:"displayname"`
GUID types.Int64 `tfsdk:"guid"`
Machines types.Object `tfsdk:"machines"`
+ Reason types.String `tfsdk:"reason"`
Status types.String `tfsdk:"status"`
UpdatedTime types.Int64 `tfsdk:"updated_time"`
Version types.Int64 `tfsdk:"version"`
@@ -54,6 +54,11 @@ type UsersModel struct {
AccessType types.String `tfsdk:"access_type"`
}
+var ItemUsersResource = map[string]attr.Type{
+ "user_id": types.StringType,
+ "access_type": types.StringType,
+}
+
type ResourceLimitsInAccountResourceModel struct {
CUC types.Float64 `tfsdk:"cu_c"`
CUD types.Float64 `tfsdk:"cu_d"`
diff --git a/internal/service/cloudapi/account/resource_account.go b/internal/service/cloudapi/account/resource_account.go
index f7d64fc..8f176ac 100644
--- a/internal/service/cloudapi/account/resource_account.go
+++ b/internal/service/cloudapi/account/resource_account.go
@@ -137,7 +137,7 @@ func (r *resourceAccount) Update(ctx context.Context, req resource.UpdateRequest
// enable/disable account
if !plan.Enable.Equal(state.Enable) && !plan.Enable.IsNull() {
- resp.Diagnostics.Append(utilities.EnableDisableAccount(ctx, uint64(accountId), plan.Enable.ValueBool(), r.client)...)
+ resp.Diagnostics.Append(utilities.EnableDisableAccount(ctx, uint64(accountId), &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceAccount: Error enabling/disabling account")
return
@@ -204,9 +204,6 @@ func (r *resourceAccount) Delete(ctx context.Context, req resource.DeleteRequest
defer cancel()
permanently := state.Permanently.ValueBool()
- if state.Permanently.IsNull() {
- permanently = true
- } // default true
// Delete existing resource group
delReq := account.DeleteRequest{
diff --git a/internal/service/cloudapi/account/schemas/schema_data_source_account.go b/internal/service/cloudapi/account/schemas/schema_data_source_account.go
index 985ffd9..649d1b9 100644
--- a/internal/service/cloudapi/account/schemas/schema_data_source_account.go
+++ b/internal/service/cloudapi/account/schemas/schema_data_source_account.go
@@ -73,6 +73,9 @@ func MakeSchemaDataSourceAccount() map[string]schema.Attribute {
"deleted_by": schema.StringAttribute{
Computed: true,
},
+ "desc": schema.StringAttribute{
+ Computed: true,
+ },
"deleted_time": schema.Int64Attribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/account/schemas/schema_data_source_account_list.go b/internal/service/cloudapi/account/schemas/schema_data_source_account_list.go
index 44360ea..e8f8a2d 100644
--- a/internal/service/cloudapi/account/schemas/schema_data_source_account_list.go
+++ b/internal/service/cloudapi/account/schemas/schema_data_source_account_list.go
@@ -83,6 +83,9 @@ func MakeSchemaDataSourceAccountList() map[string]schema.Attribute {
"account_id": schema.Int64Attribute{
Computed: true,
},
+ "desc": schema.StringAttribute{
+ Computed: true,
+ },
"account_name": schema.StringAttribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/account/schemas/schema_data_source_account_list_deleted.go b/internal/service/cloudapi/account/schemas/schema_data_source_account_list_deleted.go
index 4d4b6e6..22e20df 100644
--- a/internal/service/cloudapi/account/schemas/schema_data_source_account_list_deleted.go
+++ b/internal/service/cloudapi/account/schemas/schema_data_source_account_list_deleted.go
@@ -72,6 +72,9 @@ func MakeSchemaDataSourceAccountListDeleted() map[string]schema.Attribute {
"deleted_time": schema.Int64Attribute{
Computed: true,
},
+ "desc": schema.StringAttribute{
+ Computed: true,
+ },
"account_id": schema.Int64Attribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/account/schemas/schema_data_source_account_rg_list.go b/internal/service/cloudapi/account/schemas/schema_data_source_account_rg_list.go
index 0245472..a36ac99 100644
--- a/internal/service/cloudapi/account/schemas/schema_data_source_account_rg_list.go
+++ b/internal/service/cloudapi/account/schemas/schema_data_source_account_rg_list.go
@@ -201,6 +201,9 @@ func MakeSchemaDataSourceAccountRGList() map[string]schema.Attribute {
"deleted_time": schema.Int64Attribute{
Computed: true,
},
+ "desc": schema.StringAttribute{
+ Computed: true,
+ },
"rg_id": schema.Int64Attribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/account/schemas/schema_resource_account.go b/internal/service/cloudapi/account/schemas/schema_resource_account.go
index 502f51e..58ae0f4 100644
--- a/internal/service/cloudapi/account/schemas/schema_resource_account.go
+++ b/internal/service/cloudapi/account/schemas/schema_resource_account.go
@@ -2,6 +2,7 @@ package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
@@ -14,21 +15,19 @@ func MakeSchemaResourceAccount() map[string]schema.Attribute {
Required: true,
Description: "name of the account",
},
- "username": schema.StringAttribute{
- Required: true,
- Description: "username of owner the account",
- },
// optional attributes
- "emailaddress": schema.StringAttribute{
- Optional: true,
- Description: "email",
- },
"send_access_emails": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(false),
Description: "if true send emails when a user is granted access to resources",
},
- "users": schema.ListNestedAttribute{
+ "desc": schema.StringAttribute{
+ Optional: true,
+ Description: "description of the account",
+ },
+ "users": schema.SetNestedAttribute{
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
@@ -43,16 +42,25 @@ func MakeSchemaResourceAccount() map[string]schema.Attribute {
},
"restore": schema.BoolAttribute{
Optional: true,
+ Computed: true,
Description: "restore a deleted account",
+ Default: booldefault.StaticBool(true),
},
"permanently": schema.BoolAttribute{
Optional: true,
+ Computed: true,
Description: "whether to completely delete the account",
- // default is false
+ Default: booldefault.StaticBool(true),
},
"enable": schema.BoolAttribute{
Optional: true,
+ Computed: true,
Description: "enable/disable account",
+ Default: booldefault.StaticBool(true),
+ },
+ "reason": schema.StringAttribute{
+ Optional: true,
+ Description: "reason to disable",
},
"resource_limits": schema.SingleNestedAttribute{
Optional: true,
diff --git a/internal/service/cloudapi/account/utilities/utility_resource_account.go b/internal/service/cloudapi/account/utilities/utility_resource_account.go
index 3c61d48..b835c8d 100644
--- a/internal/service/cloudapi/account/utilities/utility_resource_account.go
+++ b/internal/service/cloudapi/account/utilities/utility_resource_account.go
@@ -120,10 +120,11 @@ func RestoreAccount(ctx context.Context, accountId uint64, c *client.Client) dia
// EnableDisableAccount performs account Enable/Disable request.
// Returns error in case of failures.
-func EnableDisableAccount(ctx context.Context, accountId uint64, enable bool, c *client.Client) diag.Diagnostics {
+func EnableDisableAccount(ctx context.Context, accountId uint64, plan *models.ResourceAccountModel, c *client.Client) diag.Diagnostics {
tflog.Info(ctx, "Start EnableDisableAccount", map[string]any{"account_id": accountId})
diags := diag.Diagnostics{}
+ enable := plan.Enable.ValueBool()
if enable {
tflog.Info(ctx, "EnableDisableAccount: before calling CloudAPI().Account().Enable", map[string]any{"account_id": accountId})
@@ -141,7 +142,8 @@ func EnableDisableAccount(ctx context.Context, accountId uint64, enable bool, c
}
tflog.Info(ctx, "EnableDisableAccount: before calling CloudAPI().Account().Disable", map[string]any{"account_id": accountId})
- res, err := c.CloudAPI().Account().Disable(ctx, account.DisableEnableRequest{AccountID: accountId})
+ reason := plan.Reason.ValueString()
+ res, err := c.CloudAPI().Account().Disable(ctx, account.DisableEnableRequest{AccountID: accountId, Reason: reason})
if err != nil {
diags.AddError(
"EnableDisableAccount: cannot disable account",
@@ -172,6 +174,12 @@ func UpdateAccount(ctx context.Context, accountId uint64, plan, state *models.Re
updateNeeded = true
}
+ // check if description was changed
+ if !plan.Desc.Equal(state.Desc) {
+ updateReq.Description = plan.Desc.ValueString()
+ updateNeeded = true
+ }
+
// check if resource_limits were changed
if !plan.ResourceLimits.Equal(state.ResourceLimits) && !plan.ResourceLimits.IsUnknown() {
tflog.Info(ctx, "UpdateAccount: new ResourceLimits specified", map[string]any{"account_id": accountId})
diff --git a/internal/service/cloudapi/bservice/flattens/flatten_data_source_bservice_group.go b/internal/service/cloudapi/bservice/flattens/flatten_data_source_bservice_group.go
index 46e95f8..8a93b1f 100644
--- a/internal/service/cloudapi/bservice/flattens/flatten_data_source_bservice_group.go
+++ b/internal/service/cloudapi/bservice/flattens/flatten_data_source_bservice_group.go
@@ -83,6 +83,7 @@ func BServiceGroupDataSource(ctx context.Context, state *models.RecordGroupModel
ID: types.Int64Value(int64(v.ID)),
IPAddresses: flattens.FlattenSimpleTypeToList(ctx, types.StringType, ipAddresses),
Name: types.StringValue(v.Name),
+ Chipset: types.StringValue(v.Chipset),
OSUsers: osUsers,
}
computesList = append(computesList, temp)
diff --git a/internal/service/cloudapi/bservice/flattens/flatten_resource_bservice_group.go b/internal/service/cloudapi/bservice/flattens/flatten_resource_bservice_group.go
index b7c1934..aa16d3a 100644
--- a/internal/service/cloudapi/bservice/flattens/flatten_resource_bservice_group.go
+++ b/internal/service/cloudapi/bservice/flattens/flatten_resource_bservice_group.go
@@ -57,6 +57,7 @@ func BServiceGroupResource(ctx context.Context, plan *models.ResourceRecordGroup
RAM: types.Int64Value(int64(recordResourceGroup.RAM)),
Disk: types.Int64Value(int64(recordResourceGroup.Disk)),
ImageID: types.Int64Value(int64(recordResourceGroup.ImageID)),
+ Chipset: plan.Chipset,
Driver: types.StringValue(recordResourceGroup.Driver),
SEPID: types.Int64Value(int64(recordResourceGroup.SEPID)),
SepPool: types.StringValue(recordResourceGroup.PoolName),
@@ -112,6 +113,7 @@ func flattenGroupComputes(ctx context.Context, items bservice.ListGroupComputes)
ID: types.Int64Value(int64(v.ID)),
Name: types.StringValue(v.Name),
IPAddresses: flattens.FlattenSimpleTypeToList(ctx, types.StringType, v.IPAddresses),
+ Chipset: types.StringValue(v.Chipset),
OSUsers: flattenOSuser(ctx, v.OSUsers),
}
obj, diags := types.ObjectValueFrom(ctx, models.ResourceItemGroupCompute, temp)
diff --git a/internal/service/cloudapi/bservice/models/model_data_source_bservice_group.go b/internal/service/cloudapi/bservice/models/model_data_source_bservice_group.go
index d4fd7c9..b32e1b1 100644
--- a/internal/service/cloudapi/bservice/models/model_data_source_bservice_group.go
+++ b/internal/service/cloudapi/bservice/models/model_data_source_bservice_group.go
@@ -48,6 +48,7 @@ type ItemGroupComputeModel struct {
ID types.Int64 `tfsdk:"id"`
IPAddresses types.List `tfsdk:"ip_addresses"`
Name types.String `tfsdk:"name"`
+ Chipset types.String `tfsdk:"chipset"`
OSUsers []ItemOSUserModel `tfsdk:"os_users"`
}
diff --git a/internal/service/cloudapi/bservice/models/model_resource_bservice_group.go b/internal/service/cloudapi/bservice/models/model_resource_bservice_group.go
index 3d53a27..6870390 100644
--- a/internal/service/cloudapi/bservice/models/model_resource_bservice_group.go
+++ b/internal/service/cloudapi/bservice/models/model_resource_bservice_group.go
@@ -22,6 +22,7 @@ type ResourceRecordGroupModel struct {
SepPool types.String `tfsdk:"sep_pool"`
CloudInit types.String `tfsdk:"cloud_init"`
Role types.String `tfsdk:"role"`
+ Chipset types.String `tfsdk:"chipset"`
TimeoutStart types.Int64 `tfsdk:"timeout_start"`
VINSes types.List `tfsdk:"vinses"`
ExtNets types.List `tfsdk:"extnets"`
@@ -61,6 +62,7 @@ type ResourceItemGroupComputeModel struct {
ID types.Int64 `tfsdk:"id"`
IPAddresses types.List `tfsdk:"ip_addresses"`
Name types.String `tfsdk:"name"`
+ Chipset types.String `tfsdk:"chipset"`
OSUsers types.List `tfsdk:"os_users"`
}
@@ -68,6 +70,7 @@ var ResourceItemGroupCompute = map[string]attr.Type{
"id": types.Int64Type,
"ip_addresses": types.ListType{ElemType: types.StringType},
"name": types.StringType,
+ "chipset": types.StringType,
"os_users": types.ListType{ElemType: types.ObjectType{AttrTypes: ResourceItemOSUser}},
}
diff --git a/internal/service/cloudapi/bservice/schemas/schema_data_source_bservice_group.go b/internal/service/cloudapi/bservice/schemas/schema_data_source_bservice_group.go
index 802d727..461dea4 100644
--- a/internal/service/cloudapi/bservice/schemas/schema_data_source_bservice_group.go
+++ b/internal/service/cloudapi/bservice/schemas/schema_data_source_bservice_group.go
@@ -33,6 +33,9 @@ func MakeSchemaDataSourceBServiceGroup() map[string]schema.Attribute {
"name": schema.StringAttribute{
Computed: true,
},
+ "chipset": schema.StringAttribute{
+ Computed: true,
+ },
"os_users": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
diff --git a/internal/service/cloudapi/bservice/schemas/schema_resource_bservice.go b/internal/service/cloudapi/bservice/schemas/schema_resource_bservice.go
index 24d67c4..50ab682 100644
--- a/internal/service/cloudapi/bservice/schemas/schema_resource_bservice.go
+++ b/internal/service/cloudapi/bservice/schemas/schema_resource_bservice.go
@@ -2,6 +2,7 @@ package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
)
@@ -24,15 +25,23 @@ func MakeSchemaResourceBService() map[string]schema.Attribute {
},
"permanently": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
},
"enable": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
},
"restore": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(false),
},
"start": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(false),
},
"service_id": schema.Int64Attribute{
Optional: true,
diff --git a/internal/service/cloudapi/bservice/schemas/schema_resource_bservice_group.go b/internal/service/cloudapi/bservice/schemas/schema_resource_bservice_group.go
index 8d3720c..b9e307a 100644
--- a/internal/service/cloudapi/bservice/schemas/schema_resource_bservice_group.go
+++ b/internal/service/cloudapi/bservice/schemas/schema_resource_bservice_group.go
@@ -4,6 +4,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
@@ -42,6 +43,13 @@ func MakeSchemaResourceBServiceGroup() map[string]schema.Attribute {
"driver": schema.StringAttribute{
Required: true,
},
+ "chipset": schema.StringAttribute{
+ Optional: true,
+ Validators: []validator.String{
+ stringvalidator.OneOf("i440fx", "Q35"),
+ },
+ Description: "Type of the emulated system, Q35 or i440fx",
+ },
"sep_id": schema.Int64Attribute{
Optional: true,
Computed: true,
@@ -79,12 +87,18 @@ func MakeSchemaResourceBServiceGroup() map[string]schema.Attribute {
},
"start": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(false),
},
"force_stop": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(false),
},
"force_update": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(false),
},
"parents": schema.ListAttribute{
Optional: true,
@@ -119,6 +133,10 @@ func MakeSchemaResourceBServiceGroup() map[string]schema.Attribute {
"name": schema.StringAttribute{
Computed: true,
},
+ "chipset": schema.StringAttribute{
+ Computed: true,
+ Description: "Type of the emulated system, Q35 or i440fx",
+ },
"os_users": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
diff --git a/internal/service/cloudapi/bservice/utilities/utility_resource_bservice_group.go b/internal/service/cloudapi/bservice/utilities/utility_resource_bservice_group.go
index e64f714..d551089 100644
--- a/internal/service/cloudapi/bservice/utilities/utility_resource_bservice_group.go
+++ b/internal/service/cloudapi/bservice/utilities/utility_resource_bservice_group.go
@@ -48,6 +48,12 @@ func BServiceGroupResourceCreate(ctx context.Context, plan *models.ResourceRecor
req.SEPID = uint64(plan.SEPID.ValueInt64())
}
+ if plan.Chipset.IsNull() {
+ req.Chipset = "i440fx"
+ } else {
+ req.Chipset = plan.Chipset.ValueString()
+ }
+
if !plan.SepPool.IsNull() {
req.SEPPool = plan.SepPool.ValueString()
}
@@ -131,6 +137,12 @@ func BServiceGroupResize(ctx context.Context, plan *models.ResourceRecordGroupMo
Mode: plan.Mode.ValueString(),
}
+ if plan.Chipset.IsNull() {
+ req.Chipset = "i440fx"
+ } else {
+ req.Chipset = plan.Chipset.ValueString()
+ }
+
tflog.Info(ctx, "BServiceGroupResize: before calling CloudAPI().BService().GroupResize", map[string]any{"req": req})
_, err = c.CloudAPI().BService().GroupResize(ctx, req)
if err != nil {
diff --git a/internal/service/cloudapi/disks/flattens/flatten_data_source_disk.go b/internal/service/cloudapi/disks/flattens/flatten_data_source_disk.go
index 6a98e41..c928b17 100644
--- a/internal/service/cloudapi/disks/flattens/flatten_data_source_disk.go
+++ b/internal/service/cloudapi/disks/flattens/flatten_data_source_disk.go
@@ -39,18 +39,23 @@ func DiskDataSource(ctx context.Context, state *models.DataSourceDiskModel, c *c
Timeouts: state.Timeouts,
// computed fields
- Id: types.StringValue(id.String()),
+ ID: types.StringValue(id.String()),
AccountID: types.Int64Value(int64(recordDisk.AccountID)),
AccountName: types.StringValue(recordDisk.AccountName),
ACL: types.StringValue(string(diskAcl)),
Computes: flattenComputes(ctx, recordDisk.Computes),
+ CreatedBy: types.StringValue(recordDisk.CreatedBy),
CreatedTime: types.Int64Value(int64(recordDisk.CreatedTime)),
+ DeletedBy: types.StringValue(recordDisk.DeletedBy),
DeletedTime: types.Int64Value(int64(recordDisk.DeletedTime)),
Description: types.StringValue(recordDisk.Description),
DestructionTime: types.Int64Value(int64(recordDisk.DestructionTime)),
DeviceName: types.StringValue(recordDisk.DeviceName),
GID: types.Int64Value(int64(recordDisk.GID)),
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
+ MachineID: types.Int64Value(int64(recordDisk.MachineID)),
+ MachineName: types.StringValue(recordDisk.MachineName),
+ Milestones: types.Int64Value(int64(recordDisk.Milestones)),
Name: types.StringValue(recordDisk.Name),
Order: types.Int64Value(int64(recordDisk.Order)),
Params: types.StringValue(recordDisk.Params),
@@ -64,20 +69,23 @@ func DiskDataSource(ctx context.Context, state *models.DataSourceDiskModel, c *c
SepID: types.Int64Value(int64(recordDisk.SepID)),
SepType: types.StringValue(recordDisk.SepType),
Shareable: types.BoolValue(recordDisk.Shareable),
+ SizeAvailable: types.Float64Value(recordDisk.SizeAvailable),
SizeMax: types.Int64Value(int64(recordDisk.SizeMax)),
SizeUsed: types.Float64Value(recordDisk.SizeUsed),
Snapshots: flattenSnapshots(ctx, recordDisk.Snapshots),
Status: types.StringValue(recordDisk.Status),
TechStatus: types.StringValue(recordDisk.TechStatus),
Type: types.StringValue(recordDisk.Type),
+ UpdatedBy: types.StringValue(recordDisk.UpdatedBy),
+ UpdatedTime: types.Int64Value(int64(recordDisk.UpdatedTime)),
VMID: types.Int64Value(int64(recordDisk.VMID)),
}
- state.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
+ state.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskDataSource: cannot flatten recordDisk.Images to state.Images", diags))
}
- state.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
+ state.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskDataSource: cannot flatten recordDisk.PresentTo to state.PresentTo", diags))
}
diff --git a/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_list.go b/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_list.go
index 6e3799b..798d604 100644
--- a/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_list.go
+++ b/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_list.go
@@ -47,7 +47,7 @@ func DiskListDataSource(ctx context.Context, state *models.DataSourceDiskListMod
Timeouts: state.Timeouts,
// computed fields
- Id: types.StringValue(id.String()),
+ ID: types.StringValue(id.String()),
EntryCount: types.Int64Value(int64(diskList.EntryCount)),
}
@@ -59,7 +59,9 @@ func DiskListDataSource(ctx context.Context, state *models.DataSourceDiskListMod
AccountName: types.StringValue(recordDisk.AccountName),
ACL: types.StringValue(string(diskAcl)),
Computes: flattenComputes(ctx, recordDisk.Computes),
+ CreatedBy: types.StringValue(recordDisk.CreatedBy),
CreatedTime: types.Int64Value(int64(recordDisk.CreatedTime)),
+ DeletedBy: types.StringValue(recordDisk.DeletedBy),
DeletedTime: types.Int64Value(int64(recordDisk.DeletedTime)),
Description: types.StringValue(recordDisk.Description),
DestructionTime: types.Int64Value(int64(recordDisk.DestructionTime)),
@@ -68,6 +70,9 @@ func DiskListDataSource(ctx context.Context, state *models.DataSourceDiskListMod
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
DiskId: types.Int64Value(int64(recordDisk.ID)),
DiskName: types.StringValue(recordDisk.Name),
+ MachineID: types.Int64Value(int64(recordDisk.MachineID)),
+ MachineName: types.StringValue(recordDisk.MachineName),
+ Milestones: types.Int64Value(int64(recordDisk.Milestones)),
Order: types.Int64Value(int64(recordDisk.Order)),
Params: types.StringValue(recordDisk.Params),
ParentID: types.Int64Value(int64(recordDisk.ParentID)),
@@ -80,20 +85,23 @@ func DiskListDataSource(ctx context.Context, state *models.DataSourceDiskListMod
SepID: types.Int64Value(int64(recordDisk.SepID)),
SepType: types.StringValue(recordDisk.SepType),
Shareable: types.BoolValue(recordDisk.Shareable),
+ SizeAvailable: types.Float64Value(recordDisk.SizeAvailable),
SizeMax: types.Int64Value(int64(recordDisk.SizeMax)),
SizeUsed: types.Float64Value(recordDisk.SizeUsed),
Snapshots: flattenSnapshots(ctx, recordDisk.Snapshots),
Status: types.StringValue(recordDisk.Status),
TechStatus: types.StringValue(recordDisk.TechStatus),
Type: types.StringValue(recordDisk.Type),
+ UpdatedBy: types.StringValue(recordDisk.UpdatedBy),
+ UpdatedTime: types.Int64Value(int64(recordDisk.UpdatedTime)),
VMID: types.Int64Value(int64(recordDisk.VMID)),
}
- d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
+ d.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDataSource: cannot flatten recordDisk.Images to d.Images", diags))
}
- d.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
+ d.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDataSource: cannot flatten recordDisk.PresentTo to d.PresentTo", diags))
}
diff --git a/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_list_deleted.go b/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_list_deleted.go
index d413790..5935168 100644
--- a/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_list_deleted.go
+++ b/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_list_deleted.go
@@ -44,7 +44,7 @@ func DiskListDeletedDataSource(ctx context.Context, state *models.DataSourceDisk
Timeouts: state.Timeouts,
// computed fields
- Id: types.StringValue(id.String()),
+ ID: types.StringValue(id.String()),
EntryCount: types.Int64Value(int64(diskList.EntryCount)),
}
@@ -56,7 +56,9 @@ func DiskListDeletedDataSource(ctx context.Context, state *models.DataSourceDisk
AccountName: types.StringValue(recordDisk.AccountName),
ACL: types.StringValue(string(diskAcl)),
Computes: flattenComputes(ctx, recordDisk.Computes),
+ CreatedBy: types.StringValue(recordDisk.CreatedBy),
CreatedTime: types.Int64Value(int64(recordDisk.CreatedTime)),
+ DeletedBy: types.StringValue(recordDisk.DeletedBy),
DeletedTime: types.Int64Value(int64(recordDisk.DeletedTime)),
Description: types.StringValue(recordDisk.Description),
DestructionTime: types.Int64Value(int64(recordDisk.DestructionTime)),
@@ -65,6 +67,7 @@ func DiskListDeletedDataSource(ctx context.Context, state *models.DataSourceDisk
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
DiskId: types.Int64Value(int64(recordDisk.ID)),
DiskName: types.StringValue(recordDisk.Name),
+ Milestones: types.Int64Value(int64(recordDisk.Milestones)),
Order: types.Int64Value(int64(recordDisk.Order)),
Params: types.StringValue(recordDisk.Params),
ParentID: types.Int64Value(int64(recordDisk.ParentID)),
@@ -77,20 +80,23 @@ func DiskListDeletedDataSource(ctx context.Context, state *models.DataSourceDisk
SepID: types.Int64Value(int64(recordDisk.SepID)),
SepType: types.StringValue(recordDisk.SepType),
Shareable: types.BoolValue(recordDisk.Shareable),
+ SizeAvailable: types.Float64Value(recordDisk.SizeAvailable),
SizeMax: types.Int64Value(int64(recordDisk.SizeMax)),
SizeUsed: types.Float64Value(recordDisk.SizeUsed),
Snapshots: flattenSnapshots(ctx, recordDisk.Snapshots),
Status: types.StringValue(recordDisk.Status),
TechStatus: types.StringValue(recordDisk.TechStatus),
Type: types.StringValue(recordDisk.Type),
+ UpdatedBy: types.StringValue(recordDisk.UpdatedBy),
+ UpdatedTime: types.Int64Value(int64(recordDisk.UpdatedTime)),
VMID: types.Int64Value(int64(recordDisk.VMID)),
}
- d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
+ d.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDeletedDataSource: cannot flatten recordDisk.Images to d.Images", diags))
}
- d.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
+ d.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDeletedDataSource: cannot flatten recordDisk.PresentTo to d.PresentTo", diags))
}
diff --git a/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_list_unattached.go b/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_list_unattached.go
index 4e2662c..98e332d 100644
--- a/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_list_unattached.go
+++ b/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_list_unattached.go
@@ -97,7 +97,7 @@ func DiskListUnattachedDataSource(ctx context.Context, state *models.DataSourceD
VMID: types.Int64Value(int64(recordDisk.VMID)),
}
- d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
+ d.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskListUnattachedDataSource: cannot flatten recordDisk.Images to d.Images", diags))
}
diff --git a/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_replication.go b/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_replication.go
index 4c88ea4..0f95d95 100644
--- a/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_replication.go
+++ b/internal/service/cloudapi/disks/flattens/flatten_data_source_disk_replication.go
@@ -47,14 +47,13 @@ func DiskReplicationDataSource(ctx context.Context, state *models.RecordDiskMode
DestructionTime: types.Int64Value(int64(recordDisk.DestructionTime)),
GID: types.Int64Value(int64(recordDisk.GID)),
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
- Images: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordDisk.Images),
+ Images: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordDisk.Images),
Name: types.StringValue(recordDisk.Name),
Order: types.Int64Value(int64(recordDisk.Order)),
Params: types.StringValue(recordDisk.Params),
ParentID: types.Int64Value(int64(recordDisk.ParentID)),
PCISlot: types.Int64Value(int64(recordDisk.PCISlot)),
Pool: types.StringValue(recordDisk.Pool),
- PresentTo: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordDisk.PresentTo),
PurgeTime: types.Int64Value(int64(recordDisk.PurgeTime)),
Replication: &models.ItemReplicationModel{},
ResID: types.StringValue(recordDisk.ResID),
@@ -73,6 +72,11 @@ func DiskReplicationDataSource(ctx context.Context, state *models.RecordDiskMode
VMID: types.Int64Value(int64(recordDisk.VMID)),
}
+ state.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
+ if diags != nil {
+ tflog.Error(ctx, fmt.Sprint("flattens.DiskDataSource: cannot flatten recordDisk.PresentTo to state.PresentTo", diags))
+ }
+
iotune := models.DiskReplicationIOTune{
ReadBytesSec: types.Int64Value(int64(recordDisk.IOTune.ReadBytesSec)),
ReadBytesSecMax: types.Int64Value(int64(recordDisk.IOTune.ReadBytesSecMax)),
diff --git a/internal/service/cloudapi/disks/flattens/flatten_resource_disk.go b/internal/service/cloudapi/disks/flattens/flatten_resource_disk.go
index 59d935f..d6d0dec 100644
--- a/internal/service/cloudapi/disks/flattens/flatten_resource_disk.go
+++ b/internal/service/cloudapi/disks/flattens/flatten_resource_disk.go
@@ -23,7 +23,7 @@ func DiskResource(ctx context.Context, plan *models.ResourceDiskModel, c *client
diags := diag.Diagnostics{}
- diskId, err := strconv.ParseUint(plan.Id.ValueString(), 10, 64)
+ diskId, err := strconv.ParseUint(plan.ID.ValueString(), 10, 64)
if err != nil {
diags.AddError("flattens.DiskResource: Cannot parse disk ID from state", err.Error())
return diags
@@ -43,13 +43,11 @@ func DiskResource(ctx context.Context, plan *models.ResourceDiskModel, c *client
AccountID: types.Int64Value(int64(recordDisk.AccountID)),
DiskName: types.StringValue(recordDisk.Name),
SizeMax: types.Int64Value(int64(recordDisk.SizeMax)),
- GID: types.Int64Value(int64(recordDisk.GID)),
// optional fields
- Description: plan.Description,
- Pool: plan.Pool,
- SEPID: plan.SEPID,
- Type: plan.Type,
+ Description: types.StringValue(recordDisk.Description),
+ Pool: types.StringValue(recordDisk.Pool),
+ SEPID: types.Int64Value(int64(recordDisk.SepID)),
Detach: plan.Detach,
Permanently: plan.Permanently,
Shareable: plan.Shareable,
@@ -57,16 +55,21 @@ func DiskResource(ctx context.Context, plan *models.ResourceDiskModel, c *client
// computed fields
LastUpdated: plan.LastUpdated,
- Id: types.StringValue(strconv.Itoa(int(recordDisk.ID))),
- DiskId: types.Int64Value(int64(recordDisk.ID)),
+ ID: types.StringValue(strconv.Itoa(int(recordDisk.ID))),
+ DiskID: types.Int64Value(int64(recordDisk.ID)),
AccountName: types.StringValue(recordDisk.AccountName),
ACL: types.StringValue(string(diskAcl)),
Computes: flattenComputes(ctx, recordDisk.Computes),
+ CreatedBy: types.StringValue(recordDisk.CreatedBy),
CreatedTime: types.Int64Value(int64(recordDisk.CreatedTime)),
+ DeletedBy: types.StringValue(recordDisk.DeletedBy),
DeletedTime: types.Int64Value(int64(recordDisk.DeletedTime)),
DestructionTime: types.Int64Value(int64(recordDisk.DestructionTime)),
DeviceName: types.StringValue(recordDisk.DeviceName),
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
+ MachineID: types.Int64Value(int64(recordDisk.MachineID)),
+ MachineName: types.StringValue(recordDisk.MachineName),
+ GID: types.Int64Value(int64(recordDisk.GID)),
Order: types.Int64Value(int64(recordDisk.Order)),
Params: types.StringValue(recordDisk.Params),
ParentID: types.Int64Value(int64(recordDisk.ParentID)),
@@ -80,14 +83,17 @@ func DiskResource(ctx context.Context, plan *models.ResourceDiskModel, c *client
Snapshots: flattenSnapshots(ctx, recordDisk.Snapshots),
Status: types.StringValue(recordDisk.Status),
TechStatus: types.StringValue(recordDisk.TechStatus),
+ Type: types.StringValue(recordDisk.Type),
+ UpdatedBy: types.StringValue(recordDisk.UpdatedBy),
+ UpdatedTime: types.Int64Value(int64(recordDisk.UpdatedTime)),
VMID: types.Int64Value(int64(recordDisk.VMID)),
}
- plan.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
+ plan.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskResource: cannot flatten recordDisk.Images to plan.Images", diags))
}
- plan.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
+ plan.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskResource: cannot flatten recordDisk.PresentTo to plan.PresentTo", diags))
}
@@ -129,7 +135,7 @@ func DiskResource(ctx context.Context, plan *models.ResourceDiskModel, c *client
}
plan.IOTune = obj
- tflog.Info(ctx, "flattens.DiskResource: after flatten", map[string]any{"disk_id": plan.Id.ValueString()})
+ tflog.Info(ctx, "flattens.DiskResource: after flatten", map[string]any{"disk_id": plan.ID.ValueString()})
tflog.Info(ctx, "End flattens.DiskResource")
return nil
diff --git a/internal/service/cloudapi/disks/flattens/flatten_resource_disk_replication.go b/internal/service/cloudapi/disks/flattens/flatten_resource_disk_replication.go
index f35b6ce..0aa2288 100644
--- a/internal/service/cloudapi/disks/flattens/flatten_resource_disk_replication.go
+++ b/internal/service/cloudapi/disks/flattens/flatten_resource_disk_replication.go
@@ -57,13 +57,12 @@ func DiskReplicationResource(ctx context.Context, state *models.ResourceRecordDi
DestructionTime: types.Int64Value(int64(recordDisk.DestructionTime)),
GID: types.Int64Value(int64(recordDisk.GID)),
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
- Images: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordDisk.Images),
+ Images: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordDisk.Images),
Order: types.Int64Value(int64(recordDisk.Order)),
Params: types.StringValue(recordDisk.Params),
ParentID: types.Int64Value(int64(recordDisk.ParentID)),
PCISlot: types.Int64Value(int64(recordDisk.PCISlot)),
Pool: types.StringValue(recordDisk.Pool),
- PresentTo: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordDisk.PresentTo),
PurgeTime: types.Int64Value(int64(recordDisk.PurgeTime)),
ResID: types.StringValue(recordDisk.ResID),
ResName: types.StringValue(recordDisk.ResName),
@@ -80,6 +79,11 @@ func DiskReplicationResource(ctx context.Context, state *models.ResourceRecordDi
VMID: types.Int64Value(int64(recordDisk.VMID)),
}
+ state.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
+ if diags != nil {
+ tflog.Error(ctx, fmt.Sprint("flattens.DiskDataSource: cannot flatten recordDisk.PresentTo to state.PresentTo", diags))
+ }
+
iotune := models.ResourceDiskReplicationIOTuneModel{
ReadBytesSec: types.Int64Value(int64(recordDisk.IOTune.ReadBytesSec)),
ReadBytesSecMax: types.Int64Value(int64(recordDisk.IOTune.ReadBytesSecMax)),
diff --git a/internal/service/cloudapi/disks/input_checks.go b/internal/service/cloudapi/disks/input_checks.go
index e508859..3ae7d68 100644
--- a/internal/service/cloudapi/disks/input_checks.go
+++ b/internal/service/cloudapi/disks/input_checks.go
@@ -22,12 +22,6 @@ func resourceDiskCreateInputChecks(ctx context.Context, plan *models.ResourceDis
diags.AddError(fmt.Sprintf("Cannot get info about account with ID %v", accountId), err.Error())
}
- gid := uint64(plan.GID.ValueInt64())
- tflog.Info(ctx, "resourceDiskCreateInputChecks: exist gid check", map[string]any{"gid": gid})
- err = ic.ExistGID(ctx, gid, c)
- if err != nil {
- diags.AddError(fmt.Sprintf("Cannot get info about GID %v", gid), err.Error())
- }
return diags
}
@@ -62,7 +56,7 @@ func resourceDiskUpdateInputChecks(ctx context.Context, plan, state *models.Reso
fmt.Sprintf("cannot change description from %s to %s for disk id %s",
state.Description.ValueString(),
plan.Description.ValueString(),
- plan.Id.ValueString()))
+ plan.ID.ValueString()))
}
// check pool
@@ -72,7 +66,7 @@ func resourceDiskUpdateInputChecks(ctx context.Context, plan, state *models.Reso
fmt.Sprintf("cannot change pool from %s to %s for disk id %s",
state.Pool.ValueString(),
plan.Pool.ValueString(),
- plan.Id.ValueString()))
+ plan.ID.ValueString()))
}
// check sep_id
@@ -82,17 +76,7 @@ func resourceDiskUpdateInputChecks(ctx context.Context, plan, state *models.Reso
fmt.Sprintf("cannot change sep_id from %d to %d for disk id %s",
state.SEPID.ValueInt64(),
plan.SEPID.ValueInt64(),
- plan.Id.ValueString()))
- }
-
- // check type
- if !plan.Type.Equal(state.Type) && !plan.Type.IsUnknown() {
- diags.AddError(
- "resourceDiskUpdateInputChecks: type change is not allowed",
- fmt.Sprintf("cannot change type from %s to %s for disk id %s",
- state.Type.ValueString(),
- plan.Type.ValueString(),
- plan.Id.ValueString()))
+ plan.ID.ValueString()))
}
return diags
diff --git a/internal/service/cloudapi/disks/models/model_data_source_disk.go b/internal/service/cloudapi/disks/models/model_data_source_disk.go
index a52106b..4829d26 100644
--- a/internal/service/cloudapi/disks/models/model_data_source_disk.go
+++ b/internal/service/cloudapi/disks/models/model_data_source_disk.go
@@ -11,12 +11,14 @@ type DataSourceDiskModel struct {
Timeouts timeouts.Value `tfsdk:"timeouts"`
// response fields
- Id types.String `tfsdk:"id"`
+ ID types.String `tfsdk:"id"`
ACL types.String `tfsdk:"acl"`
AccountID types.Int64 `tfsdk:"account_id"`
AccountName types.String `tfsdk:"account_name"`
Computes types.List `tfsdk:"computes"`
+ CreatedBy types.String `tfsdk:"created_by"`
CreatedTime types.Int64 `tfsdk:"created_time"`
+ DeletedBy types.String `tfsdk:"deleted_by"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
DeviceName types.String `tfsdk:"devicename"`
Description types.String `tfsdk:"desc"`
@@ -25,13 +27,16 @@ type DataSourceDiskModel struct {
ImageID types.Int64 `tfsdk:"image_id"`
Images types.List `tfsdk:"images"`
IOTune types.Object `tfsdk:"iotune"`
+ MachineID types.Int64 `tfsdk:"machine_id"`
+ MachineName types.String `tfsdk:"machine_name"`
+ Milestones types.Int64 `tfsdk:"milestones"`
Name types.String `tfsdk:"disk_name"`
Order types.Int64 `tfsdk:"order"`
Params types.String `tfsdk:"params"`
ParentID types.Int64 `tfsdk:"parent_id"`
PCISlot types.Int64 `tfsdk:"pci_slot"`
Pool types.String `tfsdk:"pool"`
- PresentTo types.List `tfsdk:"present_to"`
+ PresentTo types.Map `tfsdk:"present_to"`
PurgeTime types.Int64 `tfsdk:"purge_time"`
ResID types.String `tfsdk:"res_id"`
ResName types.String `tfsdk:"res_name"`
@@ -39,11 +44,14 @@ type DataSourceDiskModel struct {
SepType types.String `tfsdk:"sep_type"`
SepID types.Int64 `tfsdk:"sep_id"`
Shareable types.Bool `tfsdk:"shareable"`
+ SizeAvailable types.Float64 `tfsdk:"size_available"`
SizeMax types.Int64 `tfsdk:"size_max"`
SizeUsed types.Float64 `tfsdk:"size_used"`
Snapshots types.List `tfsdk:"snapshots"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
Type types.String `tfsdk:"type"`
+ UpdatedBy types.String `tfsdk:"updated_by"`
+ UpdatedTime types.Int64 `tfsdk:"updated_time"`
VMID types.Int64 `tfsdk:"vmid"`
}
diff --git a/internal/service/cloudapi/disks/models/model_data_source_disk_list.go b/internal/service/cloudapi/disks/models/model_data_source_disk_list.go
index c3585be..540a5ce 100644
--- a/internal/service/cloudapi/disks/models/model_data_source_disk_list.go
+++ b/internal/service/cloudapi/disks/models/model_data_source_disk_list.go
@@ -23,7 +23,7 @@ type DataSourceDiskListModel struct {
Timeouts timeouts.Value `tfsdk:"timeouts"`
// response fields
- Id types.String `tfsdk:"id"`
+ ID types.String `tfsdk:"id"`
Items []ItemDiskModel `tfsdk:"items"`
EntryCount types.Int64 `tfsdk:"entry_count"`
}
@@ -33,7 +33,9 @@ type ItemDiskModel struct {
AccountName types.String `tfsdk:"account_name"`
ACL types.String `tfsdk:"acl"`
Computes types.List `tfsdk:"computes"`
+ CreatedBy types.String `tfsdk:"created_by"`
CreatedTime types.Int64 `tfsdk:"created_time"`
+ DeletedBy types.String `tfsdk:"deleted_by"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
Description types.String `tfsdk:"desc"`
DestructionTime types.Int64 `tfsdk:"destruction_time"`
@@ -46,12 +48,13 @@ type ItemDiskModel struct {
MachineName types.String `tfsdk:"machine_name"`
DiskId types.Int64 `tfsdk:"disk_id"`
DiskName types.String `tfsdk:"disk_name"`
+ Milestones types.Int64 `tfsdk:"milestones"`
Order types.Int64 `tfsdk:"order"`
Params types.String `tfsdk:"params"`
ParentID types.Int64 `tfsdk:"parent_id"`
PCISlot types.Int64 `tfsdk:"pci_slot"`
Pool types.String `tfsdk:"pool"`
- PresentTo types.List `tfsdk:"present_to"`
+ PresentTo types.Map `tfsdk:"present_to"`
PurgeTime types.Int64 `tfsdk:"purge_time"`
ResID types.String `tfsdk:"res_id"`
ResName types.String `tfsdk:"res_name"`
@@ -59,11 +62,14 @@ type ItemDiskModel struct {
SepID types.Int64 `tfsdk:"sep_id"`
SepType types.String `tfsdk:"sep_type"`
Shareable types.Bool `tfsdk:"shareable"`
+ SizeAvailable types.Float64 `tfsdk:"size_available"`
SizeMax types.Int64 `tfsdk:"size_max"`
SizeUsed types.Float64 `tfsdk:"size_used"`
Snapshots types.List `tfsdk:"snapshots"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
Type types.String `tfsdk:"type"`
+ UpdatedBy types.String `tfsdk:"updated_by"`
+ UpdatedTime types.Int64 `tfsdk:"updated_time"`
VMID types.Int64 `tfsdk:"vmid"`
}
diff --git a/internal/service/cloudapi/disks/models/model_data_source_disk_list_deleted.go b/internal/service/cloudapi/disks/models/model_data_source_disk_list_deleted.go
index 0536266..bb7d44f 100644
--- a/internal/service/cloudapi/disks/models/model_data_source_disk_list_deleted.go
+++ b/internal/service/cloudapi/disks/models/model_data_source_disk_list_deleted.go
@@ -20,7 +20,7 @@ type DataSourceDiskListDeletedModel struct {
Timeouts timeouts.Value `tfsdk:"timeouts"`
// response fields
- Id types.String `tfsdk:"id"`
+ ID types.String `tfsdk:"id"`
Items []ItemDiskModel `tfsdk:"items"`
EntryCount types.Int64 `tfsdk:"entry_count"`
}
diff --git a/internal/service/cloudapi/disks/models/model_data_source_disk_replication.go b/internal/service/cloudapi/disks/models/model_data_source_disk_replication.go
index 68a18ff..8be3136 100644
--- a/internal/service/cloudapi/disks/models/model_data_source_disk_replication.go
+++ b/internal/service/cloudapi/disks/models/model_data_source_disk_replication.go
@@ -31,7 +31,7 @@ type RecordDiskModel struct {
ParentID types.Int64 `tfsdk:"parent_id"`
PCISlot types.Int64 `tfsdk:"pci_slot"`
Pool types.String `tfsdk:"pool"`
- PresentTo types.List `tfsdk:"present_to"`
+ PresentTo types.Map `tfsdk:"present_to"`
PurgeTime types.Int64 `tfsdk:"purge_time"`
Replication *ItemReplicationModel `tfsdk:"replication"`
ResID types.String `tfsdk:"res_id"`
diff --git a/internal/service/cloudapi/disks/models/model_resource_disk.go b/internal/service/cloudapi/disks/models/model_resource_disk.go
index a80e4c4..9ed85c1 100644
--- a/internal/service/cloudapi/disks/models/model_resource_disk.go
+++ b/internal/service/cloudapi/disks/models/model_resource_disk.go
@@ -11,7 +11,6 @@ type ResourceDiskModel struct {
AccountID types.Int64 `tfsdk:"account_id"`
DiskName types.String `tfsdk:"disk_name"`
SizeMax types.Int64 `tfsdk:"size_max"`
- GID types.Int64 `tfsdk:"gid"`
// request fields - optional
Description types.String `tfsdk:"desc"`
@@ -25,23 +24,28 @@ type ResourceDiskModel struct {
Timeouts timeouts.Value `tfsdk:"timeouts"`
// response fields
- Id types.String `tfsdk:"id"`
+ ID types.String `tfsdk:"id"`
LastUpdated types.String `tfsdk:"last_updated"`
ACL types.String `tfsdk:"acl"`
AccountName types.String `tfsdk:"account_name"`
Computes types.List `tfsdk:"computes"`
+ CreatedBy types.String `tfsdk:"created_by"`
CreatedTime types.Int64 `tfsdk:"created_time"`
+ DeletedBy types.String `tfsdk:"deleted_by"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
DeviceName types.String `tfsdk:"devicename"`
DestructionTime types.Int64 `tfsdk:"destruction_time"`
- DiskId types.Int64 `tfsdk:"disk_id"`
+ DiskID types.Int64 `tfsdk:"disk_id"`
ImageID types.Int64 `tfsdk:"image_id"`
Images types.List `tfsdk:"images"`
+ MachineID types.Int64 `tfsdk:"machine_id"`
+ MachineName types.String `tfsdk:"machine_name"`
+ GID types.Int64 `tfsdk:"gid"`
Order types.Int64 `tfsdk:"order"`
Params types.String `tfsdk:"params"`
ParentID types.Int64 `tfsdk:"parent_id"`
PCISlot types.Int64 `tfsdk:"pci_slot"`
- PresentTo types.List `tfsdk:"present_to"`
+ PresentTo types.Map `tfsdk:"present_to"`
PurgeTime types.Int64 `tfsdk:"purge_time"`
ResID types.String `tfsdk:"res_id"`
ResName types.String `tfsdk:"res_name"`
@@ -51,6 +55,8 @@ type ResourceDiskModel struct {
Snapshots types.List `tfsdk:"snapshots"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
+ UpdatedBy types.String `tfsdk:"updated_by"`
+ UpdatedTime types.Int64 `tfsdk:"updated_time"`
VMID types.Int64 `tfsdk:"vmid"`
}
diff --git a/internal/service/cloudapi/disks/models/model_resource_disk_replication.go b/internal/service/cloudapi/disks/models/model_resource_disk_replication.go
index 53ef140..a701f00 100644
--- a/internal/service/cloudapi/disks/models/model_resource_disk_replication.go
+++ b/internal/service/cloudapi/disks/models/model_resource_disk_replication.go
@@ -40,7 +40,7 @@ type ResourceRecordDiskReplicationModel struct {
ParentID types.Int64 `tfsdk:"parent_id"`
PCISlot types.Int64 `tfsdk:"pci_slot"`
Pool types.String `tfsdk:"pool"`
- PresentTo types.List `tfsdk:"present_to"`
+ PresentTo types.Map `tfsdk:"present_to"`
PurgeTime types.Int64 `tfsdk:"purge_time"`
Replication types.Object `tfsdk:"replication"`
ResID types.String `tfsdk:"res_id"`
diff --git a/internal/service/cloudapi/disks/resource_disk.go b/internal/service/cloudapi/disks/resource_disk.go
index e580b2f..aa8d724 100644
--- a/internal/service/cloudapi/disks/resource_disk.go
+++ b/internal/service/cloudapi/disks/resource_disk.go
@@ -51,7 +51,6 @@ func (r *resourceDisk) Create(ctx context.Context, req resource.CreateRequest, r
"account_id": plan.AccountID.ValueInt64(),
"disk_name": plan.DiskName.ValueString(),
"size_max": plan.SizeMax.ValueInt64(),
- "gid": plan.GID.ValueInt64(),
}
tflog.Info(ctx, "Create resourceDisk: got plan successfully", contextCreateMap)
tflog.Info(ctx, "Create resourceDisk: start creating", contextCreateMap)
@@ -67,7 +66,6 @@ func (r *resourceDisk) Create(ctx context.Context, req resource.CreateRequest, r
"account_id": plan.AccountID.ValueInt64(),
"disk_name": plan.DiskName.ValueString(),
"size_max": plan.SizeMax.ValueInt64(),
- "gid": plan.GID.ValueInt64(),
"createTimeout": createTimeout})
ctx, cancel := context.WithTimeout(ctx, createTimeout)
@@ -93,7 +91,7 @@ func (r *resourceDisk) Create(ctx context.Context, req resource.CreateRequest, r
)
return
}
- plan.Id = types.StringValue(strconv.Itoa(int(diskId)))
+ plan.ID = types.StringValue(strconv.Itoa(int(diskId)))
tflog.Info(ctx, "Create resourceDisk: disk created", map[string]any{"diskId": diskId, "disk_name": plan.DiskName.ValueString()})
// additional settings after disk creation: in case of failures, warnings are added to resp.Diagnostics,
@@ -137,7 +135,7 @@ func (r *resourceDisk) Read(ctx context.Context, req resource.ReadRequest, resp
tflog.Error(ctx, "Read resourceDisk: Error get state")
return
}
- tflog.Info(ctx, "Read resourceDisk: got state successfully", map[string]any{"disk_id": state.Id.ValueString()})
+ tflog.Info(ctx, "Read resourceDisk: got state successfully", map[string]any{"disk_id": state.ID.ValueString()})
// Set timeouts
readTimeout, diags := state.Timeouts.Read(ctx, constants.Timeout300s)
@@ -147,7 +145,7 @@ func (r *resourceDisk) Read(ctx context.Context, req resource.ReadRequest, resp
return
}
tflog.Info(ctx, "Read resourceDisk: set timeouts successfully", map[string]any{
- "disk_id": state.Id.ValueString(),
+ "disk_id": state.ID.ValueString(),
"readTimeout": readTimeout})
ctx, cancel := context.WithTimeout(ctx, readTimeout)
@@ -185,7 +183,7 @@ func (r *resourceDisk) Update(ctx context.Context, req resource.UpdateRequest, r
tflog.Error(ctx, "Update resourceDisk: Error receiving the plan")
return
}
- tflog.Info(ctx, "Update resourceDisk: got plan successfully", map[string]any{"disk_id": plan.Id.ValueString()})
+ tflog.Info(ctx, "Update resourceDisk: got plan successfully", map[string]any{"disk_id": plan.ID.ValueString()})
// Retrieve values from state
var state models.ResourceDiskModel
@@ -194,7 +192,7 @@ func (r *resourceDisk) Update(ctx context.Context, req resource.UpdateRequest, r
tflog.Error(ctx, "Update resourceDisk: Error receiving the state")
return
}
- tflog.Info(ctx, "Update resourceDisk: got state successfully", map[string]any{"disk_id": state.Id.ValueString()})
+ tflog.Info(ctx, "Update resourceDisk: got state successfully", map[string]any{"disk_id": state.ID.ValueString()})
// Set timeouts
updateTimeout, diags := plan.Timeouts.Update(ctx, constants.Timeout300s)
@@ -204,22 +202,22 @@ func (r *resourceDisk) Update(ctx context.Context, req resource.UpdateRequest, r
return
}
tflog.Info(ctx, "Update resourceDisk: set timeouts successfully", map[string]any{
- "disk_id": state.Id.ValueString(),
+ "disk_id": state.ID.ValueString(),
"updateTimeout": updateTimeout})
ctx, cancel := context.WithTimeout(ctx, updateTimeout)
defer cancel()
// Checking if inputs are valid
- tflog.Info(ctx, "Update resourceDisk: starting input checks", map[string]any{"disk_id": plan.Id.ValueString()})
+ tflog.Info(ctx, "Update resourceDisk: starting input checks", map[string]any{"disk_id": plan.ID.ValueString()})
resp.Diagnostics.Append(resourceDiskUpdateInputChecks(ctx, &plan, &state, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceDisk: Error input checks")
return
}
- tflog.Info(ctx, "Update resourceDisk: input checks successful", map[string]any{"disk_id": state.Id.ValueString()})
+ tflog.Info(ctx, "Update resourceDisk: input checks successful", map[string]any{"disk_id": state.ID.ValueString()})
- diskId, err := strconv.Atoi(state.Id.ValueString())
+ diskId, err := strconv.Atoi(state.ID.ValueString())
if err != nil {
resp.Diagnostics.AddError("Update resourceDisk: Cannot parse disk ID from state", err.Error())
return
@@ -261,7 +259,7 @@ func (r *resourceDisk) Update(ctx context.Context, req resource.UpdateRequest, r
}
}
- tflog.Info(ctx, "Update resourceDisk: disk update is completed", map[string]any{"disk_id": plan.Id.ValueString()})
+ tflog.Info(ctx, "Update resourceDisk: disk update is completed", map[string]any{"disk_id": plan.ID.ValueString()})
// Map response body to schema and populate Computed attribute values
resp.Diagnostics.Append(flattens.DiskResource(ctx, &plan, r.client)...)
@@ -288,7 +286,7 @@ func (r *resourceDisk) Delete(ctx context.Context, req resource.DeleteRequest, r
tflog.Error(ctx, "Delete resourceDisk: Error get state")
return
}
- tflog.Info(ctx, "Delete resourceDisk: got state successfully", map[string]any{"disk_id": state.Id.ValueString()})
+ tflog.Info(ctx, "Delete resourceDisk: got state successfully", map[string]any{"disk_id": state.ID.ValueString()})
// Set timeouts
deleteTimeout, diags := state.Timeouts.Delete(ctx, constants.Timeout300s)
@@ -298,7 +296,7 @@ func (r *resourceDisk) Delete(ctx context.Context, req resource.DeleteRequest, r
return
}
tflog.Info(ctx, "Delete resourceDisk: set timeouts successfully", map[string]any{
- "disk_id": state.Id.ValueString(),
+ "disk_id": state.ID.ValueString(),
"deleteTimeout": deleteTimeout})
ctx, cancel := context.WithTimeout(ctx, deleteTimeout)
@@ -306,7 +304,7 @@ func (r *resourceDisk) Delete(ctx context.Context, req resource.DeleteRequest, r
// Delete existing resource group
delReq := disks.DeleteRequest{
- DiskID: uint64(state.DiskId.ValueInt64()),
+ DiskID: uint64(state.DiskID.ValueInt64()),
Detach: state.Detach.ValueBool(), // default false
Permanently: state.Permanently.ValueBool(), // default false
}
@@ -318,7 +316,7 @@ func (r *resourceDisk) Delete(ctx context.Context, req resource.DeleteRequest, r
return
}
- tflog.Info(ctx, "End delete resourceDisk", map[string]any{"disk_id": state.Id.ValueString()})
+ tflog.Info(ctx, "End delete resourceDisk", map[string]any{"disk_id": state.ID.ValueString()})
}
// Schema defines the schema for the resource.
diff --git a/internal/service/cloudapi/disks/schemas/schema_data_source_disk.go b/internal/service/cloudapi/disks/schemas/schema_data_source_disk.go
index 0787900..d5057e9 100644
--- a/internal/service/cloudapi/disks/schemas/schema_data_source_disk.go
+++ b/internal/service/cloudapi/disks/schemas/schema_data_source_disk.go
@@ -38,9 +38,15 @@ func MakeSchemaDataSourceDisk() map[string]schema.Attribute {
},
},
},
+ "created_by": schema.StringAttribute{
+ Computed: true,
+ },
"created_time": schema.Int64Attribute{
Computed: true,
},
+ "deleted_by": schema.StringAttribute{
+ Computed: true,
+ },
"deleted_time": schema.Int64Attribute{
Computed: true,
},
@@ -61,7 +67,7 @@ func MakeSchemaDataSourceDisk() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
@@ -110,6 +116,15 @@ func MakeSchemaDataSourceDisk() map[string]schema.Attribute {
"disk_name": schema.StringAttribute{
Computed: true,
},
+ "machine_id": schema.Int64Attribute{
+ Computed: true,
+ },
+ "machine_name": schema.StringAttribute{
+ Computed: true,
+ },
+ "milestones": schema.Int64Attribute{
+ Computed: true,
+ },
"order": schema.Int64Attribute{
Computed: true,
},
@@ -125,7 +140,7 @@ func MakeSchemaDataSourceDisk() map[string]schema.Attribute {
"pool": schema.StringAttribute{
Computed: true,
},
- "present_to": schema.ListAttribute{
+ "present_to": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
@@ -150,6 +165,9 @@ func MakeSchemaDataSourceDisk() map[string]schema.Attribute {
"shareable": schema.BoolAttribute{
Computed: true,
},
+ "size_available": schema.Float64Attribute{
+ Computed: true,
+ },
"size_max": schema.Int64Attribute{
Computed: true,
},
@@ -190,6 +208,12 @@ func MakeSchemaDataSourceDisk() map[string]schema.Attribute {
"type": schema.StringAttribute{
Computed: true,
},
+ "updated_by": schema.StringAttribute{
+ Computed: true,
+ },
+ "updated_time": schema.Int64Attribute{
+ Computed: true,
+ },
"vmid": schema.Int64Attribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/disks/schemas/schema_data_source_disk_list.go b/internal/service/cloudapi/disks/schemas/schema_data_source_disk_list.go
index ee51429..3a4a2a4 100644
--- a/internal/service/cloudapi/disks/schemas/schema_data_source_disk_list.go
+++ b/internal/service/cloudapi/disks/schemas/schema_data_source_disk_list.go
@@ -91,9 +91,15 @@ func MakeSchemaDataSourceDiskList() map[string]schema.Attribute {
},
},
},
+ "created_by": schema.StringAttribute{
+ Computed: true,
+ },
"created_time": schema.Int64Attribute{
Computed: true,
},
+ "deleted_by": schema.StringAttribute{
+ Computed: true,
+ },
"deleted_time": schema.Int64Attribute{
Computed: true,
},
@@ -117,7 +123,7 @@ func MakeSchemaDataSourceDiskList() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
@@ -169,6 +175,9 @@ func MakeSchemaDataSourceDiskList() map[string]schema.Attribute {
"machine_name": schema.StringAttribute{
Computed: true,
},
+ "milestones": schema.Int64Attribute{
+ Computed: true,
+ },
"disk_name": schema.StringAttribute{
Computed: true,
},
@@ -187,7 +196,7 @@ func MakeSchemaDataSourceDiskList() map[string]schema.Attribute {
"pool": schema.StringAttribute{
Computed: true,
},
- "present_to": schema.ListAttribute{
+ "present_to": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
@@ -212,6 +221,9 @@ func MakeSchemaDataSourceDiskList() map[string]schema.Attribute {
"shareable": schema.BoolAttribute{
Computed: true,
},
+ "size_available": schema.Float64Attribute{
+ Computed: true,
+ },
"size_max": schema.Int64Attribute{
Computed: true,
},
@@ -252,6 +264,12 @@ func MakeSchemaDataSourceDiskList() map[string]schema.Attribute {
"type": schema.StringAttribute{
Computed: true,
},
+ "updated_by": schema.StringAttribute{
+ Computed: true,
+ },
+ "updated_time": schema.Int64Attribute{
+ Computed: true,
+ },
"vmid": schema.Int64Attribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/disks/schemas/schema_data_source_disk_list_deleted.go b/internal/service/cloudapi/disks/schemas/schema_data_source_disk_list_deleted.go
index c341c03..c94f2d9 100644
--- a/internal/service/cloudapi/disks/schemas/schema_data_source_disk_list_deleted.go
+++ b/internal/service/cloudapi/disks/schemas/schema_data_source_disk_list_deleted.go
@@ -79,9 +79,15 @@ func MakeSchemaDataSourceDiskListDeleted() map[string]schema.Attribute {
},
},
},
+ "created_by": schema.StringAttribute{
+ Computed: true,
+ },
"created_time": schema.Int64Attribute{
Computed: true,
},
+ "deleted_by": schema.StringAttribute{
+ Computed: true,
+ },
"deleted_time": schema.Int64Attribute{
Computed: true,
},
@@ -105,7 +111,7 @@ func MakeSchemaDataSourceDiskListDeleted() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
@@ -157,6 +163,9 @@ func MakeSchemaDataSourceDiskListDeleted() map[string]schema.Attribute {
"machine_name": schema.StringAttribute{
Computed: true,
},
+ "milestones": schema.Int64Attribute{
+ Computed: true,
+ },
"disk_name": schema.StringAttribute{
Computed: true,
},
@@ -175,7 +184,7 @@ func MakeSchemaDataSourceDiskListDeleted() map[string]schema.Attribute {
"pool": schema.StringAttribute{
Computed: true,
},
- "present_to": schema.ListAttribute{
+ "present_to": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
@@ -200,6 +209,9 @@ func MakeSchemaDataSourceDiskListDeleted() map[string]schema.Attribute {
"shareable": schema.BoolAttribute{
Computed: true,
},
+ "size_available": schema.Float64Attribute{
+ Computed: true,
+ },
"size_max": schema.Int64Attribute{
Computed: true,
},
@@ -240,6 +252,12 @@ func MakeSchemaDataSourceDiskListDeleted() map[string]schema.Attribute {
"type": schema.StringAttribute{
Computed: true,
},
+ "updated_by": schema.StringAttribute{
+ Computed: true,
+ },
+ "updated_time": schema.Int64Attribute{
+ Computed: true,
+ },
"vmid": schema.Int64Attribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/disks/schemas/schema_data_source_disk_list_unattached.go b/internal/service/cloudapi/disks/schemas/schema_data_source_disk_list_unattached.go
index b6feb97..5a02b66 100644
--- a/internal/service/cloudapi/disks/schemas/schema_data_source_disk_list_unattached.go
+++ b/internal/service/cloudapi/disks/schemas/schema_data_source_disk_list_unattached.go
@@ -109,7 +109,7 @@ func MakeSchemaDataSourceDiskListUnattached() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
diff --git a/internal/service/cloudapi/disks/schemas/schema_data_source_disk_replication.go b/internal/service/cloudapi/disks/schemas/schema_data_source_disk_replication.go
index 1867ec7..cedc469 100644
--- a/internal/service/cloudapi/disks/schemas/schema_data_source_disk_replication.go
+++ b/internal/service/cloudapi/disks/schemas/schema_data_source_disk_replication.go
@@ -66,7 +66,7 @@ func MakeSchemaDataSourceDiskReplication() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
@@ -130,7 +130,7 @@ func MakeSchemaDataSourceDiskReplication() map[string]schema.Attribute {
"pool": schema.StringAttribute{
Computed: true,
},
- "present_to": schema.ListAttribute{
+ "present_to": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
diff --git a/internal/service/cloudapi/disks/schemas/schema_resource_disk.go b/internal/service/cloudapi/disks/schemas/schema_resource_disk.go
index 187ce88..07b27a7 100644
--- a/internal/service/cloudapi/disks/schemas/schema_resource_disk.go
+++ b/internal/service/cloudapi/disks/schemas/schema_resource_disk.go
@@ -1,11 +1,10 @@
package schemas
import (
- "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
- "github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
)
@@ -24,10 +23,6 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
Required: true,
Description: "size in GB, default is 10",
},
- "gid": schema.Int64Attribute{
- Required: true,
- Description: "ID of the grid (platform)",
- },
// optional attributes
"desc": schema.StringAttribute{
@@ -46,23 +41,21 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
Description: "Storage endpoint provider ID to create disk",
},
"type": schema.StringAttribute{
- Optional: true,
- Computed: true,
- Validators: []validator.String{
- stringvalidator.OneOf("B", "D", "T"), // case is not ignored
- },
+ Computed: true,
Description: "(B;D;T) B=Boot;D=Data;T=Temp",
// default is D
},
"detach": schema.BoolAttribute{
Optional: true,
+ Computed: true,
Description: "Detaching the disk from compute",
- // default is false
+ Default: booldefault.StaticBool(true),
},
"permanently": schema.BoolAttribute{
Optional: true,
+ Computed: true,
Description: "Whether to completely delete the disk, works only with non attached disks",
- // default is false
+ Default: booldefault.StaticBool(true),
},
"shareable": schema.BoolAttribute{
Optional: true,
@@ -170,9 +163,15 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
},
},
},
+ "created_by": schema.StringAttribute{
+ Computed: true,
+ },
"created_time": schema.Int64Attribute{
Computed: true,
},
+ "deleted_by": schema.StringAttribute{
+ Computed: true,
+ },
"deleted_time": schema.Int64Attribute{
Computed: true,
},
@@ -187,12 +186,22 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
+ },
+ "gid": schema.Int64Attribute{
+ Computed: true,
+ Description: "ID of the grid (platform)",
},
"last_updated": schema.StringAttribute{
Computed: true,
Description: "Timestamp of the last Terraform update of the disk resource.",
},
+ "machine_id": schema.Int64Attribute{
+ Computed: true,
+ },
+ "machine_name": schema.StringAttribute{
+ Computed: true,
+ },
"order": schema.Int64Attribute{
Computed: true,
},
@@ -205,7 +214,7 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
"pci_slot": schema.Int64Attribute{
Computed: true,
},
- "present_to": schema.ListAttribute{
+ "present_to": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
@@ -258,6 +267,12 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
"tech_status": schema.StringAttribute{
Computed: true,
},
+ "updated_by": schema.StringAttribute{
+ Computed: true,
+ },
+ "updated_time": schema.Int64Attribute{
+ Computed: true,
+ },
"vmid": schema.Int64Attribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/disks/schemas/schema_resource_disk_replication.go b/internal/service/cloudapi/disks/schemas/schema_resource_disk_replication.go
index f5a22ba..8d0200b 100644
--- a/internal/service/cloudapi/disks/schemas/schema_resource_disk_replication.go
+++ b/internal/service/cloudapi/disks/schemas/schema_resource_disk_replication.go
@@ -97,7 +97,7 @@ func MakeSchemaResourceDiskReplication() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
@@ -158,7 +158,7 @@ func MakeSchemaResourceDiskReplication() map[string]schema.Attribute {
"pool": schema.StringAttribute{
Computed: true,
},
- "present_to": schema.ListAttribute{
+ "present_to": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
diff --git a/internal/service/cloudapi/disks/utilities/utility_resource_disk.go b/internal/service/cloudapi/disks/utilities/utility_resource_disk.go
index 6827c13..04122b1 100644
--- a/internal/service/cloudapi/disks/utilities/utility_resource_disk.go
+++ b/internal/service/cloudapi/disks/utilities/utility_resource_disk.go
@@ -17,16 +17,16 @@ import (
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/disks/models"
)
-// DiskCheckPresence checks if disk with diskId exists
-func DiskCheckPresence(ctx context.Context, diskId uint64, c *client.Client) (*disks.RecordDisk, error) {
- tflog.Info(ctx, fmt.Sprintf("Get info about disk with ID - %v", diskId))
+// DiskCheckPresence checks if disk with diskID exists
+func DiskCheckPresence(ctx context.Context, diskID uint64, c *client.Client) (*disks.RecordDisk, error) {
+ tflog.Info(ctx, fmt.Sprintf("Get info about disk with ID - %v", diskID))
- diskRecord, err := c.CloudAPI().Disks().Get(ctx, disks.GetRequest{DiskID: diskId})
+ diskRecord, err := c.CloudAPI().Disks().Get(ctx, disks.GetRequest{DiskID: diskID})
if err != nil {
return nil, fmt.Errorf("cannot get info about disk with error: %w", err)
}
- tflog.Info(ctx, "DiskCheckPresence resourceDisk: response from CloudAPI().Disks().Get", map[string]any{"disk_id": diskId, "response": diskRecord})
+ tflog.Info(ctx, "DiskCheckPresence resourceDisk: response from CloudAPI().Disks().Get", map[string]any{"disk_id": diskID, "response": diskRecord})
return diskRecord, err
}
@@ -37,7 +37,6 @@ func CreateRequestResourceDisk(ctx context.Context, plan *models.ResourceDiskMod
"account_id": plan.AccountID.ValueInt64(),
"disk_name": plan.DiskName.ValueString(),
"size_max": plan.SizeMax.ValueInt64(),
- "gid": plan.GID.ValueInt64(),
})
// set up required parameters in disk create request
@@ -45,14 +44,8 @@ func CreateRequestResourceDisk(ctx context.Context, plan *models.ResourceDiskMod
AccountID: uint64(plan.AccountID.ValueInt64()),
Name: plan.DiskName.ValueString(),
Size: uint64(plan.SizeMax.ValueInt64()),
- GID: uint64(plan.GID.ValueInt64()),
}
- if plan.Type.IsUnknown() {
- createReq.Type = "D" // default value
- } else {
- createReq.Type = plan.Type.ValueString()
- }
if !plan.SEPID.IsUnknown() {
createReq.SEPID = uint64(plan.SEPID.ValueInt64())
}
@@ -68,16 +61,16 @@ func CreateRequestResourceDisk(ctx context.Context, plan *models.ResourceDiskMod
// LimitIOCreateDisk sets IO limits that user specified in iotune field for created resource.
// In case of failure returns warnings.
-func LimitIOCreateDisk(ctx context.Context, diskId uint64, plan *models.ResourceDiskModel, c *client.Client) diag.Diagnostics {
+func LimitIOCreateDisk(ctx context.Context, diskID uint64, plan *models.ResourceDiskModel, c *client.Client) diag.Diagnostics {
diags := diag.Diagnostics{}
limitIOReq := disks.LimitIORequest{
- DiskID: diskId,
+ DiskID: diskID,
}
var iotunePlan models.IOTuneModel
// plan.IOTune is not null as it was checked before call
- tflog.Info(ctx, "LimitIOCreateDisk: new iotune specified", map[string]any{"disk_id": diskId})
+ tflog.Info(ctx, "LimitIOCreateDisk: new iotune specified", map[string]any{"disk_id": diskID})
diags.Append(plan.IOTune.As(ctx, &iotunePlan, basetypes.ObjectAsOptions{})...)
if diags.HasError() {
tflog.Error(ctx, "LimitIOCreateDisk: cannot populate iotune with plan.IOTune object element")
@@ -103,7 +96,7 @@ func LimitIOCreateDisk(ctx context.Context, diskId uint64, plan *models.Resource
limitIOReq.WriteIOPSSecMax = uint64(iotunePlan.WriteIOPSSecMax.ValueInt64())
tflog.Info(ctx, "LimitIOCreateDisk: before calling CloudAPI().Disks().LimitIO", map[string]any{
- "disk_id": diskId,
+ "disk_id": diskID,
"limitIOReq": limitIOReq})
res, err := c.CloudAPI().Disks().LimitIO(ctx, limitIOReq)
if err != nil {
@@ -111,7 +104,7 @@ func LimitIOCreateDisk(ctx context.Context, diskId uint64, plan *models.Resource
err.Error())
}
tflog.Info(ctx, "LimitIOCreateDisk: response from CloudAPI().Disks().LimitIO", map[string]any{
- "disk_id": diskId,
+ "disk_id": diskID,
"response": res})
return diags
@@ -119,17 +112,17 @@ func LimitIOCreateDisk(ctx context.Context, diskId uint64, plan *models.Resource
// ShareableCreateDisk shares disk.
// In case of failure returns warnings.
-func ShareableCreateDisk(ctx context.Context, diskId uint64, c *client.Client) diag.Diagnostics {
+func ShareableCreateDisk(ctx context.Context, diskID uint64, c *client.Client) diag.Diagnostics {
diags := diag.Diagnostics{}
- tflog.Info(ctx, "ShareableCreateDisk: before calling CloudAPI().Disks().Share", map[string]any{"disk_id": diskId})
- res, err := c.CloudAPI().Disks().Share(ctx, disks.ShareRequest{DiskID: diskId})
+ tflog.Info(ctx, "ShareableCreateDisk: before calling CloudAPI().Disks().Share", map[string]any{"disk_id": diskID})
+ res, err := c.CloudAPI().Disks().Share(ctx, disks.ShareRequest{DiskID: diskID})
if err != nil {
diags.AddWarning("ShareableCreateDisk: Unable to share Disk",
err.Error())
}
tflog.Info(ctx, "ShareableCreateDisk: response from CloudAPI().Disks().Share", map[string]any{
- "disk_id": diskId,
+ "disk_id": diskID,
"response": res})
return diags
@@ -139,17 +132,17 @@ func ShareableCreateDisk(ctx context.Context, diskId uint64, c *client.Client) d
// Deleted status.
// In case of failure returns errors.
func DiskReadStatus(ctx context.Context, state *models.ResourceDiskModel, c *client.Client) diag.Diagnostics {
- tflog.Info(ctx, "DiskReadStatus: Read status disk with ID", map[string]any{"disk_id": state.Id.ValueString()})
+ tflog.Info(ctx, "DiskReadStatus: Read status disk with ID", map[string]any{"disk_id": state.ID.ValueString()})
diags := diag.Diagnostics{}
- diskId, err := strconv.ParseUint(state.Id.ValueString(), 10, 64)
+ diskID, err := strconv.ParseUint(state.ID.ValueString(), 10, 64)
if err != nil {
diags.AddError("DiskReadStatus: Cannot parse disk ID from state", err.Error())
return diags
}
- recordDisk, err := DiskCheckPresence(ctx, diskId, c)
+ recordDisk, err := DiskCheckPresence(ctx, diskID, c)
if err != nil {
diags.AddError("DiskReadStatus: Unable to Read Disk before status check", err.Error())
return diags
@@ -168,17 +161,17 @@ func DiskReadStatus(ctx context.Context, state *models.ResourceDiskModel, c *cli
tflog.Info(ctx, "DiskReadStatus: disk with status.Deleted is being read, attempt to restore it", map[string]any{
"disk_id": recordDisk.ID,
"status": recordDisk.Status})
- diags.Append(RestoreDisk(ctx, diskId, c)...)
+ diags.Append(RestoreDisk(ctx, diskID, c)...)
if diags.HasError() {
tflog.Error(ctx, "DiskReadStatus: cannot restore disk")
return diags
}
- tflog.Info(ctx, "DiskReadStatus: disk restored successfully", map[string]any{"disk_id": diskId})
+ tflog.Info(ctx, "DiskReadStatus: disk restored successfully", map[string]any{"disk_id": diskID})
state.LastUpdated = types.StringValue(time.Now().Format(time.RFC850))
case status.Destroyed, status.Purged:
diags.AddError(
"DiskReadStatus: Disk is in status Destroyed or Purged",
- fmt.Sprintf("the resource with disk_id %d cannot be read because it has been destroyed or purged", diskId),
+ fmt.Sprintf("the resource with disk_id %d cannot be read because it has been destroyed or purged", diskID),
)
return diags
}
@@ -188,14 +181,14 @@ func DiskReadStatus(ctx context.Context, state *models.ResourceDiskModel, c *cli
// RestoreDisk performs disk Restore request.
// Returns error in case of failures.
-func RestoreDisk(ctx context.Context, diskId uint64, c *client.Client) diag.Diagnostics {
+func RestoreDisk(ctx context.Context, diskID uint64, c *client.Client) diag.Diagnostics {
diags := diag.Diagnostics{}
restoreReq := disks.RestoreRequest{
- DiskID: diskId,
+ DiskID: diskID,
}
- tflog.Info(ctx, "RestoreDisk: before calling CloudAPI().Disks().Restore", map[string]any{"diskId": diskId, "req": restoreReq})
+ tflog.Info(ctx, "RestoreDisk: before calling CloudAPI().Disks().Restore", map[string]any{"diskID": diskID, "req": restoreReq})
res, err := c.CloudAPI().Disks().Restore(ctx, restoreReq)
if err != nil {
@@ -205,18 +198,18 @@ func RestoreDisk(ctx context.Context, diskId uint64, c *client.Client) diag.Diag
)
return diags
}
- tflog.Info(ctx, "RestoreDisk: response from CloudAPI().Disks().Restore", map[string]any{"disk_id": diskId, "response": res})
+ tflog.Info(ctx, "RestoreDisk: response from CloudAPI().Disks().Restore", map[string]any{"disk_id": diskID, "response": res})
return nil
}
// SizeMaxUpdateDisk resizes disk.
// Returns error in case of failures.
-func SizeMaxUpdateDisk(ctx context.Context, diskId uint64, plan, state *models.ResourceDiskModel, c *client.Client) diag.Diagnostics {
+func SizeMaxUpdateDisk(ctx context.Context, diskID uint64, plan, state *models.ResourceDiskModel, c *client.Client) diag.Diagnostics {
var diags diag.Diagnostics
resizeReq := disks.ResizeRequest{
- DiskID: diskId,
+ DiskID: diskID,
}
// check if resize request is valid
@@ -224,7 +217,7 @@ func SizeMaxUpdateDisk(ctx context.Context, diskId uint64, plan, state *models.R
diags.AddError(
"SizeMaxUpdateDisk: reducing disk size is not allowed",
fmt.Sprintf("disk with id %s has state size %d, plan size %d",
- plan.Id.ValueString(),
+ plan.ID.ValueString(),
state.SizeMax.ValueInt64(),
plan.SizeMax.ValueInt64()))
return diags
@@ -233,7 +226,7 @@ func SizeMaxUpdateDisk(ctx context.Context, diskId uint64, plan, state *models.R
resizeReq.Size = uint64(plan.SizeMax.ValueInt64())
tflog.Info(ctx, "SizeMaxUpdateDisk: before calling CloudAPI().Disks().Resize2", map[string]any{
- "disk_id": plan.Id.ValueString(),
+ "disk_id": plan.ID.ValueString(),
"size_max_state": state.SizeMax.ValueInt64(),
"size_max_plan": plan.SizeMax.ValueInt64(),
"req": resizeReq,
@@ -247,7 +240,7 @@ func SizeMaxUpdateDisk(ctx context.Context, diskId uint64, plan, state *models.R
}
tflog.Info(ctx, "SizeMaxUpdateDisk: response from CloudAPI().Disks().Resize2", map[string]any{
- "disk_id": plan.Id.ValueString(),
+ "disk_id": plan.ID.ValueString(),
"response": res})
return nil
@@ -255,16 +248,16 @@ func SizeMaxUpdateDisk(ctx context.Context, diskId uint64, plan, state *models.R
// NameUpdateDisk renames disk.
// Returns error in case of failures.
-func NameUpdateDisk(ctx context.Context, diskId uint64, plan *models.ResourceDiskModel, c *client.Client) diag.Diagnostics {
+func NameUpdateDisk(ctx context.Context, diskID uint64, plan *models.ResourceDiskModel, c *client.Client) diag.Diagnostics {
var diags diag.Diagnostics
renameReq := disks.RenameRequest{
- DiskID: diskId,
+ DiskID: diskID,
Name: plan.DiskName.ValueString(),
}
tflog.Info(ctx, "NameUpdateDisk: before calling CloudAPI().Disks().Rename", map[string]any{
- "disk_id": plan.Id.ValueString(),
+ "disk_id": plan.ID.ValueString(),
"disk_name_plan": plan.DiskName.ValueString(),
"req": renameReq,
})
@@ -277,7 +270,7 @@ func NameUpdateDisk(ctx context.Context, diskId uint64, plan *models.ResourceDis
}
tflog.Info(ctx, "NameUpdateDisk: response from CloudAPI().Disks().Rename", map[string]any{
- "disk_id": plan.Id.ValueString(),
+ "disk_id": plan.ID.ValueString(),
"response": res})
return nil
@@ -285,16 +278,16 @@ func NameUpdateDisk(ctx context.Context, diskId uint64, plan *models.ResourceDis
// LimitIOUpdateDisk changes IO limits that user specified in iotune field for updated resource.
// In case of failure returns errors.
-func LimitIOUpdateDisk(ctx context.Context, diskId uint64, plan *models.ResourceDiskModel, c *client.Client) diag.Diagnostics {
+func LimitIOUpdateDisk(ctx context.Context, diskID uint64, plan *models.ResourceDiskModel, c *client.Client) diag.Diagnostics {
diags := diag.Diagnostics{}
limitIOReq := disks.LimitIORequest{
- DiskID: diskId,
+ DiskID: diskID,
}
var iotunePlan models.IOTuneModel
// plan.IOTune is not null as it was checked before call
- tflog.Info(ctx, "LimitIOUpdateDisk: new iotune specified", map[string]any{"disk_id": diskId})
+ tflog.Info(ctx, "LimitIOUpdateDisk: new iotune specified", map[string]any{"disk_id": diskID})
diags.Append(plan.IOTune.As(ctx, &iotunePlan, basetypes.ObjectAsOptions{})...)
if diags.HasError() {
tflog.Error(ctx, "LimitIOUpdateDisk: cannot populate iotune with plan.IOTune object element")
@@ -320,7 +313,7 @@ func LimitIOUpdateDisk(ctx context.Context, diskId uint64, plan *models.Resource
limitIOReq.WriteIOPSSecMax = uint64(iotunePlan.WriteIOPSSecMax.ValueInt64())
tflog.Info(ctx, "LimitIOUpdateDisk: before calling CloudAPI().Disks().LimitIO", map[string]any{
- "disk_id": diskId,
+ "disk_id": diskID,
"limitIOReq": limitIOReq})
res, err := c.CloudAPI().Disks().LimitIO(ctx, limitIOReq)
if err != nil {
@@ -329,7 +322,7 @@ func LimitIOUpdateDisk(ctx context.Context, diskId uint64, plan *models.Resource
return diags
}
tflog.Info(ctx, "LimitIOUpdateDisk: response from CloudAPI().Disks().LimitIO", map[string]any{
- "disk_id": diskId,
+ "disk_id": diskID,
"response": res})
return nil
@@ -337,34 +330,34 @@ func LimitIOUpdateDisk(ctx context.Context, diskId uint64, plan *models.Resource
// ShareableUpdateDisk shares or unshares disk.
// In case of failure returns errors.
-func ShareableUpdateDisk(ctx context.Context, diskId uint64, share bool, c *client.Client) diag.Diagnostics {
+func ShareableUpdateDisk(ctx context.Context, diskID uint64, share bool, c *client.Client) diag.Diagnostics {
diags := diag.Diagnostics{}
// share
if share {
- tflog.Info(ctx, "ShareableUpdateDisk: before calling CloudAPI().Disks().Share", map[string]any{"disk_id": diskId})
- res, err := c.CloudAPI().Disks().Share(ctx, disks.ShareRequest{DiskID: diskId})
+ tflog.Info(ctx, "ShareableUpdateDisk: before calling CloudAPI().Disks().Share", map[string]any{"disk_id": diskID})
+ res, err := c.CloudAPI().Disks().Share(ctx, disks.ShareRequest{DiskID: diskID})
if err != nil {
diags.AddError("ShareableUpdateDisk: Unable to share Disk",
err.Error())
return diags
}
tflog.Info(ctx, "ShareableUpdateDisk: response from CloudAPI().Disks().Share", map[string]any{
- "disk_id": diskId,
+ "disk_id": diskID,
"response": res})
}
// unshare
if !share {
- tflog.Info(ctx, "ShareableUpdateDisk: before calling CloudAPI().Disks().Unshare", map[string]any{"disk_id": diskId})
- res, err := c.CloudAPI().Disks().Unshare(ctx, disks.UnshareRequest{DiskID: diskId})
+ tflog.Info(ctx, "ShareableUpdateDisk: before calling CloudAPI().Disks().Unshare", map[string]any{"disk_id": diskID})
+ res, err := c.CloudAPI().Disks().Unshare(ctx, disks.UnshareRequest{DiskID: diskID})
if err != nil {
diags.AddError("ShareableUpdateDisk: Unable to unshare Disk",
err.Error())
return diags
}
tflog.Info(ctx, "ShareableUpdateDisk: response from CloudAPI().Disks().Unshare", map[string]any{
- "disk_id": diskId,
+ "disk_id": diskID,
"response": res})
}
diff --git a/internal/service/cloudapi/extnet/flattens/flatten_data_source_extnet.go b/internal/service/cloudapi/extnet/flattens/flatten_data_source_extnet.go
index 6dd04e8..05bac8e 100644
--- a/internal/service/cloudapi/extnet/flattens/flatten_data_source_extnet.go
+++ b/internal/service/cloudapi/extnet/flattens/flatten_data_source_extnet.go
@@ -58,6 +58,7 @@ func ExtNetDataSource(ctx context.Context, state *models.DataSourceExtNetModel,
NetName: types.StringValue(recordExtNet.Name),
Network: types.StringValue(recordExtNet.Network),
NetworkID: types.Int64Value(int64(recordExtNet.NetworkID)),
+ NTP: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordExtNet.NTP),
PreReservationsNum: types.Int64Value(int64(recordExtNet.PreReservationsNum)),
Prefix: types.Int64Value(int64(recordExtNet.Prefix)),
PriVNFDevID: types.Int64Value(int64(recordExtNet.PriVNFDevID)),
diff --git a/internal/service/cloudapi/extnet/flattens/flatten_data_source_extnet_list.go b/internal/service/cloudapi/extnet/flattens/flatten_data_source_extnet_list.go
index 03e20f5..566396b 100644
--- a/internal/service/cloudapi/extnet/flattens/flatten_data_source_extnet_list.go
+++ b/internal/service/cloudapi/extnet/flattens/flatten_data_source_extnet_list.go
@@ -36,6 +36,7 @@ func ExtNetListDataSource(ctx context.Context, state *models.DataSourceExtNetLis
Network: state.Network,
VLANID: state.VLANID,
VNFDevID: state.VNFDevID,
+ OVSBridge: state.OVSBridge,
Status: state.Status,
Page: state.Page,
Size: state.Size,
diff --git a/internal/service/cloudapi/extnet/models/model_data_source_extnet.go b/internal/service/cloudapi/extnet/models/model_data_source_extnet.go
index 4fd9afa..88a92d7 100644
--- a/internal/service/cloudapi/extnet/models/model_data_source_extnet.go
+++ b/internal/service/cloudapi/extnet/models/model_data_source_extnet.go
@@ -30,6 +30,7 @@ type DataSourceExtNetModel struct {
NetName types.String `tfsdk:"net_name"`
Network types.String `tfsdk:"network"`
NetworkID types.Int64 `tfsdk:"network_id"`
+ NTP types.List `tfsdk:"ntp"`
PreReservationsNum types.Int64 `tfsdk:"pre_reservations_num"`
Prefix types.Int64 `tfsdk:"prefix"`
PriVNFDevID types.Int64 `tfsdk:"pri_vnf_dev_id"`
diff --git a/internal/service/cloudapi/extnet/models/model_data_source_extnet_list.go b/internal/service/cloudapi/extnet/models/model_data_source_extnet_list.go
index 6a1e608..d00c4bc 100644
--- a/internal/service/cloudapi/extnet/models/model_data_source_extnet_list.go
+++ b/internal/service/cloudapi/extnet/models/model_data_source_extnet_list.go
@@ -13,6 +13,7 @@ type DataSourceExtNetListModel struct {
Network types.String `tfsdk:"network"`
VLANID types.Int64 `tfsdk:"vlan_id"`
VNFDevID types.Int64 `tfsdk:"vnfdev_id"`
+ OVSBridge types.String `tfsdk:"ovs_bridge"`
Status types.String `tfsdk:"status"`
Page types.Int64 `tfsdk:"page"`
Size types.Int64 `tfsdk:"size"`
diff --git a/internal/service/cloudapi/extnet/schemas/schema_data_source_extnet.go b/internal/service/cloudapi/extnet/schemas/schema_data_source_extnet.go
index 5aed3cd..f3d3884 100644
--- a/internal/service/cloudapi/extnet/schemas/schema_data_source_extnet.go
+++ b/internal/service/cloudapi/extnet/schemas/schema_data_source_extnet.go
@@ -31,6 +31,10 @@ func MakeSchemaDataSourceExtNet() map[string]schema.Attribute {
"default": schema.BoolAttribute{
Computed: true,
},
+ "ntp": schema.ListAttribute{
+ Computed: true,
+ ElementType: types.StringType,
+ },
"default_qos": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
diff --git a/internal/service/cloudapi/extnet/schemas/schema_data_source_extnet_list.go b/internal/service/cloudapi/extnet/schemas/schema_data_source_extnet_list.go
index e71b59b..855dcf9 100644
--- a/internal/service/cloudapi/extnet/schemas/schema_data_source_extnet_list.go
+++ b/internal/service/cloudapi/extnet/schemas/schema_data_source_extnet_list.go
@@ -31,6 +31,10 @@ func MakeSchemaDataSourceExtNetList() map[string]schema.Attribute {
Optional: true,
Description: "find by vnfdevices id",
},
+ "ovs_bridge": schema.StringAttribute{
+ Optional: true,
+ Description: "find by ovs_bridge",
+ },
"status": schema.StringAttribute{
Optional: true,
Description: "find by status",
diff --git a/internal/service/cloudapi/extnet/utilities/utility_data_source_extnet_list.go b/internal/service/cloudapi/extnet/utilities/utility_data_source_extnet_list.go
index 42f0475..33172ff 100644
--- a/internal/service/cloudapi/extnet/utilities/utility_data_source_extnet_list.go
+++ b/internal/service/cloudapi/extnet/utilities/utility_data_source_extnet_list.go
@@ -34,6 +34,9 @@ func ExtNetListCheckPresence(ctx context.Context, plan *models.DataSourceExtNetL
if !plan.VNFDevID.IsNull() {
extnetListReq.VNFDevID = uint64(plan.VNFDevID.ValueInt64())
}
+ if !plan.OVSBridge.IsNull() {
+ extnetListReq.OVSBridge = plan.OVSBridge.ValueString()
+ }
if !plan.Status.IsNull() {
extnetListReq.Status = plan.Status.ValueString()
}
diff --git a/internal/service/cloudapi/flipgroup/flattens/flatten_resource.go b/internal/service/cloudapi/flipgroup/flattens/flatten_resource.go
index bc9c24d..25b296c 100644
--- a/internal/service/cloudapi/flipgroup/flattens/flatten_resource.go
+++ b/internal/service/cloudapi/flipgroup/flattens/flatten_resource.go
@@ -33,16 +33,16 @@ func FlipgroupResource(ctx context.Context, plan *models.ResourceFLIPGroupModel,
}
*plan = models.ResourceFLIPGroupModel{
- AccountID: plan.AccountID,
- Name: plan.Name,
- NetType: plan.NetType,
- NetID: plan.NetID,
- ClientType: plan.ClientType,
+ AccountID: types.Int64Value(int64(recordFG.AccountID)),
+ Name: types.StringValue(recordFG.Name),
+ NetType: types.StringValue(recordFG.NetType),
+ NetID: types.Int64Value(int64(recordFG.NetID)),
+ ClientType: types.StringValue(recordFG.ClientType),
Timeouts: plan.Timeouts,
- Description: plan.Description,
- ClientIDs: plan.ClientIDs,
+ Description: types.StringValue(recordFG.Description),
+ ClientIDs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordFG.ClientIDs),
ID: plan.ID,
- IP: plan.IP,
+ IP: types.StringValue(recordFG.IP),
AccountName: types.StringValue(recordFG.AccountName),
ConnID: types.Int64Value(int64(recordFG.ConnID)),
@@ -69,10 +69,6 @@ func FlipgroupResource(ctx context.Context, plan *models.ResourceFLIPGroupModel,
plan.IP = types.StringValue(recordFG.IP)
}
- if plan.ClientIDs.IsUnknown() {
- plan.ClientIDs = flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordFG.ClientIDs)
- }
-
tflog.Info(ctx, "End flattens.FlipgroupResource", map[string]any{"flipgroup_id": plan.ID.ValueString()})
return nil
}
diff --git a/internal/service/cloudapi/image/flattens/flatten_data_source_image.go b/internal/service/cloudapi/image/flattens/flatten_data_source_image.go
index 175c7e9..7dd0394 100644
--- a/internal/service/cloudapi/image/flattens/flatten_data_source_image.go
+++ b/internal/service/cloudapi/image/flattens/flatten_data_source_image.go
@@ -62,6 +62,7 @@ func DataSourceImage(ctx context.Context, state *models.RecordImageModel, c *cli
ResID: types.StringValue(image.ResID),
RescueCD: types.BoolValue(image.RescueCD),
SepID: types.Int64Value(int64(image.SepID)),
+ SnapshotID: types.StringValue(image.SnapshotID),
Size: types.Int64Value(int64(image.Size)),
Status: types.StringValue(image.Status),
TechStatus: types.StringValue(image.TechStatus),
@@ -77,7 +78,7 @@ func DataSourceImage(ctx context.Context, state *models.RecordImageModel, c *cli
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenDrivers", diags))
}
- state.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, image.PresentTo)
+ state.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, image.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenPresentTo", diags))
}
diff --git a/internal/service/cloudapi/image/flattens/flatten_resource_image.go b/internal/service/cloudapi/image/flattens/flatten_resource_image.go
index 6f1ca7a..80d30a0 100644
--- a/internal/service/cloudapi/image/flattens/flatten_resource_image.go
+++ b/internal/service/cloudapi/image/flattens/flatten_resource_image.go
@@ -71,6 +71,7 @@ func ResourceImage(ctx context.Context, plan *models.ImageResourceModel, c *clie
ResID: types.StringValue(image.ResID),
RescueCD: types.BoolValue(image.RescueCD),
Size: types.Int64Value(int64(image.Size)),
+ SnapshotID: types.StringValue(image.SnapshotID),
Status: types.StringValue(image.Status),
TechStatus: types.StringValue(image.TechStatus),
Version: types.StringValue(image.Version),
@@ -84,7 +85,7 @@ func ResourceImage(ctx context.Context, plan *models.ImageResourceModel, c *clie
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenDrivers", diags))
}
- plan.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, image.PresentTo)
+ plan.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, image.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenPresentTo", diags))
}
diff --git a/internal/service/cloudapi/image/flattens/flatten_resource_image_virtual.go b/internal/service/cloudapi/image/flattens/flatten_resource_image_virtual.go
index 2408f3d..fe66aa6 100644
--- a/internal/service/cloudapi/image/flattens/flatten_resource_image_virtual.go
+++ b/internal/service/cloudapi/image/flattens/flatten_resource_image_virtual.go
@@ -2,6 +2,7 @@ package flattens
import (
"context"
+ "encoding/json"
"fmt"
"strconv"
@@ -30,42 +31,46 @@ func ResourceImageVirtual(ctx context.Context, plan *models.ImageVirtualResource
return diags
}
+ cdPresentedTo, _ := json.Marshal(image.CdPresentedTo)
*plan = models.ImageVirtualResourceModel{
- ImageName: types.StringValue(image.Name),
- LinkTo: types.Int64Value(int64(image.LinkTo)),
- Timeouts: plan.Timeouts,
- Id: types.StringValue(strconv.Itoa(int(image.ID))),
- LastUpdated: plan.LastUpdated,
- UNCPath: types.StringValue(image.UNCPath),
- CKey: types.StringValue(image.CKey),
- AccountID: types.Int64Value(int64(image.AccountID)),
- Architecture: types.StringValue(image.Architecture),
- BootType: types.StringValue(image.BootType),
- Bootable: types.BoolValue(image.Bootable),
- ComputeCIID: types.Int64Value(int64(image.ComputeCIID)),
- DeletedTime: types.Int64Value(int64(image.DeletedTime)),
- Description: types.StringValue(image.Description),
- Enabled: types.BoolValue(image.Enabled),
- GID: types.Int64Value(int64(image.GID)),
- GUID: types.Int64Value(int64(image.GUID)),
- History: flattenHistoryInResource(ctx, &image.History),
- HotResize: types.BoolValue(image.HotResize),
- LastModified: types.Int64Value(int64(image.LastModified)),
- Milestones: types.Int64Value(int64(image.Milestones)),
- ImageId: types.Int64Value(int64(image.ID)),
- ImageType: types.StringValue(image.Type),
- Password: types.StringValue(image.Password),
- PoolName: types.StringValue(image.Pool),
- ProviderName: types.StringValue(image.ProviderName),
- PurgeAttempts: types.Int64Value(int64(image.PurgeAttempts)),
- ResID: types.StringValue(image.ResID),
- RescueCD: types.BoolValue(image.RescueCD),
- SepID: types.Int64Value(int64(image.SepID)),
- Size: types.Int64Value(int64(image.Size)),
- Status: types.StringValue(image.Status),
- TechStatus: types.StringValue(image.TechStatus),
- Username: types.StringValue(image.Username),
- Version: types.StringValue(image.Version),
+ ImageName: types.StringValue(image.Name),
+ LinkTo: types.Int64Value(int64(image.LinkTo)),
+ Timeouts: plan.Timeouts,
+ Id: types.StringValue(strconv.Itoa(int(image.ID))),
+ LastUpdated: plan.LastUpdated,
+ UNCPath: types.StringValue(image.UNCPath),
+ CKey: types.StringValue(image.CKey),
+ AccountID: types.Int64Value(int64(image.AccountID)),
+ Architecture: types.StringValue(image.Architecture),
+ BootType: types.StringValue(image.BootType),
+ Bootable: types.BoolValue(image.Bootable),
+ CdPresentedTo: types.StringValue(string(cdPresentedTo)),
+ ComputeCIID: types.Int64Value(int64(image.ComputeCIID)),
+ DeletedTime: types.Int64Value(int64(image.DeletedTime)),
+ Description: types.StringValue(image.Description),
+ Enabled: types.BoolValue(image.Enabled),
+ GID: types.Int64Value(int64(image.GID)),
+ GUID: types.Int64Value(int64(image.GUID)),
+ History: flattenHistoryInResource(ctx, &image.History),
+ HotResize: types.BoolValue(image.HotResize),
+ LastModified: types.Int64Value(int64(image.LastModified)),
+ Milestones: types.Int64Value(int64(image.Milestones)),
+ NetworkInterfaceNaming: types.StringValue(image.NetworkInterfaceNaming),
+ ImageId: types.Int64Value(int64(image.ID)),
+ ImageType: types.StringValue(image.Type),
+ Password: types.StringValue(image.Password),
+ PoolName: types.StringValue(image.Pool),
+ ProviderName: types.StringValue(image.ProviderName),
+ PurgeAttempts: types.Int64Value(int64(image.PurgeAttempts)),
+ ResID: types.StringValue(image.ResID),
+ RescueCD: types.BoolValue(image.RescueCD),
+ SepID: types.Int64Value(int64(image.SepID)),
+ Size: types.Int64Value(int64(image.Size)),
+ SnapshotID: types.StringValue(image.SnapshotID),
+ Status: types.StringValue(image.Status),
+ TechStatus: types.StringValue(image.TechStatus),
+ Username: types.StringValue(image.Username),
+ Version: types.StringValue(image.Version),
}
plan.ACL, diags = types.ListValueFrom(ctx, types.StringType, image.ACL)
@@ -76,7 +81,7 @@ func ResourceImageVirtual(ctx context.Context, plan *models.ImageVirtualResource
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenDrivers", diags))
}
- plan.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, image.PresentTo)
+ plan.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, image.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenPresentTo", diags))
}
diff --git a/internal/service/cloudapi/image/models/model_data_source_image.go b/internal/service/cloudapi/image/models/model_data_source_image.go
index bc93c01..0861136 100644
--- a/internal/service/cloudapi/image/models/model_data_source_image.go
+++ b/internal/service/cloudapi/image/models/model_data_source_image.go
@@ -37,12 +37,13 @@ type RecordImageModel struct {
Password types.String `tfsdk:"password"`
NetworkInterfaceNaming types.String `tfsdk:"network_interface_naming"`
PoolName types.String `tfsdk:"pool_name"`
- PresentTo types.List `tfsdk:"present_to"`
+ PresentTo types.Map `tfsdk:"present_to"`
ProviderName types.String `tfsdk:"provider_name"`
PurgeAttempts types.Int64 `tfsdk:"purge_attempts"`
ResID types.String `tfsdk:"res_id"`
RescueCD types.Bool `tfsdk:"rescuecd"`
SepID types.Int64 `tfsdk:"sep_id"`
+ SnapshotID types.String `tfsdk:"snapshot_id"`
SharedWith types.List `tfsdk:"shared_with"`
Size types.Int64 `tfsdk:"size"`
Status types.String `tfsdk:"status"`
diff --git a/internal/service/cloudapi/image/models/model_resource_image.go b/internal/service/cloudapi/image/models/model_resource_image.go
index 901e31b..5e62f05 100644
--- a/internal/service/cloudapi/image/models/model_resource_image.go
+++ b/internal/service/cloudapi/image/models/model_resource_image.go
@@ -43,12 +43,13 @@ type ImageResourceModel struct {
LinkTo types.Int64 `tfsdk:"link_to"`
Milestones types.Int64 `tfsdk:"milestones"`
ImageId types.Int64 `tfsdk:"image_id"`
- PresentTo types.List `tfsdk:"present_to"`
+ PresentTo types.Map `tfsdk:"present_to"`
ProviderName types.String `tfsdk:"provider_name"`
PurgeAttempts types.Int64 `tfsdk:"purge_attempts"`
ResID types.String `tfsdk:"res_id"`
RescueCD types.Bool `tfsdk:"rescuecd"`
SharedWith types.List `tfsdk:"shared_with"`
+ SnapshotID types.String `tfsdk:"snapshot_id"`
Size types.Int64 `tfsdk:"size"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
diff --git a/internal/service/cloudapi/image/models/model_resource_image_virtual.go b/internal/service/cloudapi/image/models/model_resource_image_virtual.go
index 9d5f83d..b86da14 100644
--- a/internal/service/cloudapi/image/models/model_resource_image_virtual.go
+++ b/internal/service/cloudapi/image/models/model_resource_image_virtual.go
@@ -11,42 +11,45 @@ type ImageVirtualResourceModel struct {
LinkTo types.Int64 `tfsdk:"link_to"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
// responce fields
- Id types.String `tfsdk:"id"`
- LastUpdated types.String `tfsdk:"last_updated"`
- UNCPath types.String `tfsdk:"unc_path"`
- CKey types.String `tfsdk:"ckey"`
- AccountID types.Int64 `tfsdk:"account_id"`
- ACL types.List `tfsdk:"acl"`
- Architecture types.String `tfsdk:"architecture"`
- BootType types.String `tfsdk:"boot_type"`
- Bootable types.Bool `tfsdk:"bootable"`
- ComputeCIID types.Int64 `tfsdk:"compute_ci_id"`
- DeletedTime types.Int64 `tfsdk:"deleted_time"`
- Description types.String `tfsdk:"desc"`
- Drivers types.List `tfsdk:"drivers"`
- Enabled types.Bool `tfsdk:"enabled"`
- GID types.Int64 `tfsdk:"gid"`
- GUID types.Int64 `tfsdk:"guid"`
- History types.List `tfsdk:"history"`
- HotResize types.Bool `tfsdk:"hot_resize"`
- LastModified types.Int64 `tfsdk:"last_modified"`
- Milestones types.Int64 `tfsdk:"milestones"`
- ImageId types.Int64 `tfsdk:"image_id"`
- ImageType types.String `tfsdk:"image_type"`
- Password types.String `tfsdk:"password"`
- PoolName types.String `tfsdk:"pool_name"`
- PresentTo types.List `tfsdk:"present_to"`
- ProviderName types.String `tfsdk:"provider_name"`
- PurgeAttempts types.Int64 `tfsdk:"purge_attempts"`
- ResID types.String `tfsdk:"res_id"`
- RescueCD types.Bool `tfsdk:"rescuecd"`
- SepID types.Int64 `tfsdk:"sep_id"`
- SharedWith types.List `tfsdk:"shared_with"`
- Size types.Int64 `tfsdk:"size"`
- Status types.String `tfsdk:"status"`
- TechStatus types.String `tfsdk:"tech_status"`
- Username types.String `tfsdk:"username"`
- Version types.String `tfsdk:"version"`
+ Id types.String `tfsdk:"id"`
+ LastUpdated types.String `tfsdk:"last_updated"`
+ UNCPath types.String `tfsdk:"unc_path"`
+ CKey types.String `tfsdk:"ckey"`
+ AccountID types.Int64 `tfsdk:"account_id"`
+ ACL types.List `tfsdk:"acl"`
+ Architecture types.String `tfsdk:"architecture"`
+ BootType types.String `tfsdk:"boot_type"`
+ Bootable types.Bool `tfsdk:"bootable"`
+ CdPresentedTo types.String `tfsdk:"cd_presented_to"`
+ ComputeCIID types.Int64 `tfsdk:"compute_ci_id"`
+ DeletedTime types.Int64 `tfsdk:"deleted_time"`
+ Description types.String `tfsdk:"desc"`
+ Drivers types.List `tfsdk:"drivers"`
+ Enabled types.Bool `tfsdk:"enabled"`
+ GID types.Int64 `tfsdk:"gid"`
+ GUID types.Int64 `tfsdk:"guid"`
+ History types.List `tfsdk:"history"`
+ HotResize types.Bool `tfsdk:"hot_resize"`
+ LastModified types.Int64 `tfsdk:"last_modified"`
+ Milestones types.Int64 `tfsdk:"milestones"`
+ ImageId types.Int64 `tfsdk:"image_id"`
+ ImageType types.String `tfsdk:"image_type"`
+ NetworkInterfaceNaming types.String `tfsdk:"network_interface_naming"`
+ Password types.String `tfsdk:"password"`
+ PoolName types.String `tfsdk:"pool_name"`
+ PresentTo types.Map `tfsdk:"present_to"`
+ ProviderName types.String `tfsdk:"provider_name"`
+ PurgeAttempts types.Int64 `tfsdk:"purge_attempts"`
+ ResID types.String `tfsdk:"res_id"`
+ RescueCD types.Bool `tfsdk:"rescuecd"`
+ SepID types.Int64 `tfsdk:"sep_id"`
+ SharedWith types.List `tfsdk:"shared_with"`
+ Size types.Int64 `tfsdk:"size"`
+ SnapshotID types.String `tfsdk:"snapshot_id"`
+ Status types.String `tfsdk:"status"`
+ TechStatus types.String `tfsdk:"tech_status"`
+ Username types.String `tfsdk:"username"`
+ Version types.String `tfsdk:"version"`
}
type HistoryInImageVirtualResourceModel struct {
diff --git a/internal/service/cloudapi/image/schemas/schema_data_source_image.go b/internal/service/cloudapi/image/schemas/schema_data_source_image.go
index 3217d41..018ffdb 100644
--- a/internal/service/cloudapi/image/schemas/schema_data_source_image.go
+++ b/internal/service/cloudapi/image/schemas/schema_data_source_image.go
@@ -115,7 +115,7 @@ func MakeSchemaDataSourceImage() map[string]schema.Attribute {
"purge_attempts": schema.Int64Attribute{
Computed: true,
},
- "present_to": schema.ListAttribute{
+ "present_to": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
@@ -128,6 +128,9 @@ func MakeSchemaDataSourceImage() map[string]schema.Attribute {
"sep_id": schema.Int64Attribute{
Computed: true,
},
+ "snapshot_id": schema.StringAttribute{
+ Computed: true,
+ },
"shared_with": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
diff --git a/internal/service/cloudapi/image/schemas/schema_resource_image.go b/internal/service/cloudapi/image/schemas/schema_resource_image.go
index 84d1854..529ddcc 100644
--- a/internal/service/cloudapi/image/schemas/schema_resource_image.go
+++ b/internal/service/cloudapi/image/schemas/schema_resource_image.go
@@ -30,9 +30,9 @@ func MakeSchemaResourceImage() map[string]schema.Attribute {
"image_type": schema.StringAttribute{
Required: true,
Validators: []validator.String{
- stringvalidator.OneOf("linux", "windows", "other"),
+ stringvalidator.OneOf("linux", "windows", "unknown"),
},
- Description: "Image type linux, windows or other",
+ Description: "Image type linux, windows or unknown",
},
"drivers": schema.ListAttribute{
Required: true,
@@ -167,7 +167,7 @@ func MakeSchemaResourceImage() map[string]schema.Attribute {
"purge_attempts": schema.Int64Attribute{
Computed: true,
},
- "present_to": schema.ListAttribute{
+ "present_to": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
@@ -184,6 +184,9 @@ func MakeSchemaResourceImage() map[string]schema.Attribute {
"size": schema.Int64Attribute{
Computed: true,
},
+ "snapshot_id": schema.StringAttribute{
+ Computed: true,
+ },
"status": schema.StringAttribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/image/schemas/schema_resource_image_virtual.go b/internal/service/cloudapi/image/schemas/schema_resource_image_virtual.go
index 715ba79..2c225a3 100644
--- a/internal/service/cloudapi/image/schemas/schema_resource_image_virtual.go
+++ b/internal/service/cloudapi/image/schemas/schema_resource_image_virtual.go
@@ -54,6 +54,9 @@ func MakeSchemaResourceImageVirtual() map[string]schema.Attribute {
"compute_ci_id": schema.Int64Attribute{
Computed: true,
},
+ "cd_presented_to": schema.StringAttribute{
+ Computed: true,
+ },
"deleted_time": schema.Int64Attribute{
Computed: true,
},
@@ -98,6 +101,9 @@ func MakeSchemaResourceImageVirtual() map[string]schema.Attribute {
"milestones": schema.Int64Attribute{
Computed: true,
},
+ "network_interface_naming": schema.StringAttribute{
+ Computed: true,
+ },
"image_id": schema.Int64Attribute{
Computed: true,
},
@@ -116,7 +122,7 @@ func MakeSchemaResourceImageVirtual() map[string]schema.Attribute {
"purge_attempts": schema.Int64Attribute{
Computed: true,
},
- "present_to": schema.ListAttribute{
+ "present_to": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
@@ -136,6 +142,9 @@ func MakeSchemaResourceImageVirtual() map[string]schema.Attribute {
"size": schema.Int64Attribute{
Computed: true,
},
+ "snapshot_id": schema.StringAttribute{
+ Computed: true,
+ },
"status": schema.StringAttribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/k8s/flattens/flatten_data_source_k8s.go b/internal/service/cloudapi/k8s/flattens/flatten_data_source_k8s.go
index 1359593..ddcc06f 100644
--- a/internal/service/cloudapi/k8s/flattens/flatten_data_source_k8s.go
+++ b/internal/service/cloudapi/k8s/flattens/flatten_data_source_k8s.go
@@ -73,6 +73,7 @@ func DataSourceK8s(ctx context.Context, state *models.RecordK8SDataSourceModel,
CreatedTime: types.Int64Value(int64(cluster.CreatedTime)),
DeletedBy: types.StringValue(cluster.DeletedBy),
DeletedTime: types.Int64Value(int64(cluster.DeletedTime)),
+ Desc: types.StringValue(cluster.Description),
ExtnetOnly: types.BoolValue(cluster.ExtnetOnly),
HighlyAvailableLB: types.BoolValue(cluster.HighlyAvailableLB),
K8CIName: types.StringValue(cluster.K8CIName),
diff --git a/internal/service/cloudapi/k8s/flattens/flatten_resource_k8s_cp.go b/internal/service/cloudapi/k8s/flattens/flatten_resource_k8s_cp.go
index 6250477..3bf50cc 100644
--- a/internal/service/cloudapi/k8s/flattens/flatten_resource_k8s_cp.go
+++ b/internal/service/cloudapi/k8s/flattens/flatten_resource_k8s_cp.go
@@ -57,20 +57,20 @@ func K8SCPResource(ctx context.Context, plan *models.ResourceK8SCPModel, c *clie
NetworkPlugin: types.StringValue(cluster.NetworkPlugin),
SEPID: plan.SEPID,
SEPPool: plan.SEPPool,
- WithLB: plan.WithLB,
- HighlyAvailable: plan.HighlyAvailable,
+ WithLB: types.BoolValue(cluster.WithLB),
+ HighlyAvailable: types.BoolValue(cluster.HighlyAvailableLB),
AdditionalSANs: plan.AdditionalSANs,
InitConfiguration: plan.InitConfiguration,
ClusterConfiguration: plan.ClusterConfiguration,
KubeletConfiguration: plan.KubeletConfiguration,
KubeProxyConfiguration: plan.KubeProxyConfiguration,
JoinConfiguration: plan.JoinConfiguration,
- Description: plan.Description,
- ExtNetOnly: plan.ExtNetOnly,
+ Description: types.StringValue(cluster.Description),
+ ExtNetOnly: types.BoolValue(cluster.ExtnetOnly),
OidcCertificate: plan.OidcCertificate,
Chipset: plan.Chipset,
- Start: plan.Start,
- Enabled: plan.Enabled,
+ Start: types.BoolValue(cluster.TechStatus == "STARTED"),
+ Enabled: types.BoolValue(cluster.Status == "ENABLED"),
Permanently: plan.Permanently,
Restore: plan.Restore,
Timeouts: plan.Timeouts,
diff --git a/internal/service/cloudapi/k8s/flattens/flatten_resource_k8s_wg.go b/internal/service/cloudapi/k8s/flattens/flatten_resource_k8s_wg.go
index 1ff34b7..fedd0a2 100644
--- a/internal/service/cloudapi/k8s/flattens/flatten_resource_k8s_wg.go
+++ b/internal/service/cloudapi/k8s/flattens/flatten_resource_k8s_wg.go
@@ -49,7 +49,6 @@ func K8SWGResource(ctx context.Context, plan *models.ResourceK8SWGModel, c *clie
CloudInit: plan.CloudInit,
Timeouts: plan.Timeouts,
Chipset: plan.Chipset,
- WorkerChipset: plan.WorkerChipset,
Id: types.StringValue(strconv.Itoa(int(wg.ID))),
WorkerGroupId: types.Int64Value(int64(wg.ID)),
LastUpdated: plan.LastUpdated,
diff --git a/internal/service/cloudapi/k8s/models/model_data_source_k8s.go b/internal/service/cloudapi/k8s/models/model_data_source_k8s.go
index 49e1b96..1a0132d 100644
--- a/internal/service/cloudapi/k8s/models/model_data_source_k8s.go
+++ b/internal/service/cloudapi/k8s/models/model_data_source_k8s.go
@@ -23,6 +23,7 @@ type RecordK8SDataSourceModel struct {
HighlyAvailableLB types.Bool `tfsdk:"ha_mode"`
K8SAddressVIP *K8SAddressVIP `tfsdk:"address_vip"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
+ Desc types.String `tfsdk:"desc"`
ExtNetID types.Int64 `tfsdk:"extnet_id"`
K8CIName types.String `tfsdk:"k8sci_name"`
Masters *MasterGroupDataSourceModel `tfsdk:"masters"`
diff --git a/internal/service/cloudapi/k8s/models/model_resource_k8s_wg.go b/internal/service/cloudapi/k8s/models/model_resource_k8s_wg.go
index 78fae64..5437506 100644
--- a/internal/service/cloudapi/k8s/models/model_resource_k8s_wg.go
+++ b/internal/service/cloudapi/k8s/models/model_resource_k8s_wg.go
@@ -11,7 +11,6 @@ type ResourceK8SWGModel struct {
K8SID types.Int64 `tfsdk:"k8s_id"`
Name types.String `tfsdk:"name"`
Num types.Int64 `tfsdk:"num"`
- WorkerChipset types.String `tfsdk:"worker_chipset"`
CPU types.Int64 `tfsdk:"cpu"`
RAM types.Int64 `tfsdk:"ram"`
Chipset types.String `tfsdk:"chipset"`
diff --git a/internal/service/cloudapi/k8s/resource_k8s_cp.go b/internal/service/cloudapi/k8s/resource_k8s_cp.go
index 244125c..4a7a2f5 100644
--- a/internal/service/cloudapi/k8s/resource_k8s_cp.go
+++ b/internal/service/cloudapi/k8s/resource_k8s_cp.go
@@ -185,7 +185,7 @@ func (r *resourceK8SCP) Update(ctx context.Context, req resource.UpdateRequest,
}
// Update Name or/and Description cluster
- if !plan.Name.Equal(state.Name) || !plan.Description.Equal(state.Description) {
+ if !plan.Name.Equal(state.Name) || (!plan.Description.Equal(state.Description) && !plan.Description.IsNull()) {
resp.Diagnostics.Append(utilities.K8SCPUpdateNameOrDescription(ctx, &plan, &state, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Error update info")
@@ -221,7 +221,7 @@ func (r *resourceK8SCP) Update(ctx context.Context, req resource.UpdateRequest,
}
//Update LB params
- if (state.WithLB.IsNull() || state.WithLB.ValueBool()) && !plan.LBSysctlParams.Equal(state.LBSysctlParams) {
+ if state.WithLB.ValueBool() && !plan.LBSysctlParams.Equal(state.LBSysctlParams) && !plan.LBSysctlParams.IsNull() {
resp.Diagnostics.Append(utilities.K8CPUpdateSysctlParams(ctx, &plan, &state, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Error Update LB params")
diff --git a/internal/service/cloudapi/k8s/schemas/schema_data_source_k8s.go b/internal/service/cloudapi/k8s/schemas/schema_data_source_k8s.go
index 664f790..329ad85 100644
--- a/internal/service/cloudapi/k8s/schemas/schema_data_source_k8s.go
+++ b/internal/service/cloudapi/k8s/schemas/schema_data_source_k8s.go
@@ -119,6 +119,9 @@ func MakeSchemaDataSourceK8S() map[string]schema.Attribute {
"deleted_time": schema.Int64Attribute{
Computed: true,
},
+ "desc": schema.StringAttribute{
+ Computed: true,
+ },
"extnet_id": schema.Int64Attribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/k8s/schemas/schema_resource_k8s_cp.go b/internal/service/cloudapi/k8s/schemas/schema_resource_k8s_cp.go
index c6c5d54..3f03ee3 100644
--- a/internal/service/cloudapi/k8s/schemas/schema_resource_k8s_cp.go
+++ b/internal/service/cloudapi/k8s/schemas/schema_resource_k8s_cp.go
@@ -4,6 +4,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
@@ -85,10 +86,14 @@ func MakeSchemaResourceK8SCP() map[string]schema.Attribute {
},
"with_lb": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
Description: "Create k8s with load balancer if true.",
},
"ha_mode": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(false),
Description: "Use Highly Available schema for LB deploy",
},
"additional_sans": schema.ListAttribute{
@@ -118,10 +123,13 @@ func MakeSchemaResourceK8SCP() map[string]schema.Attribute {
},
"desc": schema.StringAttribute{
Optional: true,
+ Computed: true,
Description: "Text description of this instance.",
},
"extnet_only": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(false),
Description: "Use only selected ExtNet for infrastructure connections",
},
"oidc_cert": schema.StringAttribute{
@@ -152,18 +160,26 @@ func MakeSchemaResourceK8SCP() map[string]schema.Attribute {
// optional attributes for update
"start": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(false),
Description: "Start k8s cluster.",
},
"enabled": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
Description: "Enable k8s cluster",
},
"permanently": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
Description: "whether to completely delete the k8s cluster",
},
"restore": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
Description: "if true, restore the k8s cluster from Recycle Bin",
},
// computed attributes
diff --git a/internal/service/cloudapi/k8s/schemas/schema_resource_k8s_wg.go b/internal/service/cloudapi/k8s/schemas/schema_resource_k8s_wg.go
index 332c9ba..9d26b59 100644
--- a/internal/service/cloudapi/k8s/schemas/schema_resource_k8s_wg.go
+++ b/internal/service/cloudapi/k8s/schemas/schema_resource_k8s_wg.go
@@ -29,13 +29,6 @@ func MakeSchemaResourceK8SWG() map[string]schema.Attribute {
Computed: true,
Description: "Number of worker nodes to create.",
},
- "worker_chipset": schema.StringAttribute{
- Optional: true,
- Description: "Type of the emulated system of worker nodes",
- Validators: []validator.String{
- stringvalidator.OneOfCaseInsensitive("Q35", "i440fx"),
- },
- },
"cpu": schema.Int64Attribute{
Optional: true,
Computed: true,
diff --git a/internal/service/cloudapi/k8s/utilities/utility_resource_k8s_wg.go b/internal/service/cloudapi/k8s/utilities/utility_resource_k8s_wg.go
index e8516f0..2c94d93 100644
--- a/internal/service/cloudapi/k8s/utilities/utility_resource_k8s_wg.go
+++ b/internal/service/cloudapi/k8s/utilities/utility_resource_k8s_wg.go
@@ -219,7 +219,7 @@ func K8SWGUpdateNumWorkers(ctx context.Context, plan, state *models.ResourceK8SW
K8SID: k8sId,
WorkersGroupID: wg.ID,
Num: uint64(newNum) - wg.Num,
- Chipset: plan.WorkerChipset.ValueString(),
+ Chipset: plan.Chipset.ValueString(),
}
tflog.Info(ctx, "Add workers in wg with id", map[string]any{"wg_id": state.WorkerGroupId.ValueInt64(), "k8s_id": state.K8SID.ValueInt64()})
diff --git a/internal/service/cloudapi/kvmvm/flattens/flatten_data_source_compute.go b/internal/service/cloudapi/kvmvm/flattens/flatten_data_source_compute.go
index f249548..1e81025 100644
--- a/internal/service/cloudapi/kvmvm/flattens/flatten_data_source_compute.go
+++ b/internal/service/cloudapi/kvmvm/flattens/flatten_data_source_compute.go
@@ -51,6 +51,7 @@ func DataSourceCompute(ctx context.Context, state *models.RecordComputeModel, c
Chipset: types.StringValue(computeRecord.Chipset),
BootDiskSize: types.Int64Value(int64(computeRecord.BootDiskSize)),
BootOrder: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &computeRecord.BootOrder),
+ BootType: types.StringValue(computeRecord.BootType),
CdImageId: types.Int64Value(int64(computeRecord.CdImageId)),
Clones: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.Clones),
CloneReference: types.Int64Value(int64(computeRecord.CloneReference)),
@@ -69,10 +70,12 @@ func DataSourceCompute(ctx context.Context, state *models.RecordComputeModel, c
GID: types.Int64Value(int64(computeRecord.GID)),
GUID: types.Int64Value(int64(computeRecord.GUID)),
HPBacked: types.BoolValue(computeRecord.HPBacked),
+ HotResize: types.BoolValue(computeRecord.HotResize),
ImageID: types.Int64Value(int64(computeRecord.ImageID)),
ImageName: types.StringValue(computeRecord.ImageName),
Interfaces: flattenInterfaces(ctx, &computeRecord.Interfaces),
LockStatus: types.StringValue(computeRecord.LockStatus),
+ LoaderType: types.StringValue(computeRecord.LoaderType),
ManagerID: types.Int64Value(int64(computeRecord.ManagerID)),
ManagerType: types.StringValue(computeRecord.ManagerType),
MigrationJob: types.Int64Value(int64(computeRecord.MigrationJob)),
@@ -84,32 +87,33 @@ func DataSourceCompute(ctx context.Context, state *models.RecordComputeModel, c
NatableVINSNetwork: types.StringValue(computeRecord.NatableVINSNetwork),
NatableVINSNetworkName: types.StringValue(computeRecord.NatableVINSNetworkName),
NeedReboot: types.BoolValue(computeRecord.NeedReboot),
+ NetworkInterfaceNaming: types.StringValue(computeRecord.NetworkInterfaceNaming),
NumaAffinity: types.StringValue(computeRecord.NumaAffinity),
NumaNodeId: types.Int64Value(int64(computeRecord.NumaNodeId)),
OSUsers: flattenOSUsers(ctx, &computeRecord.OSUsers),
- Pinned: types.BoolValue(computeRecord.Pinned),
- PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.PreferredCPU),
- PCIDevices: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, flattenPCI(ctx, pciDevicesList)),
- RAM: types.Int64Value(int64(computeRecord.RAM)),
- ReferenceID: types.StringValue(computeRecord.ReferenceID),
- Registered: types.BoolValue(computeRecord.Registered),
- ResName: types.StringValue(computeRecord.ResName),
- ReservedNodeCpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.ReservedNodeCpus),
- RGID: types.Int64Value(int64(computeRecord.RGID)),
- RGName: types.StringValue(computeRecord.RGName),
- SnapSets: flattenSnapSet(ctx, &computeRecord.SnapSets),
- StatelessSepID: types.Int64Value(int64(computeRecord.StatelessSepID)),
- StatelessSepType: types.StringValue(computeRecord.StatelessSepType),
- Status: types.StringValue(computeRecord.Status),
- TechStatus: types.StringValue(computeRecord.TechStatus),
- UpdatedBy: types.StringValue(computeRecord.UpdatedBy),
- UpdatedTime: types.Int64Value(int64(computeRecord.UpdatedTime)),
- UserManaged: types.BoolValue(computeRecord.UserManaged),
- Userdata: types.StringValue(string(userdata)),
- VirtualImageID: types.Int64Value(int64(computeRecord.VirtualImageID)),
- VirtualImageName: types.StringValue(computeRecord.VirtualImageName),
- VNCPassword: types.StringValue(computeRecord.VNCPassword),
- VGPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.VGPUs),
+ //Pinned: types.BoolValue(computeRecord.Pinned),
+ PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.PreferredCPU),
+ PCIDevices: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, flattenPCI(ctx, pciDevicesList)),
+ RAM: types.Int64Value(int64(computeRecord.RAM)),
+ ReferenceID: types.StringValue(computeRecord.ReferenceID),
+ Registered: types.BoolValue(computeRecord.Registered),
+ ResName: types.StringValue(computeRecord.ResName),
+ ReservedNodeCpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.ReservedNodeCpus),
+ RGID: types.Int64Value(int64(computeRecord.RGID)),
+ RGName: types.StringValue(computeRecord.RGName),
+ SnapSets: flattenSnapSet(ctx, &computeRecord.SnapSets),
+ StatelessSepID: types.Int64Value(int64(computeRecord.StatelessSepID)),
+ StatelessSepType: types.StringValue(computeRecord.StatelessSepType),
+ Status: types.StringValue(computeRecord.Status),
+ TechStatus: types.StringValue(computeRecord.TechStatus),
+ UpdatedBy: types.StringValue(computeRecord.UpdatedBy),
+ UpdatedTime: types.Int64Value(int64(computeRecord.UpdatedTime)),
+ UserManaged: types.BoolValue(computeRecord.UserManaged),
+ Userdata: types.StringValue(string(userdata)),
+ VirtualImageID: types.Int64Value(int64(computeRecord.VirtualImageID)),
+ VirtualImageName: types.StringValue(computeRecord.VirtualImageName),
+ VNCPassword: types.StringValue(computeRecord.VNCPassword),
+ VGPUs: flattenComputeVGPU(ctx, computeRecord.VGPUs),
}
state.Tags, diags = types.MapValueFrom(ctx, types.StringType, computeRecord.Tags)
@@ -232,23 +236,24 @@ func flattenDisks(ctx context.Context, disks *compute.ListComputeDisks) []models
StorageID: types.StringValue(item.Replication.StorageID),
VolumeID: types.StringValue(item.Replication.VolumeID),
},
- ResID: types.StringValue(item.ResID),
- Role: types.StringValue(item.Role),
- SepID: types.Int64Value(int64(item.SepID)),
- Shareable: types.BoolValue(item.Shareable),
- SizeMax: types.Int64Value(int64(item.SizeMax)),
- SizeUsed: types.Float64Value(item.SizeUsed),
- Snapshots: flattenSnapshotExtend(ctx, &item.Snapshots),
- Status: types.StringValue(item.Status),
- TechStatus: types.StringValue(item.TechStatus),
- Type: types.StringValue(item.Type),
- VMID: types.Int64Value(int64(item.VMID)),
+ ResID: types.StringValue(item.ResID),
+ Role: types.StringValue(item.Role),
+ SepID: types.Int64Value(int64(item.SepID)),
+ Shareable: types.BoolValue(item.Shareable),
+ SizeAvailable: types.Float64Value(item.SizeAvailable),
+ SizeMax: types.Int64Value(int64(item.SizeMax)),
+ SizeUsed: types.Float64Value(item.SizeUsed),
+ Snapshots: flattenSnapshotExtend(ctx, &item.Snapshots),
+ Status: types.StringValue(item.Status),
+ TechStatus: types.StringValue(item.TechStatus),
+ Type: types.StringValue(item.Type),
+ VMID: types.Int64Value(int64(item.VMID)),
}
temp.Images, diags = types.ListValueFrom(ctx, types.Int64Type, item.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenDisks", diags))
}
- temp.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, item.PresentTo)
+ temp.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, item.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenDisks", diags))
}
@@ -387,3 +392,36 @@ func flattenPCI(ctx context.Context, pciList *compute.ListPCIDevices) []uint64 {
tflog.Info(ctx, "End flattenPCI")
return res
}
+
+func flattenComputeVGPU(ctx context.Context, vgpuList []compute.VGPUItem) []models.VGPUModel {
+ tflog.Info(ctx, "Start flattenVGPU")
+
+ res := make([]models.VGPUModel, 0, len(vgpuList))
+ for _, item := range vgpuList {
+ temp := models.VGPUModel{
+ ID: types.Int64Value(int64(item.ID)),
+ GID: types.Int64Value(int64(item.GID)),
+ Type: types.StringValue(item.Type),
+ Mode: types.StringValue(item.Mode),
+ Status: types.StringValue(item.Status),
+ ProfileID: types.Int64Value(int64(item.ProfileID)),
+ RAM: types.Int64Value(int64(item.RAM)),
+ LastUpdateTime: types.Int64Value(int64(item.LastUpdateTime)),
+ CreatedTime: types.Int64Value(int64(item.CreatedTime)),
+ DeletedTime: types.Int64Value(int64(item.DeletedTime)),
+ VMID: types.Int64Value(int64(item.VMID)),
+ PGPUID: types.Int64Value(int64(item.PGPuid)),
+ ReferenceID: types.StringValue(item.ReferenceID),
+ AccountID: types.Int64Value(int64(item.AccountID)),
+ RGID: types.Int64Value(int64(item.RgID)),
+ LastClaimedBy: types.Int64Value(int64(item.LastClaimedBy)),
+ PCISlot: types.Int64Value(int64(item.PCISlot)),
+ BusNumber: types.Int64Value(int64(item.BusNumber)),
+ GUID: types.Int64Value(int64(item.GUID)),
+ }
+ res = append(res, temp)
+ }
+
+ tflog.Info(ctx, "End flattenVGPU")
+ return res
+}
diff --git a/internal/service/cloudapi/kvmvm/flattens/flatten_data_source_compute_list.go b/internal/service/cloudapi/kvmvm/flattens/flatten_data_source_compute_list.go
index 92cda6e..e82b4ba 100644
--- a/internal/service/cloudapi/kvmvm/flattens/flatten_data_source_compute_list.go
+++ b/internal/service/cloudapi/kvmvm/flattens/flatten_data_source_compute_list.go
@@ -65,69 +65,73 @@ func flattenItemsList(ctx context.Context, computes *compute.ListComputes) []mod
customFields, _ := json.Marshal(item.CustomFields)
devices, _ := json.Marshal(item.Devices)
temp := models.ItemComputeModel{
- ACL: flattenACLInList(ctx, &item.ACL),
- AccountID: types.Int64Value(int64(item.AccountID)),
- AccountName: types.StringValue(item.AccountName),
- AffinityLabel: types.StringValue(item.AffinityLabel),
- AffinityRules: flattenAffinityRuleInList(ctx, &item.AffinityRules),
- AffinityWeight: types.Int64Value(int64(item.AffinityWeight)),
- AntiAffinityRules: flattenAffinityRuleInList(ctx, &item.AntiAffinityRules),
- Architecture: types.StringValue(item.Architecture),
- AutoStartWithNode: types.BoolValue(item.AutoStart),
- BootDiskSize: types.Int64Value(int64(item.BootDiskSize)),
- BootOrder: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.BootOrder),
- CdImageId: types.Int64Value(int64(item.CdImageId)),
- Clones: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Clones),
- CloneReference: types.Int64Value(int64(item.CloneReference)),
- Chipset: types.StringValue(item.Chipset),
- ComputeCIID: types.Int64Value(int64(item.ComputeCIID)),
- CPU: types.Int64Value(int64(item.CPU)),
- CPUPin: types.BoolValue(item.CPUPin),
- CreatedBy: types.StringValue(item.CreatedBy),
- CreatedTime: types.Int64Value(int64(item.CreatedTime)),
- CustomFields: types.StringValue(string(customFields)),
- DeletedBy: types.StringValue(item.DeletedBy),
- DeletedTime: types.Int64Value(int64(item.DeletedTime)),
- Description: types.StringValue(item.Description),
- Devices: types.StringValue(string(devices)),
- Disks: flattenDisksInList(ctx, &item.Disks),
- Driver: types.StringValue(item.Driver),
- GID: types.Int64Value(int64(item.GID)),
- GUID: types.Int64Value(int64(item.GUID)),
- HPBacked: types.BoolValue(item.HPBacked),
- ComputeId: types.Int64Value(int64(item.ID)),
- ImageID: types.Int64Value(int64(item.ImageID)),
- Interfaces: flattenInterfaceInList(ctx, &item.Interfaces),
- LockStatus: types.StringValue(item.LockStatus),
- ManagerID: types.Int64Value(int64(item.ManagerID)),
- ManagerType: types.StringValue(item.ManagerType),
- MigrationJob: types.Int64Value(int64(item.MigrationJob)),
- Milestones: types.Int64Value(int64(item.Milestones)),
- Name: types.StringValue(item.Name),
- NeedReboot: types.BoolValue(item.NeedReboot),
- NumaAffinity: types.StringValue(item.NumaAffinity),
- NumaNodeId: types.Int64Value(int64(item.NumaNodeId)),
- Pinned: types.BoolValue(item.Pinned),
- PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.PreferredCPU),
- RAM: types.Int64Value(int64(item.RAM)),
- ReferenceID: types.StringValue(item.ReferenceID),
- Registered: types.BoolValue(item.Registered),
- ResName: types.StringValue(item.ResName),
- ReservedNodeCpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.ReservedNodeCpus),
- RGID: types.Int64Value(int64(item.RGID)),
- RGName: types.StringValue(item.RGName),
- SnapSets: flattenSnapSetInList(ctx, &item.SnapSets),
- StatelessSepID: types.Int64Value(int64(item.StatelessSepID)),
- StatelessSepType: types.StringValue(item.StatelessSepType),
- Status: types.StringValue(item.Status),
- TechStatus: types.StringValue(item.TechStatus),
- TotalDiskSize: types.Int64Value(int64(item.TotalDiskSize)),
- UpdatedBy: types.StringValue(item.UpdatedBy),
- UpdatedTime: types.Int64Value(int64(item.UpdatedTime)),
- UserManaged: types.BoolValue(item.UserManaged),
- VINSConnected: types.Int64Value(int64(item.VINSConnected)),
- VirtualImageID: types.Int64Value(int64(item.VirtualImageID)),
- VGPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.VGPUs),
+ ACL: flattenACLInList(ctx, &item.ACL),
+ AccountID: types.Int64Value(int64(item.AccountID)),
+ AccountName: types.StringValue(item.AccountName),
+ AffinityLabel: types.StringValue(item.AffinityLabel),
+ AffinityRules: flattenAffinityRuleInList(ctx, &item.AffinityRules),
+ AffinityWeight: types.Int64Value(int64(item.AffinityWeight)),
+ AntiAffinityRules: flattenAffinityRuleInList(ctx, &item.AntiAffinityRules),
+ Architecture: types.StringValue(item.Architecture),
+ AutoStartWithNode: types.BoolValue(item.AutoStart),
+ BootDiskSize: types.Int64Value(int64(item.BootDiskSize)),
+ BootOrder: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.BootOrder),
+ BootType: types.StringValue(item.BootType),
+ CdImageId: types.Int64Value(int64(item.CdImageId)),
+ Clones: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Clones),
+ CloneReference: types.Int64Value(int64(item.CloneReference)),
+ Chipset: types.StringValue(item.Chipset),
+ ComputeCIID: types.Int64Value(int64(item.ComputeCIID)),
+ CPU: types.Int64Value(int64(item.CPU)),
+ CPUPin: types.BoolValue(item.CPUPin),
+ CreatedBy: types.StringValue(item.CreatedBy),
+ CreatedTime: types.Int64Value(int64(item.CreatedTime)),
+ CustomFields: types.StringValue(string(customFields)),
+ DeletedBy: types.StringValue(item.DeletedBy),
+ DeletedTime: types.Int64Value(int64(item.DeletedTime)),
+ Description: types.StringValue(item.Description),
+ Devices: types.StringValue(string(devices)),
+ Disks: flattenDisksInList(ctx, &item.Disks),
+ Driver: types.StringValue(item.Driver),
+ GID: types.Int64Value(int64(item.GID)),
+ GUID: types.Int64Value(int64(item.GUID)),
+ HPBacked: types.BoolValue(item.HPBacked),
+ HotResize: types.BoolValue(item.HotResize),
+ ComputeId: types.Int64Value(int64(item.ID)),
+ ImageID: types.Int64Value(int64(item.ImageID)),
+ Interfaces: flattenInterfaceInList(ctx, &item.Interfaces),
+ LockStatus: types.StringValue(item.LockStatus),
+ LoaderType: types.StringValue(item.LoaderType),
+ ManagerID: types.Int64Value(int64(item.ManagerID)),
+ ManagerType: types.StringValue(item.ManagerType),
+ MigrationJob: types.Int64Value(int64(item.MigrationJob)),
+ Milestones: types.Int64Value(int64(item.Milestones)),
+ Name: types.StringValue(item.Name),
+ NeedReboot: types.BoolValue(item.NeedReboot),
+ NetworkInterfaceNaming: types.StringValue(item.NetworkInterfaceNaming),
+ NumaAffinity: types.StringValue(item.NumaAffinity),
+ NumaNodeId: types.Int64Value(int64(item.NumaNodeId)),
+ //Pinned: types.BoolValue(item.Pinned),
+ PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.PreferredCPU),
+ RAM: types.Int64Value(int64(item.RAM)),
+ ReferenceID: types.StringValue(item.ReferenceID),
+ Registered: types.BoolValue(item.Registered),
+ ResName: types.StringValue(item.ResName),
+ ReservedNodeCpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.ReservedNodeCpus),
+ RGID: types.Int64Value(int64(item.RGID)),
+ RGName: types.StringValue(item.RGName),
+ SnapSets: flattenSnapSetInList(ctx, &item.SnapSets),
+ StatelessSepID: types.Int64Value(int64(item.StatelessSepID)),
+ StatelessSepType: types.StringValue(item.StatelessSepType),
+ Status: types.StringValue(item.Status),
+ TechStatus: types.StringValue(item.TechStatus),
+ TotalDiskSize: types.Int64Value(int64(item.TotalDiskSize)),
+ UpdatedBy: types.StringValue(item.UpdatedBy),
+ UpdatedTime: types.Int64Value(int64(item.UpdatedTime)),
+ UserManaged: types.BoolValue(item.UserManaged),
+ VINSConnected: types.Int64Value(int64(item.VINSConnected)),
+ VirtualImageID: types.Int64Value(int64(item.VirtualImageID)),
+ VGPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.VGPUs),
}
temp.Tags, diags = types.MapValueFrom(ctx, types.StringType, item.Tags)
@@ -187,9 +191,9 @@ func flattenDisksInList(ctx context.Context, disks *compute.ListInfoDisks) []mod
res := make([]models.DiskInListModel, 0, len(*disks))
for _, item := range *disks {
temp := models.DiskInListModel{
- BusNumber: types.Int64Value(int64(item.BusNumber)),
- DiskId: types.Int64Value(int64(item.ID)),
- PCISlot: types.Int64Value(item.PCISlot),
+ //BusNumber: types.Int64Value(int64(item.BusNumber)),
+ DiskId: types.Int64Value(int64(item.ID)),
+ //PCISlot: types.Int64Value(item.PCISlot),
}
res = append(res, temp)
}
diff --git a/internal/service/cloudapi/kvmvm/flattens/flatten_data_source_compute_list_deleted.go b/internal/service/cloudapi/kvmvm/flattens/flatten_data_source_compute_list_deleted.go
index 258c652..5527c1f 100644
--- a/internal/service/cloudapi/kvmvm/flattens/flatten_data_source_compute_list_deleted.go
+++ b/internal/service/cloudapi/kvmvm/flattens/flatten_data_source_compute_list_deleted.go
@@ -63,69 +63,73 @@ func flattenItemsListDeleted(ctx context.Context, computes *compute.ListComputes
customFields, _ := json.Marshal(item.CustomFields)
devices, _ := json.Marshal(item.Devices)
temp := models.ItemListDeletedComputeModel{
- ACL: flattenACLInListDeleted(ctx, &item.ACL),
- AccountID: types.Int64Value(int64(item.AccountID)),
- AccountName: types.StringValue(item.AccountName),
- AffinityLabel: types.StringValue(item.AffinityLabel),
- AffinityRules: flattenAffinityRuleInListDeleted(ctx, &item.AffinityRules),
- AffinityWeight: types.Int64Value(int64(item.AffinityWeight)),
- AntiAffinityRules: flattenAffinityRuleInListDeleted(ctx, &item.AntiAffinityRules),
- Architecture: types.StringValue(item.Architecture),
- AutoStartWithNode: types.BoolValue(item.AutoStart),
- BootDiskSize: types.Int64Value(int64(item.BootDiskSize)),
- BootOrder: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.BootOrder),
- CdImageId: types.Int64Value(int64(item.CdImageId)),
- Clones: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Clones),
- Chipset: types.StringValue(item.Chipset),
- CloneReference: types.Int64Value(int64(item.CloneReference)),
- ComputeCIID: types.Int64Value(int64(item.ComputeCIID)),
- CPU: types.Int64Value(int64(item.CPU)),
- CPUPin: types.BoolValue(item.CPUPin),
- CreatedBy: types.StringValue(item.CreatedBy),
- CreatedTime: types.Int64Value(int64(item.CreatedTime)),
- CustomFields: types.StringValue(string(customFields)),
- DeletedBy: types.StringValue(item.DeletedBy),
- DeletedTime: types.Int64Value(int64(item.DeletedTime)),
- Description: types.StringValue(item.Description),
- Devices: types.StringValue(string(devices)),
- Disks: flattenDisksInListDeleted(ctx, &item.Disks),
- Driver: types.StringValue(item.Driver),
- GID: types.Int64Value(int64(item.GID)),
- GUID: types.Int64Value(int64(item.GUID)),
- HPBacked: types.BoolValue(item.HPBacked),
- ComputeId: types.Int64Value(int64(item.ID)),
- ImageID: types.Int64Value(int64(item.ImageID)),
- Interfaces: flattenInterfaceInListDeleted(ctx, &item.Interfaces),
- LockStatus: types.StringValue(item.LockStatus),
- ManagerID: types.Int64Value(int64(item.ManagerID)),
- ManagerType: types.StringValue(item.ManagerType),
- MigrationJob: types.Int64Value(int64(item.MigrationJob)),
- Milestones: types.Int64Value(int64(item.Milestones)),
- Name: types.StringValue(item.Name),
- NeedReboot: types.BoolValue(item.NeedReboot),
- NumaAffinity: types.StringValue(item.NumaAffinity),
- NumaNodeId: types.Int64Value(int64(item.NumaNodeId)),
- Pinned: types.BoolValue(item.Pinned),
- PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.PreferredCPU),
- RAM: types.Int64Value(int64(item.RAM)),
- ReferenceID: types.StringValue(item.ReferenceID),
- Registered: types.BoolValue(item.Registered),
- ResName: types.StringValue(item.ResName),
- ReservedNodeCpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.ReservedNodeCpus),
- RGID: types.Int64Value(int64(item.RGID)),
- RGName: types.StringValue(item.RGName),
- SnapSets: flattenSnapSetInListDeleted(ctx, &item.SnapSets),
- StatelessSepID: types.Int64Value(int64(item.StatelessSepID)),
- StatelessSepType: types.StringValue(item.StatelessSepType),
- Status: types.StringValue(item.Status),
- TechStatus: types.StringValue(item.TechStatus),
- TotalDiskSize: types.Int64Value(int64(item.TotalDiskSize)),
- UpdatedBy: types.StringValue(item.UpdatedBy),
- UpdatedTime: types.Int64Value(int64(item.UpdatedTime)),
- UserManaged: types.BoolValue(item.UserManaged),
- VINSConnected: types.Int64Value(int64(item.VINSConnected)),
- VirtualImageID: types.Int64Value(int64(item.VirtualImageID)),
- VGPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.VGPUs),
+ ACL: flattenACLInListDeleted(ctx, &item.ACL),
+ AccountID: types.Int64Value(int64(item.AccountID)),
+ AccountName: types.StringValue(item.AccountName),
+ AffinityLabel: types.StringValue(item.AffinityLabel),
+ AffinityRules: flattenAffinityRuleInListDeleted(ctx, &item.AffinityRules),
+ AffinityWeight: types.Int64Value(int64(item.AffinityWeight)),
+ AntiAffinityRules: flattenAffinityRuleInListDeleted(ctx, &item.AntiAffinityRules),
+ Architecture: types.StringValue(item.Architecture),
+ AutoStartWithNode: types.BoolValue(item.AutoStart),
+ BootDiskSize: types.Int64Value(int64(item.BootDiskSize)),
+ BootOrder: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.BootOrder),
+ BootType: types.StringValue(item.BootType),
+ CdImageId: types.Int64Value(int64(item.CdImageId)),
+ Clones: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Clones),
+ Chipset: types.StringValue(item.Chipset),
+ CloneReference: types.Int64Value(int64(item.CloneReference)),
+ ComputeCIID: types.Int64Value(int64(item.ComputeCIID)),
+ CPU: types.Int64Value(int64(item.CPU)),
+ CPUPin: types.BoolValue(item.CPUPin),
+ CreatedBy: types.StringValue(item.CreatedBy),
+ CreatedTime: types.Int64Value(int64(item.CreatedTime)),
+ CustomFields: types.StringValue(string(customFields)),
+ DeletedBy: types.StringValue(item.DeletedBy),
+ DeletedTime: types.Int64Value(int64(item.DeletedTime)),
+ Description: types.StringValue(item.Description),
+ Devices: types.StringValue(string(devices)),
+ Disks: flattenDisksInListDeleted(ctx, &item.Disks),
+ Driver: types.StringValue(item.Driver),
+ GID: types.Int64Value(int64(item.GID)),
+ GUID: types.Int64Value(int64(item.GUID)),
+ HPBacked: types.BoolValue(item.HPBacked),
+ HotResize: types.BoolValue(item.HotResize),
+ ComputeId: types.Int64Value(int64(item.ID)),
+ ImageID: types.Int64Value(int64(item.ImageID)),
+ Interfaces: flattenInterfaceInListDeleted(ctx, &item.Interfaces),
+ LockStatus: types.StringValue(item.LockStatus),
+ LoaderType: types.StringValue(item.LoaderType),
+ ManagerID: types.Int64Value(int64(item.ManagerID)),
+ ManagerType: types.StringValue(item.ManagerType),
+ MigrationJob: types.Int64Value(int64(item.MigrationJob)),
+ Milestones: types.Int64Value(int64(item.Milestones)),
+ Name: types.StringValue(item.Name),
+ NeedReboot: types.BoolValue(item.NeedReboot),
+ NetworkInterfaceNaming: types.StringValue(item.NetworkInterfaceNaming),
+ NumaAffinity: types.StringValue(item.NumaAffinity),
+ NumaNodeId: types.Int64Value(int64(item.NumaNodeId)),
+ //Pinned: types.BoolValue(item.Pinned),
+ PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.PreferredCPU),
+ RAM: types.Int64Value(int64(item.RAM)),
+ ReferenceID: types.StringValue(item.ReferenceID),
+ Registered: types.BoolValue(item.Registered),
+ ResName: types.StringValue(item.ResName),
+ ReservedNodeCpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.ReservedNodeCpus),
+ RGID: types.Int64Value(int64(item.RGID)),
+ RGName: types.StringValue(item.RGName),
+ SnapSets: flattenSnapSetInListDeleted(ctx, &item.SnapSets),
+ StatelessSepID: types.Int64Value(int64(item.StatelessSepID)),
+ StatelessSepType: types.StringValue(item.StatelessSepType),
+ Status: types.StringValue(item.Status),
+ TechStatus: types.StringValue(item.TechStatus),
+ TotalDiskSize: types.Int64Value(int64(item.TotalDiskSize)),
+ UpdatedBy: types.StringValue(item.UpdatedBy),
+ UpdatedTime: types.Int64Value(int64(item.UpdatedTime)),
+ UserManaged: types.BoolValue(item.UserManaged),
+ VINSConnected: types.Int64Value(int64(item.VINSConnected)),
+ VirtualImageID: types.Int64Value(int64(item.VirtualImageID)),
+ VGPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.VGPUs),
}
temp.Tags, diags = types.MapValueFrom(ctx, types.StringType, item.Tags)
@@ -185,9 +189,9 @@ func flattenDisksInListDeleted(ctx context.Context, disks *compute.ListInfoDisks
res := make([]models.DiskInListDeletedModel, 0, len(*disks))
for _, item := range *disks {
temp := models.DiskInListDeletedModel{
- BusNumber: types.Int64Value(int64(item.BusNumber)),
- DiskId: types.Int64Value(int64(item.ID)),
- PCISlot: types.Int64Value(item.PCISlot),
+ //BusNumber: types.Int64Value(int64(item.BusNumber)),
+ DiskId: types.Int64Value(int64(item.ID)),
+ //PCISlot: types.Int64Value(item.PCISlot),
}
res = append(res, temp)
}
diff --git a/internal/service/cloudapi/kvmvm/flattens/flatten_resource_compute.go b/internal/service/cloudapi/kvmvm/flattens/flatten_resource_compute.go
index e9fd86e..8c425a3 100644
--- a/internal/service/cloudapi/kvmvm/flattens/flatten_resource_compute.go
+++ b/internal/service/cloudapi/kvmvm/flattens/flatten_resource_compute.go
@@ -25,6 +25,24 @@ func ComputeResource(ctx context.Context, plan *models.ResourceComputeModel, c *
if diags.HasError() {
return diags
}
+ pfwList, err := utilities.ComputeResourcePFWListGet(ctx, recordItemCompute.ID, c)
+ if err != nil {
+ if err != nil {
+ diags.AddError("ComputeResourcePFWListGet error: ", err.Error())
+ tflog.Error(ctx, fmt.Sprint("ComputeResourcePFWListGet error ", err))
+ }
+ }
+
+ userList, err := utilities.ComputeResourceUserAccessGet(ctx, recordItemCompute.ID, c)
+ if err != nil {
+ tflog.Error(ctx, fmt.Sprintf("Error getting user list: %v", err))
+ }
+
+ pciDevicesList, err := utilities.ResourceComputePCIDevicesListCheckPresence(ctx, recordItemCompute.ID, c)
+ if err != nil {
+ tflog.Error(ctx, fmt.Sprintf("Error getting pci list: %v", err))
+ }
+
bootdisk := findBootDisk(recordItemCompute.Disks)
devices, _ := json.Marshal(recordItemCompute.Devices)
userdata, _ := json.Marshal(recordItemCompute.Userdata)
@@ -32,57 +50,58 @@ func ComputeResource(ctx context.Context, plan *models.ResourceComputeModel, c *
*plan = models.ResourceComputeModel{
// required fields
- Name: plan.Name,
- RGID: plan.RGID,
- Driver: plan.Driver,
- CPU: plan.CPU,
- RAM: plan.RAM,
- ID: plan.ID,
+ Name: types.StringValue(recordItemCompute.Name),
+ RGID: types.Int64Value(int64(recordItemCompute.RGID)),
+ Driver: types.StringValue(recordItemCompute.Driver),
+ CPU: types.Int64Value(int64(recordItemCompute.CPU)),
+ RAM: types.Int64Value(int64(recordItemCompute.RAM)),
Timeouts: plan.Timeouts,
// optional fields
- ImageID: plan.ImageID,
+ ImageID: types.Int64Value(int64(bootdisk.ImageID)),
WithoutBootDisk: plan.WithoutBootDisk,
// we intentionally use the SizeMax field, do not change it until the BootDiskSize field is fixed on the platform
- BootDiskSize: types.Int64Value(int64(bootdisk.SizeMax)),
- AffinityLabel: types.StringValue(recordItemCompute.AffinityLabel),
- AffinityRules: plan.AffinityRules,
- AntiAffinityRules: plan.AntiAffinityRules,
- AutoStartWithNode: types.BoolValue(recordItemCompute.AutoStart),
- CustomFields: types.StringValue(string(customFields)),
- Chipset: types.StringValue(recordItemCompute.Chipset),
- Stateless: plan.Stateless,
- SepId: types.Int64Value(int64(bootdisk.SepID)),
- Pool: types.StringValue(bootdisk.Pool),
- ExtraDisks: plan.ExtraDisks,
- Network: flattenNetwork(ctx, plan.Network, &recordItemCompute.Interfaces),
- Tags: plan.Tags,
- PortForwarding: plan.PortForwarding,
- UserAccess: plan.UserAccess,
- Snapshot: plan.Snapshot,
- PCIDevices: plan.PCIDevices,
- Rollback: plan.Rollback,
- CD: plan.CD,
- PinToStack: plan.PinToStack,
- Description: types.StringValue(recordItemCompute.Description),
- CloudInit: plan.CloudInit,
- Enabled: plan.Enabled,
- Pause: plan.Pause,
- Reset: plan.Reset,
- Restore: plan.Restore,
- AutoStart: plan.AutoStart,
- ForceStop: plan.ForceStop,
- ForceResize: plan.ForceResize,
- DataDisks: plan.DataDisks,
- Started: plan.Started,
- DetachDisks: plan.DetachDisks,
- Permanently: plan.Permanently,
- IS: plan.IS,
- IpaType: plan.IpaType,
- NumaAffinity: plan.NumaAffinity,
- CPUPin: plan.CPUPin,
- HPBacked: plan.HPBacked,
-
+ BootDiskSize: types.Int64Value(int64(bootdisk.SizeMax)),
+ AffinityLabel: types.StringValue(recordItemCompute.AffinityLabel),
+ AffinityRules: flattenComputeAffinityRule(ctx, &recordItemCompute.AffinityRules),
+ AntiAffinityRules: flattenComputeAffinityRule(ctx, &recordItemCompute.AntiAffinityRules),
+ AutoStartWithNode: types.BoolValue(recordItemCompute.AutoStart),
+ CustomFields: types.StringValue(string(customFields)),
+ Chipset: types.StringValue(recordItemCompute.Chipset),
+ SepId: types.Int64Value(int64(bootdisk.SepID)),
+ Pool: types.StringValue(bootdisk.Pool),
+ ExtraDisks: plan.ExtraDisks,
+ Network: flattenNetwork(ctx, plan.Network, &recordItemCompute.Interfaces),
+ Tags: flattenComputeTags(ctx, recordItemCompute.Tags),
+ PortForwarding: flattenComputePortForwarding(ctx, pfwList.Data),
+ UserAccess: flattenUserAccess(ctx, userList),
+ Snapshot: plan.Snapshot,
+ PCIDevices: flattens.FlattenSimpleTypeToSet(ctx, types.Int64Type, flattenPCIDevices(ctx, pciDevicesList)),
+ Rollback: plan.Rollback,
+ CDImageID: types.Int64Value(int64(recordItemCompute.CdImageId)),
+ PinToStack: types.BoolValue(recordItemCompute.PinnedToStack),
+ Description: types.StringValue(recordItemCompute.Description),
+ CloudInit: plan.CloudInit,
+ Enabled: types.BoolValue(recordItemCompute.Status == "ENABLED"),
+ Pause: types.BoolValue(recordItemCompute.TechStatus == "PAUSED"),
+ Reset: plan.Reset,
+ Restore: plan.Restore,
+ ForceStop: plan.ForceStop,
+ ForceResize: plan.ForceResize,
+ Started: types.BoolValue(recordItemCompute.TechStatus == "STARTED"),
+ DetachDisks: plan.DetachDisks,
+ Permanently: plan.Permanently,
+ IS: plan.IS,
+ IpaType: plan.IpaType,
+ NumaAffinity: types.StringValue(recordItemCompute.NumaAffinity),
+ CPUPin: types.BoolValue(recordItemCompute.CPUPin),
+ HPBacked: types.BoolValue(recordItemCompute.HPBacked),
+ SnapshotDeleteAsync: plan.SnapshotDeleteAsync,
+
+ LoaderType: types.StringValue(recordItemCompute.LoaderType),
+ BootType: types.StringValue(recordItemCompute.BootType),
+ HotResize: types.BoolValue(recordItemCompute.HotResize),
+ NetworkInterfaceNaming: types.StringValue(recordItemCompute.NetworkInterfaceNaming),
//computed fields
AccountId: types.Int64Value(int64(recordItemCompute.AccountID)),
AccountName: types.StringValue(recordItemCompute.AccountName),
@@ -92,7 +111,6 @@ func ComputeResource(ctx context.Context, plan *models.ResourceComputeModel, c *
BootOrder: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordItemCompute.BootOrder),
BootDisk: flattenDisk(ctx, bootdisk),
BootDiskId: types.Int64Value(int64(bootdisk.ID)),
- CdImageId: types.Int64Value(int64(recordItemCompute.CdImageId)),
CloneReference: types.Int64Value(int64(recordItemCompute.CloneReference)),
Clones: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordItemCompute.Clones),
ComputeCIID: types.Int64Value(int64(recordItemCompute.ComputeCIID)),
@@ -105,6 +123,7 @@ func ComputeResource(ctx context.Context, plan *models.ResourceComputeModel, c *
Disks: flattenResourceDisks(ctx, &recordItemCompute.Disks),
GID: types.Int64Value(int64(recordItemCompute.GID)),
GUID: types.Int64Value(int64(recordItemCompute.GUID)),
+ ID: plan.ID,
ImageName: types.StringValue(recordItemCompute.ImageName),
Interfaces: flattenResourceInterfaces(ctx, &recordItemCompute.Interfaces),
LockStatus: types.StringValue(recordItemCompute.LockStatus),
@@ -120,7 +139,7 @@ func ComputeResource(ctx context.Context, plan *models.ResourceComputeModel, c *
NeedReboot: types.BoolValue(recordItemCompute.NeedReboot),
NumaNodeId: types.Int64Value(int64(recordItemCompute.NumaNodeId)),
OSUsers: flattenResourceOSUsers(ctx, &recordItemCompute.OSUsers),
- Pinned: types.BoolValue(recordItemCompute.Pinned),
+ Pinned: types.BoolValue(recordItemCompute.PinnedToStack),
PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordItemCompute.PreferredCPU),
ReferenceID: types.StringValue(recordItemCompute.ReferenceID),
Registered: types.BoolValue(recordItemCompute.Registered),
@@ -136,7 +155,7 @@ func ComputeResource(ctx context.Context, plan *models.ResourceComputeModel, c *
UpdatedTime: types.Int64Value(int64(recordItemCompute.UpdatedTime)),
UserManaged: types.BoolValue(recordItemCompute.UserManaged),
Userdata: types.StringValue(string(userdata)),
- VGPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordItemCompute.VGPUs),
+ VGPUs: flattenResourceComputeVGPU(ctx, recordItemCompute.VGPUs),
VirtualImageID: types.Int64Value(int64(recordItemCompute.VirtualImageID)),
VirtualImageName: types.StringValue(recordItemCompute.VirtualImageName),
VNCPassword: types.StringValue(recordItemCompute.VNCPassword),
@@ -204,9 +223,10 @@ func flattenACLItems(ctx context.Context, item *compute.ListACL) types.List {
func flattenDisk(ctx context.Context, disk *compute.ItemComputeDisk) types.Object {
tflog.Info(ctx, fmt.Sprintf("flattenDisk: start flatten disk with ID - %v", disk.ID))
+ diags := diag.Diagnostics{}
+
acl, _ := json.Marshal(disk.ACL)
temp := models.ItemResourceDiskModel{
- CKey: types.StringValue(disk.CKey),
ACL: types.StringValue(string(acl)),
AccountID: types.Int64Value(int64(disk.AccountID)),
BootPartition: types.Int64Value(int64(disk.BootPartition)),
@@ -220,7 +240,7 @@ func flattenDisk(ctx context.Context, disk *compute.ItemComputeDisk) types.Objec
GUID: types.Int64Value(int64(disk.GUID)),
ID: types.Int64Value(int64(disk.ID)),
ImageID: types.Int64Value(int64(disk.ImageID)),
- Images: flattens.FlattenSimpleTypeToList(ctx, types.StringType, disk.Images),
+ Images: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, disk.Images),
IOTune: flattensIOTune(ctx, &disk.IOTune),
IQN: types.StringValue(disk.IQN),
Login: types.StringValue(disk.Login),
@@ -232,7 +252,6 @@ func flattenDisk(ctx context.Context, disk *compute.ItemComputeDisk) types.Objec
Passwd: types.StringValue(disk.Passwd),
Pool: types.StringValue(disk.Pool),
PCISlot: types.Int64Value(disk.PCISlot),
- PresentTo: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, disk.PresentTo),
PurgeTime: types.Int64Value(int64(disk.PurgeTime)),
RealityDeviceNumber: types.Int64Value(int64(disk.RealityDeviceNumber)),
Replication: flattenDiskReplication(ctx, &disk.Replication),
@@ -249,9 +268,14 @@ func flattenDisk(ctx context.Context, disk *compute.ItemComputeDisk) types.Objec
VMID: types.Int64Value(int64(disk.VMID)),
}
- res, err := types.ObjectValueFrom(ctx, models.ItemDisk, temp)
- if err != nil {
- tflog.Error(ctx, fmt.Sprint("Error flattenDisk struct to obj", err))
+ temp.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, disk.PresentTo)
+ if diags != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenPresentTo", diags))
+ }
+
+ res, diags := types.ObjectValueFrom(ctx, models.ItemDisk, temp)
+ if diags != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenDisk struct to obj", diags))
}
tflog.Info(ctx, fmt.Sprintf("flattenDisk: end flatten disk with ID - %v", disk.ID))
@@ -537,3 +561,165 @@ func flattenNetworkWeight(ctx context.Context, networks types.Set, item compute.
tflog.Info(ctx, "End flattenNetworkWeight")
return types.Int64Value(0)
}
+
+func flattenComputeAffinityRule(ctx context.Context, rules *compute.ListRules) types.Set {
+ tflog.Info(ctx, "Start flattenAffinityRule")
+
+ tempSlice := make([]types.Object, 0, len(*rules))
+ for _, item := range *rules {
+ temp := models.ItemResourceRulesModel{
+ Key: types.StringValue(item.Key),
+ Mode: types.StringValue(item.Mode),
+ Policy: types.StringValue(item.Policy),
+ Topology: types.StringValue(item.Topology),
+ Value: types.StringValue(item.Value),
+ }
+ obj, err := types.ObjectValueFrom(ctx, models.ItemResourceRules, temp)
+ if err != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenComputeAffinityRule struct to obj", err))
+ }
+ tempSlice = append(tempSlice, obj)
+ }
+
+ res, err := types.SetValueFrom(ctx, types.ObjectType{AttrTypes: models.ItemResourceRules}, tempSlice)
+ if err != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenComputeAffinityRule", err))
+ }
+
+ tflog.Info(ctx, "End flattenAffinityRule")
+ return res
+}
+
+func flattenComputeTags(ctx context.Context, tags map[string]string) types.Set {
+ tflog.Info(ctx, "Start flattenComputeTags")
+
+ tempSlice := make([]types.Object, 0, len(tags))
+ for key, value := range tags {
+ temp := models.ItemTagModel{
+ Key: types.StringValue(key),
+ Value: types.StringValue(value),
+ }
+ obj, err := types.ObjectValueFrom(ctx, models.ItemTag, temp)
+ if err != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenComputeTags struct to obj", err))
+ }
+ tempSlice = append(tempSlice, obj)
+ }
+
+ res, err := types.SetValueFrom(ctx, types.ObjectType{AttrTypes: models.ItemTag}, tempSlice)
+ if err != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenComputeTags", err))
+ }
+
+ tflog.Info(ctx, "End flattenComputeTags")
+ return res
+}
+
+func flattenComputePortForwarding(ctx context.Context, list []compute.ItemPFW) types.Set {
+ tflog.Info(ctx, "Start flattenComputePortForwarding")
+
+ tempSlice := make([]types.Object, 0, len(list))
+ for _, item := range list {
+ temp := models.ItemPortForfardingModel{
+ PublicPortStart: types.Int64Value(int64(item.PublicPortStart)),
+ PublicPortEnd: types.Int64Value(int64(item.PublicPortEnd)),
+ LocalPort: types.Int64Value(int64(item.LocalPort)),
+ Proto: types.StringValue(item.Protocol),
+ }
+ obj, err := types.ObjectValueFrom(ctx, models.ItemPortForfarding, temp)
+ if err != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenComputePortForwarding struct to obj", err))
+ }
+ tempSlice = append(tempSlice, obj)
+ }
+
+ res, err := types.SetValueFrom(ctx, types.ObjectType{AttrTypes: models.ItemPortForfarding}, tempSlice)
+ if err != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenComputePortForwarding", err))
+ }
+
+ tflog.Info(ctx, "End flattenComputePortForwarding")
+ return res
+}
+
+func flattenUserAccess(ctx context.Context, userList *compute.ListUsers) types.Set {
+ tflog.Info(ctx, "Start flattenUserAccess")
+ tempSlice := make([]types.Object, 0)
+
+ // Process compute ACL
+ for _, item := range userList.Data.ComputeACL {
+ temp := models.UserAccessModel{
+ Username: types.StringValue(item.UserGroupID),
+ AccessType: types.StringValue(item.Right),
+ }
+ obj, diags := types.ObjectValueFrom(ctx, models.ItemUserAccess, temp)
+ if diags != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenUserAccess struct to obj", diags))
+ continue
+ }
+ tempSlice = append(tempSlice, obj)
+ }
+
+ res, diags := types.SetValueFrom(ctx, types.ObjectType{AttrTypes: models.ItemUserAccess}, tempSlice)
+ if diags != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenUserAccess", diags))
+ }
+
+ tflog.Info(ctx, "End flattenUserAccess")
+ return res
+}
+
+func flattenPCIDevices(ctx context.Context, pciList *compute.ListPCIDevices) []uint64 {
+ tflog.Info(ctx, "Start flattenPCI")
+ res := make([]uint64, 0, len(pciList.Data))
+
+ for _, v := range pciList.Data {
+ res = append(res, v.ID)
+ }
+
+ tflog.Info(ctx, "End flattenPCI")
+ return res
+}
+
+func flattenResourceComputeVGPU(ctx context.Context, vgpuList []compute.VGPUItem) types.List {
+ tflog.Info(ctx, "Start flattenVGPU")
+ tempSlice := make([]types.Object, 0, len(vgpuList))
+
+ for _, item := range vgpuList {
+ temp := models.ComputeVGPUModel{
+ ID: types.Int64Value(int64(item.ID)),
+ GID: types.Int64Value(int64(item.GID)),
+ Type: types.StringValue(item.Type),
+ Mode: types.StringValue(item.Mode),
+ Status: types.StringValue(item.Status),
+ ProfileID: types.Int64Value(int64(item.ProfileID)),
+ RAM: types.Int64Value(int64(item.RAM)),
+ LastUpdateTime: types.Int64Value(int64(item.LastUpdateTime)),
+ CreatedTime: types.Int64Value(int64(item.CreatedTime)),
+ DeletedTime: types.Int64Value(int64(item.DeletedTime)),
+ VMID: types.Int64Value(int64(item.VMID)),
+ PGPUID: types.Int64Value(int64(item.PGPuid)),
+ ReferenceID: types.StringValue(item.ReferenceID),
+ AccountID: types.Int64Value(int64(item.AccountID)),
+ RGID: types.Int64Value(int64(item.RgID)),
+ LastClaimedBy: types.Int64Value(int64(item.LastClaimedBy)),
+ PCISlot: types.Int64Value(int64(item.PCISlot)),
+ BusNumber: types.Int64Value(int64(item.BusNumber)),
+ GUID: types.Int64Value(int64(item.GUID)),
+ }
+
+ obj, err := types.ObjectValueFrom(ctx, models.ComputeItemVGPU, temp)
+ if err != nil {
+ tflog.Error(ctx, fmt.Sprint("Error converting VGPU model to object", err))
+ }
+ tempSlice = append(tempSlice, obj)
+ }
+
+ res, err := types.ListValueFrom(ctx, types.ObjectType{AttrTypes: models.ComputeItemVGPU}, tempSlice)
+ if err != nil {
+ tflog.Error(ctx, fmt.Sprint("Error creating VGPU list value", err))
+ }
+
+ tflog.Info(ctx, "End flattenVGPU")
+ return res
+}
diff --git a/internal/service/cloudapi/kvmvm/models/model_data_source_compute.go b/internal/service/cloudapi/kvmvm/models/model_data_source_compute.go
index f22b2a9..9cc2119 100644
--- a/internal/service/cloudapi/kvmvm/models/model_data_source_compute.go
+++ b/internal/service/cloudapi/kvmvm/models/model_data_source_compute.go
@@ -79,10 +79,14 @@ type RecordComputeModel struct {
UpdatedTime types.Int64 `tfsdk:"updated_time"`
UserManaged types.Bool `tfsdk:"user_managed"`
Userdata types.String `tfsdk:"user_data"`
- VGPUs types.List `tfsdk:"vgpus"`
+ VGPUs []VGPUModel `tfsdk:"vgpus"`
VirtualImageID types.Int64 `tfsdk:"virtual_image_id"`
VirtualImageName types.String `tfsdk:"virtual_image_name"`
VNCPassword types.String `tfsdk:"vnc_password"`
+ LoaderType types.String `tfsdk:"loader_type"`
+ BootType types.String `tfsdk:"boot_type"`
+ HotResize types.Bool `tfsdk:"hot_resize"`
+ NetworkInterfaceNaming types.String `tfsdk:"network_interface_naming"`
}
type RecordACLModel struct {
@@ -136,7 +140,7 @@ type ItemDiskModel struct {
Passwd types.String `tfsdk:"passwd"`
PCISlot types.Int64 `tfsdk:"pci_slot"`
Pool types.String `tfsdk:"pool"`
- PresentTo types.List `tfsdk:"present_to"`
+ PresentTo types.Map `tfsdk:"present_to"`
PurgeTime types.Int64 `tfsdk:"purge_time"`
ReferenceID types.String `tfsdk:"reference_id"`
RealityDeviceNumber types.Int64 `tfsdk:"reality_device_number"`
@@ -145,6 +149,7 @@ type ItemDiskModel struct {
Role types.String `tfsdk:"role"`
SepID types.Int64 `tfsdk:"sep_id"`
Shareable types.Bool `tfsdk:"shareable"`
+ SizeAvailable types.Float64 `tfsdk:"size_available"`
SizeMax types.Int64 `tfsdk:"size_max"`
SizeUsed types.Float64 `tfsdk:"size_used"`
Snapshots []ItemSnapshotExtendModel `tfsdk:"snapshots"`
@@ -244,3 +249,25 @@ type ReplicationModel struct {
StorageID types.String `tfsdk:"storage_id"`
VolumeID types.String `tfsdk:"volume_id"`
}
+
+type VGPUModel struct {
+ ID types.Int64 `tfsdk:"id"`
+ GID types.Int64 `tfsdk:"gid"`
+ Type types.String `tfsdk:"type"`
+ Mode types.String `tfsdk:"mode"`
+ Status types.String `tfsdk:"status"`
+ ProfileID types.Int64 `tfsdk:"profile_id"`
+ RAM types.Int64 `tfsdk:"ram"`
+ LastUpdateTime types.Int64 `tfsdk:"last_update_time"`
+ CreatedTime types.Int64 `tfsdk:"created_time"`
+ DeletedTime types.Int64 `tfsdk:"deleted_time"`
+ VMID types.Int64 `tfsdk:"vmid"`
+ PGPUID types.Int64 `tfsdk:"pgpuid"`
+ ReferenceID types.String `tfsdk:"reference_id"`
+ AccountID types.Int64 `tfsdk:"account_id"`
+ RGID types.Int64 `tfsdk:"rg_id"`
+ LastClaimedBy types.Int64 `tfsdk:"last_claimed_by"`
+ PCISlot types.Int64 `tfsdk:"pci_slot"`
+ BusNumber types.Int64 `tfsdk:"bus_number"`
+ GUID types.Int64 `tfsdk:"guid"`
+}
diff --git a/internal/service/cloudapi/kvmvm/models/model_data_source_compute_list.go b/internal/service/cloudapi/kvmvm/models/model_data_source_compute_list.go
index 23d26be..2244ef6 100644
--- a/internal/service/cloudapi/kvmvm/models/model_data_source_compute_list.go
+++ b/internal/service/cloudapi/kvmvm/models/model_data_source_compute_list.go
@@ -30,70 +30,74 @@ type ListComputesModel struct {
}
type ItemComputeModel struct {
- ACL []ItemACLInListModel `tfsdk:"acl"`
- AccountID types.Int64 `tfsdk:"account_id"`
- AccountName types.String `tfsdk:"account_name"`
- AffinityLabel types.String `tfsdk:"affinity_label"`
- AffinityRules []ItemRuleInListModel `tfsdk:"affinity_rules"`
- AffinityWeight types.Int64 `tfsdk:"affinity_weight"`
- AntiAffinityRules []ItemRuleInListModel `tfsdk:"anti_affinity_rules"`
- Architecture types.String `tfsdk:"arch"`
- AutoStartWithNode types.Bool `tfsdk:"auto_start_w_node"`
- BootOrder types.List `tfsdk:"boot_order"`
- BootDiskSize types.Int64 `tfsdk:"bootdisk_size"`
- CdImageId types.Int64 `tfsdk:"cd_image_id"`
- CloneReference types.Int64 `tfsdk:"clone_reference"`
- Clones types.List `tfsdk:"clones"`
- Chipset types.String `tfsdk:"chipset"`
- ComputeCIID types.Int64 `tfsdk:"computeci_id"`
- CPU types.Int64 `tfsdk:"cpus"`
- CPUPin types.Bool `tfsdk:"cpu_pin"`
- CreatedBy types.String `tfsdk:"created_by"`
- CreatedTime types.Int64 `tfsdk:"created_time"`
- CustomFields types.String `tfsdk:"custom_fields"`
- DeletedBy types.String `tfsdk:"deleted_by"`
- DeletedTime types.Int64 `tfsdk:"deleted_time"`
- Description types.String `tfsdk:"desc"`
- Devices types.String `tfsdk:"devices"`
- Disks []DiskInListModel `tfsdk:"disks"`
- Driver types.String `tfsdk:"driver"`
- GID types.Int64 `tfsdk:"gid"`
- GUID types.Int64 `tfsdk:"guid"`
- HPBacked types.Bool `tfsdk:"hp_backed"`
- ComputeId types.Int64 `tfsdk:"compute_id"`
- ImageID types.Int64 `tfsdk:"image_id"`
- Interfaces []ItemVNFInterfaceInListModel `tfsdk:"interfaces"`
- LockStatus types.String `tfsdk:"lock_status"`
- ManagerID types.Int64 `tfsdk:"manager_id"`
- ManagerType types.String `tfsdk:"manager_type"`
- MigrationJob types.Int64 `tfsdk:"migrationjob"`
- Milestones types.Int64 `tfsdk:"milestones"`
- Name types.String `tfsdk:"name"`
- NeedReboot types.Bool `tfsdk:"need_reboot"`
- NumaAffinity types.String `tfsdk:"numa_affinity"`
- NumaNodeId types.Int64 `tfsdk:"numa_node_id"`
- Pinned types.Bool `tfsdk:"pinned"`
- PreferredCPU types.List `tfsdk:"preferred_cpu"`
- RAM types.Int64 `tfsdk:"ram"`
- ReferenceID types.String `tfsdk:"reference_id"`
- Registered types.Bool `tfsdk:"registered"`
- ResName types.String `tfsdk:"res_name"`
- ReservedNodeCpus types.List `tfsdk:"reserved_node_cpus"`
- RGID types.Int64 `tfsdk:"rg_id"`
- RGName types.String `tfsdk:"rg_name"`
- SnapSets []ItemSnapSetInListModel `tfsdk:"snap_sets"`
- StatelessSepID types.Int64 `tfsdk:"stateless_sep_id"`
- StatelessSepType types.String `tfsdk:"stateless_sep_type"`
- Status types.String `tfsdk:"status"`
- Tags types.Map `tfsdk:"tags"`
- TechStatus types.String `tfsdk:"tech_status"`
- TotalDiskSize types.Int64 `tfsdk:"total_disks_size"`
- UpdatedBy types.String `tfsdk:"updated_by"`
- UpdatedTime types.Int64 `tfsdk:"updated_time"`
- UserManaged types.Bool `tfsdk:"user_managed"`
- VGPUs types.List `tfsdk:"vgpus"`
- VINSConnected types.Int64 `tfsdk:"vins_connected"`
- VirtualImageID types.Int64 `tfsdk:"virtual_image_id"`
+ ACL []ItemACLInListModel `tfsdk:"acl"`
+ AccountID types.Int64 `tfsdk:"account_id"`
+ AccountName types.String `tfsdk:"account_name"`
+ AffinityLabel types.String `tfsdk:"affinity_label"`
+ AffinityRules []ItemRuleInListModel `tfsdk:"affinity_rules"`
+ AffinityWeight types.Int64 `tfsdk:"affinity_weight"`
+ AntiAffinityRules []ItemRuleInListModel `tfsdk:"anti_affinity_rules"`
+ Architecture types.String `tfsdk:"arch"`
+ AutoStartWithNode types.Bool `tfsdk:"auto_start_w_node"`
+ BootOrder types.List `tfsdk:"boot_order"`
+ BootDiskSize types.Int64 `tfsdk:"bootdisk_size"`
+ CdImageId types.Int64 `tfsdk:"cd_image_id"`
+ CloneReference types.Int64 `tfsdk:"clone_reference"`
+ Clones types.List `tfsdk:"clones"`
+ Chipset types.String `tfsdk:"chipset"`
+ ComputeCIID types.Int64 `tfsdk:"computeci_id"`
+ CPU types.Int64 `tfsdk:"cpus"`
+ CPUPin types.Bool `tfsdk:"cpu_pin"`
+ CreatedBy types.String `tfsdk:"created_by"`
+ CreatedTime types.Int64 `tfsdk:"created_time"`
+ CustomFields types.String `tfsdk:"custom_fields"`
+ DeletedBy types.String `tfsdk:"deleted_by"`
+ DeletedTime types.Int64 `tfsdk:"deleted_time"`
+ Description types.String `tfsdk:"desc"`
+ Devices types.String `tfsdk:"devices"`
+ Disks []DiskInListModel `tfsdk:"disks"`
+ Driver types.String `tfsdk:"driver"`
+ GID types.Int64 `tfsdk:"gid"`
+ GUID types.Int64 `tfsdk:"guid"`
+ HPBacked types.Bool `tfsdk:"hp_backed"`
+ ComputeId types.Int64 `tfsdk:"compute_id"`
+ ImageID types.Int64 `tfsdk:"image_id"`
+ Interfaces []ItemVNFInterfaceInListModel `tfsdk:"interfaces"`
+ LockStatus types.String `tfsdk:"lock_status"`
+ ManagerID types.Int64 `tfsdk:"manager_id"`
+ ManagerType types.String `tfsdk:"manager_type"`
+ MigrationJob types.Int64 `tfsdk:"migrationjob"`
+ Milestones types.Int64 `tfsdk:"milestones"`
+ Name types.String `tfsdk:"name"`
+ NeedReboot types.Bool `tfsdk:"need_reboot"`
+ NumaAffinity types.String `tfsdk:"numa_affinity"`
+ NumaNodeId types.Int64 `tfsdk:"numa_node_id"`
+ Pinned types.Bool `tfsdk:"pinned"`
+ PreferredCPU types.List `tfsdk:"preferred_cpu"`
+ RAM types.Int64 `tfsdk:"ram"`
+ ReferenceID types.String `tfsdk:"reference_id"`
+ Registered types.Bool `tfsdk:"registered"`
+ ResName types.String `tfsdk:"res_name"`
+ ReservedNodeCpus types.List `tfsdk:"reserved_node_cpus"`
+ RGID types.Int64 `tfsdk:"rg_id"`
+ RGName types.String `tfsdk:"rg_name"`
+ SnapSets []ItemSnapSetInListModel `tfsdk:"snap_sets"`
+ StatelessSepID types.Int64 `tfsdk:"stateless_sep_id"`
+ StatelessSepType types.String `tfsdk:"stateless_sep_type"`
+ Status types.String `tfsdk:"status"`
+ Tags types.Map `tfsdk:"tags"`
+ TechStatus types.String `tfsdk:"tech_status"`
+ TotalDiskSize types.Int64 `tfsdk:"total_disks_size"`
+ UpdatedBy types.String `tfsdk:"updated_by"`
+ UpdatedTime types.Int64 `tfsdk:"updated_time"`
+ UserManaged types.Bool `tfsdk:"user_managed"`
+ VGPUs types.List `tfsdk:"vgpus"`
+ VINSConnected types.Int64 `tfsdk:"vins_connected"`
+ VirtualImageID types.Int64 `tfsdk:"virtual_image_id"`
+ LoaderType types.String `tfsdk:"loader_type"`
+ BootType types.String `tfsdk:"boot_type"`
+ HotResize types.Bool `tfsdk:"hot_resize"`
+ NetworkInterfaceNaming types.String `tfsdk:"network_interface_naming"`
}
type ItemACLInListModel struct {
diff --git a/internal/service/cloudapi/kvmvm/models/model_data_source_compute_list_deleted.go b/internal/service/cloudapi/kvmvm/models/model_data_source_compute_list_deleted.go
index 01b90e1..052f453 100644
--- a/internal/service/cloudapi/kvmvm/models/model_data_source_compute_list_deleted.go
+++ b/internal/service/cloudapi/kvmvm/models/model_data_source_compute_list_deleted.go
@@ -28,70 +28,74 @@ type ListDeletedComputesModel struct {
}
type ItemListDeletedComputeModel struct {
- ACL []ItemACLInListDeletedModel `tfsdk:"acl"`
- AccountID types.Int64 `tfsdk:"account_id"`
- AccountName types.String `tfsdk:"account_name"`
- AffinityLabel types.String `tfsdk:"affinity_label"`
- AffinityRules []ItemRuleInListDeletedModel `tfsdk:"affinity_rules"`
- AffinityWeight types.Int64 `tfsdk:"affinity_weight"`
- AntiAffinityRules []ItemRuleInListDeletedModel `tfsdk:"anti_affinity_rules"`
- Architecture types.String `tfsdk:"arch"`
- AutoStartWithNode types.Bool `tfsdk:"auto_start_w_node"`
- BootOrder types.List `tfsdk:"boot_order"`
- BootDiskSize types.Int64 `tfsdk:"bootdisk_size"`
- CdImageId types.Int64 `tfsdk:"cd_image_id"`
- Chipset types.String `tfsdk:"chipset"`
- CloneReference types.Int64 `tfsdk:"clone_reference"`
- Clones types.List `tfsdk:"clones"`
- ComputeCIID types.Int64 `tfsdk:"computeci_id"`
- CPU types.Int64 `tfsdk:"cpus"`
- CPUPin types.Bool `tfsdk:"cpu_pin"`
- CreatedBy types.String `tfsdk:"created_by"`
- CreatedTime types.Int64 `tfsdk:"created_time"`
- CustomFields types.String `tfsdk:"custom_fields"`
- DeletedBy types.String `tfsdk:"deleted_by"`
- DeletedTime types.Int64 `tfsdk:"deleted_time"`
- Description types.String `tfsdk:"desc"`
- Devices types.String `tfsdk:"devices"`
- Disks []DiskInListDeletedModel `tfsdk:"disks"`
- Driver types.String `tfsdk:"driver"`
- GID types.Int64 `tfsdk:"gid"`
- GUID types.Int64 `tfsdk:"guid"`
- HPBacked types.Bool `tfsdk:"hp_backed"`
- ComputeId types.Int64 `tfsdk:"compute_id"`
- ImageID types.Int64 `tfsdk:"image_id"`
- Interfaces []ItemVNFInterfaceInListDeletedModel `tfsdk:"interfaces"`
- LockStatus types.String `tfsdk:"lock_status"`
- ManagerID types.Int64 `tfsdk:"manager_id"`
- ManagerType types.String `tfsdk:"manager_type"`
- MigrationJob types.Int64 `tfsdk:"migrationjob"`
- Milestones types.Int64 `tfsdk:"milestones"`
- Name types.String `tfsdk:"name"`
- NeedReboot types.Bool `tfsdk:"need_reboot"`
- NumaAffinity types.String `tfsdk:"numa_affinity"`
- NumaNodeId types.Int64 `tfsdk:"numa_node_id"`
- Pinned types.Bool `tfsdk:"pinned"`
- PreferredCPU types.List `tfsdk:"preferred_cpu"`
- RAM types.Int64 `tfsdk:"ram"`
- ReferenceID types.String `tfsdk:"reference_id"`
- Registered types.Bool `tfsdk:"registered"`
- ResName types.String `tfsdk:"res_name"`
- ReservedNodeCpus types.List `tfsdk:"reserved_node_cpus"`
- RGID types.Int64 `tfsdk:"rg_id"`
- RGName types.String `tfsdk:"rg_name"`
- SnapSets []ItemSnapSetInListDeletedModel `tfsdk:"snap_sets"`
- StatelessSepID types.Int64 `tfsdk:"stateless_sep_id"`
- StatelessSepType types.String `tfsdk:"stateless_sep_type"`
- Status types.String `tfsdk:"status"`
- Tags types.Map `tfsdk:"tags"`
- TechStatus types.String `tfsdk:"tech_status"`
- TotalDiskSize types.Int64 `tfsdk:"total_disks_size"`
- UpdatedBy types.String `tfsdk:"updated_by"`
- UpdatedTime types.Int64 `tfsdk:"updated_time"`
- UserManaged types.Bool `tfsdk:"user_managed"`
- VGPUs types.List `tfsdk:"vgpus"`
- VINSConnected types.Int64 `tfsdk:"vins_connected"`
- VirtualImageID types.Int64 `tfsdk:"virtual_image_id"`
+ ACL []ItemACLInListDeletedModel `tfsdk:"acl"`
+ AccountID types.Int64 `tfsdk:"account_id"`
+ AccountName types.String `tfsdk:"account_name"`
+ AffinityLabel types.String `tfsdk:"affinity_label"`
+ AffinityRules []ItemRuleInListDeletedModel `tfsdk:"affinity_rules"`
+ AffinityWeight types.Int64 `tfsdk:"affinity_weight"`
+ AntiAffinityRules []ItemRuleInListDeletedModel `tfsdk:"anti_affinity_rules"`
+ Architecture types.String `tfsdk:"arch"`
+ AutoStartWithNode types.Bool `tfsdk:"auto_start_w_node"`
+ BootOrder types.List `tfsdk:"boot_order"`
+ BootDiskSize types.Int64 `tfsdk:"bootdisk_size"`
+ CdImageId types.Int64 `tfsdk:"cd_image_id"`
+ Chipset types.String `tfsdk:"chipset"`
+ CloneReference types.Int64 `tfsdk:"clone_reference"`
+ Clones types.List `tfsdk:"clones"`
+ ComputeCIID types.Int64 `tfsdk:"computeci_id"`
+ CPU types.Int64 `tfsdk:"cpus"`
+ CPUPin types.Bool `tfsdk:"cpu_pin"`
+ CreatedBy types.String `tfsdk:"created_by"`
+ CreatedTime types.Int64 `tfsdk:"created_time"`
+ CustomFields types.String `tfsdk:"custom_fields"`
+ DeletedBy types.String `tfsdk:"deleted_by"`
+ DeletedTime types.Int64 `tfsdk:"deleted_time"`
+ Description types.String `tfsdk:"desc"`
+ Devices types.String `tfsdk:"devices"`
+ Disks []DiskInListDeletedModel `tfsdk:"disks"`
+ Driver types.String `tfsdk:"driver"`
+ GID types.Int64 `tfsdk:"gid"`
+ GUID types.Int64 `tfsdk:"guid"`
+ HPBacked types.Bool `tfsdk:"hp_backed"`
+ ComputeId types.Int64 `tfsdk:"compute_id"`
+ ImageID types.Int64 `tfsdk:"image_id"`
+ Interfaces []ItemVNFInterfaceInListDeletedModel `tfsdk:"interfaces"`
+ LockStatus types.String `tfsdk:"lock_status"`
+ ManagerID types.Int64 `tfsdk:"manager_id"`
+ ManagerType types.String `tfsdk:"manager_type"`
+ MigrationJob types.Int64 `tfsdk:"migrationjob"`
+ Milestones types.Int64 `tfsdk:"milestones"`
+ Name types.String `tfsdk:"name"`
+ NeedReboot types.Bool `tfsdk:"need_reboot"`
+ NumaAffinity types.String `tfsdk:"numa_affinity"`
+ NumaNodeId types.Int64 `tfsdk:"numa_node_id"`
+ Pinned types.Bool `tfsdk:"pinned"`
+ PreferredCPU types.List `tfsdk:"preferred_cpu"`
+ RAM types.Int64 `tfsdk:"ram"`
+ ReferenceID types.String `tfsdk:"reference_id"`
+ Registered types.Bool `tfsdk:"registered"`
+ ResName types.String `tfsdk:"res_name"`
+ ReservedNodeCpus types.List `tfsdk:"reserved_node_cpus"`
+ RGID types.Int64 `tfsdk:"rg_id"`
+ RGName types.String `tfsdk:"rg_name"`
+ SnapSets []ItemSnapSetInListDeletedModel `tfsdk:"snap_sets"`
+ StatelessSepID types.Int64 `tfsdk:"stateless_sep_id"`
+ StatelessSepType types.String `tfsdk:"stateless_sep_type"`
+ Status types.String `tfsdk:"status"`
+ Tags types.Map `tfsdk:"tags"`
+ TechStatus types.String `tfsdk:"tech_status"`
+ TotalDiskSize types.Int64 `tfsdk:"total_disks_size"`
+ UpdatedBy types.String `tfsdk:"updated_by"`
+ UpdatedTime types.Int64 `tfsdk:"updated_time"`
+ UserManaged types.Bool `tfsdk:"user_managed"`
+ VGPUs types.List `tfsdk:"vgpus"`
+ VINSConnected types.Int64 `tfsdk:"vins_connected"`
+ VirtualImageID types.Int64 `tfsdk:"virtual_image_id"`
+ LoaderType types.String `tfsdk:"loader_type"`
+ BootType types.String `tfsdk:"boot_type"`
+ HotResize types.Bool `tfsdk:"hot_resize"`
+ NetworkInterfaceNaming types.String `tfsdk:"network_interface_naming"`
}
type ItemACLInListDeletedModel struct {
diff --git a/internal/service/cloudapi/kvmvm/models/model_resource_compute.go b/internal/service/cloudapi/kvmvm/models/model_resource_compute.go
index 04806ba..97f7f92 100644
--- a/internal/service/cloudapi/kvmvm/models/model_resource_compute.go
+++ b/internal/service/cloudapi/kvmvm/models/model_resource_compute.go
@@ -16,47 +16,49 @@ type ResourceComputeModel struct {
RAM types.Int64 `tfsdk:"ram"`
//optional fields
- ImageID types.Int64 `tfsdk:"image_id"`
- WithoutBootDisk types.Bool `tfsdk:"without_boot_disk"`
- BootDiskSize types.Int64 `tfsdk:"boot_disk_size"`
- AffinityLabel types.String `tfsdk:"affinity_label"`
- AffinityRules types.Set `tfsdk:"affinity_rules"`
- AntiAffinityRules types.Set `tfsdk:"anti_affinity_rules"`
- AutoStartWithNode types.Bool `tfsdk:"auto_start_w_node"`
- CustomFields types.String `tfsdk:"custom_fields"`
- Chipset types.String `tfsdk:"chipset"`
- Stateless types.Bool `tfsdk:"stateless"`
- SepId types.Int64 `tfsdk:"sep_id"`
- Pool types.String `tfsdk:"pool"`
- ExtraDisks types.Set `tfsdk:"extra_disks"`
- Network types.Set `tfsdk:"network"`
- Tags types.Set `tfsdk:"tags"`
- PortForwarding types.Set `tfsdk:"port_forwarding"`
- UserAccess types.Set `tfsdk:"user_access"`
- Snapshot types.Set `tfsdk:"snapshot"`
- PCIDevices types.Set `tfsdk:"pci_devices"`
- Rollback types.Object `tfsdk:"rollback"`
- CD types.Object `tfsdk:"cd"`
- PinToStack types.Bool `tfsdk:"pin_to_stack"`
- PreferredCPU types.List `tfsdk:"preferred_cpu"`
- Description types.String `tfsdk:"description"`
- CloudInit types.String `tfsdk:"cloud_init"`
- Enabled types.Bool `tfsdk:"enabled"`
- Pause types.Bool `tfsdk:"pause"`
- Reset types.Bool `tfsdk:"reset"`
- Restore types.Bool `tfsdk:"restore"`
- AutoStart types.Bool `tfsdk:"auto_start"`
- ForceStop types.Bool `tfsdk:"force_stop"`
- ForceResize types.Bool `tfsdk:"force_resize"`
- DataDisks types.String `tfsdk:"data_disks"`
- Started types.Bool `tfsdk:"started"`
- DetachDisks types.Bool `tfsdk:"detach_disks"`
- Permanently types.Bool `tfsdk:"permanently"`
- IS types.String `tfsdk:"is"`
- IpaType types.String `tfsdk:"ipa_type"`
- NumaAffinity types.String `tfsdk:"numa_affinity"`
- CPUPin types.Bool `tfsdk:"cpu_pin"`
- HPBacked types.Bool `tfsdk:"hp_backed"`
+ ImageID types.Int64 `tfsdk:"image_id"`
+ WithoutBootDisk types.Bool `tfsdk:"without_boot_disk"`
+ BootDiskSize types.Int64 `tfsdk:"boot_disk_size"`
+ AffinityLabel types.String `tfsdk:"affinity_label"`
+ AffinityRules types.Set `tfsdk:"affinity_rules"`
+ AntiAffinityRules types.Set `tfsdk:"anti_affinity_rules"`
+ AutoStartWithNode types.Bool `tfsdk:"auto_start_w_node"`
+ CustomFields types.String `tfsdk:"custom_fields"`
+ Chipset types.String `tfsdk:"chipset"`
+ SepId types.Int64 `tfsdk:"sep_id"`
+ Pool types.String `tfsdk:"pool"`
+ ExtraDisks types.Set `tfsdk:"extra_disks"`
+ Network types.Set `tfsdk:"network"`
+ Tags types.Set `tfsdk:"tags"`
+ PortForwarding types.Set `tfsdk:"port_forwarding"`
+ UserAccess types.Set `tfsdk:"user_access"`
+ Snapshot types.Set `tfsdk:"snapshot"`
+ PCIDevices types.Set `tfsdk:"pci_devices"`
+ Rollback types.Object `tfsdk:"rollback"`
+ CDImageID types.Int64 `tfsdk:"cd_image_id"`
+ PinToStack types.Bool `tfsdk:"pin_to_stack"`
+ PreferredCPU types.List `tfsdk:"preferred_cpu"`
+ Description types.String `tfsdk:"description"`
+ CloudInit types.String `tfsdk:"cloud_init"`
+ Enabled types.Bool `tfsdk:"enabled"`
+ Pause types.Bool `tfsdk:"pause"`
+ Reset types.Bool `tfsdk:"reset"`
+ Restore types.Bool `tfsdk:"restore"`
+ ForceStop types.Bool `tfsdk:"force_stop"`
+ ForceResize types.Bool `tfsdk:"force_resize"`
+ Started types.Bool `tfsdk:"started"`
+ DetachDisks types.Bool `tfsdk:"detach_disks"`
+ Permanently types.Bool `tfsdk:"permanently"`
+ IS types.String `tfsdk:"is"`
+ IpaType types.String `tfsdk:"ipa_type"`
+ NumaAffinity types.String `tfsdk:"numa_affinity"`
+ CPUPin types.Bool `tfsdk:"cpu_pin"`
+ HPBacked types.Bool `tfsdk:"hp_backed"`
+ LoaderType types.String `tfsdk:"loader_type"`
+ BootType types.String `tfsdk:"boot_type"`
+ HotResize types.Bool `tfsdk:"hot_resize"`
+ NetworkInterfaceNaming types.String `tfsdk:"network_interface_naming"`
+ SnapshotDeleteAsync types.Bool `tfsdk:"snapshot_delete_async"`
// response fields
ID types.String `tfsdk:"id"`
@@ -68,7 +70,6 @@ type ResourceComputeModel struct {
BootOrder types.List `tfsdk:"boot_order"`
BootDisk types.Object `tfsdk:"boot_disk"`
BootDiskId types.Int64 `tfsdk:"boot_disk_id"`
- CdImageId types.Int64 `tfsdk:"cd_image_id"`
CloneReference types.Int64 `tfsdk:"clone_reference"`
Clones types.List `tfsdk:"clones"`
ComputeCIID types.Int64 `tfsdk:"computeci_id"`
@@ -125,7 +126,6 @@ type RecordResourceACLModel struct {
}
type ItemResourceDiskModel struct {
- CKey types.String `tfsdk:"ckey"`
ACL types.String `tfsdk:"acl"`
AccountID types.Int64 `tfsdk:"account_id"`
BootPartition types.Int64 `tfsdk:"boot_partition"`
@@ -151,7 +151,7 @@ type ItemResourceDiskModel struct {
Passwd types.String `tfsdk:"passwd"`
PCISlot types.Int64 `tfsdk:"pci_slot"`
Pool types.String `tfsdk:"pool"`
- PresentTo types.List `tfsdk:"present_to"`
+ PresentTo types.Map `tfsdk:"present_to"`
PurgeTime types.Int64 `tfsdk:"purge_time"`
ReferenceID types.String `tfsdk:"reference_id"`
RealityDeviceNumber types.Int64 `tfsdk:"reality_device_number"`
@@ -218,6 +218,38 @@ type ItemResourceRulesModel struct {
Value types.String `tfsdk:"value"`
}
+type ItemTagModel struct {
+ Key types.String `tfsdk:"key"`
+ Value types.String `tfsdk:"value"`
+}
+
+type UserAccessModel struct {
+ Username types.String `tfsdk:"username"`
+ AccessType types.String `tfsdk:"access_type"`
+}
+
+type ComputeVGPUModel struct {
+ ID types.Int64 `tfsdk:"id"`
+ GID types.Int64 `tfsdk:"gid"`
+ Type types.String `tfsdk:"type"`
+ Mode types.String `tfsdk:"mode"`
+ Status types.String `tfsdk:"status"`
+ ProfileID types.Int64 `tfsdk:"profile_id"`
+ RAM types.Int64 `tfsdk:"ram"`
+ LastUpdateTime types.Int64 `tfsdk:"last_update_time"`
+ CreatedTime types.Int64 `tfsdk:"created_time"`
+ DeletedTime types.Int64 `tfsdk:"deleted_time"`
+ VMID types.Int64 `tfsdk:"vmid"`
+ PGPUID types.Int64 `tfsdk:"pgpuid"`
+ ReferenceID types.String `tfsdk:"reference_id"`
+ AccountID types.Int64 `tfsdk:"account_id"`
+ RGID types.Int64 `tfsdk:"rg_id"`
+ LastClaimedBy types.Int64 `tfsdk:"last_claimed_by"`
+ PCISlot types.Int64 `tfsdk:"pci_slot"`
+ BusNumber types.Int64 `tfsdk:"bus_number"`
+ GUID types.Int64 `tfsdk:"guid"`
+}
+
var ItemNetwork = map[string]attr.Type{
"net_type": types.StringType,
"net_id": types.Int64Type,
@@ -228,7 +260,6 @@ var ItemNetwork = map[string]attr.Type{
}
var ItemDisk = map[string]attr.Type{
- "ckey": types.StringType,
"acl": types.StringType,
"account_id": types.Int64Type,
"boot_partition": types.Int64Type,
@@ -242,7 +273,7 @@ var ItemDisk = map[string]attr.Type{
"guid": types.Int64Type,
"disk_id": types.Int64Type,
"image_id": types.Int64Type,
- "images": types.ListType{ElemType: types.StringType},
+ "images": types.ListType{ElemType: types.Int64Type},
"iotune": types.ObjectType{AttrTypes: disks.ItemIOTune},
"iqn": types.StringType,
"login": types.StringType,
@@ -254,7 +285,7 @@ var ItemDisk = map[string]attr.Type{
"passwd": types.StringType,
"pci_slot": types.Int64Type,
"pool": types.StringType,
- "present_to": types.ListType{ElemType: types.Int64Type},
+ "present_to": types.MapType{ElemType: types.Int64Type},
"purge_time": types.Int64Type,
"replication": types.ObjectType{AttrTypes: ItemReplication},
"reality_device_number": types.Int64Type,
@@ -361,3 +392,50 @@ var ItemSnapSets = map[string]attr.Type{
"label": types.StringType,
"timestamp": types.Int64Type,
}
+
+var ItemResourceRules = map[string]attr.Type{
+ "key": types.StringType,
+ "mode": types.StringType,
+ "policy": types.StringType,
+ "topology": types.StringType,
+ "value": types.StringType,
+}
+
+var ItemTag = map[string]attr.Type{
+ "key": types.StringType,
+ "value": types.StringType,
+}
+
+var ItemPortForfarding = map[string]attr.Type{
+ "public_port_start": types.Int64Type,
+ "public_port_end": types.Int64Type,
+ "local_port": types.Int64Type,
+ "proto": types.StringType,
+}
+
+var ItemUserAccess = map[string]attr.Type{
+ "username": types.StringType,
+ "access_type": types.StringType,
+}
+
+var ComputeItemVGPU = map[string]attr.Type{
+ "id": types.Int64Type,
+ "gid": types.Int64Type,
+ "type": types.StringType,
+ "mode": types.StringType,
+ "status": types.StringType,
+ "profile_id": types.Int64Type,
+ "ram": types.Int64Type,
+ "last_update_time": types.Int64Type,
+ "created_time": types.Int64Type,
+ "deleted_time": types.Int64Type,
+ "vmid": types.Int64Type,
+ "pgpuid": types.Int64Type,
+ "reference_id": types.StringType,
+ "account_id": types.Int64Type,
+ "rg_id": types.Int64Type,
+ "last_claimed_by": types.Int64Type,
+ "pci_slot": types.Int64Type,
+ "bus_number": types.Int64Type,
+ "guid": types.Int64Type,
+}
diff --git a/internal/service/cloudapi/kvmvm/resource_compute.go b/internal/service/cloudapi/kvmvm/resource_compute.go
index 65c7f15..f1285ea 100644
--- a/internal/service/cloudapi/kvmvm/resource_compute.go
+++ b/internal/service/cloudapi/kvmvm/resource_compute.go
@@ -80,7 +80,7 @@ func (r *resourceCompute) Create(ctx context.Context, req resource.CreateRequest
tflog.Info(ctx, "Create resourceCompute: new simple Compute created", map[string]any{"id": ComputeId, "name": plan.Name.ValueString()})
// attach extra disk(s) to new compute
- if !plan.ExtraDisks.IsNull() {
+ if !plan.ExtraDisks.IsNull() && !plan.ExtraDisks.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourceExtraDiskCreate(ctx, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Create resourceCompute: error when attaching extra disk(s) to a new Compute ")
@@ -112,52 +112,52 @@ func (r *resourceCompute) Create(ctx context.Context, req resource.CreateRequest
}
// add affinity_rules if needed, warnings added to resp.Diagnostics in case of failure.
- if !plan.AffinityRules.IsNull() {
+ if !plan.AffinityRules.IsNull() && !plan.AffinityRules.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourceAffinityRules(ctx, &plan, r.client)...)
}
// add anti_affinity_rules if needed, warnings added to resp.Diagnostics in case of failure.
- if !plan.AntiAffinityRules.IsNull() {
+ if !plan.AntiAffinityRules.IsNull() && !plan.AntiAffinityRules.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourceAntiAffinityRules(ctx, &plan, r.client)...)
}
// add tags if needed, warnings added to resp.Diagnostics in case of failure.
- if !plan.Tags.IsNull() {
+ if !plan.Tags.IsNull() && !plan.Tags.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourceTags(ctx, &plan, r.client)...)
}
// add port_forwarding if needed, warnings added to resp.Diagnostics in case of failure.
- if !plan.PortForwarding.IsNull() {
+ if !plan.PortForwarding.IsNull() && !plan.PortForwarding.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourcePortForwarding(ctx, &plan, r.client)...)
}
// add user_access if needed, warnings added to resp.Diagnostics in case of failure.
- if !plan.UserAccess.IsNull() {
+ if !plan.UserAccess.IsNull() && !plan.UserAccess.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourceUserAccess(ctx, &plan, r.client)...)
}
// add snapshot if needed, warnings added to resp.Diagnostics in case of failure.
- if !plan.Snapshot.IsNull() {
+ if !plan.Snapshot.IsNull() && !plan.Snapshot.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourceSnapshot(ctx, &plan, r.client)...)
}
// add cd if needed, warnings added to resp.Diagnostics in case of failure.
- if !plan.CD.IsNull() {
+ if !plan.CDImageID.IsNull() && !plan.CDImageID.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourceCDInsert(ctx, &plan, r.client)...)
}
// attach PCI devices to compute if needed, warnings added to resp.Diagnostics in case of failure.
- if !plan.PCIDevices.IsNull() {
+ if !plan.PCIDevices.IsNull() && !plan.PCIDevices.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourcePCIDevice(ctx, &plan, r.client)...)
}
// set auto start_w_node if pin_to_stack == false
- if !plan.PinToStack.ValueBool() && plan.AutoStartWithNode.ValueBool() {
+ if !plan.PinToStack.ValueBool() && plan.AutoStartWithNode.ValueBool() && !plan.PinToStack.IsUnknown() && !plan.AutoStartWithNode.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourceAutoStartWithNode(ctx, &plan, r.client)...)
}
// pause if needed, warnings added to resp.Diagnostics in case of failure.
- if !plan.Pause.IsNull() && plan.Pause.ValueBool() {
+ if !plan.Pause.IsNull() && plan.Pause.ValueBool() && !plan.Pause.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourcePause(ctx, &plan, r.client)...)
}
@@ -275,7 +275,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
plan.ID = state.ID
// Enable/disable Compute if needed
- if !plan.Enabled.Equal(state.Enabled) {
+ if !plan.Enabled.IsUnknown() && !plan.Enabled.Equal(state.Enabled) {
resp.Diagnostics.Append(utilities.ComputeResourceEnableDisable(ctx, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error enable/disable Compute")
@@ -284,7 +284,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// Start/stop Compute if needed
- if !plan.Started.Equal(state.Started) {
+ if !plan.Started.IsUnknown() && !plan.Started.Equal(state.Started) {
resp.Diagnostics.Append(utilities.ComputeResourceStartStop(ctx, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error start/stop Compute")
@@ -302,7 +302,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// Resize boot disk size if needed
- if !plan.BootDiskSize.Equal(state.BootDiskSize) {
+ if !plan.BootDiskSize.IsUnknown() && !plan.BootDiskSize.Equal(state.BootDiskSize) {
resp.Diagnostics.Append(utilities.ComputeResourceBootDiskResize(ctx, &state, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error resize boot disk")
@@ -311,7 +311,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// Extra disk(s) update if needed
- if !plan.ExtraDisks.Equal(state.ExtraDisks) {
+ if !plan.ExtraDisks.IsUnknown() && !plan.ExtraDisks.Equal(state.ExtraDisks) {
resp.Diagnostics.Append(utilities.ComputeResourceExtraDiskUpdate(ctx, &state, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update extra disk list")
@@ -320,7 +320,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// PCI device(s) update if needed
- if !plan.PCIDevices.Equal(state.PCIDevices) {
+ if !plan.PCIDevices.IsUnknown() && !plan.PCIDevices.Equal(state.PCIDevices) {
resp.Diagnostics.Append(utilities.ComputeResourcePCIDeviceUpdate(ctx, &state, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update PCI device(s) list")
@@ -329,7 +329,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// pin to stack if needed
- if !plan.PinToStack.Equal(state.PinToStack) {
+ if !plan.PinToStack.IsUnknown() && !plan.PinToStack.Equal(state.PinToStack) {
resp.Diagnostics.Append(utilities.ComputeResourcePinToStackUpdate(ctx, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error pin/unpin to stack compute")
@@ -338,9 +338,14 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// Compute parameters update if needed
- if (!plan.Description.IsUnknown() && !plan.Description.Equal(state.Description)) || !plan.Name.Equal(state.Name) ||
- !plan.NumaAffinity.Equal(state.NumaAffinity) || !plan.CPUPin.Equal(state.CPUPin) || !plan.HPBacked.Equal(state.HPBacked) || (!plan.Chipset.IsUnknown() && !plan.Chipset.Equal(state.Chipset)) ||
- !plan.AutoStartWithNode.Equal(state.AutoStartWithNode) || (!plan.PreferredCPU.IsUnknown() && !plan.PreferredCPU.Equal(state.Description)) {
+ if (!plan.Description.IsUnknown() && !plan.Description.Equal(state.Description)) ||
+ !plan.Name.IsUnknown() && !plan.Name.Equal(state.Name) ||
+ !plan.NumaAffinity.IsUnknown() && !plan.NumaAffinity.Equal(state.NumaAffinity) ||
+ !plan.CPUPin.IsUnknown() && !plan.CPUPin.Equal(state.CPUPin) ||
+ !plan.HPBacked.IsUnknown() && !plan.HPBacked.Equal(state.HPBacked) ||
+ (!plan.Chipset.IsUnknown() && !plan.Chipset.Equal(state.Chipset)) ||
+ !plan.AutoStartWithNode.IsUnknown() && !plan.AutoStartWithNode.Equal(state.AutoStartWithNode) ||
+ (!plan.PreferredCPU.IsUnknown() && !plan.PreferredCPU.Equal(state.Description)) {
resp.Diagnostics.Append(utilities.ComputeResourceComputeUpdate(ctx, &state, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update compute parameters")
@@ -358,7 +363,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// Affinity label update if needed
- if !plan.AffinityLabel.Equal(state.AffinityLabel) && !plan.AffinityLabel.IsUnknown() {
+ if !plan.AffinityLabel.IsUnknown() && !plan.AffinityLabel.Equal(state.AffinityLabel) {
resp.Diagnostics.Append(utilities.ComputeResourceAffinityLabelUpdate(ctx, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update affinity label")
@@ -367,7 +372,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// Affinity rules update if needed
- if !plan.AffinityRules.Equal(state.AffinityRules) {
+ if !plan.AffinityRules.IsUnknown() && !plan.AffinityRules.Equal(state.AffinityRules) {
resp.Diagnostics.Append(utilities.ComputeResourceAffinityRulesUpdate(ctx, &state, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update affinity rules")
@@ -376,7 +381,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// Anti affinity rules update if needed
- if !plan.AntiAffinityRules.Equal(state.AntiAffinityRules) {
+ if !plan.AntiAffinityRules.IsUnknown() && !plan.AntiAffinityRules.Equal(state.AntiAffinityRules) {
resp.Diagnostics.Append(utilities.ComputeResourceAntiAffinityRulesUpdate(ctx, &state, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update anti affinity rules")
@@ -385,7 +390,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// Tags update if needed
- if !plan.Tags.Equal(state.Tags) {
+ if !plan.Tags.IsUnknown() && !plan.Tags.Equal(state.Tags) {
resp.Diagnostics.Append(utilities.ComputeResourceTagsUpdate(ctx, &state, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update tags")
@@ -394,7 +399,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// Port forwarding update if needed
- if !plan.PortForwarding.Equal(state.PortForwarding) {
+ if !plan.PortForwarding.IsUnknown() && !plan.PortForwarding.Equal(state.PortForwarding) {
resp.Diagnostics.Append(utilities.ComputeResourcePortForwardingUpdate(ctx, &state, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update port forwarding rules")
@@ -403,7 +408,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// User access update if needed
- if !plan.UserAccess.Equal(state.UserAccess) {
+ if !plan.UserAccess.IsUnknown() && !plan.UserAccess.Equal(state.UserAccess) {
resp.Diagnostics.Append(utilities.ComputeResourceUserAccessUpdate(ctx, &state, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update user(s) access rules")
@@ -412,7 +417,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// Snapshot update if needed
- if !plan.Snapshot.Equal(state.Snapshot) {
+ if !plan.Snapshot.IsUnknown() && !plan.Snapshot.Equal(state.Snapshot) {
resp.Diagnostics.Append(utilities.ComputeResourceSnapshotUpdate(ctx, &state, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update snapshot(s)")
@@ -421,7 +426,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// Rollback if needed
- if !plan.Rollback.Equal(state.Rollback) && !plan.Rollback.IsNull() {
+ if !plan.Rollback.Equal(state.Rollback) && !plan.Rollback.IsNull() && !plan.Rollback.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourceRollback(ctx, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error rollback compute")
@@ -430,7 +435,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// Cd update if needed
- if !plan.CD.Equal(state.CD) {
+ if !plan.CDImageID.IsUnknown() && !plan.CDImageID.Equal(state.CDImageID) {
resp.Diagnostics.Append(utilities.ComputeResourceCDUpdate(ctx, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update cd image update")
@@ -448,7 +453,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// reset compute if need
- if !plan.Reset.Equal(state.Reset) && plan.Reset.ValueBool() {
+ if !plan.Reset.IsUnknown() && !plan.Reset.Equal(state.Reset) && plan.Reset.ValueBool() {
resp.Diagnostics.Append(utilities.ComputeResourceResetCompute(ctx, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error reset compute")
@@ -457,7 +462,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// redeploy compute if need
- if !plan.ImageID.Equal(state.ImageID) {
+ if !plan.ImageID.IsUnknown() && !plan.ImageID.Equal(state.ImageID) {
resp.Diagnostics.Append(utilities.ComputeResourceRedeploy(ctx, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error redeploy compute")
@@ -466,7 +471,7 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
// custom fields update if needed
- if !plan.CustomFields.Equal(state.CustomFields) && !plan.CustomFields.IsUnknown() {
+ if !plan.CustomFields.IsUnknown() && !plan.CustomFields.Equal(state.CustomFields) {
resp.Diagnostics.Append(utilities.ComputeResourceCustomFieldUpdate(ctx, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update custom fields")
diff --git a/internal/service/cloudapi/kvmvm/schemas/schema_data_source_compute.go b/internal/service/cloudapi/kvmvm/schemas/schema_data_source_compute.go
index 234aa27..21f609f 100644
--- a/internal/service/cloudapi/kvmvm/schemas/schema_data_source_compute.go
+++ b/internal/service/cloudapi/kvmvm/schemas/schema_data_source_compute.go
@@ -170,6 +170,9 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
Computed: true,
ElementType: types.StringType,
},
+ "boot_type": schema.StringAttribute{
+ Computed: true,
+ },
"bootdisk_size": schema.Int64Attribute{
Computed: true,
},
@@ -337,7 +340,7 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
"pool": schema.StringAttribute{
Computed: true,
},
- "present_to": schema.ListAttribute{
+ "present_to": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
@@ -385,6 +388,9 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
"shareable": schema.BoolAttribute{
Computed: true,
},
+ "size_available": schema.Float64Attribute{
+ Computed: true,
+ },
"size_max": schema.Int64Attribute{
Computed: true,
},
@@ -446,6 +452,9 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
"hp_backed": schema.BoolAttribute{
Computed: true,
},
+ "hot_resize": schema.BoolAttribute{
+ Computed: true,
+ },
"image_id": schema.Int64Attribute{
Computed: true,
},
@@ -563,6 +572,9 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
},
},
},
+ "loader_type": schema.StringAttribute{
+ Computed: true,
+ },
"lock_status": schema.StringAttribute{
Computed: true,
},
@@ -581,6 +593,9 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
"name": schema.StringAttribute{
Computed: true,
},
+ "network_interface_naming": schema.StringAttribute{
+ Computed: true,
+ },
"need_reboot": schema.BoolAttribute{
Computed: true,
},
@@ -705,9 +720,69 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
"user_managed": schema.BoolAttribute{
Computed: true,
},
- "vgpus": schema.ListAttribute{
- Computed: true,
- ElementType: types.Int64Type,
+ "vgpus": schema.ListNestedAttribute{
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "id": schema.Int64Attribute{
+ Computed: true,
+ },
+ "gid": schema.Int64Attribute{
+ Computed: true,
+ },
+ "type": schema.StringAttribute{
+ Computed: true,
+ },
+ "mode": schema.StringAttribute{
+ Computed: true,
+ },
+ "status": schema.StringAttribute{
+ Computed: true,
+ },
+ "profile_id": schema.Int64Attribute{
+ Computed: true,
+ },
+ "ram": schema.Int64Attribute{
+ Computed: true,
+ },
+ "last_update_time": schema.Int64Attribute{
+ Computed: true,
+ },
+ "created_time": schema.Int64Attribute{
+ Computed: true,
+ },
+ "deleted_time": schema.Int64Attribute{
+ Computed: true,
+ },
+ "vmid": schema.Int64Attribute{
+ Computed: true,
+ },
+ "pgpuid": schema.Int64Attribute{
+ Computed: true,
+ },
+ "reference_id": schema.StringAttribute{
+ Computed: true,
+ },
+ "account_id": schema.Int64Attribute{
+ Computed: true,
+ },
+ "rg_id": schema.Int64Attribute{
+ Computed: true,
+ },
+ "last_claimed_by": schema.Int64Attribute{
+ Computed: true,
+ },
+ "pci_slot": schema.Int64Attribute{
+ Computed: true,
+ },
+ "bus_number": schema.Int64Attribute{
+ Computed: true,
+ },
+ "guid": schema.Int64Attribute{
+ Computed: true,
+ },
+ },
+ },
},
"virtual_image_id": schema.Int64Attribute{
Computed: true,
diff --git a/internal/service/cloudapi/kvmvm/schemas/schema_data_source_compute_list.go b/internal/service/cloudapi/kvmvm/schemas/schema_data_source_compute_list.go
index d1f7d0b..38c7905 100644
--- a/internal/service/cloudapi/kvmvm/schemas/schema_data_source_compute_list.go
+++ b/internal/service/cloudapi/kvmvm/schemas/schema_data_source_compute_list.go
@@ -176,6 +176,9 @@ func MakeSchemaDataSourceComputeList() map[string]schema.Attribute {
Computed: true,
ElementType: types.StringType,
},
+ "boot_type": schema.StringAttribute{
+ Computed: true,
+ },
"bootdisk_size": schema.Int64Attribute{
Computed: true,
},
@@ -247,6 +250,9 @@ func MakeSchemaDataSourceComputeList() map[string]schema.Attribute {
"hp_backed": schema.BoolAttribute{
Computed: true,
},
+ "hot_resize": schema.BoolAttribute{
+ Computed: true,
+ },
"compute_id": schema.Int64Attribute{
Computed: true,
},
@@ -364,6 +370,9 @@ func MakeSchemaDataSourceComputeList() map[string]schema.Attribute {
"lock_status": schema.StringAttribute{
Computed: true,
},
+ "loader_type": schema.StringAttribute{
+ Computed: true,
+ },
"manager_id": schema.Int64Attribute{
Computed: true,
},
@@ -379,6 +388,9 @@ func MakeSchemaDataSourceComputeList() map[string]schema.Attribute {
"name": schema.StringAttribute{
Computed: true,
},
+ "network_interface_naming": schema.StringAttribute{
+ Computed: true,
+ },
"need_reboot": schema.BoolAttribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/kvmvm/schemas/schema_data_source_compute_list_deleted.go b/internal/service/cloudapi/kvmvm/schemas/schema_data_source_compute_list_deleted.go
index 1f2807c..f1c55c2 100644
--- a/internal/service/cloudapi/kvmvm/schemas/schema_data_source_compute_list_deleted.go
+++ b/internal/service/cloudapi/kvmvm/schemas/schema_data_source_compute_list_deleted.go
@@ -168,6 +168,9 @@ func MakeSchemaDataSourceComputeListDeleted() map[string]schema.Attribute {
Computed: true,
ElementType: types.StringType,
},
+ "boot_type": schema.StringAttribute{
+ Computed: true,
+ },
"bootdisk_size": schema.Int64Attribute{
Computed: true,
},
@@ -239,6 +242,9 @@ func MakeSchemaDataSourceComputeListDeleted() map[string]schema.Attribute {
"hp_backed": schema.BoolAttribute{
Computed: true,
},
+ "hot_resize": schema.BoolAttribute{
+ Computed: true,
+ },
"compute_id": schema.Int64Attribute{
Computed: true,
},
@@ -356,6 +362,9 @@ func MakeSchemaDataSourceComputeListDeleted() map[string]schema.Attribute {
"lock_status": schema.StringAttribute{
Computed: true,
},
+ "loader_type": schema.StringAttribute{
+ Computed: true,
+ },
"manager_id": schema.Int64Attribute{
Computed: true,
},
@@ -371,6 +380,9 @@ func MakeSchemaDataSourceComputeListDeleted() map[string]schema.Attribute {
"name": schema.StringAttribute{
Computed: true,
},
+ "network_interface_naming": schema.StringAttribute{
+ Computed: true,
+ },
"need_reboot": schema.BoolAttribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/kvmvm/schemas/schema_resource_compute.go b/internal/service/cloudapi/kvmvm/schemas/schema_resource_compute.go
index 299d4c2..5973187 100644
--- a/internal/service/cloudapi/kvmvm/schemas/schema_resource_compute.go
+++ b/internal/service/cloudapi/kvmvm/schemas/schema_resource_compute.go
@@ -2,7 +2,6 @@ package schemas
import (
"github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
- "github.com/hashicorp/terraform-plugin-framework-validators/setvalidator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
@@ -53,6 +52,7 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
// optional attributes
"image_id": schema.Int64Attribute{
Optional: true,
+ Computed: true,
Description: "ID of the OS image to base this compute instance on.",
},
"without_boot_disk": schema.BoolAttribute{ //default false
@@ -71,6 +71,7 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
},
"affinity_rules": schema.SetNestedAttribute{
Optional: true,
+ Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"topology": schema.StringAttribute{
@@ -107,6 +108,7 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
},
"anti_affinity_rules": schema.SetNestedAttribute{
Optional: true,
+ Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"topology": schema.StringAttribute{
@@ -146,10 +148,6 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
Computed: true,
Description: "custom fields for Compute. Must be dict",
},
- "stateless": schema.BoolAttribute{ //default false
- Optional: true,
- Description: "Compute will be stateless (SVA_KVM_X86) if set to True",
- },
"sep_id": schema.Int64Attribute{
Optional: true,
Computed: true,
@@ -163,18 +161,12 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
"extra_disks": schema.SetAttribute{
Optional: true,
//Computed: true,
- Validators: []validator.Set{
- setvalidator.SizeAtMost(constants.MaxExtraDisksPerCompute),
- },
ElementType: types.Int64Type,
Description: "Optional list of IDs of extra disks to attach to this compute. You may specify several extra disks.",
},
"network": schema.SetNestedAttribute{
- Optional: true,
- Computed: true,
- Validators: []validator.Set{
- setvalidator.SizeBetween(1, constants.MaxNetworksPerCompute),
- },
+ Optional: true,
+ Computed: true,
Description: "Optional network connection(s) for this compute. You may specify several network blocks, one for each connection.",
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
@@ -195,6 +187,7 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
Description: "Optional IP address to assign to this connection. This IP should belong to the selected network and free for use.",
},
"mac": schema.StringAttribute{
+ Optional: true,
Computed: true,
Description: "MAC address associated with this connection. MAC address is assigned automatically.",
},
@@ -216,6 +209,7 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
},
"tags": schema.SetNestedAttribute{
Optional: true,
+ Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"key": schema.StringAttribute{
@@ -229,6 +223,7 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
},
"port_forwarding": schema.SetNestedAttribute{
Optional: true,
+ Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"public_port_start": schema.Int64Attribute{
@@ -252,6 +247,7 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
},
"user_access": schema.SetNestedAttribute{
Optional: true,
+ Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"username": schema.StringAttribute{
@@ -281,13 +277,9 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
},
},
},
- "cd": schema.SingleNestedAttribute{
+ "cd_image_id": schema.Int64Attribute{
Optional: true,
- Attributes: map[string]schema.Attribute{
- "cdrom_id": schema.Int64Attribute{
- Required: true,
- },
- },
+ Computed: true,
},
"pin_to_stack": schema.BoolAttribute{
Optional: true,
@@ -311,6 +303,7 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
},
"pause": schema.BoolAttribute{
Optional: true,
+ Computed: true,
//Default: false,
},
"reset": schema.BoolAttribute{
@@ -323,11 +316,6 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
Default: booldefault.StaticBool(true),
//Default: true,
},
- "auto_start": schema.BoolAttribute{
- Optional: true,
- //Default: false,
- Description: "Flag for redeploy compute",
- },
"force_stop": schema.BoolAttribute{
Optional: true,
//Default: false,
@@ -338,14 +326,6 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
//Default: false,
Description: "Flag for resize compute",
},
- "data_disks": schema.StringAttribute{
- Optional: true,
- Validators: []validator.String{
- stringvalidator.OneOf("KEEP", "DETACH", "DESTROY"),
- },
- //Default: "DETACH",
- Description: "Flag for redeploy compute",
- },
"started": schema.BoolAttribute{
Optional: true,
Computed: true,
@@ -372,6 +352,7 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
},
"numa_affinity": schema.StringAttribute{
Optional: true,
+ Computed: true,
Validators: []validator.String{
stringvalidator.OneOf("none", "strict", "loose"),
},
@@ -398,6 +379,7 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
},
"pci_devices": schema.SetAttribute{
Optional: true,
+ Computed: true,
ElementType: types.Int64Type,
Description: "ID of the connected pci devices",
},
@@ -415,6 +397,42 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
Description: "Flag for start compute after node exits from MAINTENANCE state",
Default: booldefault.StaticBool(false),
},
+ "snapshot_delete_async": schema.BoolAttribute{
+ Optional: true,
+ Computed: true,
+ Description: "Flag for deleting snapshots asynchronously",
+ Default: booldefault.StaticBool(false),
+ },
+ "loader_type": schema.StringAttribute{
+ Optional: true,
+ Computed: true,
+ Description: "Type of VM",
+ Validators: []validator.String{
+ stringvalidator.OneOfCaseInsensitive("unknown", "linux", "windows"),
+ },
+ },
+
+ "boot_type": schema.StringAttribute{
+ Optional: true,
+ Computed: true,
+ Description: "Type of image upload",
+ Validators: []validator.String{
+ stringvalidator.OneOfCaseInsensitive("bios", "uefi"),
+ },
+ },
+ "hot_resize": schema.BoolAttribute{
+ Optional: true,
+ Computed: true,
+ Description: "Changing the size of a VM",
+ },
+ "network_interface_naming": schema.StringAttribute{
+ Optional: true,
+ Computed: true,
+ Description: "Name of the network interface",
+ Validators: []validator.String{
+ stringvalidator.OneOfCaseInsensitive("eth", "ens"),
+ },
+ },
// computed attributes
"compute_id": schema.Int64Attribute{
@@ -531,9 +549,6 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
"boot_disk_id": schema.Int64Attribute{
Computed: true,
},
- "cd_image_id": schema.Int64Attribute{
- Computed: true,
- },
"clone_reference": schema.Int64Attribute{
Computed: true,
},
@@ -804,9 +819,69 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
"user_managed": schema.BoolAttribute{
Computed: true,
},
- "vgpus": schema.ListAttribute{
- Computed: true,
- ElementType: types.Int64Type,
+ "vgpus": schema.ListNestedAttribute{
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "id": schema.Int64Attribute{
+ Computed: true,
+ },
+ "gid": schema.Int64Attribute{
+ Computed: true,
+ },
+ "type": schema.StringAttribute{
+ Computed: true,
+ },
+ "mode": schema.StringAttribute{
+ Computed: true,
+ },
+ "status": schema.StringAttribute{
+ Computed: true,
+ },
+ "profile_id": schema.Int64Attribute{
+ Computed: true,
+ },
+ "ram": schema.Int64Attribute{
+ Computed: true,
+ },
+ "last_update_time": schema.Int64Attribute{
+ Computed: true,
+ },
+ "created_time": schema.Int64Attribute{
+ Computed: true,
+ },
+ "deleted_time": schema.Int64Attribute{
+ Computed: true,
+ },
+ "vmid": schema.Int64Attribute{
+ Computed: true,
+ },
+ "pgpuid": schema.Int64Attribute{
+ Computed: true,
+ },
+ "reference_id": schema.StringAttribute{
+ Computed: true,
+ },
+ "account_id": schema.Int64Attribute{
+ Computed: true,
+ },
+ "rg_id": schema.Int64Attribute{
+ Computed: true,
+ },
+ "last_claimed_by": schema.Int64Attribute{
+ Computed: true,
+ },
+ "pci_slot": schema.Int64Attribute{
+ Computed: true,
+ },
+ "bus_number": schema.Int64Attribute{
+ Computed: true,
+ },
+ "guid": schema.Int64Attribute{
+ Computed: true,
+ },
+ },
+ },
},
"virtual_image_id": schema.Int64Attribute{
Computed: true,
@@ -822,9 +897,6 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
func MakeSchemaResourceComputeDisks() map[string]schema.Attribute {
return map[string]schema.Attribute{
- "ckey": schema.StringAttribute{
- Computed: true,
- },
"acl": schema.StringAttribute{
Computed: true,
},
@@ -866,7 +938,7 @@ func MakeSchemaResourceComputeDisks() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
@@ -942,7 +1014,7 @@ func MakeSchemaResourceComputeDisks() map[string]schema.Attribute {
"pool": schema.StringAttribute{
Computed: true,
},
- "present_to": schema.ListAttribute{
+ "present_to": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
diff --git a/internal/service/cloudapi/kvmvm/utilities/utility_resource_compute_create.go b/internal/service/cloudapi/kvmvm/utilities/utility_resource_compute_create.go
index 06ebcb1..dcdb61a 100644
--- a/internal/service/cloudapi/kvmvm/utilities/utility_resource_compute_create.go
+++ b/internal/service/cloudapi/kvmvm/utilities/utility_resource_compute_create.go
@@ -37,6 +37,60 @@ func ComputeResourceCheckPresence(ctx context.Context, plan *models.ResourceComp
return computeItem, nil
}
+func ResourceComputePCIDevicesListCheckPresence(ctx context.Context, id uint64, c *client.Client) (*compute.ListPCIDevices, error) {
+ tflog.Info(ctx, "Get PCI devices info")
+
+ req := compute.ListPCIDeviceRequest{
+ ComputeID: id,
+ }
+
+ tflog.Info(ctx, "Check req", map[string]any{"req": req})
+
+ pciDevicesList, err := c.CloudAPI().Compute().ListPCIDevice(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+
+ tflog.Info(ctx, "Getting PCI devices info, successfully")
+ return pciDevicesList, nil
+}
+
+func ComputeResourceUserAccessGet(ctx context.Context, computeID uint64, c *client.Client) (*compute.ListUsers, error) {
+ tflog.Info(ctx, "Get compute user access info")
+
+ req := compute.UserListRequest{
+ ComputeID: computeID,
+ }
+
+ tflog.Info(ctx, "Check req", map[string]any{"req": req})
+
+ userList, err := c.CloudAPI().Compute().UserList(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+
+ tflog.Info(ctx, "Getting compute user access info, successfully")
+ return userList, nil
+}
+
+func ComputeResourcePFWListGet(ctx context.Context, computeID uint64, c *client.Client) (*compute.ListPFWs, error) {
+ tflog.Info(ctx, "Get compute pfw list info")
+
+ req := compute.PFWListRequest{
+ ComputeID: computeID,
+ }
+
+ tflog.Info(ctx, "Check req", map[string]any{"req": req})
+
+ pfwList, err := c.CloudAPI().Compute().PFWList(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+
+ tflog.Info(ctx, "Getting compute pfw list info, successfully")
+ return pfwList, nil
+}
+
func ComputeResourceCheckDetachDisks(state *models.ResourceComputeModel, recordCompute *compute.RecordCompute) bool {
bootDiskId := uint64(state.BootDiskId.ValueInt64())
extraDiskList := state.ExtraDisks.Elements()
@@ -140,6 +194,10 @@ func CreateResourceCompute(ctx context.Context, plan *models.ResourceComputeMode
if ipSet {
reqInterface.IPAddr = ipaddr.(types.String).ValueString()
}
+ macaddr, macSet := elemMap["mac"]
+ if macSet {
+ reqInterface.MAC = macaddr.(types.String).ValueString()
+ }
interfaces = append(interfaces, reqInterface)
}
@@ -206,6 +264,37 @@ func CreateResourceCompute(ctx context.Context, plan *models.ResourceComputeMode
diags.AddError("CreateResourceCompute: unable to create KVM VP x86", err.Error())
return 0, diags
}
+
+ updateReq := compute.UpdateRequest{}
+
+ if !plan.LoaderType.IsNull() {
+ updateReq.LoaderType = plan.LoaderType.ValueString()
+ }
+
+ if !plan.BootType.IsNull() {
+ updateReq.BootType = plan.BootType.ValueString()
+ }
+
+ if !plan.HotResize.IsNull() {
+ updateReq.HotResize = plan.HotResize.ValueBool()
+ }
+
+ if !plan.NetworkInterfaceNaming.IsNull() {
+ updateReq.NetworkInterfaceNaming = plan.NetworkInterfaceNaming.ValueString()
+ }
+
+ if !plan.LoaderType.IsNull() ||
+ !plan.BootType.IsNull() ||
+ !plan.HotResize.IsNull() ||
+ !plan.NetworkInterfaceNaming.IsNull() {
+ updateReq.ComputeID = id
+ tflog.Info(ctx, "CreateResourceCompute: creating Compute with LoaderType or BootType or HotResize or NetworkInterfaceNaming")
+ _, err = c.CloudAPI().Compute().Update(ctx, updateReq)
+ if err != nil {
+ diags.AddWarning("CreateResourceCompute: unable to update LoaderType or BootType or HotResize or NetworkInterfaceNaming", err.Error())
+ }
+ }
+
return id, diags
}
@@ -520,8 +609,8 @@ func ComputeResourcePortForwarding(ctx context.Context, plan *models.ResourceCom
PublicPortStart: uint64(itemPortForwarding.PublicPortStart.ValueInt64()),
Proto: strings.ToLower(itemPortForwarding.Proto.ValueString()),
}
- if itemPortForwarding.PublicPortStart.ValueInt64() != 0 {
- req.PublicPortStart = uint64(itemPortForwarding.PublicPortStart.ValueInt64())
+ if itemPortForwarding.PublicPortEnd.ValueInt64() != 0 {
+ req.PublicPortEnd = itemPortForwarding.PublicPortEnd.ValueInt64()
}
if itemPortForwarding.LocalPort.ValueInt64() != 0 {
req.LocalBasePort = uint64(itemPortForwarding.LocalPort.ValueInt64())
@@ -659,7 +748,7 @@ func ComputeResourceCDInsert(ctx context.Context, plan *models.ResourceComputeMo
}
req := compute.CDInsertRequest{ComputeID: computeId}
- req.CDROMID = uint64(plan.CD.Attributes()["cdrom_id"].(types.Int64).ValueInt64())
+ req.CDROMID = uint64(plan.CDImageID.ValueInt64())
tflog.Info(ctx, "ComputeResourceCDInsert: before calling CloudAPI().Compute().CDInsert", map[string]any{"compute_id": computeId, "req": req})
res, err := c.CloudAPI().Compute().CDInsert(ctx, req)
tflog.Info(ctx, "ComputeResourceCDInsert: response from CloudAPI().Compute().CDInsert", map[string]any{"compute_id": computeId, "response": res})
diff --git a/internal/service/cloudapi/kvmvm/utilities/utility_resource_compute_difference.go b/internal/service/cloudapi/kvmvm/utilities/utility_resource_compute_difference.go
index 48d3c4e..dda7f50 100644
--- a/internal/service/cloudapi/kvmvm/utilities/utility_resource_compute_difference.go
+++ b/internal/service/cloudapi/kvmvm/utilities/utility_resource_compute_difference.go
@@ -33,12 +33,13 @@ func differenceSimpleType(oldSet, newSet types.Set) (added, removed []any) {
return
}
-func differenceNetwork(oldSet, newSet types.Set) (added, changeIp, removed []map[string]attr.Value) {
+func differenceNetwork(oldSet, newSet types.Set) (added, changeIp, changeMac, removed []map[string]attr.Value) {
oldSlice := oldSet.Elements()
newSlice := newSet.Elements()
added = make([]map[string]attr.Value, 0)
changeIp = make([]map[string]attr.Value, 0)
+ changeMac = make([]map[string]attr.Value, 0)
removed = make([]map[string]attr.Value, 0)
for _, oldNetwork := range oldSlice {
@@ -47,15 +48,19 @@ func differenceNetwork(oldSet, newSet types.Set) (added, changeIp, removed []map
for _, newNetwork := range newSlice {
newMap := newNetwork.(types.Object).Attributes()
if newMap["net_type"] == oldMap["net_type"] && newMap["net_id"] == oldMap["net_id"] && newMap["weight"] == oldMap["weight"] && (newMap["mtu"] == oldMap["mtu"] || newMap["mtu"].(types.Int64).ValueInt64() == 0) {
- if (newMap["net_type"].(types.String).ValueString() == "EXTNET" || newMap["net_type"].(types.String).ValueString() == "VINS") && (newMap["ip_address"] != oldMap["ip_address"] && newMap["ip_address"].(types.String).ValueString() != "") {
+ found = true
+ switch {
+ case (newMap["net_type"].(types.String).ValueString() == "EXTNET" || newMap["net_type"].(types.String).ValueString() == "VINS") && (newMap["ip_address"] != oldMap["ip_address"] && newMap["ip_address"].(types.String).ValueString() != ""):
changeIp = append(changeIp, newMap)
- found = true
- break
- } else if newMap["ip_address"] == oldMap["ip_address"] || newMap["ip_address"].(types.String).ValueString() != "" {
- found = true
- break
+ fallthrough
+ case newMap["mac"] != oldMap["mac"] && newMap["mac"].(types.String).ValueString() != "":
+ newMap["old_mac"] = oldMap["mac"]
+ changeMac = append(changeMac, newMap)
}
}
+ if found {
+ break
+ }
}
if found {
continue
@@ -69,10 +74,8 @@ func differenceNetwork(oldSet, newSet types.Set) (added, changeIp, removed []map
for _, oldNetwork := range oldSlice {
oldMap := oldNetwork.(types.Object).Attributes()
if newMap["net_type"] == oldMap["net_type"] && newMap["net_id"] == oldMap["net_id"] && newMap["weight"] == oldMap["weight"] && (newMap["mtu"] == oldMap["mtu"] || newMap["mtu"].(types.Int64).ValueInt64() == 0) {
- if newMap["ip_address"] == oldMap["ip_address"] || newMap["ip_address"].(types.String).ValueString() != "" || ((newMap["net_type"].(types.String).ValueString() == "EXTNET" || newMap["net_type"].(types.String).ValueString() == "VINS") && newMap["ip_address"] != oldMap["ip_address"]) {
- found = true
- break
- }
+ found = true
+ break
}
}
if found {
diff --git a/internal/service/cloudapi/kvmvm/utilities/utility_resource_compute_update.go b/internal/service/cloudapi/kvmvm/utilities/utility_resource_compute_update.go
index 25b66c0..6ef4c21 100644
--- a/internal/service/cloudapi/kvmvm/utilities/utility_resource_compute_update.go
+++ b/internal/service/cloudapi/kvmvm/utilities/utility_resource_compute_update.go
@@ -93,7 +93,7 @@ func ComputeResourceBootDiskResize(ctx context.Context, state *models.ResourceCo
}
if state.BootDiskSize.ValueInt64() > plan.BootDiskSize.ValueInt64() {
- diags.AddError(fmt.Sprintf("ComputeResourceBootDiskResize: compute ID %d - shrinking boot disk is not allowed", computeId), "")
+ diags.AddError(fmt.Sprintf("ComputeResourceBootDiskResize: compute ID %d - shrinking boot disk is not allowed, state: %d, plan: %d", computeId, state.BootDiskSize.ValueInt64(), plan.BootDiskSize.ValueInt64()), "")
return diags
}
@@ -159,17 +159,6 @@ func ComputeResourceExtraDiskUpdate(ctx context.Context, state *models.ResourceC
return diags
}
- if len(detachSet) > 0 {
- tflog.Info(ctx, "ComputeResourceExtraDiskUpdate: stop compute", map[string]any{"compute_id": computeId})
- _, err = c.CloudAPI().Compute().Stop(ctx, compute.StopRequest{ComputeID: computeId})
- if err != nil {
- diags.AddError(
- "ComputeResourceExtraDiskUpdate: cannot stop compute", err.Error(),
- )
- return diags
- }
- }
-
for _, disk := range detachSet {
diskId := uint64(disk.(types.Int64).ValueInt64())
tflog.Info(ctx, fmt.Sprintf("ComputeResourceExtraDiskUpdate: Start detach extra disk with ID - %d from compute with ID - %d", diskId, computeId))
@@ -184,10 +173,6 @@ func ComputeResourceExtraDiskUpdate(ctx context.Context, state *models.ResourceC
}
}
- if len(detachSet) > 0 && plan.Started.ValueBool() {
- diags = ComputeResourceStartStop(ctx, plan, c)
- }
-
if diags.HasError() {
tflog.Error(ctx, "ComputeResourceExtraDiskUpdate: Errors occurred while managing disks")
return diags
@@ -207,7 +192,7 @@ func ComputeResourcePCIDeviceUpdate(ctx context.Context, state *models.ResourceC
return diags
}
- attachSet, detachSet := differenceSimpleType(state.ExtraDisks, plan.ExtraDisks)
+ attachSet, detachSet := differenceSimpleType(state.PCIDevices, plan.PCIDevices)
for _, pciDevice := range detachSet {
pciDeviceId := pciDevice.(types.Int64).ValueInt64()
@@ -256,7 +241,7 @@ func ComputeResourceNetworkUpdate(ctx context.Context, state *models.ResourceCom
return diags
}
- attachMap, changeIpMap, detachMap := differenceNetwork(state.Network, plan.Network)
+ attachMap, changeIpMap, changeMacMap, detachMap := differenceNetwork(state.Network, plan.Network)
tflog.Info(ctx, "ComputeResourceNetworkUpdate: start detach network(s) rules to compute with ID", map[string]any{"compute_id": plan.ID.ValueString()})
for _, network := range detachMap {
@@ -302,7 +287,7 @@ func ComputeResourceNetworkUpdate(ctx context.Context, state *models.ResourceCom
needStart := false
// need stop to attach first network
- if len(detachMap) == len(state.Network.Elements()) || (len(state.Network.Elements()) < 1) && len(attachMap) > 0 {
+ if len(detachMap) == len(state.Network.Elements()) || (len(state.Network.Elements()) < 1) && len(attachMap) > 0 || hasDPDKnetwork(attachMap) || len(changeMacMap) > 0 {
tflog.Info(ctx, "ComputeResourceNetworkUpdate: stop compute", map[string]any{"compute_id": computeId})
_, err = c.CloudAPI().Compute().Stop(ctx, compute.StopRequest{ComputeID: computeId})
if err != nil {
@@ -316,6 +301,27 @@ func ComputeResourceNetworkUpdate(ctx context.Context, state *models.ResourceCom
}
}
+ tflog.Info(ctx, "ComputeResourceNetworkUpdate: start change MAC address network(s) to compute with ID", map[string]any{"compute_id": plan.ID.ValueString()})
+
+ for _, network := range changeMacMap {
+ req := compute.ChangeMACRequest{
+ ComputeID: computeId,
+ NewMAC: network["mac"].(types.String).ValueString(),
+ СurrentMAC: network["old_mac"].(types.String).ValueString(),
+ }
+ tflog.Info(ctx, "ComputeResourceNetworkUpdate: before calling CloudAPI().Compute().ChangeMAC", map[string]any{"compute_id": computeId, "req": req})
+ res, err := c.CloudAPI().Compute().ChangeMAC(ctx, req)
+ tflog.Info(ctx, "ComputeResourceNetworkUpdate: response from CloudAPI().Compute().ChangeMAC", map[string]any{"compute_id": plan.ID.ValueString(), "response": res})
+ if err != nil {
+ diags.AddError(fmt.Sprintf("ComputeResourceNetworkUpdate: failed to change Mac to net ID %d from Compute ID %d",
+ network["net_id"].(types.Int64).ValueInt64(), computeId), err.Error())
+ }
+ }
+
+ if diags.HasError() {
+ return diags
+ }
+
sort.Slice(attachMap, func(i, j int) bool {
weightI := attachMap[i]["weight"].(types.Int64).ValueInt64()
weightJ := attachMap[j]["weight"].(types.Int64).ValueInt64()
@@ -341,6 +347,10 @@ func ComputeResourceNetworkUpdate(ctx context.Context, state *models.ResourceCom
if ipSet {
req.IPAddr = ipaddr.(types.String).ValueString()
}
+ macaddr, macSet := network["mac"]
+ if macSet {
+ req.MACAddr = macaddr.(types.String).ValueString()
+ }
tflog.Info(ctx, "ComputeResourceNetworkUpdate: before calling CloudAPI().Compute().NetAttach", map[string]any{"compute_id": computeId, "req": req})
res, err := c.CloudAPI().Compute().NetAttach(ctx, req)
tflog.Info(ctx, "ComputeResourceNetworkUpdate: response from CloudAPI().Compute().NetAttach", map[string]any{"compute_id": plan.ID.ValueString(), "response": res})
@@ -367,6 +377,15 @@ func ComputeResourceNetworkUpdate(ctx context.Context, state *models.ResourceCom
return nil
}
+func hasDPDKnetwork(networkAttachMap []map[string]attr.Value) bool {
+ for _, elem := range networkAttachMap {
+ if elem["net_type"].(types.String).ValueString() == "DPDK" {
+ return true
+ }
+ }
+ return false
+}
+
func ComputeResourceComputeUpdate(ctx context.Context, state *models.ResourceComputeModel, plan *models.ResourceComputeModel, c *client.Client) diag.Diagnostics {
tflog.Info(ctx, "ComputeResourceComputeUpdate: start update compute parameters", map[string]any{"compute_id": plan.ID.ValueString()})
diags := diag.Diagnostics{}
@@ -389,13 +408,29 @@ func ComputeResourceComputeUpdate(ctx context.Context, state *models.ResourceCom
req.Description = plan.Description.ValueString()
}
- if !plan.NumaAffinity.Equal(state.NumaAffinity) {
+ if !plan.NumaAffinity.Equal(state.NumaAffinity) && !plan.NumaAffinity.IsUnknown() {
req.NumaAffinity = plan.NumaAffinity.ValueString()
}
- req.CPUPin = plan.CPUPin.ValueBool()
- req.HPBacked = plan.HPBacked.ValueBool()
- req.AutoStart = plan.AutoStartWithNode.ValueBool()
+ if !plan.CPUPin.Equal(state.CPUPin) && !plan.CPUPin.IsUnknown() {
+ req.CPUPin = plan.CPUPin.ValueBool()
+ }
+ if !plan.HPBacked.Equal(state.HPBacked) && !plan.HPBacked.IsUnknown() {
+ req.HPBacked = plan.HPBacked.ValueBool()
+ }
+ if !plan.LoaderType.Equal(state.LoaderType) && !plan.LoaderType.IsUnknown() {
+ req.LoaderType = plan.LoaderType.ValueString()
+ }
+
+ if !plan.BootType.Equal(state.BootType) && !plan.BootType.IsUnknown() {
+ req.BootType = plan.BootType.ValueString()
+ }
+ if !plan.HotResize.Equal(state.HotResize) && !plan.HotResize.IsUnknown() {
+ req.HotResize = plan.HotResize.ValueBool()
+ }
+ if !plan.NetworkInterfaceNaming.Equal(state.NetworkInterfaceNaming) && !plan.NetworkInterfaceNaming.IsUnknown() {
+ req.NetworkInterfaceNaming = plan.NetworkInterfaceNaming.ValueString()
+ }
if !plan.Chipset.IsUnknown() && !plan.Chipset.Equal(state.Chipset) {
req.Chipset = plan.Chipset.ValueString()
@@ -413,6 +448,10 @@ func ComputeResourceComputeUpdate(ctx context.Context, state *models.ResourceCom
req.PreferredCPU = []int64{-1}
}
+ if !plan.LoaderType.IsUnknown() && !plan.LoaderType.Equal(state.Description) {
+ req.Description = plan.Description.ValueString()
+ }
+
// Note bene: numa_affinity, cpu_pin and hp_backed are not allowed to be changed for compute in STARTED tech status.
// If STARTED, we need to stop it before update
@@ -917,19 +956,35 @@ func ComputeResourceSnapshotUpdate(ctx context.Context, state *models.ResourceCo
addedLabel, deleteLabel := differenceSnapshot(state.Snapshot, plan.Snapshot)
for _, label := range deleteLabel {
- req := compute.SnapshotDeleteRequest{ComputeID: computeId}
objTag := label.(types.Object)
tagMap := objTag.Attributes()
- req.Label = tagMap["label"].(types.String).ValueString()
- tflog.Info(ctx, "ComputeResourceSnapshotUpdate: before calling CloudAPI().Compute().SnapshotDelete", map[string]any{"compute_id": computeId, "req": req})
- res, err := c.CloudAPI().Compute().SnapshotDelete(ctx, req)
- tflog.Info(ctx, "ComputeResourceSnapshotUpdate: response from CloudAPI().Compute().SnapshotDelete", map[string]any{"compute_id": computeId, "response": res})
- if err != nil {
- diags.AddError(
- "ComputeResourceSnapshotUpdate: Unable to delete snapshot for Compute",
- err.Error(),
- )
+ reqLabel := tagMap["label"].(types.String).ValueString()
+ req := compute.SnapshotDeleteRequest{ComputeID: computeId, Label: reqLabel}
+ if (state.SnapshotDeleteAsync).ValueBool() {
+ tflog.Info(ctx, "ComputeResourceSnapshotUpdate: before calling CloudAPI().Compute().SnapshotDeleteAsync", map[string]any{"compute_id": computeId, "req": req})
+ res, err := c.CloudAPI().Compute().SnapshotDeleteAsync(ctx, req)
+ req.Label = reqLabel
+ tflog.Info(ctx, "ComputeResourceSnapshotUpdate: response from CloudAPI().Compute().SnapshotDeleteAsync", map[string]any{"compute_id": computeId, "response": res})
+ if err != nil {
+ diags.AddError(
+ "ComputeResourceSnapshotUpdate: Unable to async delete snapshot for Compute",
+ err.Error(),
+ )
+ }
+ } else {
+
+ tflog.Info(ctx, "ComputeResourceSnapshotUpdate: before calling CloudAPI().Compute().SnapshotDelete", map[string]any{"compute_id": computeId, "req": req})
+ res, err := c.CloudAPI().Compute().SnapshotDelete(ctx, req)
+ req.Label = reqLabel
+ tflog.Info(ctx, "ComputeResourceSnapshotUpdate: response from CloudAPI().Compute().SnapshotDelete", map[string]any{"compute_id": computeId, "response": res})
+ if err != nil {
+ diags.AddError(
+ "ComputeResourceSnapshotUpdate: Unable to delete snapshot for Compute",
+ err.Error(),
+ )
+ }
}
+
}
if diags.HasError() {
@@ -1023,7 +1078,7 @@ func ComputeResourceCDUpdate(ctx context.Context, plan *models.ResourceComputeMo
return diags
}
- if plan.CD.IsNull() {
+ if plan.CDImageID.IsNull() {
tflog.Info(ctx, "ComputeResourceCDUpdate: before calling CloudAPI().Compute().CDEject", map[string]any{"compute_id": computeId})
res, err := c.CloudAPI().Compute().CDEject(ctx, compute.CDEjectRequest{ComputeID: computeId})
tflog.Info(ctx, "ComputeResourceCDUpdate: response from CloudAPI().Compute().CDEject", map[string]any{"compute_id": computeId, "response": res})
@@ -1036,7 +1091,7 @@ func ComputeResourceCDUpdate(ctx context.Context, plan *models.ResourceComputeMo
}
} else {
req := compute.CDInsertRequest{ComputeID: computeId}
- req.CDROMID = uint64(plan.CD.Attributes()["cdrom_id"].(types.Int64).ValueInt64())
+ req.CDROMID = uint64(plan.CDImageID.ValueInt64())
tflog.Info(ctx, "ComputeResourceCDUpdate: before calling CloudAPI().Compute().CDInsert", map[string]any{"compute_id": computeId, "req": req})
res, err := c.CloudAPI().Compute().CDInsert(ctx, req)
tflog.Info(ctx, "ComputeResourceCDUpdate: response from CloudAPI().Compute().CDInsert", map[string]any{"compute_id": computeId, "response": res})
@@ -1188,17 +1243,14 @@ func ComputeResourceRedeploy(ctx context.Context, plan *models.ResourceComputeMo
req := compute.RedeployRequest{
ComputeID: computeId,
ImageID: uint64(plan.ImageID.ValueInt64()),
- DataDisks: "detach",
+ DataDisks: "KEEP",
}
if !plan.BootDiskSize.IsNull() {
req.DiskSize = uint64(plan.BootDiskSize.ValueInt64())
}
- if !plan.DataDisks.IsNull() {
- req.DataDisks = plan.DataDisks.ValueString()
- }
- if !plan.AutoStart.IsNull() {
- req.AutoStart = plan.AutoStart.ValueBool()
+ if !plan.Started.IsNull() {
+ req.AutoStart = plan.Started.ValueBool()
}
if !plan.ForceStop.IsNull() {
req.ForceStop = plan.ForceStop.ValueBool()
diff --git a/internal/service/cloudapi/lb/flattens/flatten_resource_lb.go b/internal/service/cloudapi/lb/flattens/flatten_resource_lb.go
index 3835106..c63933d 100644
--- a/internal/service/cloudapi/lb/flattens/flatten_resource_lb.go
+++ b/internal/service/cloudapi/lb/flattens/flatten_resource_lb.go
@@ -27,11 +27,11 @@ func LBResource(ctx context.Context, plan *models.ResourceLBModel, c *client.Cli
acl, _ := json.Marshal(recordItemLB.ACL)
*plan = models.ResourceLBModel{
- RGID: plan.RGID,
- Name: plan.Name,
- ExtNetID: plan.ExtNetID,
- VINSID: plan.VINSID,
- Start: plan.Start,
+ RGID: types.Int64Value(int64(recordItemLB.RGID)),
+ Name: types.StringValue(recordItemLB.Name),
+ ExtNetID: types.Int64Value(int64(recordItemLB.ExtNetID)),
+ VINSID: types.Int64Value(int64(recordItemLB.VINSID)),
+ Start: types.BoolValue(recordItemLB.TechStatus == "STARTED"),
ID: plan.ID,
HAMode: types.BoolValue(recordItemLB.HAMode),
@@ -41,7 +41,7 @@ func LBResource(ctx context.Context, plan *models.ResourceLBModel, c *client.Cli
Permanently: plan.Permanently,
Restore: plan.Restore,
Restart: plan.Restart,
- Enable: plan.Enable,
+ Enable: types.BoolValue(recordItemLB.Status == "ENABLED"),
ConfigReset: plan.ConfigReset,
ACL: types.StringValue(string(acl)),
diff --git a/internal/service/cloudapi/lb/flattens/flatten_resource_lb_backend.go b/internal/service/cloudapi/lb/flattens/flatten_resource_lb_backend.go
index cf24adc..67c7615 100644
--- a/internal/service/cloudapi/lb/flattens/flatten_resource_lb_backend.go
+++ b/internal/service/cloudapi/lb/flattens/flatten_resource_lb_backend.go
@@ -25,7 +25,7 @@ func LBBackendResource(ctx context.Context, plan *models.ResourceLBBackendModel,
*plan = models.ResourceLBBackendModel{
LBID: plan.LBID,
- Name: plan.Name,
+ Name: types.StringValue(recordItemBackend.Name),
ID: plan.ID,
Timeouts: plan.Timeouts,
GUID: types.StringValue(recordItemBackend.GUID),
diff --git a/internal/service/cloudapi/lb/flattens/flatten_resource_lb_backend_server.go b/internal/service/cloudapi/lb/flattens/flatten_resource_lb_backend_server.go
index f894e5c..2a51cfc 100644
--- a/internal/service/cloudapi/lb/flattens/flatten_resource_lb_backend_server.go
+++ b/internal/service/cloudapi/lb/flattens/flatten_resource_lb_backend_server.go
@@ -24,9 +24,10 @@ func LBBackendServerResource(ctx context.Context, plan *models.ResourceLBBackend
*plan = models.ResourceLBBackendServerModel{
LBID: plan.LBID,
Backend: plan.Backend,
- Name: plan.Name,
- Address: plan.Address,
- Port: plan.Port,
+ Name: types.StringValue(recordItemServer.Name),
+ Address: types.StringValue(recordItemServer.Address),
+ Port: types.Int64Value(int64(recordItemServer.Port)),
+ GUID: types.StringValue(recordItemServer.GUID),
ID: plan.ID,
Timeouts: plan.Timeouts,
Check: types.StringValue(recordItemServer.Check),
diff --git a/internal/service/cloudapi/lb/flattens/flatten_resoursce_lb_frontend.go b/internal/service/cloudapi/lb/flattens/flatten_resoursce_lb_frontend.go
index fedd59a..6fef191 100644
--- a/internal/service/cloudapi/lb/flattens/flatten_resoursce_lb_frontend.go
+++ b/internal/service/cloudapi/lb/flattens/flatten_resoursce_lb_frontend.go
@@ -25,7 +25,7 @@ func LBFrontendResource(ctx context.Context, plan *models.ResourceLBFrontendMode
*plan = models.ResourceLBFrontendModel{
LBID: plan.LBID,
- Name: plan.Name,
+ Name: types.StringValue(recordItemFrontend.Name),
Backend: plan.Backend,
ID: plan.ID,
Timeouts: plan.Timeouts,
diff --git a/internal/service/cloudapi/lb/flattens/flatten_resoursce_lb_frontend_bind.go b/internal/service/cloudapi/lb/flattens/flatten_resoursce_lb_frontend_bind.go
index f325436..89153bc 100644
--- a/internal/service/cloudapi/lb/flattens/flatten_resoursce_lb_frontend_bind.go
+++ b/internal/service/cloudapi/lb/flattens/flatten_resoursce_lb_frontend_bind.go
@@ -22,14 +22,14 @@ func LBFrontendBindResource(ctx context.Context, plan *models.ResourceLBFrontend
}
*plan = models.ResourceLBFrontendBindModel{
- Address: plan.Address,
+ Address: types.StringValue(recordItemFrontendBind.Address),
Frontend: plan.Frontend,
LBID: plan.LBID,
- Name: plan.Name,
+ Name: types.StringValue(recordItemFrontendBind.Name),
ID: plan.ID,
Timeouts: plan.Timeouts,
GUID: types.StringValue(recordItemFrontendBind.GUID),
- Port: plan.Port,
+ Port: types.Int64Value(int64(recordItemFrontendBind.Port)),
}
tflog.Info(ctx, "End flattens.LBFrontendBindResource", map[string]any{"name": plan.Name.ValueString()})
diff --git a/internal/service/cloudapi/lb/schemas/schema_resource_lb.go b/internal/service/cloudapi/lb/schemas/schema_resource_lb.go
index 64f5bfb..a048535 100644
--- a/internal/service/cloudapi/lb/schemas/schema_resource_lb.go
+++ b/internal/service/cloudapi/lb/schemas/schema_resource_lb.go
@@ -30,6 +30,7 @@ func MakeSchemaResourceLB() map[string]schema.Attribute {
"ha_mode": schema.BoolAttribute{
Optional: true,
Computed: true,
+ Default: booldefault.StaticBool(false),
},
"desc": schema.StringAttribute{
Optional: true,
diff --git a/internal/service/cloudapi/rg/flattens/flatten_data_source_rg.go b/internal/service/cloudapi/rg/flattens/flatten_data_source_rg.go
index 619a476..21594f9 100644
--- a/internal/service/cloudapi/rg/flattens/flatten_data_source_rg.go
+++ b/internal/service/cloudapi/rg/flattens/flatten_data_source_rg.go
@@ -43,7 +43,6 @@ func RGDataSource(ctx context.Context, state *models.DataSourceRGModel, c *clien
Name: types.StringValue(recordRG.Name),
DefNetType: types.StringValue(recordRG.DefNetType),
Description: types.StringValue(recordRG.Description),
- RegisterComputes: types.BoolValue(recordRG.RegisterComputes),
AccountName: types.StringValue(recordRG.AccountName),
ACL: flattenACL(ctx, &recordRG.ACL),
CPUAllocationParameter: types.StringValue(recordRG.CPUAllocationParameter),
diff --git a/internal/service/cloudapi/rg/flattens/flatten_data_source_rg_list.go b/internal/service/cloudapi/rg/flattens/flatten_data_source_rg_list.go
index fc8be65..d83318b 100644
--- a/internal/service/cloudapi/rg/flattens/flatten_data_source_rg_list.go
+++ b/internal/service/cloudapi/rg/flattens/flatten_data_source_rg_list.go
@@ -69,7 +69,6 @@ func RGListDataSource(ctx context.Context, state *models.DataSourceRGListModel,
LockStatus: types.StringValue(rgItem.LockStatus),
Milestones: types.Int64Value(int64(rgItem.Milestones)),
Name: types.StringValue(rgItem.Name),
- RegisterComputes: types.BoolValue(rgItem.RegisterComputes),
ResourceLimits: &models.ResourceLimitsModel{
CUC: types.Float64Value(rgItem.ResourceLimits.CUC),
CUD: types.Float64Value(rgItem.ResourceLimits.CUD),
diff --git a/internal/service/cloudapi/rg/flattens/flatten_data_source_rg_list_deleted.go b/internal/service/cloudapi/rg/flattens/flatten_data_source_rg_list_deleted.go
index 9489861..703cac2 100644
--- a/internal/service/cloudapi/rg/flattens/flatten_data_source_rg_list_deleted.go
+++ b/internal/service/cloudapi/rg/flattens/flatten_data_source_rg_list_deleted.go
@@ -68,7 +68,6 @@ func RGListDeletedDataSource(ctx context.Context, state *models.DataSourceRGList
LockStatus: types.StringValue(rgItem.LockStatus),
Milestones: types.Int64Value(int64(rgItem.Milestones)),
Name: types.StringValue(rgItem.Name),
- RegisterComputes: types.BoolValue(rgItem.RegisterComputes),
ResourceLimits: &models.ResourceLimitsModel{
CUC: types.Float64Value(rgItem.ResourceLimits.CUC),
CUD: types.Float64Value(rgItem.ResourceLimits.CUD),
diff --git a/internal/service/cloudapi/rg/flattens/flatten_resource_rg.go b/internal/service/cloudapi/rg/flattens/flatten_resource_rg.go
index 0dab912..55f592e 100644
--- a/internal/service/cloudapi/rg/flattens/flatten_resource_rg.go
+++ b/internal/service/cloudapi/rg/flattens/flatten_resource_rg.go
@@ -41,21 +41,20 @@ func RGResource(ctx context.Context, plan *models.ResourceRGModel, c *client.Cli
GID: types.Int64Value(int64(recordRG.GID)),
Name: types.StringValue(recordRG.Name),
- DefNetType: plan.DefNetType,
- IPCIDR: plan.IPCIDR,
- Quota: flattenQuota(ctx, &recordRG.ResourceLimits),
- ExtNetID: plan.ExtNetID,
- ExtIP: plan.ExtIP,
- Owner: plan.Owner,
- Access: plan.Access,
- DefNet: plan.DefNet,
- Description: plan.Description,
- Force: plan.Force,
- Permanently: plan.Permanently,
- RegisterComputes: plan.RegisterComputes,
- Restore: plan.Restore,
- Enable: plan.Enable,
- Timeouts: plan.Timeouts,
+ DefNetType: plan.DefNetType,
+ IPCIDR: plan.IPCIDR,
+ Quota: flattenQuota(ctx, &recordRG.ResourceLimits),
+ ExtNetID: plan.ExtNetID,
+ ExtIP: plan.ExtIP,
+ Owner: plan.Owner,
+ Access: flattenAccess(ctx, &recordRG.ACL),
+ DefNet: plan.DefNet,
+ Description: types.StringValue(recordRG.Description),
+ Force: plan.Force,
+ Permanently: plan.Permanently,
+ Restore: plan.Restore,
+ Enable: types.BoolValue(recordRG.Status == "ENABLED"),
+ Timeouts: plan.Timeouts,
RGID: types.Int64Value(int64(recordRG.ID)),
LastUpdated: plan.LastUpdated,
@@ -64,6 +63,8 @@ func RGResource(ctx context.Context, plan *models.ResourceRGModel, c *client.Cli
CPUAllocationParameter: types.StringValue(recordRG.CPUAllocationParameter),
CPUAllocationRatio: types.Float64Value(recordRG.CPUAllocationRatio),
DefNetID: types.Int64Value(recordRG.DefNetID),
+ CreatedBy: types.StringValue(recordRG.CreatedBy),
+ CreatedTime: types.Int64Value(int64(recordRG.CreatedTime)),
DeletedBy: types.StringValue(recordRG.DeletedBy),
DeletedTime: types.Int64Value(int64(recordRG.DeletedTime)),
Dirty: types.BoolValue(recordRG.Dirty),
@@ -150,3 +151,43 @@ func flattenQuota(ctx context.Context, item *rg.ResourceLimits) types.Object {
}
return quota
}
+
+func flattenAccess(ctx context.Context, aclList *rg.ListACL) types.Set {
+ tflog.Info(ctx, "Start flattenAccess")
+ tempSlice := make([]types.Object, 0, len(*aclList)-1)
+ for i, item := range *aclList {
+ if i == 0 {
+ continue
+ }
+ temp := models.AccessModel{
+ Right: types.StringValue(item.Right),
+ User: types.StringValue(item.UserGroupID),
+ }
+ obj, diags := types.ObjectValueFrom(ctx, models.ItemAccess, temp)
+ if diags != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenAccess struct to obj", diags))
+ }
+ tempSlice = append(tempSlice, obj)
+ }
+
+ res, diags := types.SetValueFrom(ctx, types.ObjectType{AttrTypes: models.ItemAccess}, tempSlice)
+ if diags != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenAccess", diags))
+ }
+
+ tflog.Info(ctx, "End flattenAccess")
+ return res
+}
+
+func flattenDefNet(ctx context.Context, dnType string, dnId int64) types.Object {
+ tflog.Info(ctx, "Start flattenDefNet")
+ tempStruct := models.DefNetModel{
+ NetType: types.StringValue(dnType),
+ NetId: types.Int64Value(int64(dnId)),
+ }
+ quota, diags := types.ObjectValueFrom(ctx, models.ItemDefNet, tempStruct)
+ if diags != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenDefNet", diags))
+ }
+ return quota
+}
diff --git a/internal/service/cloudapi/rg/models/model_data_source_rg.go b/internal/service/cloudapi/rg/models/model_data_source_rg.go
index db9a81f..4ef9663 100644
--- a/internal/service/cloudapi/rg/models/model_data_source_rg.go
+++ b/internal/service/cloudapi/rg/models/model_data_source_rg.go
@@ -31,7 +31,6 @@ type DataSourceRGModel struct {
LockStatus types.String `tfsdk:"lock_status"`
Milestones types.Int64 `tfsdk:"milestones"`
Name types.String `tfsdk:"name"`
- RegisterComputes types.Bool `tfsdk:"register_computes"`
ResourceLimits *ResourceLimitsModel `tfsdk:"resource_limits"`
ResTypes types.List `tfsdk:"res_types"`
Secret types.String `tfsdk:"secret"`
diff --git a/internal/service/cloudapi/rg/models/model_data_source_rg_list.go b/internal/service/cloudapi/rg/models/model_data_source_rg_list.go
index 722fadb..a5be4ea 100644
--- a/internal/service/cloudapi/rg/models/model_data_source_rg_list.go
+++ b/internal/service/cloudapi/rg/models/model_data_source_rg_list.go
@@ -48,7 +48,6 @@ type ItemsRGListModel struct {
LockStatus types.String `tfsdk:"lock_status"`
Milestones types.Int64 `tfsdk:"milestones"`
Name types.String `tfsdk:"name"`
- RegisterComputes types.Bool `tfsdk:"register_computes"`
ResourceLimits *ResourceLimitsModel `tfsdk:"resource_limits"`
ResTypes types.List `tfsdk:"resource_types"`
Secret types.String `tfsdk:"secret"`
diff --git a/internal/service/cloudapi/rg/models/model_data_source_rg_list_deleted.go b/internal/service/cloudapi/rg/models/model_data_source_rg_list_deleted.go
index 85b5c56..09b016a 100644
--- a/internal/service/cloudapi/rg/models/model_data_source_rg_list_deleted.go
+++ b/internal/service/cloudapi/rg/models/model_data_source_rg_list_deleted.go
@@ -46,7 +46,6 @@ type ItemsRGListDeletedModel struct {
LockStatus types.String `tfsdk:"lock_status"`
Milestones types.Int64 `tfsdk:"milestones"`
Name types.String `tfsdk:"name"`
- RegisterComputes types.Bool `tfsdk:"register_computes"`
ResourceLimits *ResourceLimitsModel `tfsdk:"resource_limits"`
ResTypes types.List `tfsdk:"resource_types"`
Secret types.String `tfsdk:"secret"`
diff --git a/internal/service/cloudapi/rg/models/model_resource_rg.go b/internal/service/cloudapi/rg/models/model_resource_rg.go
index 8819a3d..90fd8b8 100644
--- a/internal/service/cloudapi/rg/models/model_resource_rg.go
+++ b/internal/service/cloudapi/rg/models/model_resource_rg.go
@@ -13,21 +13,20 @@ type ResourceRGModel struct {
Name types.String `tfsdk:"name"`
// request fields - optional
- DefNetType types.String `tfsdk:"def_net_type"`
- IPCIDR types.String `tfsdk:"ipcidr"`
- ExtNetID types.Int64 `tfsdk:"ext_net_id"`
- ExtIP types.String `tfsdk:"ext_ip"`
- Owner types.String `tfsdk:"owner"`
- Quota types.Object `tfsdk:"quota"`
- Access types.List `tfsdk:"access"`
- DefNet types.Object `tfsdk:"def_net"`
- Description types.String `tfsdk:"description"`
- Force types.Bool `tfsdk:"force"`
- Permanently types.Bool `tfsdk:"permanently"`
- RegisterComputes types.Bool `tfsdk:"register_computes"`
- Restore types.Bool `tfsdk:"restore"`
- Enable types.Bool `tfsdk:"enable"`
- Timeouts timeouts.Value `tfsdk:"timeouts"`
+ DefNetType types.String `tfsdk:"def_net_type"`
+ IPCIDR types.String `tfsdk:"ipcidr"`
+ ExtNetID types.Int64 `tfsdk:"ext_net_id"`
+ ExtIP types.String `tfsdk:"ext_ip"`
+ Owner types.String `tfsdk:"owner"`
+ Quota types.Object `tfsdk:"quota"`
+ Access types.Set `tfsdk:"access"`
+ DefNet types.Object `tfsdk:"def_net"`
+ Description types.String `tfsdk:"description"`
+ Force types.Bool `tfsdk:"force"`
+ Permanently types.Bool `tfsdk:"permanently"`
+ Restore types.Bool `tfsdk:"restore"`
+ Enable types.Bool `tfsdk:"enable"`
+ Timeouts timeouts.Value `tfsdk:"timeouts"`
// response fields
RGID types.Int64 `tfsdk:"rg_id"`
@@ -38,6 +37,8 @@ type ResourceRGModel struct {
CPUAllocationParameter types.String `tfsdk:"cpu_allocation_parameter"`
CPUAllocationRatio types.Float64 `tfsdk:"cpu_allocation_ratio"`
DefNetID types.Int64 `tfsdk:"def_net_id"`
+ CreatedBy types.String `tfsdk:"created_by"`
+ CreatedTime types.Int64 `tfsdk:"created_time"`
DeletedBy types.String `tfsdk:"deleted_by"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
Dirty types.Bool `tfsdk:"dirty"`
diff --git a/internal/service/cloudapi/rg/schemas/schema_data_source_rg.go b/internal/service/cloudapi/rg/schemas/schema_data_source_rg.go
index 488fb79..cb6187f 100644
--- a/internal/service/cloudapi/rg/schemas/schema_data_source_rg.go
+++ b/internal/service/cloudapi/rg/schemas/schema_data_source_rg.go
@@ -97,9 +97,6 @@ func MakeSchemaDataSourceRG() map[string]schema.Attribute {
"name": schema.StringAttribute{
Computed: true,
},
- "register_computes": schema.BoolAttribute{
- Computed: true,
- },
"resource_limits": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
diff --git a/internal/service/cloudapi/rg/schemas/schema_data_source_rg_list.go b/internal/service/cloudapi/rg/schemas/schema_data_source_rg_list.go
index f41ddab..11f38b7 100644
--- a/internal/service/cloudapi/rg/schemas/schema_data_source_rg_list.go
+++ b/internal/service/cloudapi/rg/schemas/schema_data_source_rg_list.go
@@ -142,9 +142,6 @@ func MakeSchemaDataSourceRGList() map[string]schema.Attribute {
"name": schema.StringAttribute{
Computed: true,
},
- "register_computes": schema.BoolAttribute{
- Computed: true,
- },
"resource_limits": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
diff --git a/internal/service/cloudapi/rg/schemas/schema_data_source_rg_list_deleted.go b/internal/service/cloudapi/rg/schemas/schema_data_source_rg_list_deleted.go
index fa1f82a..a19d0d9 100644
--- a/internal/service/cloudapi/rg/schemas/schema_data_source_rg_list_deleted.go
+++ b/internal/service/cloudapi/rg/schemas/schema_data_source_rg_list_deleted.go
@@ -134,9 +134,6 @@ func MakeSchemaDataSourceRGListDeleted() map[string]schema.Attribute {
"name": schema.StringAttribute{
Computed: true,
},
- "register_computes": schema.BoolAttribute{
- Computed: true,
- },
"resource_limits": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
diff --git a/internal/service/cloudapi/rg/schemas/schema_resource_rg.go b/internal/service/cloudapi/rg/schemas/schema_resource_rg.go
index ac73629..e54c670 100644
--- a/internal/service/cloudapi/rg/schemas/schema_resource_rg.go
+++ b/internal/service/cloudapi/rg/schemas/schema_resource_rg.go
@@ -3,6 +3,7 @@ package schemas
import (
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
@@ -96,7 +97,7 @@ func MakeSchemaResourceRG() map[string]schema.Attribute {
},
},
},
- "access": schema.ListNestedAttribute{
+ "access": schema.SetNestedAttribute{
Optional: true,
Description: "Grant/revoke user or group access to the Resource group as specified",
NestedObject: schema.NestedAttributeObject{
@@ -136,25 +137,28 @@ func MakeSchemaResourceRG() map[string]schema.Attribute {
},
"force": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
Description: "Set to True if you want force delete non-empty RG",
// default value is true
},
"permanently": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
Description: "Set to True if you want force delete non-empty RG",
// default value is true
},
- "register_computes": schema.BoolAttribute{
- Optional: true,
- Description: "Register computes in registration system",
- // default value is false
- },
"restore": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
// default value is true
},
"enable": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
Description: "flag for enable/disable RG",
// default value is true
},
@@ -214,6 +218,12 @@ func MakeSchemaResourceRG() map[string]schema.Attribute {
"def_net_id": schema.Int64Attribute{
Computed: true,
},
+ "created_by": schema.StringAttribute{
+ Computed: true,
+ },
+ "created_time": schema.Int64Attribute{
+ Computed: true,
+ },
"deleted_by": schema.StringAttribute{
Computed: true,
},
diff --git a/internal/service/cloudapi/rg/utilities/utility_resource_rg.go b/internal/service/cloudapi/rg/utilities/utility_resource_rg.go
index 34d611c..2e9c569 100644
--- a/internal/service/cloudapi/rg/utilities/utility_resource_rg.go
+++ b/internal/service/cloudapi/rg/utilities/utility_resource_rg.go
@@ -92,11 +92,6 @@ func CreateRequestResourceRG(ctx context.Context, plan *models.ResourceRGModel)
if !plan.ExtIP.IsNull() {
createReq.ExtIP = plan.ExtIP.ValueString()
}
- if plan.RegisterComputes.IsNull() {
- createReq.RegisterComputes = false // default value
- } else {
- createReq.RegisterComputes = plan.RegisterComputes.ValueBool()
- }
return createReq, nil
}
@@ -160,7 +155,7 @@ func DisableRG(ctx context.Context, rgId uint64, plan *models.ResourceRGModel, c
return err
}
-// UpdateRG compares plan and state for resource group fields name, description, quota, register_computes.
+// UpdateRG compares plan and state for resource group fields name, description, quota.
// If any changes are detected, Update request is performed. If not, no update is performed.
func UpdateRG(ctx context.Context, rgId uint64, plan, state *models.ResourceRGModel, c *client.Client) diag.Diagnostics {
var updateNeeded bool
@@ -188,19 +183,6 @@ func UpdateRG(ctx context.Context, rgId uint64, plan, state *models.ResourceRGMo
updateNeeded = true
}
- if !plan.RegisterComputes.Equal(state.RegisterComputes) {
- if plan.RegisterComputes.IsNull() {
- updateReq.RegisterComputes = false // default value
- } else {
- updateReq.RegisterComputes = plan.RegisterComputes.ValueBool()
- }
- tflog.Info(ctx, "utilityUpdateRG: new register_computes specified", map[string]any{
- "rg_id": plan.Id.ValueString(),
- "register_computes_plan": plan.RegisterComputes.ValueBool(),
- "register_computes_state": state.RegisterComputes.ValueBool()})
- updateNeeded = true
- }
-
if !plan.UniqPools.Equal(state.UniqPools) {
if plan.UniqPools.IsNull() || len(plan.UniqPools.Elements()) == 0 {
updateReq.ClearUniqPools = true
@@ -214,10 +196,6 @@ func UpdateRG(ctx context.Context, rgId uint64, plan, state *models.ResourceRGMo
}
updateReq.UniqPools = uPoolsList
}
- tflog.Info(ctx, "utilityUpdateRG: new register_computes specified", map[string]any{
- "rg_id": plan.Id.ValueString(),
- "register_computes_plan": plan.RegisterComputes.ValueBool(),
- "register_computes_state": state.RegisterComputes.ValueBool()})
updateNeeded = true
}
diff --git a/internal/service/cloudapi/vins/flattens/flatten_resource_vins.go b/internal/service/cloudapi/vins/flattens/flatten_resource_vins.go
index d110022..92174f6 100644
--- a/internal/service/cloudapi/vins/flattens/flatten_resource_vins.go
+++ b/internal/service/cloudapi/vins/flattens/flatten_resource_vins.go
@@ -10,6 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-log/tflog"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/vins"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
+ "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/flattens"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/vins/models"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/vins/utilities"
)
@@ -37,23 +38,23 @@ func VINSResource(ctx context.Context, plan *models.ResourceVINSModel, c *client
*plan = models.ResourceVINSModel{
Name: types.StringValue(recordVins.Name),
- RGID: plan.RGID,
+ RGID: types.Int64Value(int64(recordVins.RGID)),
AccountID: plan.AccountID,
IPCIDR: plan.IPCIDR,
PreReservationsNum: plan.PreReservationsNum,
Description: plan.Description,
- GID: plan.GID,
- DNS: plan.DNS,
+ GID: types.Int64Value(int64(recordVins.GID)),
+ DNS: flattens.FlattenSimpleTypeToSet(ctx, types.StringType, recordVins.VNFs.DHCP.Config.DNS),
- Enable: plan.Enable,
+ Enable: types.BoolValue(recordVins.Status == "ENABLED"),
Permanently: plan.Permanently,
Force: plan.Force,
Restore: plan.Restore,
VnfdevRestart: plan.VnfdevRestart,
VnfdevRedeploy: plan.VnfdevRedeploy,
- ExtNet: plan.ExtNet,
+ ExtNet: flattenExtNet(ctx, recordVins),
IP: plan.IP,
NatRule: plan.NatRule,
Timeouts: plan.Timeouts,
@@ -160,3 +161,22 @@ func flattenNatRule(ctx context.Context, plan *models.ResourceVINSModel, rules *
tflog.Info(ctx, "End flattenRuleIdInNatRule")
return res
}
+
+// flattenExtNet flattens ExtNet.
+// Flatten errors are added to tflog.
+func flattenExtNet(ctx context.Context, vins *vins.RecordVINS) types.Object {
+ tflog.Info(ctx, "Start flattenExtNet")
+
+ temp := models.ExtNetModel{
+ ExtNetID: types.Int64Value(int64(vins.VNFs.GW.Config.ExtNetID)),
+ ExtNetIP: types.StringValue(vins.VNFs.GW.Config.ExtNetIP),
+ }
+
+ res, err := types.ObjectValueFrom(ctx, models.ItemExtNet, temp)
+ if err != nil {
+ tflog.Error(ctx, fmt.Sprint("Error flattenExtNet struct to obj", err))
+ }
+
+ tflog.Info(ctx, "End flattenExtNet")
+ return res
+}
diff --git a/internal/service/cloudapi/vins/models/model_data_source_vins_list.go b/internal/service/cloudapi/vins/models/model_data_source_vins_list.go
index 7daab86..cd091b5 100644
--- a/internal/service/cloudapi/vins/models/model_data_source_vins_list.go
+++ b/internal/service/cloudapi/vins/models/model_data_source_vins_list.go
@@ -17,6 +17,7 @@ type DataSourceVINSListModel struct {
Page types.Int64 `tfsdk:"page"`
SortBy types.String `tfsdk:"sort_by"`
Size types.Int64 `tfsdk:"size"`
+ Status types.String `tfsdk:"status"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
// response fields
diff --git a/internal/service/cloudapi/vins/models/model_resource_vins.go b/internal/service/cloudapi/vins/models/model_resource_vins.go
index a08ec01..fe50a16 100644
--- a/internal/service/cloudapi/vins/models/model_resource_vins.go
+++ b/internal/service/cloudapi/vins/models/model_resource_vins.go
@@ -93,6 +93,11 @@ var ItemNatRuleResource = map[string]attr.Type{
"rule_id": types.Int64Type,
}
+var ItemExtNet = map[string]attr.Type{
+ "ext_net_id": types.Int64Type,
+ "ext_net_ip": types.StringType,
+}
+
// Contains returns true if NatRuleResourceModel contains n as an element. Otherwise it returns false.
func (n *NatRuleResourceModel) Contains(natRuleList []NatRuleResourceModel) bool {
for _, natRuleElem := range natRuleList {
diff --git a/internal/service/cloudapi/vins/schemas/schema_data_source_vins_list.go b/internal/service/cloudapi/vins/schemas/schema_data_source_vins_list.go
index fb693bd..f3d836b 100644
--- a/internal/service/cloudapi/vins/schemas/schema_data_source_vins_list.go
+++ b/internal/service/cloudapi/vins/schemas/schema_data_source_vins_list.go
@@ -47,7 +47,10 @@ func MakeSchemaDataSourceVINSList() map[string]schema.Attribute {
Optional: true,
Description: "Page size",
},
-
+ "status": schema.StringAttribute{
+ Optional: true,
+ Description: "Status",
+ },
// computed attributes
"id": schema.StringAttribute{
Computed: true,
diff --git a/internal/service/cloudapi/vins/schemas/schema_resource_vins.go b/internal/service/cloudapi/vins/schemas/schema_resource_vins.go
index 250aa65..b70c014 100644
--- a/internal/service/cloudapi/vins/schemas/schema_resource_vins.go
+++ b/internal/service/cloudapi/vins/schemas/schema_resource_vins.go
@@ -3,6 +3,7 @@ package schemas
import (
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
@@ -59,23 +60,31 @@ func MakeSchemaResourceVINS() map[string]schema.Attribute {
"enable": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
Description: "flag to enable/disable vins",
// default is true
},
"permanently": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
Description: "flag to delete vins permanently",
- // default is false
+ // default is true
},
"force": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
Description: "flag to force delete of non-empty vins",
- // default is false
+ // default is true
},
"restore": schema.BoolAttribute{
Optional: true,
+ Computed: true,
+ Default: booldefault.StaticBool(true),
Description: "flag to restore vins",
- // default is false
+ // default is true
},
"vnfdev_restart": schema.BoolAttribute{
Optional: true,
diff --git a/internal/service/cloudapi/vins/utilities/utility_data_source_vins_list.go b/internal/service/cloudapi/vins/utilities/utility_data_source_vins_list.go
index 335529c..b1938e4 100644
--- a/internal/service/cloudapi/vins/utilities/utility_data_source_vins_list.go
+++ b/internal/service/cloudapi/vins/utilities/utility_data_source_vins_list.go
@@ -40,6 +40,9 @@ func VINSListDataSourceCheckPresence(ctx context.Context, plan *models.DataSourc
if !plan.SortBy.IsNull() {
listReq.SortBy = plan.SortBy.ValueString()
}
+ if !plan.Status.IsNull() {
+ listReq.Status = plan.Status.ValueString()
+ }
if !plan.Page.IsNull() {
listReq.Page = uint64(plan.Page.ValueInt64())
}
diff --git a/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk.go b/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk.go
index 033e179..d89698b 100644
--- a/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk.go
+++ b/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk.go
@@ -76,7 +76,7 @@ func DiskDataSource(ctx context.Context, state *models.DiskModel, c *client.Clie
VMID: types.Int64Value(int64(recordDisk.VMID)),
}
- state.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
+ state.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskDataSource: cannot flatten recordDisk.Images to state.Images", diags))
}
diff --git a/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_list.go b/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_list.go
index 65f4556..c46cceb 100644
--- a/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_list.go
+++ b/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_list.go
@@ -96,7 +96,7 @@ func DiskListDataSource(ctx context.Context, state *models.DisksModel, c *client
VMID: types.Int64Value(int64(recordDisk.VMID)),
}
- d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
+ d.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDataSource: cannot flatten recordDisk.Images to d.Images", diags))
}
diff --git a/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_list_deleted.go b/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_list_deleted.go
index 70fdddf..28e2174 100644
--- a/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_list_deleted.go
+++ b/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_list_deleted.go
@@ -96,7 +96,7 @@ func DiskListDeletedDataSource(ctx context.Context, state *models.ListDisksModel
VMID: types.Int64Value(int64(recordDisk.VMID)),
}
- d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
+ d.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDeletedDataSource: cannot flatten recordDisk.Images to d.Images", diags))
}
diff --git a/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_list_unattached.go b/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_list_unattached.go
index 516b18e..2622194 100644
--- a/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_list_unattached.go
+++ b/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_list_unattached.go
@@ -98,7 +98,7 @@ func DiskListUnattachedDataSource(ctx context.Context, state *models.DataSourceD
VMID: types.Int64Value(int64(recordDisk.VMID)),
}
- d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
+ d.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskListUnattachedDataSource: cannot flatten recordDisk.Images to d.Images", diags))
}
diff --git a/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_replication.go b/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_replication.go
index f324646..9c652cf 100644
--- a/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_replication.go
+++ b/internal/service/cloudbroker/disks/flattens/flatten_data_source_cb_disk_replication.go
@@ -50,7 +50,7 @@ func DiskReplicationDataSource(ctx context.Context, state *models.RecordDiskMode
GID: types.Int64Value(int64(recordDisk.GID)),
GUID: types.Int64Value(int64(recordDisk.GUID)),
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
- Images: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordDisk.Images),
+ Images: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordDisk.Images),
Name: types.StringValue(recordDisk.Name),
IQN: types.StringValue(recordDisk.IQN),
Login: types.StringValue(recordDisk.Login),
diff --git a/internal/service/cloudbroker/disks/flattens/flatten_resource_cb_disk.go b/internal/service/cloudbroker/disks/flattens/flatten_resource_cb_disk.go
index 0081c68..0e574a4 100644
--- a/internal/service/cloudbroker/disks/flattens/flatten_resource_cb_disk.go
+++ b/internal/service/cloudbroker/disks/flattens/flatten_resource_cb_disk.go
@@ -86,7 +86,7 @@ func DiskResource(ctx context.Context, plan *models.ResourceDiskModel, c *client
VMID: types.Int64Value(int64(recordDisk.VMID)),
}
- plan.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
+ plan.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskResource: cannot flatten recordDisk.Images to plan.Images", diags))
}
diff --git a/internal/service/cloudbroker/disks/flattens/flatten_resource_cb_disk_replication.go b/internal/service/cloudbroker/disks/flattens/flatten_resource_cb_disk_replication.go
index 49747ba..3a7bc69 100644
--- a/internal/service/cloudbroker/disks/flattens/flatten_resource_cb_disk_replication.go
+++ b/internal/service/cloudbroker/disks/flattens/flatten_resource_cb_disk_replication.go
@@ -61,7 +61,7 @@ func DiskReplicationResource(ctx context.Context, state *models.ResourceRecordDi
GUID: types.Int64Value(int64(recordDisk.GUID)),
GID: types.Int64Value(int64(recordDisk.GID)),
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
- Images: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordDisk.Images),
+ Images: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordDisk.Images),
IQN: types.StringValue(recordDisk.IQN),
Login: types.StringValue(recordDisk.Login),
Milestones: types.Int64Value(int64(recordDisk.Milestones)),
diff --git a/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk.go b/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk.go
index b08177d..fa1b58b 100644
--- a/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk.go
+++ b/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk.go
@@ -64,7 +64,7 @@ func MakeSchemaDataSourceDisk() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
diff --git a/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_list.go b/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_list.go
index 9416e38..183c7c7 100644
--- a/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_list.go
+++ b/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_list.go
@@ -98,7 +98,7 @@ func MakeSchemaDataSourceDiskList() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
diff --git a/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_list_deleted.go b/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_list_deleted.go
index dd707fa..333ebe9 100644
--- a/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_list_deleted.go
+++ b/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_list_deleted.go
@@ -98,7 +98,7 @@ func MakeSchemaDataSourceDiskListDeleted() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
diff --git a/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_list_unattached.go b/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_list_unattached.go
index c06af46..2893021 100644
--- a/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_list_unattached.go
+++ b/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_list_unattached.go
@@ -109,7 +109,7 @@ func MakeSchemaDataSourceDiskListUnattached() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
diff --git a/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_replication.go b/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_replication.go
index fb89f59..12bba50 100644
--- a/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_replication.go
+++ b/internal/service/cloudbroker/disks/schemas/schema_data_source_cb_disk_replication.go
@@ -71,7 +71,7 @@ func MakeSchemaDataSourceDiskReplication() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
diff --git a/internal/service/cloudbroker/disks/schemas/schema_resource_cb_disk.go b/internal/service/cloudbroker/disks/schemas/schema_resource_cb_disk.go
index 9fe3440..aa485cf 100644
--- a/internal/service/cloudbroker/disks/schemas/schema_resource_cb_disk.go
+++ b/internal/service/cloudbroker/disks/schemas/schema_resource_cb_disk.go
@@ -204,7 +204,7 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"last_updated": schema.StringAttribute{
Computed: true,
diff --git a/internal/service/cloudbroker/disks/schemas/schema_resource_cb_disk_replication.go b/internal/service/cloudbroker/disks/schemas/schema_resource_cb_disk_replication.go
index 57ff2ad..e41b357 100644
--- a/internal/service/cloudbroker/disks/schemas/schema_resource_cb_disk_replication.go
+++ b/internal/service/cloudbroker/disks/schemas/schema_resource_cb_disk_replication.go
@@ -107,7 +107,7 @@ func MakeSchemaResourceDiskReplication() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
- ElementType: types.StringType,
+ ElementType: types.Int64Type,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
diff --git a/internal/service/cloudbroker/disks/utilities/utility_resource_cb_disk.go b/internal/service/cloudbroker/disks/utilities/utility_resource_cb_disk.go
index a0a5680..66c28e1 100644
--- a/internal/service/cloudbroker/disks/utilities/utility_resource_cb_disk.go
+++ b/internal/service/cloudbroker/disks/utilities/utility_resource_cb_disk.go
@@ -45,14 +45,14 @@ func CreateRequestResourceDisk(ctx context.Context, plan *models.ResourceDiskMod
AccountID: uint64(plan.AccountID.ValueInt64()),
Name: plan.DiskName.ValueString(),
Size: uint64(plan.SizeMax.ValueInt64()),
- GID: uint64(plan.GID.ValueInt64()),
+ //GID: uint64(plan.GID.ValueInt64()),
}
- if plan.Type.IsUnknown() {
- createReq.Type = "D" // default value
- } else {
- createReq.Type = plan.Type.ValueString()
- }
+ //if plan.Type.IsUnknown() {
+ // createReq.Type = "D" // default value
+ //} else {
+ // createReq.Type = plan.Type.ValueString()
+ //}
if !plan.SEPID.IsUnknown() {
createReq.SEPID = uint64(plan.SEPID.ValueInt64())
}
@@ -62,9 +62,9 @@ func CreateRequestResourceDisk(ctx context.Context, plan *models.ResourceDiskMod
if !plan.Description.IsUnknown() {
createReq.Description = plan.Description.ValueString()
}
- if !plan.SSDSize.IsUnknown() {
- createReq.SSDSize = uint64(plan.SSDSize.ValueInt64())
- }
+ //if !plan.SSDSize.IsUnknown() {
+ // createReq.SSDSize = uint64(plan.SSDSize.ValueInt64())
+ //}
return createReq
}
diff --git a/internal/service/cloudbroker/rg/flattens/flatten_data_source_rg.go b/internal/service/cloudbroker/rg/flattens/flatten_data_source_rg.go
index d2a7325..73c024b 100644
--- a/internal/service/cloudbroker/rg/flattens/flatten_data_source_rg.go
+++ b/internal/service/cloudbroker/rg/flattens/flatten_data_source_rg.go
@@ -60,7 +60,6 @@ func RGDataSource(ctx context.Context, state *models.DataSourceRGModel, c *clien
LockStatus: types.StringValue(recordRG.LockStatus),
Milestones: types.Int64Value(int64(recordRG.Milestones)),
Name: types.StringValue(recordRG.Name),
- RegisterComputes: types.BoolValue(recordRG.RegisterComputes),
ResourceLimits: flattenResourceLimits(ctx, &recordRG.ResourceLimits),
ResourceTypes: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &recordRG.ResTypes),
Secret: types.StringValue(recordRG.Secret),
diff --git a/internal/service/cloudbroker/rg/flattens/flatten_data_source_rg_list.go b/internal/service/cloudbroker/rg/flattens/flatten_data_source_rg_list.go
index 750605a..40bde4a 100644
--- a/internal/service/cloudbroker/rg/flattens/flatten_data_source_rg_list.go
+++ b/internal/service/cloudbroker/rg/flattens/flatten_data_source_rg_list.go
@@ -71,7 +71,6 @@ func RGListDataSource(ctx context.Context, state *models.DataSourceRGListModel,
Milestones: types.Int64Value(int64(rgItem.Milestones)),
Name: types.StringValue(rgItem.Name),
ResTypes: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &rgItem.ResTypes),
- RegisterComputes: types.BoolValue(rgItem.RegisterComputes),
ResourceLimits: flattenResourceLimits(ctx, &rgItem.ResourceLimits),
Secret: types.StringValue(rgItem.Secret),
Status: types.StringValue(rgItem.Status),
diff --git a/internal/service/cloudbroker/rg/flattens/flatten_data_source_rg_list_deleted.go b/internal/service/cloudbroker/rg/flattens/flatten_data_source_rg_list_deleted.go
index bb2c5f9..7083a40 100644
--- a/internal/service/cloudbroker/rg/flattens/flatten_data_source_rg_list_deleted.go
+++ b/internal/service/cloudbroker/rg/flattens/flatten_data_source_rg_list_deleted.go
@@ -70,7 +70,6 @@ func RGListDeletedDataSource(ctx context.Context, state *models.DataSourceRGList
Milestones: types.Int64Value(int64(rgItem.Milestones)),
Name: types.StringValue(rgItem.Name),
ResTypes: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &rgItem.ResTypes),
- RegisterComputes: types.BoolValue(rgItem.RegisterComputes),
ResourceLimits: flattenResourceLimits(ctx, &rgItem.ResourceLimits),
Secret: types.StringValue(rgItem.Secret),
Status: types.StringValue(rgItem.Status),
diff --git a/internal/service/cloudbroker/rg/utilities/utility_resource_rg.go b/internal/service/cloudbroker/rg/utilities/utility_resource_rg.go
index 3a066eb..cd4f54c 100644
--- a/internal/service/cloudbroker/rg/utilities/utility_resource_rg.go
+++ b/internal/service/cloudbroker/rg/utilities/utility_resource_rg.go
@@ -84,11 +84,6 @@ func CreateRequestResourceRG(ctx context.Context, plan *models.ResourceRGModel)
if !plan.ExtIP.IsNull() {
createReq.ExtIP = plan.ExtIP.ValueString()
}
- if plan.RegisterComputes.IsNull() {
- createReq.RegisterComputes = false // default value
- } else {
- createReq.RegisterComputes = plan.RegisterComputes.ValueBool()
- }
if !plan.UniqPools.IsUnknown() {
uniqPools := make([]string, 0, len(plan.UniqPools.Elements()))
diags := plan.UniqPools.ElementsAs(ctx, &uniqPools, true)
@@ -177,19 +172,6 @@ func UpdateRG(ctx context.Context, rgId uint64, plan, state *models.ResourceRGMo
updateNeeded = true
}
- if !plan.RegisterComputes.Equal(state.RegisterComputes) {
- if plan.RegisterComputes.IsNull() {
- updateReq.RegisterComputes = false // default value
- } else {
- updateReq.RegisterComputes = plan.RegisterComputes.ValueBool()
- }
- tflog.Info(ctx, "utilityUpdateRG: new register_computes specified", map[string]any{
- "rg_id": plan.Id.ValueString(),
- "register_computes_plan": plan.RegisterComputes.ValueBool(),
- "register_computes_state": state.RegisterComputes.ValueBool()})
- updateNeeded = true
- }
-
var updResLimitsNeeded bool
var resLimitsPlan, resLimitsState models.ResourceLimitsModel
diff --git a/samples/cloudapi/account/resource_account/main.tf b/samples/cloudapi/account/resource_account/main.tf
index 017ca69..29d1958 100644
--- a/samples/cloudapi/account/resource_account/main.tf
+++ b/samples/cloudapi/account/resource_account/main.tf
@@ -2,7 +2,6 @@
Пример использования
Ресурса account
Ресурс позволяет:
-1. Создавать аккаунт
2. Редактировать аккаунт
3. Удалять аккаунт
*/
@@ -34,45 +33,32 @@ resource "dynamix_account" "a" {
#имя аккаунта
#обязательный параметр
#тип - строка
- #используется при создании и редактировании аккаунта
+ #используется при обновлении
account_name = "new_my_account"
- #имя пользователя - создателя аккаунта
- #обязательный параметр
- #тип - строка
- username = "username@decs3o"
-
#доступность аккаунта
#опциональный параметр
#тип - булев
- #может применяться при редактировании аккаунта
- enable = true
-
- #id аккаунта, позволяет сформировать .tfstate, если аккаунт имеет в платформе
- #опциональный параметр
- #тип - целое число
- account_id = 11111
-
- #электронная почта, на которую будет отправлена информация о доступе
- #опциональный параметр
- #тип - строка
- #применяется при создании аккаунта
- emailaddress = "fff@fff.ff"
+ #по умолчанию - true
+ #используется при обновлении
+ #enable = true
#отправлять ли на электронную почту письмо о доступе
#опциональный параметр
#тип - булев
- #применяется при создании аккаунта и редактировании аккаунта
- send_access_emails = true
+ #по умолчанию - true
+ #используется при обновлении
+ #send_access_emails = true
#добавление/редактирование/удаление пользователей, к которым привязан аккаунт
#опциональный параметр
- #тип - объект, кол-во таких объектов не ограничено
- users = [{
+ #тип - массив объектов, кол-во таких объектов не ограничено
+ #используется при обновлении
+ #users = [{
#id пользователя
#обязательный параметр
#тип - строка
- user_id = "username_2@decs3o"
+ #user_id = "username_2@decs3o"
#тип доступа пользователя
#обязательный параметр
@@ -81,50 +67,50 @@ resource "dynamix_account" "a" {
#R - чтение
#RCX - запись
#ARCXDU - админ
- access_type = "R"
- }]
+ #access_type = "R"
+ #}]
#ограничение используемых ресурсов
#опциональный параметр
#тип - объект
- #используется при создании и редактировании
- resource_limits = {
+ #используется при обновлении
+ #resource_limits = {
#кол-во используемых ядер cpu
#опциональный параметр
#тип - целое число
#если установлена -1 - кол-во неограиченно
- cu_c = 2
+ #cu_c = 2
#кол-во используемой RAM в МБ
#опциональный параметр
#тип - целое число
#если установлена -1 - кол-во неограиченно
- cu_m = 1024
+ #cu_m = 1024
#размер дисков, в ГБ
#опциональный параметр
#тип - целое число
#если установлена -1 - размер неограичен
- cu_d = 23
+ #cu_d = 23
#кол-во используемых публичных IP
#опциональный параметр
#тип - целое число
#если установлена -1 - кол-во неограиченно
- cu_i = 2
+ #cu_i = 2
#ограничения на кол-во передачи данных, в ГБ
#опциональный параметр
#тип - целое число
#если установлена -1 - кол-во неограиченно
- cu_np = 2
+ #cu_np = 2
#кол-во графических процессоров
#опциональный параметр
#тип - целое число
#если установлена -1 - кол-во неограиченно
- gpu_units = 2
- }
+ #gpu_units = 2
+ #}
#восстановление аккаунта
#опциональный параметр
@@ -133,13 +119,23 @@ resource "dynamix_account" "a" {
#по умолчанию - true
#restore = false
- #мгновеное удаление аккаунта, если да - то аккаунт невозможно будет восстановить
+ #флаг для удаления аккаунта, без возможности восстановления
#опциональный параметр
#тип - булев
- #используется при удалении аккаунта
#по умолчанию - true
+ #используется при удалении
#permanently = true
+ #описание
+ #опциональный параметр
+ #строка
+ #desc = "description"
+
+ #причина отключения аккаунта
+ #опциональный параметр
+ #тип - строка
+ #используется при обновлении
+ #reason = "something_reason"
}
output "test" {
diff --git a/samples/cloudapi/bservice/resource_bservice/main.tf b/samples/cloudapi/bservice/resource_bservice/main.tf
index f670efa..b7bb904 100644
--- a/samples/cloudapi/bservice/resource_bservice/main.tf
+++ b/samples/cloudapi/bservice/resource_bservice/main.tf
@@ -48,7 +48,7 @@ resource "dynamix_bservice" "b" {
#необязательный параметр
#тип - булев
#используется при редактировании ресурса
- #по-умолачанию - false
+ #по-умолчанию - true
#enable = true
#снимок состояния
@@ -76,7 +76,7 @@ resource "dynamix_bservice" "b" {
#необязательный параметр
#тип - булев
#используется при редактировании ресурса
- #по-умолачанию - false
+ #по-умолчанию - false
#start = false
#восстановление сервиса после удаления
@@ -90,7 +90,7 @@ resource "dynamix_bservice" "b" {
#необязательный параметр
#тип - булев
#используется при удалении ресурса
- #по-умолачанию - false
+ #по-умолчанию - true
#permanently = true
}
diff --git a/samples/cloudapi/bservice/resource_bservice_group/main.tf b/samples/cloudapi/bservice/resource_bservice_group/main.tf
index 6c19c21..d9f3624 100644
--- a/samples/cloudapi/bservice/resource_bservice_group/main.tf
+++ b/samples/cloudapi/bservice/resource_bservice_group/main.tf
@@ -75,6 +75,13 @@ resource "dynamix_bservice_group" "bsg" {
#тип - строка
driver = "kvm_x86"
+ #чипсет
+ #возможные значения - i440fx, Q35
+ #значение по умолчанию - i440fx
+ #опциональный параметр
+ #тип - строка
+ #chipset = "i440fx"
+
#id Storage endpoint provider
#необязательный параметр
#тип - целое число
diff --git a/samples/cloudapi/disk/resource_disk/main.tf b/samples/cloudapi/disk/resource_disk/main.tf
index 4134d95..7f3d59a 100644
--- a/samples/cloudapi/disk/resource_disk/main.tf
+++ b/samples/cloudapi/disk/resource_disk/main.tf
@@ -1,6 +1,9 @@
/*
Пример использования
Ресурса диска
+1. Создавать диск
+2. Редактировать диск
+3. Удалять диск
*/
#Раскомментируйте этот код,
@@ -30,80 +33,80 @@ resource "dynamix_disk" "disk" {
#id аккаунта
#обязательный параметр
#тип - целое число
+ #используется при создании
account_id = 88366
- #gid
- #обязательный параметр
- #тип - целое число
- gid = 212
-
- #название диска диска
+ #название диска
#обязательный параметр
#тип - строка
+ #используется при создании и обновлении
disk_name = "super-disk-re"
- #максимальный размер диска
+ #максимальный размер диска, в ГБ
#обязательный параметр
#тип - целое число
+ #используется при создании и обновлении
size_max = 20
- #тип диска
- #опциональный параметр
- #тип - строка
- #допустимые значения: "D", "B", "T"
- #значение по умолчанию: "D"
- #type = "d"
-
#sep id
#опциональный параметр
#тип - целое число
- #значение по умолчанию 0
+ #по умолчанию - 0
+ #используется при создании
#sep_id = 1
#название pool
#опциональный параметр
#тип - строка
+ #используется при создании
#pool = "pool_name"
#описание диска
#опциональный параметр
#тип - строка
+ #используется при создании и обновлении
#desc = "description"
#флаг поделиться диском
#опциональный параметр
#тип - булев
+ #по умолчанию - false
+ #используется при создании и обновлении
#shareable = true
#настройки лимитов операций записи/чтения с диска
#опциональный параметр
- #тип - блок, тип вложенных полей - число
- iotune = {
- read_bytes_sec = 0
- read_bytes_sec_max = 0
- read_iops_sec = 0
- read_iops_sec_max = 0
- size_iops_sec = 0
- total_bytes_sec = 0
- total_bytes_sec_max = 0
- total_iops_sec = 3000
- total_iops_sec_max = 0
- write_bytes_sec = 0
- write_bytes_sec_max = 0
- write_iops_sec = 0
- write_iops_sec_max = 0
- }
-
- #настройки для удаления диска
-
- #флаг для удаления диска
+ #тип - блок
+ #тип вложенных полей - целое число
+ #используется при создании и обновлении
+ #iotune = {
+ #read_bytes_sec = 0
+ #read_bytes_sec_max = 0
+ #read_iops_sec = 0
+ #read_iops_sec_max = 0
+ #size_iops_sec = 0
+ #total_bytes_sec = 0
+ #total_bytes_sec_max = 0
+ #total_iops_sec = 3000
+ #total_iops_sec_max = 0
+ #write_bytes_sec = 0
+ #write_bytes_sec_max = 0
+ #write_iops_sec = 0
+ #write_iops_sec_max = 0
+ #}
+
+ #флаг для удаления диска, без возможности восстановления
#опциональный параметр
#тип - булев
+ #по умолчанию - true
+ #используется при удалении
#permanently = true
#флаг отсоединения диска от машины перед удалением
#опциональный параметр
#тип - булев
+ #по умолчанию - true
+ #используется при удалении
#detach = true
}
diff --git a/samples/cloudapi/extnet/data_extnet_list/main.tf b/samples/cloudapi/extnet/data_extnet_list/main.tf
index 4ddee0b..22e11f5 100644
--- a/samples/cloudapi/extnet/data_extnet_list/main.tf
+++ b/samples/cloudapi/extnet/data_extnet_list/main.tf
@@ -62,6 +62,11 @@ data "dynamix_extnet_list" "el" {
#тип - строка
#status = "ENABLED"
+ #имя моста openVswitch
+ #опциональный параметр
+ #тип - строка
+ #ovs_bridge = "ovs_bridge_name"
+
#сортировка по одному из поддерживаемых полей
#опциональный параметр
#тип - строка
diff --git a/samples/cloudapi/flipgroup/resource_flipgroup/main.tf b/samples/cloudapi/flipgroup/resource_flipgroup/main.tf
index 62dc79f..5834516 100644
--- a/samples/cloudapi/flipgroup/resource_flipgroup/main.tf
+++ b/samples/cloudapi/flipgroup/resource_flipgroup/main.tf
@@ -35,42 +35,50 @@ resource "dynamix_flipgroup" "fg" {
#id аккаунта
#обязательный параметр
#тип - целое число
+ #используется при создании
account_id = 999
#наименование Flipgroup
#обязательный параметр
#тип - строка
+ #используется при создании и обновлении
name = "flipgroup_name"
#тип сети (EXTNET, ViNS)
#обязательный параметр
#тип - строка
+ #используется при создании
net_type = "EXTNET"
#id сети
#обязательный параметр
#тип - целое число
+ #используется при создании
net_id = 13
#тип клиентов (в данный момент поддерживается только тип 'compute')
#обязательный параметр
#тип - строка
+ #используется при создании
client_type = "compute"
#ip-адрес
#опциональный параметр
#тип - строка
- ip = "127.0.0.1"
+ #используется при создании
+ #ip = "127.0.0.1"
#список клиентов, прикрепленных к флипгруппе
#опциональный параметр
#тип - массив целых чисел
- client_ids = [11269]
+ #используется при создании и обновлении
+ #client_ids = [11269]
#описание флипгруппы
#опциональный параметр
#тип - строка
- desc = "CHANGED"
+ #используется при создании и обновлении
+ #desc = "CHANGED"
}
output "fg_out" {
diff --git a/samples/cloudapi/k8s/resource_k8s_cp/main.tf b/samples/cloudapi/k8s/resource_k8s_cp/main.tf
index 6abae86..2a7d26a 100644
--- a/samples/cloudapi/k8s/resource_k8s_cp/main.tf
+++ b/samples/cloudapi/k8s/resource_k8s_cp/main.tf
@@ -36,144 +36,190 @@ resource "dynamix_k8s_cp" "cp" {
#название кластера
#обязательный параметр
#тип - строка
+ #используется при создании и обновлении
name = "k8s-cp"
- #K8sCI ID
+ #k8sCI ID
#обязательный параметр
#тип - целое число
+ #используется при создании
k8sci_id = 55
#плагин сети (flannel, weavenet или calico)
#обязательный параметр
#тип - строка
+ #используется при создании
network_plugin = "flannel"
#id ресурсной группы
#обязательный параметр
#тип - целое число
+ #используется при создании
rg_id = 1387
#кол-во ядер мастер-узла
#опциональный параметр
#тип - целое число
- cpu = 2
+ #используется при создании
+ #cpu = 2
- #объем RAM мастер-узла
+ #объем RAM мастер-узла, в МБ
#опциональный параметр
#тип - целое число
- ram = 2048
+ #используется при создании
+ #ram = 2048
#кол-во ВМ мастер-узла (1, 3 или 5)
#опциональный параметр
#тип - целое число
- num = 1
+ #используется при создании и обновлении
+ #num = 1
- #размер диска мастер-узла
+ #размер диска мастер-узла, в ГБ
#опциональный параметр
#тип - целое число
- disk = 10
+ #используется при создании
+ #disk = 10
#описание кластера
#опциональный параметр
#тип - строка
- desc = ""
+ #используется при создании и обновлении
+ #desc = ""
#id extnet
#опциональный параметр
#тип - целое число
- extnet_id = 0
+ #используется при создании
+ #extnet_id = 0
#id vins
#опциональный параметр
#тип - целое число
- vins_id = 1234
+ #используется при создании
+ #vins_id = 1234
#storage Endpoint ID
#опциональный параметр
#тип - целое число
- sep_id = 0
+ #используется при создании
+ #sep_id = 0
- #SEP Pool
+ #sep pool
#опциональный параметр
#тип - строка
- sep_pool = "pool"
+ #используется при создании
+ #sep_pool = "pool"
#старт/стоп кластера
#опциональный параметр
+ #по умолчанию - false
#тип - булев
- start = true
+ #используется при создании и обновлении
+ #start = true
+
+ #флаг доступности кластера
+ #опциональный параметр
+ #по умолчанию - true
+ #тип - булев
+ #enable = true
#создать кластер с/без балансировщика нагрузки
#опциональный параметр
+ #по умолчанию - true
#тип - булев
- with_lb = true
+ #используется при создании
+ #with_lb = true
- #позволяет создать схему отказоустройчивой LB
+ #создать схему отказоустойчивой LB
#опциональный параметр
+ #по умолчанию - false
#тип - булев
- ha_mode = true
+ #используется при создании
+ #ha_mode = true
#дополнительные SAN (Subject Alternative Names) для использования в процессе автоматического выписывания сертификата Кластера Kubernetes;
#возможность взаимодействовать с кластером по FQDN
#параметр получает список строк – IP-адреса и/или DNS (по формату RFC 1123 c поддержкой wildcard)
#опциональный параметр
#тип - массив строк
- additional_sans = ["192.168.201.0","192.168.201.1"]
+ #используется при создании
+ #additional_sans = ["192.168.201.0","192.168.201.1"]
#используется для определения настроек и действий, которые должны быть выполнены перед запуском любого другого компонента в кластере
#это позволяет вам настраивать такие вещи, как регистрация node, настройка network и другие задачи инициализации
#опциональный параметр
#тип - строка
- init_config = "{JSON string}"
+ #используется при создании
+ #init_config = "{JSON string}"
#используется для определения глобальных настроек и конфигураций для всего кластера
#он включает в себя такие параметры, как имя кластера, настройки DNS, методы аутентификации и другие конфигурации в масштабах кластера
#опциональный параметр
#тип - строка
- cluster_config = "{JSON string}"
+ #используется при создании
+ #cluster_config = "{JSON string}"
#используется для настройки поведения и параметров Kubelet, который является агентом primary node, запускаемым на каждом node кластера
#он включает в себя такие параметры, как IP-адрес node, распределение ресурсов, политики удаления модулей и другие конфигурации, специфичные для Kubelet
#опциональный параметр
#тип - строка
- kubelet_config = "{JSON string}"
+ #используется при создании
+ #kubelet_config = "{JSON string}"
#используется для настройки поведения и параметров присоединения node к кластеру
#он включает в себя такие параметры, как режим прокси-сервера, диапазоны IP-адресов кластера и другие конфигурации, специфичные для Kube-proxy
#опциональный параметр
#тип - строка
- kube_proxy_config = "{JSON string}"
+ #используется при создании
+ #kube_proxy_config = "{JSON string}"
#используется для настройки поведения и параметров присоединения node к кластеру
#он включает в себя такие параметры, как cluster's control plane endpoint, токен и ключ сертификата
#опциональный параметр
#тип - строка
- join_config = "{JSON string}"
+ #используется при создании
+ #join_config = "{JSON string}"
#при создании кластре использовать подключение только к сети ExtNet
#опциональный параметр
+ #по умолчанию - false
#тип - булев
- extnet_only = true
+ #используется при создании
+ #extnet_only = true
#добавить ssl-сертификат в формате x509 pem
- #необязательный параметр
- #тип - файл с форматом в виде x509 pem
- oidc_cert = file("ca.crt")
+ #опциональный параметр
+ #тип - файл с форматом в виде .crt
+ #используется при создании
+ #oidc_cert = file("ca.crt")
#тип эмулируемой системы
#опциональный параметр
#тип - строка
- chipset = "i440fx"
+ #используется при создании
+ #chipset = "i440fx"
#пользовательские значения sysctl для LB
#опциональный параметр
- #тип - список мап
- lb_sysctl_params = [{text = "1", text = "some"}]
+ #тип - массив мап
+ #используется при создании и обновлении
+ #lb_sysctl_params = [{ key1 = "value1", key2 = "value2" }]
+
+ #флаг для удаления k8s_cp, без возможности восстановления
+ #опциональный параметр
+ #тип - булев
+ #по умолчанию - true
+ #используется при удалении
+ #permanently = true
- #команда destroy удаляет кластер без возможности восстановления
+ #восстановление группы после удаления
#опциональный параметр
+ #используется при редактировании ресурса
+ #по умолчанию - true
#тип - булев
- permanently = true
+ #используется при обновлении
+ #restore = true
}
output "cp_out" {
diff --git a/samples/cloudapi/k8s/resource_k8s_wg/main.tf b/samples/cloudapi/k8s/resource_k8s_wg/main.tf
index 4c91607..f8b7069 100644
--- a/samples/cloudapi/k8s/resource_k8s_wg/main.tf
+++ b/samples/cloudapi/k8s/resource_k8s_wg/main.tf
@@ -31,64 +31,85 @@ resource "dynamix_k8s_wg" "wg" {
#id экземпляра k8s
#обязательный параметр
#тип - целое число
+ #используется при создании
k8s_id = 1234
#имя worker group
#обязательный параметр
#тип - строка
+ #используется при создании
name = "workers-2"
#количество worker node для создания
#опциональный параметр
#тип - целое число
- #по - умолчанию - 1
- num = 2
+ #по умолчанию - 1
+ #используется при создании и обновлении
+ #num = 2
- #тип эмулируемой системы worker nodes
+ #тип эмулируемой системы
#опциональный параметр
#тип - строка
- worker_chipset = "i440fx"
+ #используется при создании
+ #chipset = "i440fx"
#количество cpu для 1 worker node
#опциональный параметр
#тип - целое число
- #по - умолчанию - 1
- cpu = 1
+ #по умолчанию - 1
+ #используется при создании
+ #cpu = 1
- #тип эмулируемой системы worker группы
+ #количество RAM для одной worker node в МБ
#опциональный параметр
- #тип - строка
- chipset = "i440fx"
+ #тип - целое число
+ #по умолчанию - 1024
+ #используется при создании
+ #ram = 1024
- #количество RAM для одной worker node в Мбайтах
+ #размер загрузочного диска для worker node, в ГБ
#опциональный параметр
+ #по умолчанию - 0
+ #если установлен параметр 0, то размер диска будет равен размеру образа
#тип - целое число
- #по-умолчанию - 1024
- ram = 1024
+ #используется при создании
+ #disk = 10
- #размер загрузочного диска для worker node, в Гбайтах
+ #список строк с labels для worker группы, в формате: ["label1=value1", "label2=value2"]
#опциональный параметр
- #тип - целое число
- #по - умолчанию - 0
- #если установлен параметр 0, то размер диска будет равен размеру образа
- disk = 10
+ #тип - массив строк
+ #используется при создании
+ #labels = ["label1=value1", "label2=value2"]
- #id SEP'а для создания загрузочных дисков для группы worker node по умолчанию,
- #если не указан, используется sep_id образа
+ #список строк с annotations для worker группы, в формате: ["key1=value1", "key2=value2"]
+ #опциональный параметр
+ #тип - массив строк
+ #используется при создании
+ #annotations = ["key1=value1", "key2=value2"]
+
+ #список строк с taints для worker группы, в формате: ["key1=value1:NoSchedule", "key2=value2:NoExecute"]
+ #опциональный параметр
+ #тип - массив строк
+ #используется при создании
+ #taints = ["key1=value1", "key2=value2"]
+
+ #id СХД для создания загрузочных дисков для Worker-групп по умолчанию. Использует sepId образа, если не указан.
#опциональный параметр
#тип - целое число
- worker_sep_id = 1
+ #используется при создании
+ #worker_sep_id = 1
- #pool для использования, если установлен worker_sep_id, если не указан, выбирается системой
+ #пул для хранения Workers. Если не заполнить, будет выбран системой
#опциональный параметр
- #тип - строка
- worker_sep_pool = "pool"
+ #тип - целое число
+ #используется при создании
+ #worker_sep_pool = "worker_pool"
- #Перечень аргументов для cloud-init для виртуальных машин worker групп
+ #перечень аргументов для cloud-init для виртуальных машин worker групп
#опциональный параметр
- #тип - файл с форматом в виде yaml
- #используется при создании и обновлении ресурса
- cloud_init = file("initconfig.tftpl")
+ #тип - файл в формате YAML
+ #используется при создании и обновлении
+ #cloud_init = file("initconfig.tftpl")
}
diff --git a/samples/cloudapi/kvmvm/resource_kvmvm/main.tf b/samples/cloudapi/kvmvm/resource_kvmvm/main.tf
index d8bb454..c2d9eeb 100644
--- a/samples/cloudapi/kvmvm/resource_kvmvm/main.tf
+++ b/samples/cloudapi/kvmvm/resource_kvmvm/main.tf
@@ -35,360 +35,398 @@ resource "dynamix_kvmvm" "comp" {
#может быть изменен
#обязательный параметр
#тип - строка
+ #используется при создании и обновлении
name = "test-tf-compute-update-new"
#id resource group
#обязательный параметр
#тип - целое число
+ #используется при создании
rg_id = 1111
#тип драйвера для compute
#обязательный параметр
#тип - строка
#возможные значения: "SVA_KVM_X86", "KVM_X86"
+ #используется при создании
driver = "KVM_X86"
#число cpu
#обязательный параметр
#тип - целое число
+ #используется при создании и обновлении
cpu = 1
#кол-во оперативной памяти, МБ
#обязательный параметр
#тип - целое число
#возможные значения: кратные 128
+ #используется при создании и обновлении
ram = 2048
#размер загрузочного диска
#опциональный параметр
#тип - целое число
- boot_disk_size = 20
+ #используется при создании и обновлении
+ #boot_disk_size = 20
#тип эмулируемой системы
#опциональный параметр
#тип - строка
#возможные значения: "i440fx", "Q35"
- chipset = "i440fx"
+ #используется при создании и обновлении
+ #chipset = "i440fx"
#id сепа для boot диска
#опциональный параметр
#тип - целое число
- sep_id = 1
+ #используется при создании
+ #sep_id = 1
#название пула
#опциональный параметр
#тип - строка
- pool = "data02"
+ #используется при создании
+ #pool = "data02"
#конфигурация cloud init
#опциональный параметр
#тип - файл в формате JSON
- cloud_init = file("initconfig.tftpl")
+ #используется при создании
+ #cloud_init = file("initconfig.tftpl")
#описание compute
#опциональный параметр
#тип - строка
- description = "test update description in tf words update"
+ #используется при создании и обновлении
+ #description = "test update description in tf words update"
#id образа диска для создания compute
#опциональный параметр
#тип - целое число
- image_id = 111
+ #используется при создании и обновлении
+ #image_id = 111
#создание без загрузочного диска в остановленном состоянии
#опциональный параметр
#если значение равно True, параметры image_id, boot_disk_size, sep_id, pool должны быть пустыми
#тип - булев
- without_boot_disk = true
+ #используется при создании
+ #without_boot_disk = true
#необходимость выравнивать ВМ по NUMA
#опциональный параметр
#возможные значения - "none "strict" "loose"
#по умолчанию - "none"
#тип - строка
- numa_affinity = "loose"
+ #используется при создании и обновлении
+ #numa_affinity = "loose"
#необходимость запускать ВМ на выделенных CPU ядрах
#опциональный параметр
#по умолчанию - false
#тип - булев
- cpu_pin = true
+ #используется при создании и обновлении
+ #cpu_pin = true
#необходимость использовать для выделения RAM виртуальной машины Huge Pages
#опциональный параметр
#по умолчанию - false
#тип - булев
- hp_backed = true
+ #используется при создании и обновлении
+ #hp_backed = true
#список PCI девайсов
#опциональный параметр
#тип - массив целых чисел
- pci_devices = [1,2]
+ #используется при создании и обновлении
+ #pci_devices = [1,2]
#правила affinity
#опциональный параметр
#может быть один, несколько или ни одного
#тип - список объектов правил
- affinity_rules = [{
+ #используется при создании и обновлении
+ #affinity_rules = [{
#тип правила
#обязательный параметр
#возможные значения - compute или node
#тип - строка
- topology = "compute"
+ #topology = "compute"
#строгость правила
#обязательный параметр
#возможные значения - RECOMMENDED и REQUIRED
#тип - строка
- policy = "RECOMMENDED"
+ #policy = "RECOMMENDED"
#режим проверки
#обязательный параметр
#возможные значения - ANY, EQ, NE
#тип - строка
- mode = "ANY"
+ #mode = "ANY"
#ключ правила
#обязательный параметр
#тип - строка
- key = "testkey"
+ #key = "testkey"
#ключ правила
#опциональный параметр
#тип - строка
- value = "testvalue"
- }]
+ #value = "testvalue"
+ #}]
#правила anti-affinity
#опциональный параметр
#может быть один, несколько или ни одного
#тип - список объектов правил
- anti_affinity_rules = [{
+ #используется при создании и обновлении
+ #anti_affinity_rules = [{
#тип правила
#обязательный параметр
#возможные значения - compute или node
#тип - строка
- topology = "compute"
+ #topology = "compute"
#строгость правила
#обязательный параметр
#возможные значения - RECOMMENDED и REQUIRED
#тип - строка
- policy = "RECOMMENDED"
+ #policy = "RECOMMENDED"
#режим проверки
#обязательный параметр
#возможные значения - ANY, EQ, NE
#тип - строка
- mode = "ANY"
+ #mode = "ANY"
#ключ правила
#обязательный параметр
#тип - строка
- key = "testkey"
+ #key = "testkey"
#ключ правила
#опциональный параметр
#тип -строка
- value = "testvalue"
- }]
+ #value = "testvalue"
+ #}]
#установка метки для вм
#опциональный параметр
#тип - строка
- affinity_label = "test4"
+ #используется при создании и обновлении
+ #affinity_label = "test4"
#Управление XML виртуальной машины
#опциональный параметр
#тип - строка (json-encoded)
- custom_fields = "{`key`:`value`}"
+ #используется при создании и обновлении
+ #custom_fields = "{`key`:`value`}"
#наименование системы
#опциональный параметр
#используется при создании вм
#по умолчанию - не задан
#тип - строка
- is = ""
+ #используется при создании
+ #is = ""
#назначение вм
#опциональный параметр
#используется при создании вм
#по умолчанию - не задан
#тип - строка
- ipa_type = ""
+ #используется при создании
+ #ipa_type = ""
#id экстра дисков
#опциональный параметр
#тип - массив целых чисел
- extra_disks = [1234, 4322, 1344]
+ #используется при создании и обновлении
+ #extra_disks = [1234, 4322, 1344]
#присоединения сетей и удаление сетей в компьюте
#опциональный параметр
#тип - список объектов сетей
- network = [{
+ #используется при создании и обновлении
+ #network = [{
#тип сети
#обязательный параметр
#тип - строка
#возможные значения - "VINS", "EXTNET", "VFNIC", "DPDK" (при выборе типа DPDK, необходимо указать hp_backed = true)
- net_type = "VINS"
+ #net_type = "VINS"
#id сети
#обязательный параметр
#тип - целое число
- net_id = 1234
+ #net_id = 1234
#ip адрес входящий в сеть
#опциональный параметр
#тип - строка
- ip_address = "127.0.0.1"
+ #ip_address = "127.0.0.1"
+
+ #mac-адрес интерфейса компьюта
+ #опциональный параметр
+ #тип - строка
+ #mac = "52:54:01:12:34:60"
#вес сети, указывается при необходимости указания порядка подключения сетей
#первой подключается сеть с наименьшим весом
#сеть с нулевым или неуказанным весом имеет наименьший приоритет
#опциональный параметр
#тип - целое число
- weight = 15
+ #weight = 15
#максимальный объём данных, который может быть передан за одну итерацию
#используется только с сетями типа "DPDK"
#возможные значения - 1-9216
#опциональный параметр
#тип - целое число
- mtu = 1500
- }]
+ #mtu = 1500
+ #}]
#добавление и удаление тэгов
#опциональный параметр
#тип - список тэгов
- tags = [{
+ #используется при создании и обновлении
+ #tags = [{
#ключ для тэга
#обязательный параметр
#тип - строка
- key = "key"
+ #key = "key"
#значения тэга
#обязательный параметр
#тип - строка
- value = "value"
- }]
+ #value = "value"
+ #}]
#добавление и удаление port forwarding
#опциональный параметр
#тип - список объектов переадресации портов
- port_forwarding = [{
+ #используется при создании и обновлении
+ #port_forwarding = [{
#номер внешнего начального порта для правила
#Обязательный параметр
#тип - целое число
- public_port_start = 2023
+ #public_port_start = 2023
#номер внешнего последнего порта для правила
#опциональный параметр
#тип - целое число
#по умолчанию - -1
- public_port_end = 2023
+ #public_port_end = 2023
#номер внутреннего базового порта
#обязательный параметр
#тип - целое число
- local_port = 80
+ #local_port = 80
#сетевой протокол
- #Обязательный параметр
+ #обязательный параметр
#тип - строка
- proto = "tcp"
- }]
+ #proto = "tcp"
+ #}]
#предоставить/забрать пользователю доступ к компьюту
#опциональный параметр
#тип - список объектов прав пользователя
- user_access = [{
+ #используется при создании и обновлении
+ #user_access = [{
#имя юзера, которому предоставляем доступ
#обязательный параметр
#тип - строка
- username = "some@decs3o"
+ #username = "some@decs3o"
#права: 'R' - только на чтение, 'RCX' - чтение/запись, 'ARCXDU' - админ
#обязательный параметр
#тип - строка
- access_type = "ARCXDU"
- }]
+ #access_type = "ARCXDU"
+ #}]
#создать/удалить снапшот компьюта
#опциональный параметр
#тип - список объектов снапшотов
- snapshot = [{
+ #используется при создании и обновлении
+ #snapshot = [{
#лейбл снапшота
#обязательный параметр
#тип - строка
- label = "label1"
- }]
+ #label = "label1"
+ #}]
+
+ #флаг для удаления снапшотов в асинхронном режиме
+ #опциональный параметр
+ #по умолчанию - false
+ #тип - булев
+ #используется при удалении
+ #snapshot_delete_async = true
#rollback на нужный снапшот
#опциональный параметр
#не имеет смысла при отсутсвии снапшотов
#тип - объект
- rollback = {
- #Лейбл снапшота
- #Обязательный параметр
+ #используется при обновлении
+ #rollback = {
+ #лейбл снапшота
+ #обязательный параметр
#тип - строка
- label = "label1"
- }
+ #label = "label1"
+ #}
#вставить/удалить СD rom
#опциональный параметр
- #максимальное кол-во - 1
- #тип - объект
- cd = {
- #id образа диска CD rom
- #обязательный параметр
- #тип - целое число
- cdrom_id = 344
- }
+ #тип - целое число
+ #используется при создании и обновлении
+ #cd_image_id = 344
#список ядер для использования в механизме vcpupinning. Количество указанных ядер должно быть равно количеству виртуальных процессоров ВМ
#игнорируется если cpu_pin=false или pin_to_stack=false
#опциональный параметр
#тип - массив целых чисел
- preferred_cpu = [1234, 456]
+ #используется при создании и обновлении
+ #preferred_cpu = [1234, 456]
#добавить компьют на стэк
#опциональный параметр
#тип - булев
- pin_to_stack = true
+ #используется при создании и обновлении
+ #pin_to_stack = true
#флаг для старта компьюта при рестарте ноды
#опциональный параметр
#тип - булев
- auto_start_w_node = true
+ #используется при создании и обновлении
+ #auto_start_w_node = true
#флаг доступности компьюта для проведения с ним операций
#опциональный параметр
#тип - булев
- enabled = true
+ #используется при создании и обновлении
+ #enabled = true
#pause/resume компьюта
#опциональный параметр
#тип - булев
#по умолчанию - false
- pause = true
+ #используется при создании и обновлении
+ #pause = true
#reset компьюта
#опциональный параметр
#тип - булев
#по умолчанию - false
- reset = true
+ #используется при обновлении
+ #reset = true
#восстановить компьют из корзины
#опциональный параметр
#тип - булев
#по умолчанию - true
- restore = true
-
- #флаг для редеплоя компьюта
- #опциональный параметр
- #тип - булев
- #по умолчанию - false
- auto_start = true
+ #используется при обновлении
+ #restore = true
#флаг для редеплоя компьюта
#опциональный параметр
@@ -400,31 +438,56 @@ resource "dynamix_kvmvm" "comp" {
#опциональный параметр
#тип - булев
#по умолчанию - false
- force_resize = true
-
- #поле для редеплоя компьюта
- #опциональный параметр
- #тип - строка
- #возможные значения - "KEEP", "DETACH", "DESTROY"
- data_disks = "KEEP"
+ #используется при обновлении
+ #force_resize = true
#запуск/стоп компьюта
#опциональный параметр
#тип - булев
#по умолчанию - true
- started = true
+ #используется при создании и обновлении
+ #started = true
#detach диска при удалении компьюта
#опциональный параметр
#тип - булев
#по умолчанию - true
- detach_disks = true
+ #используется при удалении
+ #detach_disks = true
#флаг для удаления компьюта
#опциональный параметр
#тип - булев
#по умолчанию - true
- permanently = false
+ #используется при удалении
+ #permanently = false
+
+ #тип вм
+ #возможные значения - linux, windows, unknown
+ #опциональный параметр
+ #тип - строка
+ #используется при создании и обновлении
+ #loader_type = "unknown"
+
+ #тип загрузки образа
+ #возможные значения - bios, uefi
+ #опциональный параметр
+ #тип - строка
+ #используется при создании и обновлении
+ #boot_type = "bios"
+
+ #изменение размера ВМ
+ #опциональный параметр
+ #тип - булев
+ #используется при создании и обновлении
+ #hot_resize = false
+
+ #наименование сетевого интерфейса
+ #возможные значения - eth, ens
+ #опциональный параметр
+ #тип - строка
+ #используется при создании и обновлении
+ #network_interface_naming = "ens"
}
diff --git a/samples/cloudapi/lb/resource_lb/main.tf b/samples/cloudapi/lb/resource_lb/main.tf
index af570d8..3293635 100644
--- a/samples/cloudapi/lb/resource_lb/main.tf
+++ b/samples/cloudapi/lb/resource_lb/main.tf
@@ -31,26 +31,30 @@ provider "dynamix" {
}
resource "dynamix_lb" "lb" {
- #id ресурсной группы для со
+ #id ресурсной группы
#обязательный параметр
#тип - целое число
+ #используется при создании
rg_id = 1111
#наименование load balancer
#обязательный параметр
#тип - строка
+ #используется при создании
name = "tf-test-lb"
#id внешней сети
#опциональный параметр
#id внешней сети и id виртуальной сети не могут быть одновременно = 0
#тип - целое число
+ #используется при создании
#extnet_id = 6
#id виртуальной сети
#опциональный параметр
#id внешней сети и id виртуальной сети не могут быть одновременно = 0
#тип - целое число
+ #используется при создании
#vins_id = 758
#флаг запуска load balancer
@@ -59,33 +63,41 @@ resource "dynamix_lb" "lb" {
#то для успешного старта, он должен быть доступен (enable = true)
#по умолчанию - true
#тип - булев
- #start = true
+ #используется при создании и обновлении
+ start = true
#позволяет создать схему отказоустройчивой LB
#опциональный параметр
#тип - булев
+ #по умолчанию - false
+ #используется при создании и обновлении
#ha_mode = true
#описание
#опциональный параметр
#тип - строка
+ #используется при создании и обновлении
#desc = "temp super lb for testing tf provider"
#флаг доступности load balancer
#опциональный параметр
#тип - булев
+ #по умолчанию - true
+ #используется при создании и обновлении
#enable = true
#флаг перезапуска load balancer
#перезагрузка срабатывает только при изменении флага с false или null на true
#опциональный параметр
#тип - булев
+ #используется при обновлении
#restart = false
#флаг сброса конфигурации load balancer
#сброс срабатывает только при изменении флага с false или null на true
#опциональный параметр
#тип - булев
+ #используется при обновлении
#config_reset = false
#флаг моментального удаления load balancer
@@ -93,6 +105,7 @@ resource "dynamix_lb" "lb" {
#применяется при выполнении команды terraform destroy
#по умолчанию - true
#тип - булев
+ #используется при удалении
#permanently = true
#флаг восстановления load balancer
@@ -100,6 +113,7 @@ resource "dynamix_lb" "lb" {
#восстановить можно load balancer, удаленным с флагом permanently = false
#по умолчанию - true
#тип - булев
+ #используется при обновлении
#restore = true
#флаг используемый при рестарте load balancer
@@ -107,11 +121,13 @@ resource "dynamix_lb" "lb" {
#при значении "true" рестарт производится на обоих нодах в HA mode
#значение по умолчанию - true
#тип - булев
+ #используется при обновлении
#safe = true
#пользовательские значения sysctl для LB
#опциональный параметр
#тип - список мап
+ #используется при создании и обновлении
#sysctl_params = [{key = "1", value = "some" }]
}
diff --git a/samples/cloudapi/lb/resource_lb_backend/main.tf b/samples/cloudapi/lb/resource_lb_backend/main.tf
index e42c7d1..bef85ca 100644
--- a/samples/cloudapi/lb/resource_lb_backend/main.tf
+++ b/samples/cloudapi/lb/resource_lb_backend/main.tf
@@ -34,11 +34,13 @@ resource "dynamix_lb_backend" "lb" {
#id балансировщика нагрузок
#обязательный параметр
#тип - целое число
+ #используется при создании
lb_id = 668
#имя бекенда для создания сервера
#обязательный параметр
#тип - строка
+ #используется при создании
name = "testBackend"
#алгоритм балансировки
@@ -46,6 +48,7 @@ resource "dynamix_lb_backend" "lb" {
#по умолчанию - "roundrobin"
#доступные значения - "roundrobin", "static-rr", "leastconn"
#тип - строка
+ #используется при создании и обновлении
#algorithm = "roundrobin"
#-------------------
@@ -56,42 +59,49 @@ resource "dynamix_lb_backend" "lb" {
#опциональный параметр
#по умолчанию - 5000
#тип - целое число
+ #используется при создании и обновлении
#inter = 5000
#интервал между проверками доступности сервера после восстановления, в миллисекундах
#опциональный параметр
#по умолчанию - 1000
#тип - целое число
+ #используется при создании и обновлении
#downinter = 1000
#кол-во проверок, которые сервер должен успешно пройти
#опциональный параметр
#по умолчанию - 2
#тип - целое число
+ #используется при создании и обновлении
#rise = 2
#кол-во проверок, которые сервер может не пройти и после этого получить статус "unavailable"
#опциональный параметр
#по умолчанию - 2
#тип - целое число
+ #используется при создании и обновлении
#fall = 2
#кол-во миллисекунд - время между получением сервера статуса "available" и открытием соединений
#опциональный параметр
#по умолчанию - 60000
#тип - целое число
+ #используется при создании и обновлении
#slowstart = 60000
#максимальное кол-во соединений сервера, при достижении этого кол-ва, сервер выходит из схемы балансирования
#опциональный параметр
#по умолчанию - 250
#тип - целое число
+ #используется при создании и обновлении
#maxconn = 250
#максимальное кол-во соединений в очереди сервера, при достижении этого кол-ва, соединения будут перенаправлены на другой сервер
#опциональный параметр
#по умолчанию - 256
#тип - целое число
+ #используется при создании и обновлении
#maxqueue = 256
#вес сервера для балансировки
@@ -100,6 +110,7 @@ resource "dynamix_lb_backend" "lb" {
#макс - 255
#по умолчанию - 100
#тип - целое число
+ #используется при создании и обновлении
#weight = 100
}
diff --git a/samples/cloudapi/lb/resource_lb_backend_server/main.tf b/samples/cloudapi/lb/resource_lb_backend_server/main.tf
index 4d10c1b..0c4bc71 100644
--- a/samples/cloudapi/lb/resource_lb_backend_server/main.tf
+++ b/samples/cloudapi/lb/resource_lb_backend_server/main.tf
@@ -34,26 +34,31 @@ resource "dynamix_lb_backend_server" "lb" {
#id балансировщика нагрузок
#обязательный параметр
#тип - целое число
+ #используется при создании
lb_id = 668
#имя бекенда для создания сервера
#обязательный параметр
#тип - строка
+ #используется при создании
backend_name = "testBackend"
#имя сервера
#обязательный параметр
#тип - строка
+ #используется при создании и обновлении
name = "testServer"
#ip адрес сервера
#обязательный параметр
#тип - строка
+ #используется при создании и обновлении
address = "192.168.5.33"
#порт сервера
#обязательный параметр
#тип - целое число
+ #используется при создании и обновлении
port = 6553
#проверка доступности сервера
@@ -61,48 +66,56 @@ resource "dynamix_lb_backend_server" "lb" {
#по умолчанию - "enabled"
#доступные значения - "disabled", "enabled"
#тип - строка
+ #используется при создании и обновлении
#check = "enabled"
#интервал между проверками, в миллисекундах
#опциональный параметр
#по умолчанию - 5000
#тип - целое число
+ #используется при создании и обновлении
#inter = 5000
#интервал между проверками доступности сервера после восстановления, в миллисекундах
#опциональный параметр
#по умолчанию - 1000
#тип - целое число
+ #используется при создании и обновлении
#downinter = 1000
#кол-во проверок, которые сервер должен успешно пройти
#опциональный параметр
#тип - целое число
#по умолчанию - 2
+ #используется при создании и обновлении
#rise = 2
#кол-во проверок, которые сервер может не пройти и после этого получить статус "unavailable"
#опциональный параметр
#по умолчанию - 2
#тип - целое число
+ #используется при создании и обновлении
#fall = 2
#кол-во миллисекунд - время между получением сервера статуса "available" и открытием соединений
#опциональный параметр
#по умолчанию - 60000
#тип - целое число
+ #используется при создании и обновлении
#slowstart = 60000
#максимальное кол-во соединений сервера, при достижении этого кол-ва, сервер выходит из схемы балансирования
#опциональный параметр
#по умолчанию - 250
#тип - целое число
+ #используется при создании и обновлении
#maxconn = 250
#максимальное кол-во соединений в очереди сервера, при достижении этого кол-ва, соединения будут перенаправлены на другой сервер
#опциональный параметр
#по умолчанию - 256
#тип - целое число
+ #используется при создании и обновлении
#maxqueue = 256
#вес сервера для балансировки
@@ -111,6 +124,7 @@ resource "dynamix_lb_backend_server" "lb" {
#макс - 255
#по умолчанию - 100
#тип - целое число
+ #используется при создании и обновлении
#weight = 100
}
diff --git a/samples/cloudapi/lb/resource_lb_frontend/main.tf b/samples/cloudapi/lb/resource_lb_frontend/main.tf
index 3438701..20e8af2 100644
--- a/samples/cloudapi/lb/resource_lb_frontend/main.tf
+++ b/samples/cloudapi/lb/resource_lb_frontend/main.tf
@@ -33,16 +33,19 @@ resource "dynamix_lb_frontend" "lb" {
#id балансировщика нагрузок
#обязательный параметр
#тип - целое число
+ #используется при создании
lb_id = 668
#имя бекенда для создания фронтенда
#обязательный параметр
#тип - строка
+ #используется при создании
backend_name = "testBackend"
#имя фронтенда
#обязательный параметр
#тип - строка
+ #используется при создании
name = "testFrontend"
}
diff --git a/samples/cloudapi/lb/resource_lb_frontend_bind/main.tf b/samples/cloudapi/lb/resource_lb_frontend_bind/main.tf
index c816224..9d89787 100644
--- a/samples/cloudapi/lb/resource_lb_frontend_bind/main.tf
+++ b/samples/cloudapi/lb/resource_lb_frontend_bind/main.tf
@@ -34,26 +34,31 @@ resource "dynamix_lb_frontend_bind" "lb" {
#id балансировщика нагрузок
#обязательный параметр
#тип - целое число
+ #используется при создании
lb_id = 668
#имя фронтенда для создания привязки
#обязательный параметр
#тип - строка
+ #используется при создании
frontend_name = "testFrontend"
#наименование привязки
#обязательный параметр
#тип - строка
+ #используется при создании и обновлении
name = "testBinding"
#адрес привязки фронтенда
#обязательный параметр
#тип - строка
+ #используется при создании и обновлении
address = "111.111.111.111"
#порт для привязки фронтенда
#обязательный параметр
#тип - целое число
+ #используется при создании и обновлении
port = 1111
}
diff --git a/samples/cloudapi/rg/resource_rg/main.tf b/samples/cloudapi/rg/resource_rg/main.tf
index c26d6a0..25ba675 100644
--- a/samples/cloudapi/rg/resource_rg/main.tf
+++ b/samples/cloudapi/rg/resource_rg/main.tf
@@ -34,148 +34,168 @@ resource "dynamix_resgroup" "rg" {
#имя ресурсной группы
#обязательный параметр
#тип - строка
+ #используется при создании и обновлении
name = "testing_rg_1"
#id аккаунта которому будет принадлежать ресурсная группа
#обязательный параметр
#тип - целое число
+ #используется при создании
account_id = 123
- #id сети
+ #id платформы
#обязательный параметр
#тип - целое число
+ #используется при создании
gid = 1234
#тип сети по умолчанию для этой ресурсной группы
#опциональный параметр
#виртуальные машины, созданные в этой RG, по умолчанию будут подключены к этой сети
#допустимые значения: PRIVATE, PUBLIC, NONE
+ #по умолчанию - PRIVATE
#тип - строка
- def_net_type = "NONE"
+ #используется при создании
+ #def_net_type = "NONE"
#ip cidr частной сети, если сеть по умолчанию PRIVATE
#опциональный параметр
#тип - строка
- ipcidr = "1.1.1.1"
+ #используется при создании
+ #ipcidr = "1.1.1.1"
#id внешней сети
#опциональный параметр
#тип - целое число
- ext_net_id = 123
+ #используется при создании
+ #ext_net_id = 123
#ip внешней сети
#опциональный параметр
#тип - строка
- ext_ip = "1.1.1.1"
+ #используется при создании
+ #ext_ip = "1.1.1.1"
#описание
#опциональный параметр
#тип - строка
- description = "qwerty"
+ #используется при создании и обновлении
+ #description = "qwerty"
#флаг доступности ресурсной группы
#опциональный параметр
#тип - булев
- enable = true
+ #используется при создании и обновлении
+ #по умолчанию - true
+ #enable = true
#имя пользователя
#опциональный параметр
#тип - строка
- owner = "name_user"
+ #используется при создании
+ #owner = "name_user"
#блок для предоставления прав на ресурсную группу
#опциональный параметр
#тип - блок прав доступа
- access = [{
- #имя юзера предоставляемому права
+ #используется при создании и обновлении
+ #access = [{
+ #имя юзера предоставляемому права
#обязательный параметр при использовании блока
#тип - строка
- user = "kasim_baybikov_1@decs3o"
+ #user = "kasim_baybikov_1@decs3o"
#тип прав
#опциональный параметр
#тип - строка
- right = "RCX"
- }]
+ #right = "RCX"
+ #}]
#установить сеть по умолчанию
#опциональный параметр
#тип - блок сетей
- def_net = {
+ #используется при создании и обновлении
+ #def_net = {
#тип сети
#обязательный параметр при использовании блока
#тип - строка
- net_type = "PUBLIC"
+ #net_type = "PUBLIC"
#id сети
#опциональный параметр
#идентификатор сегмента сети. Если net_type — PUBLIC, а net_id — 0,
#то будет выбран сегмент внешней сети по умолчанию. Если net_type
- #имеет значение PRIVATE и net_id=0, будет выбран первый vins, определенный для этой ресурсной группы.
- #В противном случае net_id идентифицирует либо существующий сегмент внешней сети, либо vins.
+ #имеет значение PRIVATE и net_id=0, будет выбран первый vins, определенный для этой ресурсной группы
+ #в противном случае net_id идентифицирует либо существующий сегмент внешней сети, либо vins
#тип - целое число
- net_id = 1234
- }
+ #net_id = 1234
+ #}
#лимиты ресурсов для ресурсной группы
#опциональный параметр
#тип - блок конфигураций
- quota = {
+ #используется при создании и обновлении
+ #quota = {
#максимальное количество ядер процессора
#опциональный параметр
- #значение по умолчанию: -1
+ #по умолчанию: -1
#тип - целое число
- cpu = 5
+ #cpu = 5
- #максимальный размер памяти в мегабайтах
+ #максимальный размер памяти, в МБ
#опциональный параметр
- #тип - число
- #значение по умолчанию: -1
- ram = 1024
+ #по умолчанию: -1
+ #тип - целое число
+ #ram = 1024
#максимальный размер объединенных виртуальных дисков в ГБ
#опциональный параметр
- #значение по умолчанию: -1
+ #по умолчанию: -1
#тип - целое число
- disk = 180
+ #disk = 180
#максимальное количество отправленных/полученных сетевых узлов
#опциональный параметр
- #значение по умолчанию: -1
+ #по умолчанию: -1
#тип - целое число
- ext_traffic = 21
+ #ext_traffic = 21
#максимальное количество назначенных общедоступных IP-адресов
#опциональный параметр
- #значение по умолчанию: -1
+ #по умолчанию: -1
#тип - целое число
- ext_ips = 29
- }
+ #ext_ips = 29
+ #}
#список названий pools
- #необязательный параметр
+ #опциональный параметр
#игнорируется при создании ресурса, применяется только при обновлении
#тип - массив строк
- uniq_pools = ["sep1_poolName1", "sep2_poolName2"]
+ #используется при обновлении
+ #uniq_pools = ["sep1_poolName1", "sep2_poolName2"]
#флаг для принудительного удаления ресурсной группы
#опциональный параметр
#тип - булев
+ #используется при удалении
#по умолчанию - true
- force = true
+ #force = true
- #флаг для моментального удаления ресурсной группы
+ #флаг для удаления ресурсной группы, без возможности восстановления
#опциональный параметр
#тип - булев
+ #используется при удалении
#по умолчанию - true
- permanently = true
+ #permanently = true
#восстановление группы после удаления
#опциональный параметр
#используется при редактировании ресурса
- #по умолчанию - true
#тип - булев
- restore = true
+ #используется при обновлении
+ #по умолчанию - true
+ #restore = true
+
}
diff --git a/samples/cloudapi/vins/data_vins_list/main.tf b/samples/cloudapi/vins/data_vins_list/main.tf
index 47aa336..2cc25df 100644
--- a/samples/cloudapi/vins/data_vins_list/main.tf
+++ b/samples/cloudapi/vins/data_vins_list/main.tf
@@ -69,6 +69,11 @@ data "dynamix_vins_list" "vl" {
#формат - "+поле" по возрастанию / "-поле" по убыванию
#sort_by = "+name"
+ #поиск по статусу
+ #опциональный параметр
+ #тип - строка
+ #status = "ENABLED"
+
#номер страницы для отображения
#опциональный параметр
#тип - целое число
@@ -80,6 +85,7 @@ data "dynamix_vins_list" "vl" {
#тип - целое число
#если не задан - выводятся все доступные данные
#size = 1
+
}
output "test" {
diff --git a/samples/cloudapi/vins/resource_vins/main.tf b/samples/cloudapi/vins/resource_vins/main.tf
index ab49c74..a059c70 100644
--- a/samples/cloudapi/vins/resource_vins/main.tf
+++ b/samples/cloudapi/vins/resource_vins/main.tf
@@ -39,136 +39,153 @@ resource "dynamix_vins" "vins" {
#имя создаваемого ресурса
#обязательный параметр
#тип - строка
+ #используется при создании
name = "Test_name"
#id ресурсной группы для создания ресурса
#опциональный параметр
#тип - целое число
+ #используется при создании
rg_id = 10101
#id аккаунта для создания ресурса
#опциональный параметр
#тип - целое число
+ #используется при создании
account_id = 2023
#блок правил extnet
#опциональный параметр
#тип - блок extnet
- ext_net = {
+ #ext_net = {
#id внешней сети для подключения к ней ресурса
#опциональный параметр
#тип - целое число
- ext_net_id = 2222
+ #используется при создании и обновлении
+ #ext_net_id = 2222
#ip внешней сети для подключения к нему ресурса
#опциональный параметр
#тип - строка
- ext_ip_addr = "1.1.1.1"
- }
+ #используется при создании и обновлении
+ #ext_ip_addr = "1.1.1.1"
+ #}
#private network IP CIDR
#опциональный параметр
#тип - строка
- ipcidr = "192.168.0.1"
+ #используется при создании
+ #ipcidr = "192.168.0.1"
#количество зарезервированных адресов на момент создания
#опциональный параметр
#значение по умолчанию 32
#тип - целое число
- pre_reservations_num = 2
+ #используется при создании
+ #pre_reservations_num = 2
#grid (platform) ID
#опциональный параметр
#тип - целое число
- gid = 2002
+ #используется при создании
+ #gid = 2002
#описание
#опциональный параметр
#тип - строка
- desc = "Description"
+ #используется при создании и обновлении
+ #desc = "Description"
#ручное подключение и отключение ресурса
#опциональный параметр
#тип - булев
- enable = true
+ #используется при создании и обновлении
+ #enable = true
#удаление навсегда
#опциональный параметр
#по умолчанию - true
#тип - булев
- permanently = true
+ #используется при удалении
+ #permanently = true
#удаляет за собой все зависимые ресурсы
#опциональный параметр
#по умолчанию - true
#тип - булев
- force = true
+ #используется при удалении
+ #force = true
#список для резервирования ip
#опциональный параметр
#тип - массив объектов ip
- ip = [{
+ #используется при создании и обновлении
+ #ip = [{
#тип подключения
#обязательный параметр
#тип - строка
- type = "DHCP"
+ #type = "DHCP"
#ip который необходимо зарезервировать
#опциональный параметр
#тип - строка
- ip_addr = "192.168.5.5"
+ #ip_addr = "192.168.5.5"
#mac который необходимо зарезервировать
#опциональный параметр
#тип - строка
- mac_addr = "ff:ff:ff:ff:ff:ff"
- }]
+ #mac_addr = "ff:ff:ff:ff:ff:ff"
+ #}]
#список для резервирования ip
#опциональный параметр
#тип - массив объектов ip
- nat_rule = [{
+ #используется при создании и обновлении
+ #nat_rule = [{
#ip внутренний
#опциональный параметр
#тип - строка
- int_ip = "192.168.0.28"
+ #int_ip = "192.168.0.28"
#внутренний порт
#опциональный параметр
#тип - целое число
- int_port = 80
+ #int_port = 80
#начало диапазона внешних портов
#опциональный параметр
#тип - целое число
- ext_port_start = 8001
+ #ext_port_start = 8001
#конец диапазона внешних портов
#опциональный параметр
#тип - целое число
- ext_port_end = 8001
+ #ext_port_end = 8001
#протокол natRule
#опциональный параметр
#тип - строка
- proto = "tcp"
- }]
+ #proto = "tcp"
+ #}]
#восстановление ресурса
#опциональный параметр
#по умолчанию - true
#тип - булев
- restore = true
+ #используется при обновлении
+ #restore = true
#перезапуск vnfDev
#опциональный параметр
#тип - булев
- vnfdev_restart = true
+ #используется при обновлении
+ #vnfdev_restart = true
#редеплой vnfDev
#опциональный параметр
#тип - булев
- vnfdev_redeploy = true
+ #используется при обновлении
+ #vnfdev_redeploy = true
#список dns
#опциональный параметр
@@ -176,6 +193,7 @@ resource "dynamix_vins" "vins" {
#если при создании указать пустой список, то ресурс создается с полем vnfs.dhcp.config.dns, имеющим значение по умолчанию
#если при обновлении указать пустой список, то ресурс обновит в модели поле vnfs.dhcp.config.dns с текущего значения на пустой список
#тип - список строк
+ #используется при создании и обновлении
#dns = ["1.1.1.1", "2.2.2.2"]
}
diff --git a/wiki/.gitignore b/wiki/.gitignore
deleted file mode 100644
index b3b5f1f..0000000
--- a/wiki/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-.idea/
-.vscode/
-.DS_Store
\ No newline at end of file
diff --git a/wiki/1.0.0/01.-Введение.md b/wiki/1.0.0/01.-Введение.md
deleted file mode 100644
index 430cfd8..0000000
--- a/wiki/1.0.0/01.-Введение.md
+++ /dev/null
@@ -1,7 +0,0 @@
-DYNAMIX Terraform Provider позволяет управлять облачными ресурсами на платформе DYNAMIX версии 4.4.0 и выше посредством Terraform.
-
-С помощью данного провайдера можно организовать программное управление вычислительными ресурсами (_compute_), ресурсными группами, сетевыми и дисковыми ресурсами, образами дисков, кластером, а также другими параметрами облачной платформы DYNAMIX.
-
-Если вы хорошо знакомы с инструментом Terraform и хотите максимально быстро начать использовать платформу DYNAMIX в своих Terraform-проектах, то можете сразу перейти к разделу [Пример работы](https://repository.basistech.ru/BASIS/terraform-provider-dynamix/src/branch/main/wiki/1.0.0/02.-Пример-работы.md), где приведён подробно откомментированный пример работы с основными видами ресурсов платформы. Если у вас всё же возникнут вопросы по облачной платформе DYNAMIX и порядку авторизации в ней, то обратитесь к главе [«Обзор облачной платформы DYNAMIX»](https://repository.basistech.ru/BASIS/terraform-provider-dynamix/src/branch/main/wiki/1.0.0/03.-Обзор-облачной-платформы-DYNAMIX.md). Также может оказаться полезной глава [«Инициализация Terraform провайдера DYNAMIX»](https://repository.basistech.ru/BASIS/terraform-provider-dynamix/src/branch/main/wiki/1.0.0/04.02-Инициализация-Terraform-провайдера-DYNAMIX.md).
-
-Если вы только начинаете использовать инструмент Terraform и облачную платформу DYNAMIX, то рекомендуем вам начать с главы [«Обзор облачной платформы DYNAMIX»](https://repository.basistech.ru/BASIS/terraform-provider-dynamix/src/branch/main/wiki/1.0.0/03.-Обзор-облачной-платформы-DYNAMIX.md), после чего изучить главы [«_Data source_ функции Terraform провайдера DYNAMIX»](https://repository.basistech.ru/BASIS/terraform-provider-dynamix/src/branch/main/wiki/1.0.0/06.-Data-source-функции-Terraform-провайдера-DYNAMIX.md) и [«_Resource_ функции Terraform провайдера DYNAMIX»](https://repository.basistech.ru/BASIS/terraform-provider-dynamix/src/branch/main/wiki/1.0.0/07.-Resource-функции-Terraform-провайдера-DYNAMIX.md). Примеры, приведенные в этих разделах, помогут вам быстро освоить базовые приёмы работы с инструментом Terraform и провайдером DYNAMIX.
diff --git a/wiki/1.0.0/02.-Пример-работы.md b/wiki/1.0.0/02.-Пример-работы.md
deleted file mode 100644
index 1db2d57..0000000
--- a/wiki/1.0.0/02.-Пример-работы.md
+++ /dev/null
@@ -1,92 +0,0 @@
-Данный раздел предназначен для тех, кто хорошо знаком с инструментом Terraform, а также имеет представление об основных понятиях и способах авторизации в облачной платформе DYNAMIX.
-
-Ниже приведён подробно откомментированный пример, показывающий, как создать виртуальный сервер (aka _compute_ на базе системы виртуализации KVM x86) в облачной платформе DYNAMIX с помощью соответствующего Terraform провайдера. Сервер будет создан в новой ресурсной группе, к нему будет подключён один предварительно созданный диск, у сервера будет прямое сетевое подключение во внешнюю сеть.
-
-Идентификатор образа операционной системы, на базе которого должен быть создан виртуальный сервер, считывается из облачной платформы с помощью _data source_ функции `dynamix_image`.
-
-Далее мы с помощью _resource_ функции `dynamix_resgroup` создаём новую ресурсную группу, в которую будет помещён этот виртуальный сервер. В качестве альтернативы, для получения информации об уже имеющейся ресурсной группе можно использовать _data source_ функцию с таким же названием.
-
-Затем с помощью _resource_ функции `dynamix_disk` создаётся диск, который будет подключён к виртуальному серверу в качестве дополнительного. Помимо этого дополнительного диска у сервера будет также и загрузочный диск, на который в процессе создания сервера клонируется выбранный образ операционной системы.
-
-Виртуальный сервер - в данном примере на базе системы виртуализации KVM x86 - создаётся посредством _resource_ функции `dynamix_kvmvm`.
-
-Только авторизованные в контроллере облачной платформы пользователи могут управлять облачными ресурсами. Подробнее о способах авторизации см. [Обзор облачной платформы DYNAMIX](https://repository.basistech.ru/BASIS/terraform-provider-dynamix/src/branch/main/wiki/1.0.0/03.-Обзор-облачной-платформы-DYNAMIX.md).
-
-```terraform
-# 1. Initialize DYNAMIX plugin and connection to DYNAMIX cloud controller
-# NOTE: in this example credentials are expected to come from
-# DECORT_APP_ID and DECORT_APP_SECRET environmental variables - set them
-# in the shell before calling terraform.
-# Alternatively you may define plugin parameters app_id and app_secret in
-# the TF file, however, this may not be secure if you plan to share this TF
-# file with others.
-
-provider "basis" {
- authenticator = "decs3o"
- controller_url = "<>" # specify correct DECORT controller URL, e.g. "https://ds1.digitalenergy.online"
- oauth2_url = "<>" # specify corresponding DECORT SSO URL, e.g. "https://sso.digitalenergy.online"
- app_id = "<>" # application secret to access DECORT cloud API in 'decs3o' and 'bvs' authentication mode, e.g. "ewqfrvea7s890avw804389qwguf234h0otfi3w4eiu"
- app_secret = "<>" # application ID to access DECORT cloud API in 'decs3o' and 'bvs' authentication mode, e.g. "ewqfrvea7s890avw804389qwguf234h0otfi3w4eiu"
- # allow_unverified_ssl = true
-}
-
-# 2. Load account to use - new VM will belong to this account
-data "dynamix_account" "my_account" {
- account_id = # Specify account ID
-}
-
-# 3. Load OS image to use for VM deployment
-data "dynamix_image" "os_image" {
- image_id = # Specify OS image id, e.g. 1234. You can get accessible image id from data source "dynamix_image_list"
-}
-
-# 4. Create new Resource Group in the selected account, new VM will be created in this RG
-resource "dynamix_resgroup" "my_rg" {
- name = "NewRgByTF"
- account_id = data.dynamix_account.my_account.account_id
- gid = # Grid (platform) ID
- # if you want to set resource quota on this Resource Group, uncomment
- # the following code fragment
- # quota {
- # cpu = 8 # CPU limit
- # ram = 8912 # RAM limit in MB
- # disk = 96 # disk volume limit in GB
- #}
-}
-
-# 5. Create extra disk, which will be attached to the new VM.
-# This step is optional - if you do not want extra disks on your VM, skip it
-# and comment out extra_disks parameter when creating VM below.
-resource "dynamix_disk" "extra_disk" {
- disk_name = "extra-disk-for-vm"
- account_id = data.dynamix_account.my_account.account_id
- gid = # Grid (platform) ID
- size_max = 5 # disk size in GB
- type = "D" # disk type, always use "D" for extra disks
- sep_id = data.dynamix_image.os_image.sep_id # use the same SEP ID as the OS image
- pool = "<>" # consult your DECORT platform admin for configured storage pool names
-}
-
-# 6. Create virtual machine (a compute of type KVM VM x86 in this example)
-# Now that we have all necessary components at hand, we may create a virtual machine.
-# This VM will be based on the previsouly obtained OS image, located in the specified
-# Resource Group, directly connected to an external network, have a boot disk of
-# specified size and one extra disk attached.
-resource "dynamix_kvmvm" "my_new_vm" {
- name = "tf-managed-vm"
- driver = "KVM_X86" # Compute virtualization driver
- rg_id = dynamix_resgroup.my_rg.id
- cpu = 1 # CPU count
- ram = 1024 # RAM size in MB, must be even number, ideally a power of 2
- boot_disk_size = 10 # Boot disk size in GB
- image_id = data.dynamix_image.os_image.image_id
- description = "Test KVM VM Compute managed by Terraform"
- extra_disks = [ dynamix_disk.extra_disk.id ]
-
- network {
- net_type = "EXTNET"
- net_id = <> # specify external network ID to use, consult your DECORT platform admin for correct IDs
- # ip_address = "<>" # you may optionally request a specific IP address
- }
-}
-```
diff --git a/wiki/1.0.0/03.-Обзор-облачной-платформы-DYNAMIX.md b/wiki/1.0.0/03.-Обзор-облачной-платформы-DYNAMIX.md
deleted file mode 100644
index 530f691..0000000
--- a/wiki/1.0.0/03.-Обзор-облачной-платформы-DYNAMIX.md
+++ /dev/null
@@ -1,32 +0,0 @@
-## Основные понятия
-Ниже перечислены основные понятия с указанием соответствующих им аргументов в Terraform провайдере DYNAMIX.
-1. **Контроллер облачной платформы DYNAMIX** – управляющее приложение, которое обеспечивает авторизацию пользователей и оркестрацию облачных ресурсов.
- - Адрес контроллера задается в обязательном аргументе `controller_url` на стадии инициализации Terraform провайдера DYNAMIX. Например, `controller_url= "https://ds1.digitalenergy.online"`
-2. **Авторизационный провайдер** – приложение, работающее по протоколу Oauth2, предназначенное для выпуска и валидации токенов доступа к контроллеру облачной платформы в соответствующих режимах авторизации. Все действия в платформе должны выполняться авторизованными пользователями, и авторизационное приложение позволяет получить токен доступа, действующий некоторое ограниченное время, наличие которого подтверждает успешную авторизацию.
- - Адрес авторизационного провайдера задается в аргументе`oauth2_url` на стадии инициализации Terraform провайдера DYNAMIX. Например `oauth2_url= "https://sso.digitalenergy.online"`
-3. **Подписчик** (_account_) – сущность, которая используется для группирования облачных ресурсов по принадлежности к определенному клиенту для целей учета потребления и биллинга.
- - Имя подписчика задается аргументом `account_name` при вызове _resource_ или _data_ функций провайдера. Альтернативной является задание численного идентификатора подписчика в аргументе `account_id`.
-4. **Пользователь** (_user_) – пользователь облачной инфраструктуры, представленный учетной записью. Чтобы получить возможность управлять облачными ресурсами (например, создавать виртуальные серверы или дискт) пользователь должен быть ассоциирован с одним или несколькими подписчиками и иметь соответствующие права, определяемые ролевой моделью, принятой в облачной платформе DYNAMIX. Для доступа к платформе пользователь должен авторизоваться одним из способов, описанных ниже в разделе «Способы авторизации».
-5. **Ресурсная группа** (_resource group_) – способ группирования вычислительных ресурсов (например, виртуальных серверов по функциональному признаку или принадлежности к одному и тому же проекту). Ресурсную группу можно рассматривать как небольшой персональный дата-центр, в котором размещаются один или несколько серверов и виртуальных сетевых сегментов. Ресурсная группа идентифицируется по комбинации параметров `account` и `name`. Обратите внимание, что имя имя ресурсной группы уникально только в рамках одного и того же `account`.
-6. **Вычислительный ресурс** (_compute_) - универсальная абстракция пользовательского сервера в платформе DYNAMIX. Благодаря использованию такой абстракции можно, например, создать одну виртуальную машину на базе KVM Intel x86, а другую - на базе KVM IBM Power, а потом управлять ими - изменять количество CPU/RAM, подключать/отключать диски и т.п. - одинаковым образом, не задумываясь об их архитектурных различиях. В то же время, так как типизация ресурсов в Terraform не поддерживает наследование, различные типы вычислительных ресурсов, доступных на платформе DYNAMIX и абстрагируемых через понятие унифицированный _compute_, в Terraform представлены разными типами (напр., свой тип для виртуальных серверов на базе KVM и свой тип для перспективных x86-совместимых bare metal серверов).
-7. **Ресурс хранения** (_disk_) - универсальная абстракция дискового ресурса в платформе DYNAMIX. Платформа поддерживает различные типы систем хранения данных, но при этом управление созданными на разных системах хранения дисками осуществляется посредством унифицированного набора действий, например, "подключить диск к _compute_", "увеличить размер диска", "сделать мгновенный снимок диска", "настроить параметры быстродействия диска".
-8. **Виртуальный сервер** – экземпляр _compute_, в основе технической реализации которого лежит виртуальная машина, работающая в облаке и доступна по сети. Виртуальный сервер характеризуется количеством выделенных ему CPU (аргумент`cpu`), объемом ОЗУ (`ram`), размером загрузочного диска (`boot_disk size`). При создании виртуального сервера на загрузочный диск устанавливается образ операционной системы, заданный в аргументе `image_id`. Помимо загрузочного диска к виртуальному серверу можно подключить несколько дисков для хранения прикладных данных, список которых задается аргументами `extra_disks`. Виртуальный сервер идентифицируется по комбинации аргументов `name` (имя сервера) и `rgid` (идентификатор ресурсной группы). Обратите внимание, что имя виртуального сервера `name` уникально только в рамках одной и той же ресурсной группы.
-9. **Виртуальный сетевой сегмент** (_Virtual Network Segment_ или _ViNS_) - сетевой сегмент и обеспечивающая его функционирование виртуальная инфраструктура, которые пользователь может создавать для своих нужд на уровне ресурсной группы или подписчика (_account_). ViNS можно создать полностью изолированным от внешних сетей (см. ниже _External Network_) или с подключением во внешнюю сеть. Внутри ViNS работает DHCP-сервис, обеспечивающий управление IP адресами экземпляров _compute_, подключённых в этот ViNS.
-10. **Внешняя сеть** (_External Network_) - сетевой сегмент, через который платформа DYNAMIX взаимодействует с внешними по отношению к ней сетевыми ресурсами. Например, в случае с публичным облаком на базе DECORT в качестве внешней сети выступает сеть Интернет. В отличие от ViNS платформа не управляет внешней сетью, а лишь пользуется её ресурсами. В платформе может быть настроено несколько внешних сетей с различными диапазонами IP адресов, и существует механизм управления доступом пользователей к внешним сетям.
-11. Сетевой доступ к экземпляру _compute_ (виртуальному серверу) реализуется через его подключение к ViNS и/или прямое подключение во внешнюю сеть (External Network). Один и тот же экземпляр _compute_ может одновременно иметь несколько подключений в разные ViNS и/или различные внешние сети.
-
-## Способы авторизации
-Облачная платформа DYNAMIX поддерживает три базовых типа авторизации:
-1. С использованием авторизационного провайдера, работающего по протоколу _Oauth2_. Данный способ является предпочтительным, так как обеспечивает бОльшую гибкость и безопасность. Для авторизации в этом режиме при инициализации Terrafrom провайдера DYNAMIX необходимо указать параметры `oauth2_url` и `controller_url`, а также предоставить одно из нижеперечисленного:
- - Комбинация Application ID & Application secret, соответствующих пользователю, от имени которого будет осуществляться управление облачными ресурсами в текущей сессии. В процессе проверки предоставленных Application ID & Application secret модуль получает от авторизационного провайдера токен (JSON Web Token, JWT), который затем используется для доступа к указанному контроллеру DYNAMIX. Для авторизации по данному варианту, при инициализации Terraform провайдера DYNAMIX следует установить аргумент `authenticator=decs3o` и задать аргументы `app_id` и `app_secret` (или определить соответствующие переменные окружения `DECORT_APP_ID` и `DECORT_APP_SECRET`).
- - JSON Web Token – заранее полученный от авторизационного провайдера токен доступа, ассоциированный с определенным пользователем, от имени которого будет осуществляться управление облачными ресурсами в текущей сессии. Для авторизации по данному варианту, при инициализации Terraform провайдера DYNAMIX следует установить аргумент `authenticator=jwt` и задать аргумент `jwt` (или определить переменную окружения `DECORT_JWT`).
-2. С использованием комбинации _имя пользователя : пароль_. Данный режим не использует внешних авторизационных провайдеров и подразумевает, что пользователь с такой комбинацией зарегистрирован непосредственно на указанном в параметре `controller_url` контроллере облачной платформы DYNAMIX.
- - Чтобы провайдер авторизовался по данному варианту, при его инициализации следует установить аргумент `authenticator=legacy` и задать аргументы `user` и `password` (или определить соответствующие переменные окружения `DECORT_USER` и `DECORT_PASSWORD`).
-3. С использованием авторизационного провайдера, работающего по протоколу _Oauth2_oidc_. Для авторизации в этом режиме при инициализации Terrafrom провайдера DYNAMIX необходимо указать параметры `oauth2_url` и `controller_url`, а также Application ID & Application secret, _имя пользователя и пароль_, соответствующих пользователю, от имени которого будет осуществляться управление облачными ресурсами в текущей сессии, и _имя домена_. В процессе проверки предоставленных Application ID & Application secret и пары _имя пользователя-пароль_ модуль получает от авторизационного провайдера токен (JSON Web Token, JWT), который затем используется для доступа к указанному контроллеру DYNAMIX. Для авторизации по данному варианту, при инициализации Terraform провайдера DYNAMIX следует установить аргумент `authenticator=bvs`, задать аргументы `app_id` и `app_secret` (или определить соответствующие переменные окружения `DECORT_APP_ID` и `DECORT_APP_SECRET`), `bvs_user` и `bvs_password` (или определить соответствующие переменные окружения `DECORT_BVS_USER` и `DECORT_BVS_PASSWORD`), а также указать `domain` (или определить соответствующие переменные окружения `DECORT_DOMAIN`).
-
-После успешной авторизации пользователь (или приложение-клиент) получает доступ к ресурсам, находящимся под управлением соответствующего DECORT контроллера. Доступ предоставляется в рамках подписчиков (_account_), с которыми ассоциирован данный пользователь (_user_), и в соответствии с присвоенными ему ролями.
-
-## Пользовательская и административная группы API
-Пользовательская группа API - группа API платформы DYNAMIX, которая позволяет выполнять операции с платформой с правами обычного пользователя. Покрывает большую часть задач.
-Административная группа API - группа API платформы DYNAMIX, которая позволяет выполнять операции с платформой с расширенными правами. Данные права подразумевают расширенный перечень операций над ресурсами, расширенный перечень ресурсов, расширенную информацию. Требуются права администратора для взаимодействия с этой группой API.
-В Terraform провайдере DYNAMIX версии 1.0.0 реализованы функции только пользовательской группа API.
diff --git a/wiki/1.0.0/04.-Начало-работы-с-terraform-провайдером-DYNAMIX.md b/wiki/1.0.0/04.-Начало-работы-с-terraform-провайдером-DYNAMIX.md
deleted file mode 100644
index edaa664..0000000
--- a/wiki/1.0.0/04.-Начало-работы-с-terraform-провайдером-DYNAMIX.md
+++ /dev/null
@@ -1,6 +0,0 @@
-Данный раздел описывает:
-- Системные требования
-- Установку провайдера
-- Инициализацию провайдера
-- Переключение режима работы между разными группами API
-- Получение gid/grid_id площадки
diff --git a/wiki/1.0.0/04.01-Установка-Terraform-провайдера-DYNAMIX.md b/wiki/1.0.0/04.01-Установка-Terraform-провайдера-DYNAMIX.md
deleted file mode 100644
index b230690..0000000
--- a/wiki/1.0.0/04.01-Установка-Terraform-провайдера-DYNAMIX.md
+++ /dev/null
@@ -1,147 +0,0 @@
-## Системные требования
-
-Для запуска провайдера вам потребуется машина, на которой установлен Terraform.
-
-Кроме того, в связи с тем, что начиная с версии 0.12 Terraform изменил алгоритм поиска и инициализации локальных провайдеров, настройка данного провайдера для работы с Terraform 0.12 или более новыми версиями потребует выполнения ряда дополнительных действий. Подробнее см. [8.3 Настройка локального провайдера для работы с новыми версиями Terraform](https://repository.basistech.ru/BASIS/terraform-provider-dynamix/src/branch/main/wiki/1.0.0/08.-Полезные-советы#user-content-8-3-настройка-локального-провайдера-для-работы-с-новыми-версиями-terraform.md).
-
-## Установка
-В релизном архиве находятся скрипты-инсталляторы.
-Чтобы выполнить установку, необходимо:
-1. Перейти по адресу: https://repository.basistech.ru/BASIS/terraform-provider-dynamix/releases
-2. Выбрать необходимую версию провайдера подходящую под операционную систему.
-3. Скачать архив.
-4. Распаковать архив.
-5. Выполнить скрипт установщика, `install.sh` или `install.bat` для Windows.
-*Для запуска `install.sh` не забудьте изменить права доступа к файлу*
-```bash
-chmod u+x install.sh
-```
-6. Дождаться сообщения об успешной установке. Установщик выведет актуальный блок конфигурации провайдера, скопируйте его
-```bash
-terraform {
- required_providers {
- basis = {
- version = "1.0.0"
- source = "basistech.ru/tf/dynamix"
- }
- }
-}
-```
-7. После этого, создайте файл `main.tf` в рабочей директории, которая может находится в любом удобном для пользователя месте.
-В данном примере, рабочая директория с файлом main.tf находится по пути:
-```bash
-~/work/tfdir/main.tf
-```
-8. Вставьте в `main.tf` блок конфигурации провайдера, который был выведен на экран установщиком:
-```terraform
-terraform {
- required_providers {
- basis = {
- version = "1.0.0"
- source = "basistech.ru/tf/dynamix"
- }
- }
-}
-```
-9. Добавьте в файл блок с инициализацией провайдера.
-```terraform
-provider "basis" {
- authenticator = "decs3o"
- controller_url = "https://mr4.digitalenergy.online"
- oauth2_url = "https://sso.digitalenergy.online"
- allow_unverified_ssl = true
-}
-```
-
-10. В консоли выполните команду
-```bash
-terraform init
-```
-
-11. В случае успешной установки, Terraform инициализирует провайдер и будет готов к дальнейшей работе.
-
-## Установка из релизов
-Terraform провайдер DYNAMIX имеет скомпилированные релизные версии, которые расположены по адресу: [Релизы](https://repository.basistech.ru/BASIS/terraform-provider-dynamix/releases).
-Чтобы выполнить установку из релиза, необходимо:
-1. Перейти по адресу: https://repository.basistech.ru/BASIS/terraform-provider-dynamix/releases
-2. Выбрать необходимую версию провайдера подходящую под операционную систему.
-3. Скачать архив.
-4. Распаковать архив.
-5. Полученный файл (в директории `bin/`) необходимо поместить:
-Linux:
-```bash
-~/.terraform.d/plugins/${host_name}/${namespace}/${type}/${version}/${target}
-```
-Windows:
-```powershell
-%APPDATA%\terraform.d\plugins\${host_name}\${namespace}\${type}\${version}\${target}
-```
-Где:
-- host_name - имя хоста, держателя провайдера, например, basis
-- namespace - пространство имен хоста, например decort
-- type - тип провайдера, может совпадать с пространством имен, например, decort
-- version - версия провайдера, например 4.3.0
-- target - архитектура операционной системы, например windows_amd64
-
-В примере ниже используется путь до провайдера на машине с ОС Linux:
-
-```bash
-~/.terraform.d/plugins/basis/basistech.ru/tf/dynamix/1.0.0/linux_amd64/tf-provider
- ^ ^ ^ ^ ^ ^
- host_name | | | | | |
- | | | | |
- namespace | | | | |
- | | | |
- type | | | |
- | | |
- version | | |
- | |
- target | |
- |
- исполняемый файл |
-```
-
-6. После этого, создайте файл `main.tf` в рабочей директории, которая может находится в любом удобном для пользователя месте.
-В данном примере, рабочая директория с файлом main.tf находится по пути:
-```bash
-~/work/tfdir/main.tf
-```
-7. Добавьте в `main.tf` следующий блок
-```terraform
-terraform {
- required_providers {
- basis = {
- source = "basistech.ru/tf/dynamix"
- version = "1.0.0"
- }
- }
-}
-```
-В поле `version` указывается версия провайдера.
-
-**ВНИМАНИЕ: Версии в блоке и в пути к исполняемому файлу провайдера должны совпадать!**
-
-В поле `source` помещается путь до репозитория с версией вида:
-
-```bash
-${host_name}/${namespace}/${type}
-```
-
-**ВНИМАНИЕ: Версии в блоке и в пути к исполняемому файлу провайдера должны совпадать!**
-
-8. Добавьте в файл блок с инициализацией провайдера.
-```terraform
-provider "basis" {
- authenticator = "decs3o"
- controller_url = "https://mr4.digitalenergy.online"
- oauth2_url = "https://sso.digitalenergy.online"
- allow_unverified_ssl = true
-}
-```
-
-9. В консоли выполните команду
-```bash
-terraform init
-```
-
-10. В случае успешной установки, Terraform инициализирует провайдер и будет готов к дальнейшей работе.
diff --git a/wiki/1.0.0/04.02-Инициализация-Terraform-провайдера-DYNAMIX.md b/wiki/1.0.0/04.02-Инициализация-Terraform-провайдера-DYNAMIX.md
deleted file mode 100644
index 62ada5f..0000000
--- a/wiki/1.0.0/04.02-Инициализация-Terraform-провайдера-DYNAMIX.md
+++ /dev/null
@@ -1,64 +0,0 @@
-## Список аргументов для инициализации
-Перед началом использования любой Terraform провайдер должен быть инициализирован.
-
-В процессе инициализации Terraform провайдера DYNAMIX проверяется корректность переданных аргументов и выполняется авторизация в указанном контроллере облачной инфраструктуры. Подробнее о способах авторизации в платформе DYNAMIX смотри соответствующий [раздел](https://repository.basistech.ru/BASIS/terraform-provider-dynamix/src/branch/main/wiki/1.0.0/03.-Обзор-облачной-платформы-DYNAMIX#user-content-способы-авторизации.md).
-
-При инициализации Terraform провайдера DYNAMIX используются следующие аргументы:
-
-| Аргумент | Переменная окружения | Описание |
-| --- | --- | --- |
-| allow_unverified_ssl | - | Если данный аргумент явно установлен в `true`, то провайдер **не будет** проверять SSL сертификаты при взаимодействии с авторизационным сервисом OAuth2 и контроллером облачной платформы.
Отключение проверок может быть полезным при работе в доверенной среде, использующей самоподписанные SSL сертификаты. Однако, так как отключение проверок несёт потенциальные риски безопасности, данную настройку следует использовать с осторожностью.
Разрешённые значения: `false` (значение по умолчанию) и `true`. |
-| app_id | DECORT_APP_ID | Идентификатор приложения (клиента) для авторизации в контроллере облачной платформы в режиме `decs3o` или `bvs`.
Аргументы `app_id` и `app_secret` являются обязательными для режимов авторизации `authenticator=decs3o` и `authenticator=bvs`.
Если `app_id` не задан в tf-файле, то провайдер будет использовать значение из переменной окружения `DECORT_APP_ID`. |
-| app_secret | DECORT_APP_SECRET | Секретный код приложения (клиента) для авторизации в контроллере облачной платформы в режиме `decs3o` или `bvs`.
Аргументы `app_id` и `app_secret` являются обязательными для режимов авторизации `authenticator=decs3o` и `authenticator=bvs`.
Если `app_secret` не задан в tf-файле, то провайдер будет использовать значение из переменной окружения `DECORT_APP_SECRET`. |
-| authenticator | - | Режим авторизации при подключении к контроллеру облачной платформы.
Доступные режимы: `decs3o`, `legacy`, `jwt` или `bvs`.
Данный аргумент является обязательным. |
-| bvs_user | DECORT_BVS_USER | Имя пользователя для авторизации в контроллере облачной платформы в режиме `bvs`.
Аргументы `bvs_password` и `bvs_user` являются обязательными для режима авторизации `authenticator=bvs`.
Если `bvs_user` не задан в tf-файле, то провайдер будет использовать значение из переменной окружения `DECORT_BVS_USER`. |
-| bvs_password | DECORT_BVS_PASSWORD | Пароль пользователя для авторизации в контроллере облачной платформы в режиме `bvs`.
Аргументы `bvs_user` и `bvs_password` являются обязательными для режима авторизации `authenticator=bvs`.
Если `bvs_password` не задан в tf-файле, то провайдер будет использовать значение из переменной окружения `DECORT_BVS_PASSWORD`. |
-| domain | DECORT_DOMAIN | Имя домена в контроллере облачной платформы в режиме `bvs`.
Данный аргумент является обязательным.
Если `domain` не задан в tf-файле, то провайдер будет использовать значение из переменной окружения `DECORT_DOMAIN`. |
-| controller_url | - | URL контроллера облачной платформы, через который будет осуществляться управление облачными ресурсами.
Данный аргумент является обязательным. |
-| jwt | DECORT_JWT | JSON Web Token (JWT), который используется для авторизации в контроллере облачной платформы в режиме `jwt`.
Данный аргумент является обязательным для режима авторизации `authenticator=jwt`.
Если `jwt` не задан в tf-файле, то провайдер будет использовать значение из переменной окружения `DECORT_JWT` |
-| oauth2_url | DECORT_OAUTH2_URL | URL авторизационного сервиса OAuth2, который используется для управления доступом пользователей (или программных клиентов) к контроллеру облачной платформы.
Данный аргумент является обязательным для режимов авторизации `authenticator=decs3o`, `authenticator=bvs` и `authenticator=jwt`.
Если `oauth2_url` не задан в tf-файле, то провайдер будет использовать значение из переменной окружения `DECORT_OAUTH2_URL` |
-| password | DECORT_PASSWORD | Пароль для авторизации в контроллере облачной платформы в режиме `legacy`.
Аргументы `password` и `user` являются обязательными для режима авторизации `authenticator=legacy`.
Если `password` не задан в tf-файле, то провайдер будет использовать значение из переменной окружения `DECORT_PASSWORD`. |
-| user | DECORT_USER | Имя пользователя для авторизации в контроллере облачной платформы в режиме `legacy`.
Аргументы `user` и `password` являются обязательными для режима авторизации `authenticator=legacy`.
Если `user` не задан в tf-файле, то провайдер будет использовать значение из переменной окружения `DECORT_USER`. |
-
-## Пример инициализации в режиме авторизации `decs3o`
-Пример инициализации Terraform провайдера DYNAMIX:
-```terraform
-provider "basis" {
- authenticator = "decs3o"
- controller_url = "https://ctrl.decort.online"
- oauth2_url = "https://oauth2.decort.online:7777"
-}
-```
-
-В данном примере используется режим авторизации `decs3o`.
-
-Как отмечено выше, в данном режиме требуется указать аргументы `app_id` и `app_secret`, идентифицирующие пользователя (или приложение-клиент), от лица которого будут выполняться дальнейшие действия. Однако, так как данная информация является конфиденциальной (по сути, она эквивалентна паре _имя пользователя : пароль_), то в общем случае заносить такого рода данные в tf-файл не следует. Рекомендуется определять в среде запуска Terraform переменные окружения `DECORT_APP_ID` и `DECORT_APP_SECRET`, из которых провайдер извлечёт нужные данные. Приведенный пример подразумевает, что нужная информация будет получена из этих переменных окружения.
-
-Пользователь, от лица которого Terrafrom будет выполнять действия в облачной платформе, должен заранее создать пару _Application ID_ и _Application Secret_ в авторизационном приложении OAuth2. Именно эти значения, а также URL авторизационного приложения Oauth2, должны присваиваться аргументам `app_id`, `app_secret` и `oauth2_url` соответственно для успешной инициализации провайдера.
-
-Также обратите внимание на формат задания аргументов `controller_url` и `oauth2_url`. В общем случае они должны содержать идентификатор протокола (_https://_) и сетевой порт, если он отличается от порта по умолчанию (в примере для авторизационного сервиса OAuth2 указан порт _7777_). Эту информацию вы можете узнать у администратора вашей облачной инфраструктуры.
-
-## Пример инициализации в режиме авторизации `bvs`
-Пример инициализации Terraform провайдера DYNAMIX:
-```terraform
-provider "basis" {
- authenticator = "bvs"
- controller_url = "https://delta.qa.loc"
- oauth2_url = "https://bvs-delta.qa.loc:8443"
- app_id = "delta"
- app_secret = ""
- bvs_password = ""
- bvs_user = ""
- domain = "dynamix"
-}
-```
-
-В данном примере используется режим авторизации `bvs`.
-
-Как отмечено выше, в данном режиме требуется указать аргументы `app_id` - идентификатор площадки - delta, alpha, poc, etc. Можно найти на странице администратора по следующему пути: вкладка безопасность - клиентские сервисы - наименование площадки. `app_secret` - пароль площадки. Можно найти на странице администратора по следующему пути: вкладка безопасность - клиентские сервисы - наименование площадки (символ i) - поле "Пароль". Однако, так как данная информация является конфиденциальной, то в общем случае заносить такого рода данные в tf-файл не следует. Рекомендуется определять в среде запуска Terraform переменные окружения `DECORT_APP_ID` и `DECORT_APP_SECRET`, из которых провайдер извлечёт нужные данные. Приведенный пример подразумевает, что нужная информация будет получена из этих переменных окружения.
-Также обязательными аргументами являются: `bvs_user` - имя пользователя, `bvs_password` - пароль пользователя. Рекомендуется не заносить их в tf-файл, а определять в среде запуска Terraform переменные окружения `DECORT_BVS_USER` и `DECORT_BVS_PASSWORD`, из которых провайдер извлечёт нужные данные. Приведенный пример подразумевает, что нужная информация будет получена из этих переменных окружения.
-Домен для подключения `domain` - указывается наименование площадки. Данный аргумент является обязательным. Рекомендуется не заносить его в tf-файл, а определять в среде запуска Terraform переменную окружения `DECORT_DOMAIN`, из которой провайдер извлечёт нужные данные. Приведенный пример подразумевает, что нужная информация будет получена из этих переменных окружения.
-
-Пользователь, от лица которого Terrafrom будет выполнять действия в облачной платформе, должен заранее получить от администратора _Application ID_ и _Application Secret_, _bvs user_ и _bvs password_, а также _domain_. А также осуществить первичный вход на платформу посредством браузера.
-
-Также обратите внимание на формат задания аргументов `controller_url` и `oauth2_url`. В общем случае они должны содержать идентификатор протокола (_https://_) и сетевой порт, если он отличается от порта по умолчанию (в примере для авторизационного сервиса OAuth2 указан порт _8443_). Эту информацию вы можете узнать у администратора вашей облачной инфраструктуры.
diff --git a/wiki/1.0.0/04.03-Переключение-между-группами-API.md b/wiki/1.0.0/04.03-Переключение-между-группами-API.md
deleted file mode 100644
index 79557f2..0000000
--- a/wiki/1.0.0/04.03-Переключение-между-группами-API.md
+++ /dev/null
@@ -1,38 +0,0 @@
-Так как платформа DYNAMIX предоставляет для работы две группы API, то terraform провайдер позволяет свободно переключать режимы работы между этими группами.
-По умолчанию стоит пользовательская группа API. Ее можно сменить на административную группу.
-Если прав у пользователя будет достаточно, то запрос будет выполнен, если нет, то будет ошибка:
-```bash
-Permission denied
-```
-Которая говорит о том, что прав недостаточно. Тогда для выполнения операции обратитесь к администратору платформы.
-Установка режима взаимодействия с группами API осуществляется через установку переменной окружения _DECORT_ADMIN_MODE_.
-Для более подробного описания возможностей каждой группы API см. соответствующий раздел.
-
-## Переключение режима работы в Windows
-Используйте сл. команду:
-```Powershell
-$Env:DECORT_ADMIN_MODE=1
-```
-Для отключения:
-```Powershell
-$Env:DECORT_ADMIN_MODE=0
-```
-## Переключение режима работы в Linux
-Используйте сл. команду:
-```bash
-DECORT_ADMIN_MODE=1
-```
-или
-```bash
-export DECORT_ADMIN_MODE=1
-```
-Для отключения:
-```bash
-DECORT_ADMIN_MODE=0
-```
-или
-```bash
-export DECORT_ADMIN_MODE=0
-```
-**ОБРАТИТЕ ВНИМАНИЕ**
-Переменные окружения создаются для терминальной сессии. В сл. раз их придется задавать еще раз, если требуется режим, отличный от пользовательского.
diff --git a/wiki/1.0.0/04.04-Получение-gid-или-grid_id.md b/wiki/1.0.0/04.04-Получение-gid-или-grid_id.md
deleted file mode 100644
index 1161149..0000000
--- a/wiki/1.0.0/04.04-Получение-gid-или-grid_id.md
+++ /dev/null
@@ -1,17 +0,0 @@
-Платформа может располагаться на нескольких площадках(grid).
-Такие площадки имеют свой id.
-Для создания некоторых ресурсов требуется ввести grid_id или gid площадки.
-Получение gid различается для пользовательского и административного API.
-
-## Получение gid для пользовательского API
-Для получения gid с помощью пользовательского API, необходимо получить информацию из _data_source_ функции _dynamix_locations_list_, как указано ниже:
-```terraform
-data "dynamix_locations_list" "ll" {
-
-}
-
-output "test" {
- value = data.dynamix_locations_list.ll
-}
-```
-В файл состояния будет сохранен результат, где можно посмотреть доступные для работы площадки.
diff --git a/wiki/1.0.0/04.05-Сборка-terraform-провайдера-в-образ.md b/wiki/1.0.0/04.05-Сборка-terraform-провайдера-в-образ.md
deleted file mode 100644
index ad54785..0000000
--- a/wiki/1.0.0/04.05-Сборка-terraform-провайдера-в-образ.md
+++ /dev/null
@@ -1,43 +0,0 @@
-Образ приложения - современный способ запуска приложений. Образ приложения представляет собой контейнер, в который входит ОС и необходимые для работы приложения пакеты.
-Способов создать образ приложения довольно много, для этого существуют программы контейнеризации:
-- Docker
-- Podman
-- и другие
-Образ представляет собой "зафиксированную" версию приложения, что означает, что никакие изменения в приложения внесены быть не могут. Так же означает то, что приложение не может создавать побочные файлы при работе.
-Контейнер - это запущенный экземпляр образа. То есть, один образ может порождать множество контейнеров, каждый из которых будет включать в себя отдельный экземпляр приложения.
-Одно из преимуществ работы приложения в контейнере - кроссплатформенность. Это преимущество обуславливается тем, что образ приложения уже включает в себя все необходимое для успешной работы приложения, в том числе операционную систему. Поэтому, пользователю достаточно установить на вычислительной машине программу, которая обеспечивает работу с образами приложений.
-
-## Docker
-Docker является одной из самых популярных программ для работы с образами.
-Docker позволяет:
-- Создавать образы
-- Запускать контейнеры
-- Управлять контейнерами
-- Управлять образами
-Скачать и установить Docker можно по ссылке https://docs.docker.com/get-docker/
-
-## Сборка terraform провайдера
-### Требования:
-- Docker
-- git
-- Компилятор языка GO
-= make
-### Установка необходимых программ
-1. Компилятор языка GO можно скачать и установить по ссылке: https://go.dev/dl/
-2. Docker можно скачать и установить по ссылке выше.
-3. Git можно скачать и установить по ссылке: https://git-scm.com/
-4. Программа make входит в пакет установленных программ для ОС Linux. Для Windows можно воспользоваться инструкцией со stack overflow: https://stackoverflow.com/questions/32127524/how-to-install-and-use-make-in-windows
-### Порядок действий
-1. Склонировать репозиторий с провайдером:
-```bash
-git clone https://github.com/rudecs/terraform-provider-dynamix.git
-```
-2. Перейти в директорию со скачанным кодом:
-```bash
-cd terraform-provider-dynamix
-```
-3. Выполнить команду:
-```bash
-make image
-```
-В результате выполнения данной последовательности, будет создан docker образ, который содержит в себе приложение terraform, terraform провайдер.
diff --git a/wiki/1.0.0/05.-Работа-с-terraform.md b/wiki/1.0.0/05.-Работа-с-terraform.md
deleted file mode 100644
index 675f2ea..0000000
--- a/wiki/1.0.0/05.-Работа-с-terraform.md
+++ /dev/null
@@ -1,4 +0,0 @@
-Раздел описывает некоторые практики работы с terraform, которые могут быть полезны пользователю.
-Раздел включает в себя следующие статьи:
-- Импортирование ресурсов
-- Работа с таймаутами
diff --git a/wiki/1.0.0/05.01-Импортирование-ресурсов.md b/wiki/1.0.0/05.01-Импортирование-ресурсов.md
deleted file mode 100644
index 6983e22..0000000
--- a/wiki/1.0.0/05.01-Импортирование-ресурсов.md
+++ /dev/null
@@ -1,75 +0,0 @@
-Импортирование ресурсов в terraform позволяет привести в соответствие состояние terraform (.tfstate) к состоянию ресурса в платформе.
-Необходимость такого приведения возникает в нескольких случаях:
-- Ресурс был создан через портал платформы, работа продолжается через terraform провайдер,
-- Ресурс был создан через terraform провайдер, однако был изменен через портал платформы,
-- Ресурс был создан через terraform провайдер, однако был изменен другим пользователем через terraform провайдер,
-- И так далее
-
-Такие расхождения в состоянии ресурсов нередки, путей их решения несколько:
-- Использовать импортирование ресурсов,
-- Использовать общие файлы состояний ресурсов, к которым будут иметь доступ все участники, занятые в работе с платформой.
-В текущем разделе рассматривается первый вариант.
-
-## Импортирование ресурсов
-Импортирование ресурсов позволяет совершить запрос к платформе, чтобы сформировать файл состояния.
-Чтобы совершить импортирование ресурсов необходимо ввести сл. команду:
-```bash
-terraform import .
-```
-## Пример
-Предположим, что у нас ресурс, описывающий диск:
-```terraform
-resource "dynamix_disk" "disk" {
- account_id = 121212
- gid = 3333
- disk_name = "mySuperDisk"
- size_max = 100500
-}
-```
-Если запустить команду:
-```bash
-terraform apply
-```
-То у нас будет создан новый диск.
-Но, такой диск уже есть на площадке и мы хотели бы сформировать .tfstate для этого ресурса.
-Поэтому, для начала, необходимо получить список дисков:
-```terraform
-data "dynamix_disk_list" "dl"{
-
-}
-output "test" {
- value = data.dynamix_disk_list.dl
-}
-```
-В полученных данных необходимо найти требуемый диск, получить его id - параметр disk_id. Пусть это будет - 777777
-Теперь можно выполнить импортирование:
-```bash
-terraform import dynamix_disk.disk 777777
-```
-Команда должна успешно завершиться, появиться файл состояний, который позволит манипулировать ресурсом.
-
-## Ошибки при импортировании
-При импортировании ресурса может возникнуть сл. ошибка:
-```bash
-Error: : required field is not set
-```
-Где - наименование поля.
-Ошибка возникает в том случае, если в описании ресурса отсутствует обязательное поле.
-Например:
-```terraform
-resource "dynamix_disk" "disk" {
- account_id = 121212
- gid = 3333
- size_max = 100500
-}
-```
-В приведенном выше описании отсутствует поле disk_name, поэтому, при попытке импортирования возникнет ошибка.
-Для ее устранения, необходимо выполнить запрос на получение списка дисков, найти недостающее поле, после чего добавить его в описание ресурса.
-После этого повторить попытку импортирования.
-
-## Общий алгоритм устранения ошибок
-1. Выполнить запрос импортирования
-2. В случае ошибки - внести недостающие поля.
-3. Повторить п.1.
-
-
diff --git a/wiki/1.0.0/05.02-Работа-с-таймаутами.md b/wiki/1.0.0/05.02-Работа-с-таймаутами.md
deleted file mode 100644
index ecffe69..0000000
--- a/wiki/1.0.0/05.02-Работа-с-таймаутами.md
+++ /dev/null
@@ -1,100 +0,0 @@
-Terraform провайдер DYNAMIX поддерживает тонкую настройку таймаутов выполнения запросов к платформе. Таймауты необходимы для определения максимального времени выполнения запроса. При превышении этого времени соединение рвется и запрос считается невыполненным.
-Таймауты применяются при работе с _resource_ функциями провайдера. _Data source_ функции по-умолчанию имеют таймаут в 20 минут и изменяться не может.
-
-## Стандартные таймауты terraform
-| Операция | Время | Описание |
-| --- | --- | --- |
-| create | 20 минут | Создание ресурса |
-| read | 20 минут | Чтение ресурса |
-| update | 20 минут | Обновление ресурса |
-| delete | 20 минут | Удаление ресурса |
-| default | 20 минут | Значение по умолчанию. Устанавливает значение для всех операций |
-
-## Стандартные таймауты провайдера DYNAMIX
-В провайдере DYNAMIX таймауты переопределены для того, чтобы уменьшить нагрузку на платформу.
-| Операция | Время | Описание |
-| --- | --- | --- |
-| create | 10 минут | Создание ресурса |
-| read | 5 минут | Чтение ресурса |
-| update | 5 минут | Обновление ресурса |
-| delete | 5 минут | Удаление ресурса |
-| default | 5 минут | Значение по умолчанию. Устанавливает значение для всех операций |
-
-## Установка таймаутов
-Все таймауты можно установить самостоятельно для каждого ресурса.
-Для этого используется блок _timeouts_, который имеется в каждом ресурсе провайдера.
-Пример:
-```terraform
-resource "dynamix_res" "res_name" {
- timeouts {
- create = "10m"
- update = "1m"
- delete = "2m"
- read = "7m"
- #default = "15m"
- }
-}
-```
-Где:
-- create - операция создания ресурса
-- read - операция чтения ресурса
-- update - операция обновления ресурса
-- delete - операция удаления ресурса
-- default - установит заданное время для всех операций
-## Формат установления времени
-Как видно из примера выше, провайдер принимает на вход строку вида:
-```
-""
-```
-Где:
-- time-num - число
-- time-val - сокращенная запись значения временного отрезка.
-
-Таблица с временными отрезками:
-
-| Отрезок | Значение |
-| --- | --- |
-| n | наносекунда |
-| ms | миллисекунда |
-| s | секунда |
-| m | минута |
-| h | час |
-
-Примеры:
-```
-"10m"
-"1s"
-"1h10m"
-```
-И так далее
-
-## Работа с таймером через .tf-файл
-В .tf-файле, в блоке ресурса можно задавать таймауты для операций над ресурсом, однако, при работе с таймаутом, следует помнить о правиле:
-__В случае изменения таймаутов в .tf-файле, операции с новыми таймаутами будут производиться только после apply/plan/destroy__
-То есть, если изменить таймауты и выполнить операцию, то она выполнится со старыми таймаутами, а сл. операция уже будет выполнена с новыми таймаутами.
-Это объясняется тем, что значения таймаутов считываются из файла состояний .tfstate при выполнении операции, и новые значения таймаутов попадут туда только при успешно выполненной операции.
-
-## Ошибки при работе с таймаутом
-### context deadline exceeded
-Если время таймаута слишком короткое, то можно получить сл. ошибку:
-```
-context deadline exceeded
-```
-Которая говорит, что было выполнено прерывание работы программы из-за истечения времени на операцию.
-Для исправления можно увеличить размер окна таймаута и выполнить успешный запрос (например, с помощью терминала), чтобы новое значения таймаутов было добавлено в .tfstate. В противном случае, файл состояния придется править в ручную, либо удалить его и импортировать ресурс для формирования .tfstate.
-
-### 504 ошибка
-Данная ошибка говорит о том, что сервер принудительно разорвал соединения из-за истечения времени на ответ.
-В случае получения данной ошибки, обратитесь в службу технической поддержки.
-
-## Работа с таймаутами через терминал
-Сл. команда выполнит операцию terraform с заданным таймаутом:
-```bash
-timeout