Compare commits

..

No commits in common. 'main' and '1.2.2' have entirely different histories.
main ... 1.2.2

@ -1,110 +1,13 @@
## Version 1.3.0
## Version 1.2.2
### Добавлено
#### account
| Идентификатор<br>задачи | Описание |
| --- | --- |
| 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
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-905 | Опциональное поле `chipset` в resource `dynamix_bservice_group` |
| BATF-906 | Вычисляемое поле `chipset` в datasource `dynamix_bservice_group` |
#### disks
| Идентификатор<br>задачи | Описание |
| --- | --- |
| 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
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-907 | Опциональное поле `ovs_bridge` в datasource `dynamix_extnet_list` |
| BATF-911 | Вычисляемое поле `ntp` в datasource `dynamix_extnet` |
#### image
| Идентификатор<br>задачи | Описание |
| --- | --- |
| 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
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-900 | Вычисляемое поле `desc` в datasource `dynamix_k8s` |
#### kvmvm
| Идентификатор<br>задачи | Описание |
| --- | --- |
| 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
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-945 | Вычисляемые поля `created_by` и `created_time` в resource `dynamix_resgroup` |
| BATF-879 | Исправлена работа resources `dynamix_bservice` и `dynamix_bservice_group` в cloudapi/bservice |
#### vins
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-898 | Опциональное поле `status` в datasource `dynamix_vins_list` в cloudapi/vins |
### Удалено
#### kvmvm
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-938 | Опциональное поле `stateless`, `cd` в resource `dynamix_kvmvm` |
#### rg
| Идентификатор<br>задачи | Описание |
| --- | --- |
| 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` |
### Исправлено
#### общие изменения
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-883 | Исправлены некорректные импорты имеющихся ресурсов |
| BATF-984 | Установлены значения по умолчанию для булевых полех в имеющихся ресурсов |
#### disks
| Идентификатор<br>задачи | Описание |
| --- | --- |
| 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
| Идентификатор<br>задачи | Описание |
| --- | --- |
| 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
| Идентификатор<br>задачи | Описание |
| --- | --- |
| 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` |
| BATF-877 | Исправлена ошибка записи state в resource `dynamix_vins` в cloudapi/vins |

@ -8,7 +8,7 @@ ZIPDIR = ./zip
BINARY=${NAME}
WORKPATH= ./examples/terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${SECONDNAMESPACE}/${VERSION}/${OS_ARCH}
MAINPATH = ./cmd/dynamix/
VERSION=1.3.0
VERSION=1.2.2
OS_ARCH=$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)
FILES = ${BINARY}_${VERSION}_darwin_amd64\

@ -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 стали атрибутами. При конфигурации ресурса задаются как атрибуты (через знак равно).<br/>Стало: def_net = {}.<br/>Было: def_net {}. | |
| resource dynamix_resgroup | force, permanently | Новые дефолтные значения: true.<br/>Старые дефолтные значения: false. | |
| resource dynamix_resgroup | restore | Новое дефолтное значение: true. | |
| data source dynamix_rg_usage | seps | Изменилась внутренняя структура списка seps<br/>Было: sep_id (string), map (map[string]string).<br/>Стало: 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 стали атрибутами. При конфигурации ресурса задаются как атрибуты (через знак равно).<br/>Стало: def_net = {}.<br/>Было: def_net {}. | |
| resource dynamix_resgroup | force, permanently | Новые дефолтные значения: true.<br/>Старые дефолтные значения: false. | |
| resource dynamix_resgroup | restore | Новое дефолтное значение: true. | |
| data source dynamix_rg_usage | seps | Изменилась внутренняя структура списка seps<br/>Было: sep_id (string), map (map[string]string).<br/>Стало: 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,45 +103,42 @@
#### Внутренние сети 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.<br/>Старые дефолтные значения: 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.<br/>Старые дефолтные значения: 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,libvirt_settings |
| resource dynamix_vins | ext_net, vnf_dev, config, mgmt, resources, qos, default_qos, vnfs, dhcp, devices, primary, gw, nat, libvirt_settings |
| Название ресурса | Поля схемы |
|--------------------------|----------------------------------------------------------------------------------------------------|
| 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 |
#### Виртуальные машины 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.<br/>Старые дефолтные значения: 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 | Комментарий |
|------------------------|-------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|
| resource dynamix_kvmvm | disks | Поле удалено | Исключено дублирование работы с дисками, которое можно производить при помощи ресурса dynamix_disk |
| resource dynamix_kvmvm | affinity_rules, anti_affinity_rules | Изменен тип с List на Set | |
| resource dynamix_kvmvm | force, permanently | Новые дефолтные значения: true.<br/>Старые дефолтные значения: false. | |
| resource dynamix_kvmvm | restore | Новое дефолтное значение: true. | |
| resource dynamix_kvmvm | - | Операция автоматического восстановления диска (для диска, находящегося в корзине) теперь происходит при чтении ресурса. Ранее она происходила при обновлении ресурса. | |
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Single (единичная структура):
| Название ресурса | Поля схемы |
|------------------|------------|
| 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 |
| Название ресурса | Поля схемы |
|----------------------------------------|---------------------------------------------------------|
| 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 |
#### Балансировщики нагрузок lb
@ -149,13 +146,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
@ -163,8 +160,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 |
@ -175,22 +172,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 |
| Название ресурса | Поля схемы |
|------------------------------------------|------------|
| 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 |

@ -40,7 +40,6 @@ description: |-
- `deactivation_time` (Number)
- `deleted_by` (String)
- `deleted_time` (Number)
- `desc` (String)
- `displayname` (String)
- `guid` (Number)
- `id` (String) The ID of this resource.

@ -51,7 +51,6 @@ Read-Only:
- `compute_features` (List of String)
- `created_time` (Number)
- `deleted_time` (Number)
- `desc` (String)
- `status` (String)
- `updated_time` (Number)

@ -1,12 +1,12 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "dynamix_account_deleted_list Data Source - terraform-provider-dynamix"
page_title: "dynamix_account_list_deleted Data Source - terraform-provider-dynamix"
subcategory: ""
description: |-
---
# dynamix_account_deleted_list (Data Source)
# dynamix_account_list_deleted (Data Source)
@ -50,7 +50,6 @@ Read-Only:
- `compute_features` (List of String)
- `created_time` (Number)
- `deleted_time` (Number)
- `desc` (String)
- `status` (String)
- `updated_time` (Number)

@ -55,7 +55,6 @@ 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)

@ -70,7 +70,6 @@ Optional:
Read-Only:
- `chipset` (String)
- `id` (Number)
- `ip_addresses` (List of String)
- `name` (String)

@ -29,9 +29,7 @@ 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)
@ -40,17 +38,14 @@ description: |-
- `gid` (Number)
- `id` (String) The ID of this resource.
- `image_id` (Number)
- `images` (List of Number)
- `images` (List of String)
- `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` (Map of Number)
- `present_to` (List of Number)
- `purge_time` (Number)
- `res_id` (String)
- `res_name` (String)
@ -58,15 +53,12 @@ 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)
<a id="nestedblock--timeouts"></a>

@ -55,9 +55,7 @@ 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)
@ -66,17 +64,16 @@ Read-Only:
- `disk_name` (String)
- `gid` (Number)
- `image_id` (Number)
- `images` (List of Number)
- `images` (List of String)
- `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` (Map of Number)
- `present_to` (List of Number)
- `purge_time` (Number)
- `res_id` (String)
- `res_name` (String)
@ -84,15 +81,12 @@ 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)
<a id="nestedatt--items--computes"></a>

@ -52,9 +52,7 @@ 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)
@ -63,17 +61,16 @@ Read-Only:
- `disk_name` (String)
- `gid` (Number)
- `image_id` (Number)
- `images` (List of Number)
- `images` (List of String)
- `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` (Map of Number)
- `present_to` (List of Number)
- `purge_time` (Number)
- `res_id` (String)
- `res_name` (String)
@ -81,15 +78,12 @@ 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)
<a id="nestedatt--items--computes"></a>

@ -64,7 +64,7 @@ Read-Only:
- `gid` (Number)
- `guid` (Number)
- `image_id` (Number)
- `images` (List of Number)
- `images` (List of String)
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--items--iotune))
- `iqn` (String)
- `login` (String)

@ -38,14 +38,14 @@ description: |-
- `disk_name` (String)
- `gid` (Number)
- `image_id` (Number)
- `images` (List of Number)
- `images` (List of String)
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--iotune))
- `order` (Number)
- `params` (String)
- `parent_id` (Number)
- `pci_slot` (Number)
- `pool` (String)
- `present_to` (Map of Number)
- `present_to` (List of Number)
- `purge_time` (Number)
- `replication` (Attributes) (see [below for nested schema](#nestedatt--replication))
- `res_id` (String)

@ -43,7 +43,6 @@ description: |-
- `net_name` (String)
- `network` (String)
- `network_id` (Number)
- `ntp` (List of String)
- `pre_reservations_num` (Number)
- `prefix` (Number)
- `pri_vnf_dev_id` (Number)

@ -21,7 +21,6 @@ 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)

@ -51,7 +51,7 @@ description: |-
- `network_interface_naming` (String)
- `password` (String)
- `pool_name` (String)
- `present_to` (Map of Number)
- `present_to` (List of Number)
- `provider_name` (String)
- `purge_attempts` (Number)
- `res_id` (String)
@ -59,7 +59,6 @@ description: |-
- `sep_id` (Number)
- `shared_with` (List of Number)
- `size` (Number)
- `snapshot_id` (String)
- `status` (String)
- `tech_status` (String)
- `unc_path` (String)

@ -34,7 +34,6 @@ description: |-
- `created_time` (Number)
- `deleted_by` (String)
- `deleted_time` (Number)
- `desc` (String)
- `extnet_id` (Number)
- `extnet_only` (Boolean)
- `ha_mode` (Boolean)

@ -35,7 +35,6 @@ 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)
@ -55,13 +54,11 @@ 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)
@ -74,7 +71,6 @@ 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))
@ -98,7 +94,7 @@ description: |-
- `updated_time` (Number)
- `user_data` (String)
- `user_managed` (Boolean)
- `vgpus` (Attributes List) (see [below for nested schema](#nestedatt--vgpus))
- `vgpus` (List of Number)
- `virtual_image_id` (Number)
- `virtual_image_name` (String)
- `vnc_password` (String)
@ -217,7 +213,7 @@ Read-Only:
- `passwd` (String)
- `pci_slot` (Number)
- `pool` (String)
- `present_to` (Map of Number)
- `present_to` (List of Number)
- `purge_time` (Number)
- `reality_device_number` (Number)
- `reference_id` (String)
@ -226,7 +222,6 @@ 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))
@ -357,29 +352,3 @@ Read-Only:
- `guid` (String)
- `label` (String)
- `timestamp` (Number)
<a id="nestedatt--vgpus"></a>
### 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)

@ -63,7 +63,6 @@ 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)
@ -84,11 +83,9 @@ 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)
@ -96,7 +93,6 @@ Read-Only:
- `milestones` (Number)
- `name` (String)
- `need_reboot` (Boolean)
- `network_interface_naming` (String)
- `numa_affinity` (String)
- `numa_node_id` (Number)
- `pinned` (Boolean)

@ -61,7 +61,6 @@ 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)
@ -82,11 +81,9 @@ 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)
@ -94,7 +91,6 @@ Read-Only:
- `milestones` (Number)
- `name` (String)
- `need_reboot` (Boolean)
- `network_interface_naming` (String)
- `numa_affinity` (String)
- `numa_node_id` (Number)
- `pinned` (Boolean)

@ -46,6 +46,7 @@ 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)

@ -69,6 +69,7 @@ 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)

@ -67,6 +67,7 @@ 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)

@ -26,7 +26,6 @@ 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

@ -18,18 +18,18 @@ description: |-
### Required
- `account_name` (String) name of the account
- `username` (String) username of owner the account
### Optional
- `desc` (String) description of the account
- `emailaddress` (String) email
- `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 Set) (see [below for nested schema](#nestedatt--users))
- `users` (Attributes List) (see [below for nested schema](#nestedatt--users))
### Read-Only

@ -28,7 +28,6 @@ description: |-
### Optional
- `chipset` (String) Type of the emulated system, Q35 or i440fx
- `cloud_init` (String)
- `compgroup_id` (Number)
- `extnets` (List of Number)
@ -84,7 +83,6 @@ Optional:
Read-Only:
- `chipset` (String) Type of the emulated system, Q35 or i440fx
- `id` (Number)
- `ip_addresses` (List of String)
- `name` (String)

@ -19,6 +19,7 @@ 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
@ -31,31 +32,27 @@ 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 Number)
- `images` (List of String)
- `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` (Map of Number)
- `present_to` (List of Number)
- `purge_time` (Number)
- `res_id` (String)
- `res_name` (String)
@ -65,9 +62,6 @@ 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)
<a id="nestedatt--iotune"></a>

@ -45,14 +45,14 @@ description: |-
- `gid` (Number)
- `id` (String) The ID of this resource.
- `image_id` (Number)
- `images` (List of Number)
- `images` (List of String)
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--iotune))
- `order` (Number)
- `params` (String)
- `parent_id` (Number)
- `pci_slot` (Number)
- `pool` (String)
- `present_to` (Map of Number)
- `present_to` (List of Number)
- `purge_time` (Number)
- `replica_disk_id` (Number)
- `replication` (Attributes) (see [below for nested schema](#nestedatt--replication))

@ -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 unknown
- `image_type` (String) Image type linux, windows or other
- `url` (String) URL where to download media from
### Optional
@ -56,14 +56,13 @@ description: |-
- `link_to` (Number)
- `milestones` (Number)
- `network_interface_naming` (String)
- `present_to` (Map of Number)
- `present_to` (List 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)

@ -31,7 +31,6 @@ description: |-
- `architecture` (String)
- `boot_type` (String)
- `bootable` (Boolean)
- `cd_presented_to` (String)
- `ckey` (String)
- `compute_ci_id` (Number)
- `deleted_time` (Number)
@ -48,10 +47,9 @@ 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` (Map of Number)
- `present_to` (List of Number)
- `provider_name` (String)
- `purge_attempts` (Number)
- `res_id` (String)
@ -59,7 +57,6 @@ description: |-
- `sep_id` (Number)
- `shared_with` (List of Number)
- `size` (Number)
- `snapshot_id` (String)
- `status` (String)
- `tech_status` (String)
- `unc_path` (String)

@ -32,6 +32,7 @@ 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)

@ -28,28 +28,26 @@ 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.
- `boot_type` (String) Type of image upload
- `cd_image_id` (Number)
- `cd` (Attributes) (see [below for nested schema](#nestedatt--cd))
- `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
@ -63,8 +61,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))
@ -80,6 +78,7 @@ 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)
@ -123,7 +122,7 @@ description: |-
- `updated_time` (Number)
- `user_data` (String)
- `user_managed` (Boolean)
- `vgpus` (Attributes List) (see [below for nested schema](#nestedatt--vgpus))
- `vgpus` (List of Number)
- `virtual_image_id` (Number)
- `virtual_image_name` (String)
- `vnc_password` (String)
@ -158,6 +157,14 @@ Optional:
- `value` (String) value that must match the key to be taken into account when analyzing this rule
<a id="nestedatt--cd"></a>
### Nested Schema for `cd`
Required:
- `cdrom_id` (Number)
<a id="nestedatt--network"></a>
### Nested Schema for `network`
@ -169,10 +176,13 @@ 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.
<a id="nestedatt--port_forwarding"></a>
### Nested Schema for `port_forwarding`
@ -291,6 +301,7 @@ Read-Only:
- `acl` (String)
- `boot_partition` (Number)
- `bus_number` (Number)
- `ckey` (String)
- `created_time` (Number)
- `deleted_time` (Number)
- `desc` (String)
@ -300,7 +311,7 @@ Read-Only:
- `gid` (Number)
- `guid` (Number)
- `image_id` (Number)
- `images` (List of Number)
- `images` (List of String)
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--boot_disk--iotune))
- `iqn` (String)
- `login` (String)
@ -312,7 +323,7 @@ Read-Only:
- `passwd` (String)
- `pci_slot` (Number)
- `pool` (String)
- `present_to` (Map of Number)
- `present_to` (List of Number)
- `purge_time` (Number)
- `reality_device_number` (Number)
- `reference_id` (String)
@ -386,6 +397,7 @@ Read-Only:
- `acl` (String)
- `boot_partition` (Number)
- `bus_number` (Number)
- `ckey` (String)
- `created_time` (Number)
- `deleted_time` (Number)
- `desc` (String)
@ -395,7 +407,7 @@ Read-Only:
- `gid` (Number)
- `guid` (Number)
- `image_id` (Number)
- `images` (List of Number)
- `images` (List of String)
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--disks--iotune))
- `iqn` (String)
- `login` (String)
@ -407,7 +419,7 @@ Read-Only:
- `passwd` (String)
- `pci_slot` (Number)
- `pool` (String)
- `present_to` (Map of Number)
- `present_to` (List of Number)
- `purge_time` (Number)
- `reality_device_number` (Number)
- `reference_id` (String)
@ -546,29 +558,3 @@ Read-Only:
- `guid` (String)
- `label` (String)
- `timestamp` (Number)
<a id="nestedatt--vgpus"></a>
### 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)

@ -23,7 +23,7 @@ description: |-
### Optional
- `access` (Attributes Set) Grant/revoke user or group access to the Resource group as specified (see [below for nested schema](#nestedatt--access))
- `access` (Attributes List) 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,6 +35,7 @@ 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
@ -46,8 +47,6 @@ 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)

@ -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.11.5
repository.basistech.ru/BASIS/decort-golang-sdk v1.10.2
)
require (

@ -100,7 +100,5 @@ 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.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=
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=

@ -6,6 +6,12 @@ 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

@ -17,12 +17,3 @@ 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
}

@ -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_deleted_list"
resp.TypeName = req.ProviderTypeName + "_account_list_deleted"
}
// Configure adds the provider configured client to the data source.

@ -51,7 +51,6 @@ 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),

@ -52,7 +52,6 @@ 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() {

@ -48,7 +48,6 @@ 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),

@ -90,7 +90,6 @@ 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),

@ -7,7 +7,6 @@ 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"
@ -48,13 +47,13 @@ func AccountResource(ctx context.Context, state *models.ResourceAccountModel, c
*state = models.ResourceAccountModel{
// request fields
AccountName: types.StringValue(recordAccount.Name),
SendAccessEmails: types.BoolValue(recordAccount.SendAccessEmails),
Users: flattenUsers(ctx, recordAccount.ACL),
Username: state.Username,
EmailAddress: state.EmailAddress,
SendAccessEmails: state.SendAccessEmails,
Users: state.Users,
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,
@ -68,7 +67,6 @@ 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),
@ -76,22 +74,23 @@ 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)),
//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)),
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)),
}
if state.Enable == types.BoolNull() {
state.Enable = types.BoolValue(false)
if recordAccount.Status == "CONFIRMED" {
state.Enable = types.BoolValue(true)
}
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))
}
tflog.Info(ctx, "flattens.AccountResource: after flatten", map[string]any{"account_id": state.Id.ValueString()})
@ -138,30 +137,3 @@ 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
}

@ -27,7 +27,6 @@ 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"`

@ -31,7 +31,6 @@ 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 {

@ -25,7 +25,6 @@ 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"`

@ -31,7 +31,6 @@ 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"`

@ -9,16 +9,17 @@ 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.Set `tfsdk:"users"`
Users types.List `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"`
@ -41,7 +42,6 @@ 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,11 +54,6 @@ 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"`

@ -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, r.client)...)
resp.Diagnostics.Append(utilities.EnableDisableAccount(ctx, uint64(accountId), plan.Enable.ValueBool(), r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceAccount: Error enabling/disabling account")
return
@ -204,6 +204,9 @@ 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{

@ -73,9 +73,6 @@ func MakeSchemaDataSourceAccount() map[string]schema.Attribute {
"deleted_by": schema.StringAttribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"deleted_time": schema.Int64Attribute{
Computed: true,
},

@ -83,9 +83,6 @@ func MakeSchemaDataSourceAccountList() map[string]schema.Attribute {
"account_id": schema.Int64Attribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"account_name": schema.StringAttribute{
Computed: true,
},

@ -72,9 +72,6 @@ func MakeSchemaDataSourceAccountListDeleted() map[string]schema.Attribute {
"deleted_time": schema.Int64Attribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"account_id": schema.Int64Attribute{
Computed: true,
},

@ -201,9 +201,6 @@ func MakeSchemaDataSourceAccountRGList() map[string]schema.Attribute {
"deleted_time": schema.Int64Attribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"rg_id": schema.Int64Attribute{
Computed: true,
},

@ -2,7 +2,6 @@ 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"
@ -15,19 +14,21 @@ 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
"send_access_emails": schema.BoolAttribute{
"emailaddress": schema.StringAttribute{
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
Description: "if true send emails when a user is granted access to resources",
Description: "email",
},
"desc": schema.StringAttribute{
"send_access_emails": schema.BoolAttribute{
Optional: true,
Description: "description of the account",
Description: "if true send emails when a user is granted access to resources",
},
"users": schema.SetNestedAttribute{
"users": schema.ListNestedAttribute{
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
@ -42,25 +43,16 @@ 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: booldefault.StaticBool(true),
// default is false
},
"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,

@ -120,11 +120,10 @@ 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, plan *models.ResourceAccountModel, c *client.Client) diag.Diagnostics {
func EnableDisableAccount(ctx context.Context, accountId uint64, enable bool, 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})
@ -142,8 +141,7 @@ func EnableDisableAccount(ctx context.Context, accountId uint64, plan *models.Re
}
tflog.Info(ctx, "EnableDisableAccount: before calling CloudAPI().Account().Disable", map[string]any{"account_id": accountId})
reason := plan.Reason.ValueString()
res, err := c.CloudAPI().Account().Disable(ctx, account.DisableEnableRequest{AccountID: accountId, Reason: reason})
res, err := c.CloudAPI().Account().Disable(ctx, account.DisableEnableRequest{AccountID: accountId})
if err != nil {
diags.AddError(
"EnableDisableAccount: cannot disable account",
@ -174,12 +172,6 @@ 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})

@ -83,7 +83,6 @@ 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)

@ -57,7 +57,6 @@ 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),
@ -113,7 +112,6 @@ 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)

@ -48,7 +48,6 @@ 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"`
}

@ -22,7 +22,6 @@ 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"`
@ -62,7 +61,6 @@ 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"`
}
@ -70,7 +68,6 @@ 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}},
}

@ -33,9 +33,6 @@ 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{

@ -2,7 +2,6 @@ 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"
)
@ -25,23 +24,15 @@ 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,

@ -4,7 +4,6 @@ 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"
@ -43,13 +42,6 @@ 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,
@ -87,18 +79,12 @@ 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,
@ -133,10 +119,6 @@ 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{

@ -48,12 +48,6 @@ 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()
}
@ -137,12 +131,6 @@ 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 {

@ -39,23 +39,18 @@ 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),
@ -69,23 +64,20 @@ 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.Int64Type, recordDisk.Images)
state.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskDataSource: cannot flatten recordDisk.Images to state.Images", diags))
}
state.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
state.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskDataSource: cannot flatten recordDisk.PresentTo to state.PresentTo", diags))
}

@ -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,9 +59,7 @@ 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)),
@ -70,9 +68,6 @@ 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)),
@ -85,23 +80,20 @@ 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.Int64Type, recordDisk.Images)
d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDataSource: cannot flatten recordDisk.Images to d.Images", diags))
}
d.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
d.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDataSource: cannot flatten recordDisk.PresentTo to d.PresentTo", diags))
}

@ -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,9 +56,7 @@ 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)),
@ -67,7 +65,6 @@ 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)),
@ -80,23 +77,20 @@ 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.Int64Type, recordDisk.Images)
d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDeletedDataSource: cannot flatten recordDisk.Images to d.Images", diags))
}
d.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
d.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDeletedDataSource: cannot flatten recordDisk.PresentTo to d.PresentTo", diags))
}

@ -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.Int64Type, recordDisk.Images)
d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskListUnattachedDataSource: cannot flatten recordDisk.Images to d.Images", diags))
}

@ -47,13 +47,14 @@ 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.Int64Type, recordDisk.Images),
Images: flattens.FlattenSimpleTypeToList(ctx, types.StringType, 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),
@ -72,11 +73,6 @@ 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)),

@ -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,11 +43,13 @@ 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: types.StringValue(recordDisk.Description),
Pool: types.StringValue(recordDisk.Pool),
SEPID: types.Int64Value(int64(recordDisk.SepID)),
Description: plan.Description,
Pool: plan.Pool,
SEPID: plan.SEPID,
Type: plan.Type,
Detach: plan.Detach,
Permanently: plan.Permanently,
Shareable: plan.Shareable,
@ -55,21 +57,16 @@ 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)),
@ -83,17 +80,14 @@ 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.Int64Type, recordDisk.Images)
plan.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskResource: cannot flatten recordDisk.Images to plan.Images", diags))
}
plan.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
plan.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("flattens.DiskResource: cannot flatten recordDisk.PresentTo to plan.PresentTo", diags))
}
@ -135,7 +129,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

@ -57,12 +57,13 @@ 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.Int64Type, recordDisk.Images),
Images: flattens.FlattenSimpleTypeToList(ctx, types.StringType, 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),
@ -79,11 +80,6 @@ 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)),

@ -22,6 +22,12 @@ 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
}
@ -56,7 +62,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
@ -66,7 +72,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
@ -76,7 +82,17 @@ 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()))
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()))
}
return diags

@ -11,14 +11,12 @@ 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"`
@ -27,16 +25,13 @@ 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.Map `tfsdk:"present_to"`
PresentTo types.List `tfsdk:"present_to"`
PurgeTime types.Int64 `tfsdk:"purge_time"`
ResID types.String `tfsdk:"res_id"`
ResName types.String `tfsdk:"res_name"`
@ -44,14 +39,11 @@ 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"`
}

@ -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,9 +33,7 @@ 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"`
@ -48,13 +46,12 @@ 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.Map `tfsdk:"present_to"`
PresentTo types.List `tfsdk:"present_to"`
PurgeTime types.Int64 `tfsdk:"purge_time"`
ResID types.String `tfsdk:"res_id"`
ResName types.String `tfsdk:"res_name"`
@ -62,14 +59,11 @@ 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"`
}

@ -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"`
}

@ -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.Map `tfsdk:"present_to"`
PresentTo types.List `tfsdk:"present_to"`
PurgeTime types.Int64 `tfsdk:"purge_time"`
Replication *ItemReplicationModel `tfsdk:"replication"`
ResID types.String `tfsdk:"res_id"`

@ -11,6 +11,7 @@ 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"`
@ -24,28 +25,23 @@ 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.Map `tfsdk:"present_to"`
PresentTo types.List `tfsdk:"present_to"`
PurgeTime types.Int64 `tfsdk:"purge_time"`
ResID types.String `tfsdk:"res_id"`
ResName types.String `tfsdk:"res_name"`
@ -55,8 +51,6 @@ 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"`
}

@ -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.Map `tfsdk:"present_to"`
PresentTo types.List `tfsdk:"present_to"`
PurgeTime types.Int64 `tfsdk:"purge_time"`
Replication types.Object `tfsdk:"replication"`
ResID types.String `tfsdk:"res_id"`

@ -51,6 +51,7 @@ 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)
@ -66,6 +67,7 @@ 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)
@ -91,7 +93,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,
@ -135,7 +137,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)
@ -145,7 +147,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)
@ -183,7 +185,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
@ -192,7 +194,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)
@ -202,22 +204,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
@ -259,7 +261,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)...)
@ -286,7 +288,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)
@ -296,7 +298,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)
@ -304,7 +306,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
}
@ -316,7 +318,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.

@ -38,15 +38,9 @@ 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,
},
@ -67,7 +61,7 @@ func MakeSchemaDataSourceDisk() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
ElementType: types.StringType,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
@ -116,15 +110,6 @@ 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,
},
@ -140,7 +125,7 @@ func MakeSchemaDataSourceDisk() map[string]schema.Attribute {
"pool": schema.StringAttribute{
Computed: true,
},
"present_to": schema.MapAttribute{
"present_to": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
@ -165,9 +150,6 @@ func MakeSchemaDataSourceDisk() map[string]schema.Attribute {
"shareable": schema.BoolAttribute{
Computed: true,
},
"size_available": schema.Float64Attribute{
Computed: true,
},
"size_max": schema.Int64Attribute{
Computed: true,
},
@ -208,12 +190,6 @@ 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,
},

@ -91,15 +91,9 @@ 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,
},
@ -123,7 +117,7 @@ func MakeSchemaDataSourceDiskList() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
ElementType: types.StringType,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
@ -175,9 +169,6 @@ func MakeSchemaDataSourceDiskList() map[string]schema.Attribute {
"machine_name": schema.StringAttribute{
Computed: true,
},
"milestones": schema.Int64Attribute{
Computed: true,
},
"disk_name": schema.StringAttribute{
Computed: true,
},
@ -196,7 +187,7 @@ func MakeSchemaDataSourceDiskList() map[string]schema.Attribute {
"pool": schema.StringAttribute{
Computed: true,
},
"present_to": schema.MapAttribute{
"present_to": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
@ -221,9 +212,6 @@ func MakeSchemaDataSourceDiskList() map[string]schema.Attribute {
"shareable": schema.BoolAttribute{
Computed: true,
},
"size_available": schema.Float64Attribute{
Computed: true,
},
"size_max": schema.Int64Attribute{
Computed: true,
},
@ -264,12 +252,6 @@ 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,
},

@ -79,15 +79,9 @@ 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,
},
@ -111,7 +105,7 @@ func MakeSchemaDataSourceDiskListDeleted() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
ElementType: types.StringType,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
@ -163,9 +157,6 @@ func MakeSchemaDataSourceDiskListDeleted() map[string]schema.Attribute {
"machine_name": schema.StringAttribute{
Computed: true,
},
"milestones": schema.Int64Attribute{
Computed: true,
},
"disk_name": schema.StringAttribute{
Computed: true,
},
@ -184,7 +175,7 @@ func MakeSchemaDataSourceDiskListDeleted() map[string]schema.Attribute {
"pool": schema.StringAttribute{
Computed: true,
},
"present_to": schema.MapAttribute{
"present_to": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
@ -209,9 +200,6 @@ func MakeSchemaDataSourceDiskListDeleted() map[string]schema.Attribute {
"shareable": schema.BoolAttribute{
Computed: true,
},
"size_available": schema.Float64Attribute{
Computed: true,
},
"size_max": schema.Int64Attribute{
Computed: true,
},
@ -252,12 +240,6 @@ 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,
},

@ -109,7 +109,7 @@ func MakeSchemaDataSourceDiskListUnattached() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
ElementType: types.StringType,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,

@ -66,7 +66,7 @@ func MakeSchemaDataSourceDiskReplication() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
ElementType: types.StringType,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
@ -130,7 +130,7 @@ func MakeSchemaDataSourceDiskReplication() map[string]schema.Attribute {
"pool": schema.StringAttribute{
Computed: true,
},
"present_to": schema.MapAttribute{
"present_to": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},

@ -1,10 +1,11 @@
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"
)
@ -23,6 +24,10 @@ 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{
@ -41,21 +46,23 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
Description: "Storage endpoint provider ID to create disk",
},
"type": schema.StringAttribute{
Computed: true,
Optional: true,
Computed: true,
Validators: []validator.String{
stringvalidator.OneOf("B", "D", "T"), // case is not ignored
},
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: booldefault.StaticBool(true),
// default is false
},
"permanently": schema.BoolAttribute{
Optional: true,
Computed: true,
Description: "Whether to completely delete the disk, works only with non attached disks",
Default: booldefault.StaticBool(true),
// default is false
},
"shareable": schema.BoolAttribute{
Optional: true,
@ -163,15 +170,9 @@ 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,
},
@ -186,22 +187,12 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"gid": schema.Int64Attribute{
Computed: true,
Description: "ID of the grid (platform)",
ElementType: types.StringType,
},
"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,
},
@ -214,7 +205,7 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
"pci_slot": schema.Int64Attribute{
Computed: true,
},
"present_to": schema.MapAttribute{
"present_to": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
@ -267,12 +258,6 @@ 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,
},

@ -97,7 +97,7 @@ func MakeSchemaResourceDiskReplication() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
ElementType: types.StringType,
},
"iotune": schema.SingleNestedAttribute{
Computed: true,
@ -158,7 +158,7 @@ func MakeSchemaResourceDiskReplication() map[string]schema.Attribute {
"pool": schema.StringAttribute{
Computed: true,
},
"present_to": schema.MapAttribute{
"present_to": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},

@ -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,6 +37,7 @@ 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
@ -44,8 +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()),
}
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())
}
@ -61,16 +68,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")
@ -96,7 +103,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 {
@ -104,7 +111,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
@ -112,17 +119,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
@ -132,17 +139,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
@ -161,17 +168,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
}
@ -181,14 +188,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 {
@ -198,18 +205,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
@ -217,7 +224,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
@ -226,7 +233,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,
@ -240,7 +247,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
@ -248,16 +255,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,
})
@ -270,7 +277,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
@ -278,16 +285,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")
@ -313,7 +320,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 {
@ -322,7 +329,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
@ -330,34 +337,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})
}

@ -58,7 +58,6 @@ 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)),

@ -36,7 +36,6 @@ 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,

@ -30,7 +30,6 @@ 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"`

@ -13,7 +13,6 @@ 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"`

@ -31,10 +31,6 @@ 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{

@ -31,10 +31,6 @@ 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",

@ -34,9 +34,6 @@ 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()
}

@ -33,16 +33,16 @@ func FlipgroupResource(ctx context.Context, plan *models.ResourceFLIPGroupModel,
}
*plan = models.ResourceFLIPGroupModel{
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),
AccountID: plan.AccountID,
Name: plan.Name,
NetType: plan.NetType,
NetID: plan.NetID,
ClientType: plan.ClientType,
Timeouts: plan.Timeouts,
Description: types.StringValue(recordFG.Description),
ClientIDs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordFG.ClientIDs),
Description: plan.Description,
ClientIDs: plan.ClientIDs,
ID: plan.ID,
IP: types.StringValue(recordFG.IP),
IP: plan.IP,
AccountName: types.StringValue(recordFG.AccountName),
ConnID: types.Int64Value(int64(recordFG.ConnID)),
@ -69,6 +69,10 @@ 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
}

@ -62,7 +62,6 @@ 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),
@ -78,7 +77,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.MapValueFrom(ctx, types.Int64Type, image.PresentTo)
state.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, image.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenPresentTo", diags))
}

@ -71,7 +71,6 @@ 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),
@ -85,7 +84,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.MapValueFrom(ctx, types.Int64Type, image.PresentTo)
plan.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, image.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenPresentTo", diags))
}

@ -2,7 +2,6 @@ package flattens
import (
"context"
"encoding/json"
"fmt"
"strconv"
@ -31,46 +30,42 @@ 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),
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),
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),
}
plan.ACL, diags = types.ListValueFrom(ctx, types.StringType, image.ACL)
@ -81,7 +76,7 @@ func ResourceImageVirtual(ctx context.Context, plan *models.ImageVirtualResource
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenDrivers", diags))
}
plan.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, image.PresentTo)
plan.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, image.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenPresentTo", diags))
}

@ -37,13 +37,12 @@ type RecordImageModel struct {
Password types.String `tfsdk:"password"`
NetworkInterfaceNaming types.String `tfsdk:"network_interface_naming"`
PoolName types.String `tfsdk:"pool_name"`
PresentTo types.Map `tfsdk:"present_to"`
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"`
SnapshotID types.String `tfsdk:"snapshot_id"`
SharedWith types.List `tfsdk:"shared_with"`
Size types.Int64 `tfsdk:"size"`
Status types.String `tfsdk:"status"`

@ -43,13 +43,12 @@ type ImageResourceModel struct {
LinkTo types.Int64 `tfsdk:"link_to"`
Milestones types.Int64 `tfsdk:"milestones"`
ImageId types.Int64 `tfsdk:"image_id"`
PresentTo types.Map `tfsdk:"present_to"`
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"`
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"`

@ -11,45 +11,42 @@ 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"`
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"`
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"`
}
type HistoryInImageVirtualResourceModel struct {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save