diff --git a/CHANGELOG.md b/CHANGELOG.md
index 890c377b..f707437f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,210 +1,38 @@
-## Version 4.11.0
+## Version 4.11.1
### Добавлено
-#### audit
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1163 | Вычисляемые поля `resgroup_id`, `account_id`, `compute_id` в datasource `decort_cb_audit` в cloudbroker/audit |
-
-#### bservice
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1137 | Для поля `chipset` изменено значение по умолчанию с `i440fx` на `Q35` в resource `decort_bservice_group` в cloudapi/bservice|
-
#### disks
| Идентификатор
задачи | Описание |
| --- | --- |
-| BATF-1186 | Опциональное поле `cache` в resources `decort_disk` в cloudapi/disks и в `decort_cb_disk` в cloudbroker/disks |
-| BATF-1186 | Вычисляемое поле `cache` в datasources `decort_disk`, `decort_disk_list`, `decort_disk_list_deleted`,`decort_disk_list_unattached` в cloudapi/disks и `decort_cb_disk`, `decort_cb_disk_list`, `decort_cb_disk_list_deleted`, `decort_cb_disk_list_unattached` в cloudbroker/disks |
-| BATF-1201 | Опциональное поле `blk_discard` в resource `decort_cb_disk` в cloudbroker/disks |
-| BATF-1201 | Вычисляемое поле `blk_discard` в datasources `decort_disk`, `decort_disk_list`, `decort_disk_list_deleted` и `decort_disk_list_unattached` в cloudapi/disks и `decort_cb_disk`, `decort_cb_disk_list`, `decort_cb_disk_list_deleted` и `decort_cb_disk_list_unattached` в cloudbroker/disks |
-
-#### k8s
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1137 | Для поля `chipset` добавлено значение по умолчанию `Q35` и валидация возможных значений (`i440fx`, `Q35`) в resources `decort_k8s`, `decort_k8s_wg` в cloudapi/k8s и `decort_cb_k8s_cp`, `decort_cb_k8s_wg` в cloudbroker/k8s|
+| BATF-1216 | Вычисляемое поле `blk_discard` в resource `resource_disk` в cloudapi/disks |
#### kvmvm
| Идентификатор
задачи | Описание |
| --- | --- |
-| BATF-1099 | Возможность миграции диска в другой `SEP` в `decort_cb_kvmvm` в cloudbroker/kvmvm |
-| BATF-1137 | Для поля `chipset` добавлено значение по умолчанию `Q35` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
-| BATF-1139 | Опциональное поле `read_only` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
-| BATF-1139 | Вычисляемое поле `read_only` в datasources `decort_cb_kvmvm`, `decort_cb_kvmvm_list` в cloudbroker/kvmvm и в datasources `decort_kvmvm` и `decort_kvmvm_list` в cloudapi/kvmvm |
-| BATF-1161 | Вычисляемое поле `sep_id` в блоке `disks` в datasources `decort_cb_kvmvm_list` в cloudbroker/kvmvm и `decort_kvmvm_list` в cloudapi/kvmvm |
-| BATF-1187 | Опциональное поле `boot_disk_cache` в resources `decort_cb_kvmvm` в cloudbroker/kvmvm |
-| BATF-1187 | Вычисляемое поле `cache` в структуру `disks` в datasources `decort_cb_kvmvm` в cloudbroker/kvmvm и `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_kvmvm` в cloudapi/kvmvm |
-| BATF-1187 | Опциональное поле `cache` в структуру `disks` в resources `decort_cb_kvmvm` в cloudbroker/kvmvm |
-| BATF-1160 | Опциональное поле `net_mask` в структуру `network` в resources `decort_kvmvm` в cloudapi/kvmvm и `decort_cb_kvmvm` в cloudbroker/kvmvm |
-| BATF-1202 | Опциональные поля `boot_disk_blk_discard` и `blk_discard` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
-| BATF-1202 | Вычисляемое поле `blk_discard` в datasources `decort_kvmvm` в cloudapi/kvmvm и в `decort_cb_kvmvm` в cloudbroker/kvmvm |
-| BATF-1202 | Вычисляемое поле `blk_discard` в resource `decort_kvmvm` в cloudapi/kvmvm |
+| BATF-1216 | Вычисляемое поле `blk_discard` в resource `resource_kvmvm` в cloudapi/kvmvm |
-#### node
+
+### Исправлено
+
+#### disks
| Идентификатор
задачи | Описание |
| --- | --- |
-| BATF-1135 | Вычисляемые поля `openvswitch_bridges`, `description`, `sdn_hypervisor_name` в datasource `decort_cb_node` в `cloudbroker/node` |
-| BATF-1135 | Вычисляемые поля `flags`, `model_name` в структуру `cpu_info` в datasource `decort_cb_node` в `cloudbroker/node` |
-| BATF-1135 | Вычисляемые поля `openvswitch_bridges`, `api_url`, `drivers`, `old_compat_lvm_id`, `cpu_allocation_ratio`, `mem_allocation_ratio`, `packages` в datasource `decort_cb_node_list` в `cloudbroker/node` |
-| BATF-1135 | Вычисляемые поля `flags`, `model_name` в структуру `cpu_info` в datasource `decort_cb_node_list` в `cloudbroker/node` |
-| BATF-1153 | Вычисляемое поле `usable_cpus` в datasource `decort_cb_node` и в `decort_cb_node_list` в `cloudbroker/node` |
-| BATF-1193 | Вычисляемые поле `auto_start, auto_start_count` в datasource `decort_cb_node` и в `decort_cb_node_list` в `cloudbroker/node` |
-| BATF-1197 | Вычисляемое поле `mem_allocation_ratio` в datasource `decort_cb_node` в `cloudbroker/node` |
+| BATF-1186 | Тип поля `cache` с опционального на вычисляемый в resources `decort_disk` в cloudapi/disks |
-#### sep
+#### kvmvm
| Идентификатор
задачи | Описание |
| --- | --- |
-| BATF-1161 | Опциональное поле `sep_ids` в datasource `decort_cb_sep_list` и в cloudbroker/sep |
+| BATF-1220 | Ошибки применения новой конфигурации после импортирования в resource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
-#### storage policy
+#### rg
| Идентификатор
задачи | Описание |
| --- | --- |
-| BATF-1164 | Опциональное поле `sep_tech_status` в datasource `decort_storage_policy_list` в `cloudapi/stpolicy` и в datasource `decort_cb_storage_policy_list` в `cloudbroker/stpolicy` |
-| BATF-1152 | Вычисляемое поле `sep_tech_status` в datasource `decort_storage_policy_list` в `cloudapi/stpolicy` и в datasource `decort_cb_storage_policy_list` в `cloudbroker/stpolicy` |
-
-#### user
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1154 | Опциональное поле `sort_by` в datasource `decort_cb_user_get_audit` в `cloudbroker/user` |
-
-#### trunk
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1162 | Опциональное поле `mtu` в resource `decort_cb_trunk` в `cloudbroker/trunk` |
-| BATF-1162 | Вычисляемое поле `mtu` в datasources `decort_cb_trunk` и `decort_cb_trunk_list` в `cloudbroker/trunk` и в datasources `decort_trunk` и `decort_trunk_list` в `cloudapi/trunk` |
+| BATF-1214 | Оптимизировано создание ресурных групп с указанными полем `def_net_type` в `decort_resgroup` в cloudapi/rg и в `decort_cb_rg` в cloudbroker/rg|
+| BATF-1219 | Отображение полей `updated_by` и `updated_time` в datasource `decort_rg_list_computes` в cloudapi/rg |
#### zone
| Идентификатор
задачи | Описание |
| --- | --- |
-| BATF-1192 | Опциональное поле `auto_start` в resource `decort_cb_zone` в `cloudbroker/zone` |
-| BATF-1192 | Вычисляемое поле `auto_start` в datasources `decort_zone`, `decort_zone_list` в `cloudapi/zone` и в `decort_cb_zone_list`, `decort_cb_zone` в `cloudbroker/zone` |
+| BATF-1192 | Ошибка отображения в datasource `decort_zone` в cloudapi/zone |
-### Исправлено
-
-#### account
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1061 | Вывод значения поле `storage_policy_ids` в data_sourse`decort_cb_account` в cloudbroker/account |
-
-#### bservice
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1134 | Вычисляемое поле `stack_id` заменено на `node_id` в data_source и resource `decort_bservice` в cloudapi/bservice |
-| BATF-1194 | Тип поля `driver` с опционального на вычисляемый в `decort_bservice_group` в `cloudbroker/bservice` |
-
-#### disks
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1205 | Ошибка построения и применения плана при использовании состояния, созданного в предыдущих версиях провайдера в resources `decort_disk` в cloudapi/disks и в `decort_cb_disk` cloudbroker/disks |
-
-#### image
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1205 | Ошибка построения и применения плана при использовании состояния, созданного в предыдущих версиях провайдера в resources `decort_image_from_blank_compute`, `decort_image_from_platform_disk`, `decort_virtual_image` в cloudapi/image и в `decort_cb_cdrom_image`, `decort_cb_image`, `decort_cb_image_from_blank_compute`, `decort_cb_image_from_platform_disk`, `decort_cb_virtual_image` в cloudbroker/image |
-
-#### kvmvm
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1134 | Опциональные поля `stack_id`, `pin_to_stack` заменены на `node_id`, `pin_to_node` в resources `decort_kvmvm` в cloudapi/kvmvm и `decort_cb_kvmvm` в cloudbroker/kvmvm |
-| BATF-1134 | Опциональные поля `stack_id`, `stack_name` заменены на `node_id`, `node_name` в data_source `decort_cb_kvmvm_list` в cloudbroker/kvmvm |
-| BATF-1134 | Вычисляемое поле `stack_id` заменено на `node_id` в data_source `decort_kvmvm_pci_device_list` в cloudapi/kvmvm |
-| BATF-1134 | Вычисляемые поля `stack_id`, `stack_name` заменены на `node_id`, `node_name` в data_source `decort_cb_kvmvm`, `decort_cb_kvmvm_list`, `decort_cb_kvmvm_list_deleted` в cloudbroker/kvmvm |
-| BATF-1079 | Отображение поля `disks` в resource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm` в cloudbroker/kvmvm при импорте |
-| BATF-1083 | Отображение поля `boot_disk` в resource `decort_kvmvm` в cloudapi/kvmvm при обновлении поля `image_id` |
-| BATF-1092 | Отображение вычисляемых полей `devicename`,`created_by`, `deleted_by`, `updated_time` в блоке `disks` и блока `loader_meta_iso` в resource `decort_kvmvm`, datasource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm`, datasource `decort_cb_kvmvm` в cloudbroker/kvmvm |
-| BATF-1142 | Остановка виртуальной машины перед удалением в resources `decort_kvmvm` и `decort_cb_kvmvm` в cloudapi/kvmvm и в cloudbroker/kvmvm |
-| BATF-1165 | Тип поля `value` с опционального на обязательный в resource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
-| BATF-1190 | Ошибка при старте на некорректной ноде при указании поля `node_id` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
-
-#### lb
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1188 | Тип поля `start` с обязательного на опциональный в `decort_lb` в `cloudapi/lb` и в `decort_cb_lb` в `cloudbroker/lb` |
-
-#### node
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1166 | Отображение datasource `decort_cb_node_list` в `cloudbroker/node` |
-| BATF-1197 | Тип поля `cpu_allocation_ratio` с int на float в `decort_cb_node` в `cloudbroker/node` |
-
-#### pcidevice
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1134 | Обязательное поле `stack_id` заменено на `node_id` в resource `decort_cb_pcidevice` в cloudbroker/pcidevice |
-| BATF-1134 | Вычисляемое поле `stack_id` заменено на `node_id` в datasoruces `decort_cb_pcidevice` и `decort_cb_pcidevice_list` в cloudbroker/pcidevice |
-
-#### rg
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1062 | Отображение datasourses `decort_rg_list_deleted` в cloudapi/rg и `decort_cb_rg_list_deleted` в cloudbroker/rg |
-
-#### sep
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1171 | Добавлен валидатор для поля `type` в resource `decort_cb_sep` в cloudbroker/sep |
-| BATF-1171 | Заменено значение `ovs` на `ustor` в валидаторе поля `sep_type` в datasource `decort_cb_sep_template` в cloudbroker/sep |
-
-#### user
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1158 | Тип поля `emailaddress` с []string на string в `decort_cb_user` в `cloudbroker/user` |
-
-#### vins
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1134 | Вычисляемые поля `stack_id` заменены на `node_id` в datasource `decort_vins` в cloudapi/vins и datasource и resource `decort_cb_vins` в cloudbroker/vins |
-
-
-### Удалено
-
-#### account
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1136 | Поле `cu_np` во всех resources и datasources |
-| BATF-1146 | Поля `exttraffic` и `ext_traffic` во всех resources и datasources |
-
-#### disks
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1207 | Вычисляемое поле `ckey` из datasource `decort_disk_list_unattached` в cloudapi/disks и `decort_cb_disk_list_unattached` в cloudbroker/disks |
-
-#### flipgroup
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1195 | Опциональное поле `rg_id` из datasource `decort_flipgroup_list` в cloudapi/flipgroup и `decort_cb_flipgroup_list` в cloudbroker/flipgroup |
-| BATF-1195 | Вычисляемые поля `rg_id` и `rg_name` из datasources `decort_flipgroup` и `decort_flipgroup_list` в cloudapi/flipgroup и `decort_cb_flipgroup` и `decort_cb_flipgroup_list` в cloudbroker/flipgroup |
-| BATF-1195 | Вычисляемые поля `rg_id` и `rg_name` из resource `decort_flipgroup` в cloudapi/flipgroup и `decort_cb_flipgroup` в cloudbroker/flipgroup |
-
-#### grid
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1146 | Поля `exttraffic` и `ext_traffic` во всех datasources |
-
-#### image
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1134 | Datasource `decort_cb_image_List_stacks` в cloudbroker/image |
-| BATF-1206 | Вычисляемое поле `ckey` в resource `decort_image` и datasource `decort_image` в cloudapi/image и resources `decort_cb_cdrom_image` и `decort_cb_virtual_image` в cloudbroker/image |
-
-#### node
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1134 | Вычисляемое поля `stack_id` в datasources `decort_cb_node` и `decort_cb_node_list` в cloudbroker/node |
-
-#### pcidevice
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1134 | Вычисляемые поля `ckey`, `meta` в datasources `decort_cb_pcidevice` и `decort_cb_pcidevice_list` в cloudbroker/pcidevice |
-
-#### stack
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1134 | Datasources `decort_stack` и `decort_stack_list` в cloudapi/stack и datasources `decort_cb_stack`, `decort_cb_stack_list` в cloudbroker/stack |
-
-#### rg
-| Идентификатор
задачи | Описание |
-| --- | --- |
-| BATF-1138 | Опциональное поле `ext_traffic` в resource `decort_resgroup` в cloudbroker/rg |
-| BATF-1138 | Поле `cu_np` в resources `decort_resgroup` в cloudapi/rg и в `decort_cb_rg` в cloudbroker/rg |
-| BATF-1146 | Поля `exttraffic`, `ext_traffic` и `cu_np` во всех resources и datasources |
diff --git a/Makefile b/Makefile
index 9cecc0bb..4015f8db 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ ZIPDIR = ./zip
BINARY=${NAME}
WORKPATH= ./examples/terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAMESPACE}/${VERSION}/${OS_ARCH}
MAINPATH = ./cmd/decort/
-VERSION=4.11.0
+VERSION=4.11.1
OS_ARCH=$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)
FILES = ${BINARY}_${VERSION}_darwin_amd64\
diff --git a/docs/data-sources/zone.md b/docs/data-sources/zone.md
index 828bf574..1b0bdba5 100644
--- a/docs/data-sources/zone.md
+++ b/docs/data-sources/zone.md
@@ -17,7 +17,6 @@ description: |-
### Required
-- `auto_start` (Boolean)
- `zone_id` (Number)
### Optional
@@ -27,6 +26,7 @@ description: |-
### Read-Only
- `account_ids` (List of Number)
+- `auto_start` (Boolean)
- `bservice_ids` (List of Number)
- `compute_ids` (List of Number)
- `created_time` (Number)
diff --git a/docs/index.md b/docs/index.md
index 4df9c205..32e95b90 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -17,7 +17,6 @@ description: |-
### Required
- `authenticator` (String) Authentication mode to use when connecting to DECORT cloud API. Should be one of 'decs3o', 'legacy', 'jwt' or 'bvs'.
-- `controller_url` (String) URL of DECORT Cloud controller to use. API calls will be directed to this URL.
### Optional
@@ -26,6 +25,7 @@ description: |-
- `app_secret` (String) Application secret to access DECORT cloud API in 'decs3o' and 'bvs' authentication mode.
- `bvs_password` (String) User password for DECORT cloud API operations in 'bvs' authentication mode.
- `bvs_user` (String) User name for DECORT cloud API operations in 'bvs' authentication mode.
+- `controller_url` (String) URL of DECORT Cloud controller to use. API calls will be directed to this URL.
- `domain` (String) User password for DECORT cloud API operations in 'bvs' authentication mode.
- `jwt` (String) JWT to access DECORT cloud API in 'jwt' authentication mode.
- `oauth2_url` (String) OAuth2 application URL in 'decs3o' and 'bvs' authentication mode.
diff --git a/docs/resources/disk.md b/docs/resources/disk.md
index 50017bed..9351097f 100644
--- a/docs/resources/disk.md
+++ b/docs/resources/disk.md
@@ -37,6 +37,7 @@ description: |-
- `account_name` (String) The name of the subscriber '(account') to whom this disk belongs
- `acl` (String)
+- `blk_discard` (Boolean) Flag indicating whether blk-discard is enabled for the disk
- `cache` (String)
- `computes` (List of Object) (see [below for nested schema](#nestedatt--computes))
- `created_by` (String)
diff --git a/internal/service/cloudapi/disks/resource_disk.go b/internal/service/cloudapi/disks/resource_disk.go
index a9ce2c0c..f8de29ad 100644
--- a/internal/service/cloudapi/disks/resource_disk.go
+++ b/internal/service/cloudapi/disks/resource_disk.go
@@ -802,6 +802,11 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
Type: schema.TypeBool,
Computed: true,
},
+ "blk_discard": {
+ Type: schema.TypeBool,
+ Computed: true,
+ Description: "Flag indicating whether blk-discard is enabled for the disk",
+ },
}
return rets
diff --git a/internal/service/cloudapi/disks/resource_disk_snapshot.go b/internal/service/cloudapi/disks/resource_disk_snapshot.go
index 0b350a96..7507a324 100644
--- a/internal/service/cloudapi/disks/resource_disk_snapshot.go
+++ b/internal/service/cloudapi/disks/resource_disk_snapshot.go
@@ -71,7 +71,7 @@ func resourceDiskSnapshotCreate(ctx context.Context, d *schema.ResourceData, m i
TimeStamp: uint64(d.Get("timestamp").(int)),
}
- log.Debugf("resourceDiskCreate: Snapshot rollback with label", label)
+ log.Debugf("resourceDiskCreate: Snapshot rollback with label %s", label)
_, err := c.CloudAPI().Disks().SnapshotRollback(ctx, req)
if err != nil {
return diag.FromErr(err)
diff --git a/internal/service/cloudapi/image/resource_image_virtual.go b/internal/service/cloudapi/image/resource_image_virtual.go
index 1aae5628..c9291868 100644
--- a/internal/service/cloudapi/image/resource_image_virtual.go
+++ b/internal/service/cloudapi/image/resource_image_virtual.go
@@ -1,139 +1,139 @@
-/*
-Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
-Authors:
-Petr Krutov,
-Stanislav Solovev,
-Kasim Baybikov,
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-/*
-Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
-Orchestration Technology) with Terraform by Hashicorp.
-
-Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
-
-Please see README.md to learn where to place source code so that it
-builds seamlessly.
-
-Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
-*/
-
-package image
-
-import (
- "context"
- "strconv"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- log "github.com/sirupsen/logrus"
- "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/image"
- "repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
- "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
-)
-
-func resourceImageVirtualCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
- log.Debugf("resourceImageVirtualCreate: called for image %s", d.Get("name").(string))
-
- c := m.(*controller.ControllerCfg)
- req := image.CreateVirtualRequest{
- Name: d.Get("name").(string),
- TargetID: uint64(d.Get("link_to").(int)),
- AccountID: uint64(d.Get("account_id").(int)),
- }
-
- imageId, err := c.CloudAPI().Image().CreateVirtual(ctx, req)
- if err != nil {
- return diag.FromErr(err)
- }
-
- d.SetId(strconv.FormatUint(imageId, 10))
- d.Set("image_id", imageId)
-
- _, err = utilityImageCheckPresence(ctx, d, m)
- if err != nil {
- return diag.FromErr(err)
- }
-
- return resourceImageRead(ctx, d, m)
-}
-
-func resourceImageVirtualUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
- log.Debugf("resourceImageUpdate: called for %s, id: %s", d.Get("name").(string), d.Id())
-
- if d.HasChange("name") {
- err := resourceImageRename(ctx, d, m)
- if err != nil {
- return diag.FromErr(err)
- }
- }
-
- if d.HasChange("link_to") {
- err := resourceImageVirtualLink(ctx, d, m)
- if err != nil {
- return diag.FromErr(err)
- }
- }
-
- return resourceImageRead(ctx, d, m)
-}
-
-func resourceImageVirtualLink(ctx context.Context, d *schema.ResourceData, m interface{}) error {
- log.Debugf("resourceVirtualImageLink: called for %s, id: %s", d.Get("name").(string), d.Id())
- c := m.(*controller.ControllerCfg)
- req := image.LinkRequest{
- ImageID: uint64(d.Get("image_id").(int)),
- TargetID: uint64(d.Get("link_to").(int)),
- }
-
- _, err := c.CloudAPI().Image().Link(ctx, req)
- if err != nil {
- return err
- }
-
- return nil
-}
-
-func ResourceImageVirtual() *schema.Resource {
- return &schema.Resource{
- SchemaVersion: 2,
-
- CreateContext: resourceImageVirtualCreate,
- ReadContext: resourceImageRead,
- UpdateContext: resourceImageVirtualUpdate,
- DeleteContext: resourceImageDelete,
-
- Importer: &schema.ResourceImporter{
- StateContext: schema.ImportStatePassthroughContext,
- },
-
- Timeouts: &schema.ResourceTimeout{
- Create: &constants.Timeout600s,
- Read: &constants.Timeout300s,
- Update: &constants.Timeout300s,
- Delete: &constants.Timeout300s,
- Default: &constants.Timeout300s,
- },
-
- Schema: resourceImageVirtualSchemaMake(dataSourceImageExtendSchemaMake()),
- StateUpgraders: []schema.StateUpgrader{
- {
- Type: resourceImageVirtualSchemaV1().CoreConfigSchema().ImpliedType(),
- Upgrade: resourcePresentToUpgradeV1,
- Version: 1,
- },
- },
- }
-}
+/*
+Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
+Authors:
+Petr Krutov,
+Stanislav Solovev,
+Kasim Baybikov,
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
+Orchestration Technology) with Terraform by Hashicorp.
+
+Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
+
+Please see README.md to learn where to place source code so that it
+builds seamlessly.
+
+Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
+*/
+
+package image
+
+import (
+ "context"
+ "strconv"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ log "github.com/sirupsen/logrus"
+ "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/image"
+ "repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
+ "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
+)
+
+func resourceImageVirtualCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
+ log.Debugf("resourceImageVirtualCreate: called for image %s", d.Get("name").(string))
+
+ c := m.(*controller.ControllerCfg)
+ req := image.CreateVirtualRequest{
+ Name: d.Get("name").(string),
+ TargetID: uint64(d.Get("link_to").(int)),
+ AccountID: uint64(d.Get("account_id").(int)),
+ }
+
+ imageId, err := c.CloudAPI().Image().CreateVirtual(ctx, req)
+ if err != nil {
+ return diag.FromErr(err)
+ }
+
+ d.SetId(strconv.FormatUint(imageId, 10))
+ d.Set("image_id", imageId)
+
+ _, err = utilityImageCheckPresence(ctx, d, m)
+ if err != nil {
+ return diag.FromErr(err)
+ }
+
+ return resourceImageRead(ctx, d, m)
+}
+
+func resourceImageVirtualUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
+ log.Debugf("resourceImageUpdate: called for %s, id: %s", d.Get("name").(string), d.Id())
+
+ if d.HasChange("name") {
+ err := resourceImageRename(ctx, d, m)
+ if err != nil {
+ return diag.FromErr(err)
+ }
+ }
+
+ if d.HasChange("link_to") {
+ err := resourceImageVirtualLink(ctx, d, m)
+ if err != nil {
+ return diag.FromErr(err)
+ }
+ }
+
+ return resourceImageRead(ctx, d, m)
+}
+
+func resourceImageVirtualLink(ctx context.Context, d *schema.ResourceData, m interface{}) error {
+ log.Debugf("resourceVirtualImageLink: called for %s, id: %s", d.Get("name").(string), d.Id())
+ c := m.(*controller.ControllerCfg)
+ req := image.LinkRequest{
+ ImageID: uint64(d.Get("image_id").(int)),
+ TargetID: uint64(d.Get("link_to").(int)),
+ }
+
+ _, err := c.CloudAPI().Image().Link(ctx, req)
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func ResourceImageVirtual() *schema.Resource {
+ return &schema.Resource{
+ SchemaVersion: 2,
+
+ CreateContext: resourceImageVirtualCreate,
+ ReadContext: resourceImageRead,
+ UpdateContext: resourceImageVirtualUpdate,
+ DeleteContext: resourceImageDelete,
+
+ Importer: &schema.ResourceImporter{
+ StateContext: schema.ImportStatePassthroughContext,
+ },
+
+ Timeouts: &schema.ResourceTimeout{
+ Create: &constants.Timeout600s,
+ Read: &constants.Timeout300s,
+ Update: &constants.Timeout300s,
+ Delete: &constants.Timeout300s,
+ Default: &constants.Timeout300s,
+ },
+
+ Schema: resourceImageVirtualSchemaMake(dataSourceImageExtendSchemaMake()),
+ StateUpgraders: []schema.StateUpgrader{
+ {
+ Type: resourceImageVirtualSchemaV1().CoreConfigSchema().ImpliedType(),
+ Upgrade: resourcePresentToUpgradeV1,
+ Version: 1,
+ },
+ },
+ }
+}
diff --git a/internal/service/cloudapi/k8s/resource_k8s.go b/internal/service/cloudapi/k8s/resource_k8s.go
index 3582643f..457bfacc 100644
--- a/internal/service/cloudapi/k8s/resource_k8s.go
+++ b/internal/service/cloudapi/k8s/resource_k8s.go
@@ -805,13 +805,13 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
Description: "insert ssl certificate in x509 pem format",
},
- "chipset": {
- Type: schema.TypeString,
- Optional: true,
- ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
- Default: "Q35",
- Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
- },
+ "chipset": {
+ Type: schema.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
+ Default: "Q35",
+ Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
+ },
"desc": {
Type: schema.TypeString,
diff --git a/internal/service/cloudapi/k8s/resource_k8s_cp.go b/internal/service/cloudapi/k8s/resource_k8s_cp.go
index 8489fc16..d2779369 100644
--- a/internal/service/cloudapi/k8s/resource_k8s_cp.go
+++ b/internal/service/cloudapi/k8s/resource_k8s_cp.go
@@ -715,13 +715,13 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
),
Description: "Node RAM in MB.",
},
- "chipset": {
- Type: schema.TypeString,
- Optional: true,
- ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
- Default: "Q35",
- Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
- },
+ "chipset": {
+ Type: schema.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
+ Default: "Q35",
+ Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
+ },
"disk": {
Type: schema.TypeInt,
Optional: true,
diff --git a/internal/service/cloudapi/k8s/resource_k8s_wg.go b/internal/service/cloudapi/k8s/resource_k8s_wg.go
index e6d6c43d..0cde9f4b 100644
--- a/internal/service/cloudapi/k8s/resource_k8s_wg.go
+++ b/internal/service/cloudapi/k8s/resource_k8s_wg.go
@@ -290,13 +290,13 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
Description: "Number of worker nodes to create.",
},
- "chipset": {
- Type: schema.TypeString,
- Optional: true,
- ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
- Default: "Q35",
- Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
- },
+ "chipset": {
+ Type: schema.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
+ Default: "Q35",
+ Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
+ },
"cpu": {
Type: schema.TypeInt,
diff --git a/internal/service/cloudapi/kvmvm/flattens.go b/internal/service/cloudapi/kvmvm/flattens.go
index 0cda2bfa..ca2cb819 100644
--- a/internal/service/cloudapi/kvmvm/flattens.go
+++ b/internal/service/cloudapi/kvmvm/flattens.go
@@ -476,6 +476,9 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute, pc
d.Set("network_interface_naming", computeRec.NetworkInterfaceNaming)
d.Set("zone_id", computeRec.ZoneID)
d.Set("loader_meta_iso", flattenLoaderMetaIso(computeRec.LoaderMetaIso))
+ d.Set("cpu_pin", computeRec.CPUPin)
+ d.Set("numa_affinity", computeRec.NumaAffinity)
+ d.Set("hp_backed", computeRec.HPBacked)
d.Set("enabled", false)
if computeRec.Status == status.Enabled {
diff --git a/internal/service/cloudapi/lb/flattens.go b/internal/service/cloudapi/lb/flattens.go
index fc064dd5..db182770 100644
--- a/internal/service/cloudapi/lb/flattens.go
+++ b/internal/service/cloudapi/lb/flattens.go
@@ -1,300 +1,300 @@
-/*
-Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
-Authors:
-Petr Krutov,
-Stanislav Solovev,
-Kasim Baybikov,
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-/*
-Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
-Orchestration Technology) with Terraform by Hashicorp.
-
-Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
-
-Please see README.md to learn where to place source code so that it
-builds seamlessly.
-
-Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
-*/
-
-package lb
-
-import (
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/lb"
-)
-
-func flattenLBFrontendBind(d *schema.ResourceData, b *lb.ItemBinding, lbId int64, frontendName string) {
- d.Set("lb_id", lbId)
- d.Set("frontend_name", frontendName)
- d.Set("name", b.Name)
- d.Set("address", b.Address)
- d.Set("guid", b.GUID)
- d.Set("port", b.Port)
-}
-
-func flattenLBFrontend(d *schema.ResourceData, f *lb.ItemFrontend, lbId int64) {
- d.Set("lb_id", lbId)
- d.Set("backend_name", f.Backend)
- d.Set("name", f.Name)
- d.Set("guid", f.GUID)
- d.Set("bindings", flattendBindings(f.Bindings))
-}
-
-func flattenResourceLBBackendServer(d *schema.ResourceData, s *lb.ItemServer, lbId int64, backendName string) {
- d.Set("lb_id", lbId)
- d.Set("backend_name", backendName)
- d.Set("name", s.Name)
- d.Set("port", s.Port)
- d.Set("address", s.Address)
- d.Set("check", s.Check)
- d.Set("guid", s.GUID)
- d.Set("downinter", s.ServerSettings.DownInter)
- d.Set("fall", s.ServerSettings.Fall)
- d.Set("inter", s.ServerSettings.Inter)
- d.Set("maxconn", s.ServerSettings.MaxConn)
- d.Set("maxqueue", s.ServerSettings.MaxQueue)
- d.Set("rise", s.ServerSettings.Rise)
- d.Set("slowstart", s.ServerSettings.SlowStart)
- d.Set("weight", s.ServerSettings.Weight)
-
-}
-
-func flattenResourceLBBackend(d *schema.ResourceData, b *lb.ItemBackend, lbId int64) {
- d.Set("lb_id", lbId)
- d.Set("name", b.Name)
- d.Set("algorithm", b.Algorithm)
- d.Set("guid", b.GUID)
- d.Set("downinter", b.ServerDefaultSettings.DownInter)
- d.Set("fall", b.ServerDefaultSettings.Fall)
- d.Set("inter", b.ServerDefaultSettings.Inter)
- d.Set("maxconn", b.ServerDefaultSettings.MaxConn)
- d.Set("maxqueue", b.ServerDefaultSettings.MaxQueue)
- d.Set("rise", b.ServerDefaultSettings.Rise)
- d.Set("slowstart", b.ServerDefaultSettings.SlowStart)
- d.Set("weight", b.ServerDefaultSettings.Weight)
- d.Set("servers", flattenServers(b.Servers))
-}
-
-func flattenResourceLB(d *schema.ResourceData, lb *lb.RecordLB) {
- d.Set("ha_mode", lb.HAMode)
- d.Set("backend_haip", lb.BackendHAIP)
- d.Set("backends", flattenLBBackends(lb.Backends))
- d.Set("created_by", lb.CreatedBy)
- d.Set("created_time", lb.CreatedTime)
- d.Set("deleted_by", lb.DeletedBy)
- d.Set("deleted_time", lb.DeletedTime)
- d.Set("desc", lb.Description)
- d.Set("dp_api_user", lb.DPAPIUser)
- d.Set("extnet_id", lb.ExtNetID)
- d.Set("frontend_haip", lb.FrontendHAIP)
- d.Set("frontends", flattenFrontends(lb.Frontends))
- d.Set("gid", lb.GID)
- d.Set("guid", lb.GUID)
- d.Set("manager_id", lb.ManagerId)
- d.Set("manager_type", lb.ManagerType)
- d.Set("lb_id", lb.ID)
- d.Set("image_id", lb.ImageID)
- d.Set("milestones", lb.Milestones)
- d.Set("name", lb.Name)
- d.Set("part_k8s", lb.PartK8s)
- d.Set("primary_node", flattenNode(lb.PrimaryNode))
- d.Set("rg_id", lb.RGID)
- d.Set("rg_name", lb.RGName)
- d.Set("secondary_node", flattenNode(lb.SecondaryNode))
- d.Set("status", lb.Status)
- d.Set("tech_status", lb.TechStatus)
- d.Set("updated_by", lb.UpdatedBy)
- d.Set("updated_time", lb.UpdatedTime)
- d.Set("user_managed", lb.UserManaged)
- d.Set("vins_id", lb.VINSID)
- d.Set("zone_id", lb.ZoneID)
-
-}
-
-func flattenLB(d *schema.ResourceData, lb *lb.RecordLB) {
- d.Set("account_id", lb.AccountID)
- d.Set("ha_mode", lb.HAMode)
- d.Set("backend_haip", lb.BackendHAIP)
- d.Set("backends", flattenLBBackends(lb.Backends))
- d.Set("created_by", lb.CreatedBy)
- d.Set("created_time", lb.CreatedTime)
- d.Set("deleted_by", lb.DeletedBy)
- d.Set("deleted_time", lb.DeletedTime)
- d.Set("desc", lb.Description)
- d.Set("dp_api_user", lb.DPAPIUser)
- d.Set("extnet_id", lb.ExtNetID)
- d.Set("frontend_haip", lb.FrontendHAIP)
- d.Set("frontends", flattenFrontends(lb.Frontends))
- d.Set("gid", lb.GID)
- d.Set("guid", lb.GUID)
- d.Set("manager_id", lb.ManagerId)
- d.Set("manager_type", lb.ManagerType)
- d.Set("image_id", lb.ImageID)
- d.Set("milestones", lb.Milestones)
- d.Set("name", lb.Name)
- d.Set("part_k8s", lb.PartK8s)
- d.Set("primary_node", flattenNode(lb.PrimaryNode))
- d.Set("rg_id", lb.RGID)
- d.Set("rg_name", lb.RGName)
- d.Set("secondary_node", flattenNode(lb.SecondaryNode))
- d.Set("status", lb.Status)
- d.Set("tech_status", lb.TechStatus)
- d.Set("updated_by", lb.UpdatedBy)
- d.Set("updated_time", lb.UpdatedTime)
- d.Set("user_managed", lb.UserManaged)
- d.Set("vins_id", lb.VINSID)
- d.Set("zone_id", lb.ZoneID)
-}
-
-func flattenNode(node lb.RecordNode) []map[string]interface{} {
- temp := make([]map[string]interface{}, 0)
- n := map[string]interface{}{
- "backend_ip": node.BackendIP,
- "compute_id": node.ComputeID,
- "frontend_ip": node.FrontendIP,
- "guid": node.GUID,
- "mgmt_ip": node.MGMTIP,
- "network_id": node.NetworkID,
- }
-
- temp = append(temp, n)
-
- return temp
-}
-
-func flattendBindings(bs []lb.ItemBinding) []map[string]interface{} {
- temp := make([]map[string]interface{}, 0, len(bs))
- for _, b := range bs {
- t := map[string]interface{}{
- "address": b.Address,
- "guid": b.GUID,
- "name": b.Name,
- "port": b.Port,
- }
- temp = append(temp, t)
- }
- return temp
-}
-
-func flattenFrontends(fs []lb.ItemFrontend) []map[string]interface{} {
- temp := make([]map[string]interface{}, 0, len(fs))
- for _, f := range fs {
- t := map[string]interface{}{
- "backend": f.Backend,
- "bindings": flattendBindings(f.Bindings),
- "guid": f.GUID,
- "name": f.Name,
- }
- temp = append(temp, t)
- }
-
- return temp
-}
-
-func flattenServers(servers []lb.ItemServer) []map[string]interface{} {
- temp := make([]map[string]interface{}, 0, len(servers))
- for _, server := range servers {
- t := map[string]interface{}{
- "address": server.Address,
- "check": server.Check,
- "guid": server.GUID,
- "name": server.Name,
- "port": server.Port,
- "server_settings": flattenServerSettings(server.ServerSettings),
- }
-
- temp = append(temp, t)
- }
- return temp
-}
-
-func flattenServerSettings(defSet lb.RecordServerSettings) []map[string]interface{} {
- temp := map[string]interface{}{
- "downinter": defSet.DownInter,
- "fall": defSet.Fall,
- "guid": defSet.GUID,
- "inter": defSet.Inter,
- "maxconn": defSet.MaxConn,
- "maxqueue": defSet.MaxQueue,
- "rise": defSet.Rise,
- "slowstart": defSet.SlowStart,
- "weight": defSet.Weight,
- }
-
- res := make([]map[string]interface{}, 0)
- res = append(res, temp)
- return res
-}
-
-func flattenLBBackends(backends []lb.ItemBackend) []map[string]interface{} {
- temp := make([]map[string]interface{}, 0, len(backends))
- for _, item := range backends {
- t := map[string]interface{}{
- "algorithm": item.Algorithm,
- "guid": item.GUID,
- "name": item.Name,
- "server_default_settings": flattenServerSettings(item.ServerDefaultSettings),
- "servers": flattenServers(item.Servers),
- }
-
- temp = append(temp, t)
- }
- return temp
-}
-
-func flattenLBList(lbl *lb.ListLB) []map[string]interface{} {
- res := make([]map[string]interface{}, 0, len(lbl.Data))
- for _, lb := range lbl.Data {
- temp := map[string]interface{}{
- "ha_mode": lb.HAMode,
- "backend_haip": lb.BackendHAIP,
- "backends": flattenLBBackends(lb.Backends),
- "created_by": lb.CreatedBy,
- "created_time": lb.CreatedTime,
- "deleted_by": lb.DeletedBy,
- "deleted_time": lb.DeletedTime,
- "desc": lb.Description,
- "dp_api_user": lb.DPAPIUser,
- "dp_api_password": lb.DPAPIPassword,
- "extnet_id": lb.ExtNetID,
- "frontend_haip": lb.FrontendHAIP,
- "frontends": flattenFrontends(lb.Frontends),
- "gid": lb.GID,
- "guid": lb.GUID,
- "manager_id": lb.ManagerId,
- "manager_type": lb.ManagerType,
- "image_id": lb.ImageID,
- "milestones": lb.Milestones,
- "name": lb.Name,
- "part_k8s": lb.PartK8s,
- "primary_node": flattenNode(lb.PrimaryNode),
- "rg_id": lb.RGID,
- "rg_name": lb.RGName,
- "secondary_node": flattenNode(lb.SecondaryNode),
- "status": lb.Status,
- "tech_status": lb.TechStatus,
- "updated_by": lb.UpdatedBy,
- "updated_time": lb.UpdatedTime,
- "user_managed": lb.UserManaged,
- "vins_id": lb.VINSID,
- "lb_id": lb.ID,
- "zone_id": lb.ZoneID,
- }
- res = append(res, temp)
- }
- return res
-}
+/*
+Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
+Authors:
+Petr Krutov,
+Stanislav Solovev,
+Kasim Baybikov,
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
+Orchestration Technology) with Terraform by Hashicorp.
+
+Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
+
+Please see README.md to learn where to place source code so that it
+builds seamlessly.
+
+Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
+*/
+
+package lb
+
+import (
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/lb"
+)
+
+func flattenLBFrontendBind(d *schema.ResourceData, b *lb.ItemBinding, lbId int64, frontendName string) {
+ d.Set("lb_id", lbId)
+ d.Set("frontend_name", frontendName)
+ d.Set("name", b.Name)
+ d.Set("address", b.Address)
+ d.Set("guid", b.GUID)
+ d.Set("port", b.Port)
+}
+
+func flattenLBFrontend(d *schema.ResourceData, f *lb.ItemFrontend, lbId int64) {
+ d.Set("lb_id", lbId)
+ d.Set("backend_name", f.Backend)
+ d.Set("name", f.Name)
+ d.Set("guid", f.GUID)
+ d.Set("bindings", flattendBindings(f.Bindings))
+}
+
+func flattenResourceLBBackendServer(d *schema.ResourceData, s *lb.ItemServer, lbId int64, backendName string) {
+ d.Set("lb_id", lbId)
+ d.Set("backend_name", backendName)
+ d.Set("name", s.Name)
+ d.Set("port", s.Port)
+ d.Set("address", s.Address)
+ d.Set("check", s.Check)
+ d.Set("guid", s.GUID)
+ d.Set("downinter", s.ServerSettings.DownInter)
+ d.Set("fall", s.ServerSettings.Fall)
+ d.Set("inter", s.ServerSettings.Inter)
+ d.Set("maxconn", s.ServerSettings.MaxConn)
+ d.Set("maxqueue", s.ServerSettings.MaxQueue)
+ d.Set("rise", s.ServerSettings.Rise)
+ d.Set("slowstart", s.ServerSettings.SlowStart)
+ d.Set("weight", s.ServerSettings.Weight)
+
+}
+
+func flattenResourceLBBackend(d *schema.ResourceData, b *lb.ItemBackend, lbId int64) {
+ d.Set("lb_id", lbId)
+ d.Set("name", b.Name)
+ d.Set("algorithm", b.Algorithm)
+ d.Set("guid", b.GUID)
+ d.Set("downinter", b.ServerDefaultSettings.DownInter)
+ d.Set("fall", b.ServerDefaultSettings.Fall)
+ d.Set("inter", b.ServerDefaultSettings.Inter)
+ d.Set("maxconn", b.ServerDefaultSettings.MaxConn)
+ d.Set("maxqueue", b.ServerDefaultSettings.MaxQueue)
+ d.Set("rise", b.ServerDefaultSettings.Rise)
+ d.Set("slowstart", b.ServerDefaultSettings.SlowStart)
+ d.Set("weight", b.ServerDefaultSettings.Weight)
+ d.Set("servers", flattenServers(b.Servers))
+}
+
+func flattenResourceLB(d *schema.ResourceData, lb *lb.RecordLB) {
+ d.Set("ha_mode", lb.HAMode)
+ d.Set("backend_haip", lb.BackendHAIP)
+ d.Set("backends", flattenLBBackends(lb.Backends))
+ d.Set("created_by", lb.CreatedBy)
+ d.Set("created_time", lb.CreatedTime)
+ d.Set("deleted_by", lb.DeletedBy)
+ d.Set("deleted_time", lb.DeletedTime)
+ d.Set("desc", lb.Description)
+ d.Set("dp_api_user", lb.DPAPIUser)
+ d.Set("extnet_id", lb.ExtNetID)
+ d.Set("frontend_haip", lb.FrontendHAIP)
+ d.Set("frontends", flattenFrontends(lb.Frontends))
+ d.Set("gid", lb.GID)
+ d.Set("guid", lb.GUID)
+ d.Set("manager_id", lb.ManagerId)
+ d.Set("manager_type", lb.ManagerType)
+ d.Set("lb_id", lb.ID)
+ d.Set("image_id", lb.ImageID)
+ d.Set("milestones", lb.Milestones)
+ d.Set("name", lb.Name)
+ d.Set("part_k8s", lb.PartK8s)
+ d.Set("primary_node", flattenNode(lb.PrimaryNode))
+ d.Set("rg_id", lb.RGID)
+ d.Set("rg_name", lb.RGName)
+ d.Set("secondary_node", flattenNode(lb.SecondaryNode))
+ d.Set("status", lb.Status)
+ d.Set("tech_status", lb.TechStatus)
+ d.Set("updated_by", lb.UpdatedBy)
+ d.Set("updated_time", lb.UpdatedTime)
+ d.Set("user_managed", lb.UserManaged)
+ d.Set("vins_id", lb.VINSID)
+ d.Set("zone_id", lb.ZoneID)
+
+}
+
+func flattenLB(d *schema.ResourceData, lb *lb.RecordLB) {
+ d.Set("account_id", lb.AccountID)
+ d.Set("ha_mode", lb.HAMode)
+ d.Set("backend_haip", lb.BackendHAIP)
+ d.Set("backends", flattenLBBackends(lb.Backends))
+ d.Set("created_by", lb.CreatedBy)
+ d.Set("created_time", lb.CreatedTime)
+ d.Set("deleted_by", lb.DeletedBy)
+ d.Set("deleted_time", lb.DeletedTime)
+ d.Set("desc", lb.Description)
+ d.Set("dp_api_user", lb.DPAPIUser)
+ d.Set("extnet_id", lb.ExtNetID)
+ d.Set("frontend_haip", lb.FrontendHAIP)
+ d.Set("frontends", flattenFrontends(lb.Frontends))
+ d.Set("gid", lb.GID)
+ d.Set("guid", lb.GUID)
+ d.Set("manager_id", lb.ManagerId)
+ d.Set("manager_type", lb.ManagerType)
+ d.Set("image_id", lb.ImageID)
+ d.Set("milestones", lb.Milestones)
+ d.Set("name", lb.Name)
+ d.Set("part_k8s", lb.PartK8s)
+ d.Set("primary_node", flattenNode(lb.PrimaryNode))
+ d.Set("rg_id", lb.RGID)
+ d.Set("rg_name", lb.RGName)
+ d.Set("secondary_node", flattenNode(lb.SecondaryNode))
+ d.Set("status", lb.Status)
+ d.Set("tech_status", lb.TechStatus)
+ d.Set("updated_by", lb.UpdatedBy)
+ d.Set("updated_time", lb.UpdatedTime)
+ d.Set("user_managed", lb.UserManaged)
+ d.Set("vins_id", lb.VINSID)
+ d.Set("zone_id", lb.ZoneID)
+}
+
+func flattenNode(node lb.RecordNode) []map[string]interface{} {
+ temp := make([]map[string]interface{}, 0)
+ n := map[string]interface{}{
+ "backend_ip": node.BackendIP,
+ "compute_id": node.ComputeID,
+ "frontend_ip": node.FrontendIP,
+ "guid": node.GUID,
+ "mgmt_ip": node.MGMTIP,
+ "network_id": node.NetworkID,
+ }
+
+ temp = append(temp, n)
+
+ return temp
+}
+
+func flattendBindings(bs []lb.ItemBinding) []map[string]interface{} {
+ temp := make([]map[string]interface{}, 0, len(bs))
+ for _, b := range bs {
+ t := map[string]interface{}{
+ "address": b.Address,
+ "guid": b.GUID,
+ "name": b.Name,
+ "port": b.Port,
+ }
+ temp = append(temp, t)
+ }
+ return temp
+}
+
+func flattenFrontends(fs []lb.ItemFrontend) []map[string]interface{} {
+ temp := make([]map[string]interface{}, 0, len(fs))
+ for _, f := range fs {
+ t := map[string]interface{}{
+ "backend": f.Backend,
+ "bindings": flattendBindings(f.Bindings),
+ "guid": f.GUID,
+ "name": f.Name,
+ }
+ temp = append(temp, t)
+ }
+
+ return temp
+}
+
+func flattenServers(servers []lb.ItemServer) []map[string]interface{} {
+ temp := make([]map[string]interface{}, 0, len(servers))
+ for _, server := range servers {
+ t := map[string]interface{}{
+ "address": server.Address,
+ "check": server.Check,
+ "guid": server.GUID,
+ "name": server.Name,
+ "port": server.Port,
+ "server_settings": flattenServerSettings(server.ServerSettings),
+ }
+
+ temp = append(temp, t)
+ }
+ return temp
+}
+
+func flattenServerSettings(defSet lb.RecordServerSettings) []map[string]interface{} {
+ temp := map[string]interface{}{
+ "downinter": defSet.DownInter,
+ "fall": defSet.Fall,
+ "guid": defSet.GUID,
+ "inter": defSet.Inter,
+ "maxconn": defSet.MaxConn,
+ "maxqueue": defSet.MaxQueue,
+ "rise": defSet.Rise,
+ "slowstart": defSet.SlowStart,
+ "weight": defSet.Weight,
+ }
+
+ res := make([]map[string]interface{}, 0)
+ res = append(res, temp)
+ return res
+}
+
+func flattenLBBackends(backends []lb.ItemBackend) []map[string]interface{} {
+ temp := make([]map[string]interface{}, 0, len(backends))
+ for _, item := range backends {
+ t := map[string]interface{}{
+ "algorithm": item.Algorithm,
+ "guid": item.GUID,
+ "name": item.Name,
+ "server_default_settings": flattenServerSettings(item.ServerDefaultSettings),
+ "servers": flattenServers(item.Servers),
+ }
+
+ temp = append(temp, t)
+ }
+ return temp
+}
+
+func flattenLBList(lbl *lb.ListLB) []map[string]interface{} {
+ res := make([]map[string]interface{}, 0, len(lbl.Data))
+ for _, lb := range lbl.Data {
+ temp := map[string]interface{}{
+ "ha_mode": lb.HAMode,
+ "backend_haip": lb.BackendHAIP,
+ "backends": flattenLBBackends(lb.Backends),
+ "created_by": lb.CreatedBy,
+ "created_time": lb.CreatedTime,
+ "deleted_by": lb.DeletedBy,
+ "deleted_time": lb.DeletedTime,
+ "desc": lb.Description,
+ "dp_api_user": lb.DPAPIUser,
+ "dp_api_password": lb.DPAPIPassword,
+ "extnet_id": lb.ExtNetID,
+ "frontend_haip": lb.FrontendHAIP,
+ "frontends": flattenFrontends(lb.Frontends),
+ "gid": lb.GID,
+ "guid": lb.GUID,
+ "manager_id": lb.ManagerId,
+ "manager_type": lb.ManagerType,
+ "image_id": lb.ImageID,
+ "milestones": lb.Milestones,
+ "name": lb.Name,
+ "part_k8s": lb.PartK8s,
+ "primary_node": flattenNode(lb.PrimaryNode),
+ "rg_id": lb.RGID,
+ "rg_name": lb.RGName,
+ "secondary_node": flattenNode(lb.SecondaryNode),
+ "status": lb.Status,
+ "tech_status": lb.TechStatus,
+ "updated_by": lb.UpdatedBy,
+ "updated_time": lb.UpdatedTime,
+ "user_managed": lb.UserManaged,
+ "vins_id": lb.VINSID,
+ "lb_id": lb.ID,
+ "zone_id": lb.ZoneID,
+ }
+ res = append(res, temp)
+ }
+ return res
+}
diff --git a/internal/service/cloudapi/lb/lb_resource_subresource.go b/internal/service/cloudapi/lb/lb_resource_subresource.go
index ae3d42dc..1d579cbf 100644
--- a/internal/service/cloudapi/lb/lb_resource_subresource.go
+++ b/internal/service/cloudapi/lb/lb_resource_subresource.go
@@ -1,119 +1,119 @@
-/*
-Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
-Authors:
-Petr Krutov,
-Stanislav Solovev,
-Kasim Baybikov,
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-/*
-Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
-Orchestration Technology) with Terraform by Hashicorp.
-
-Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
-
-Please see README.md to learn where to place source code so that it
-builds seamlessly.
-
-Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
-*/
-
-package lb
-
-import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
-
-func lbResourceSchemaMake() map[string]*schema.Schema {
- sch := createLBSchema()
- sch["rg_id"] = &schema.Schema{
- Type: schema.TypeInt,
- Required: true,
- }
- sch["name"] = &schema.Schema{
- Type: schema.TypeString,
- Required: true,
- }
- sch["zone_id"] = &schema.Schema{
- Type: schema.TypeInt,
- Optional: true,
- Computed: true,
- }
- sch["extnet_id"] = &schema.Schema{
- Type: schema.TypeInt,
- Optional: true,
- }
-
- sch["vins_id"] = &schema.Schema{
- Type: schema.TypeInt,
- Optional: true,
- }
- sch["start"] = &schema.Schema{
- Type: schema.TypeBool,
- Optional: true,
- Default: true,
- }
- sch["desc"] = &schema.Schema{
- Type: schema.TypeString,
- Optional: true,
- Computed: true,
- }
-
- sch["enable"] = &schema.Schema{
- Type: schema.TypeBool,
- Optional: true,
- }
-
- sch["restart"] = &schema.Schema{
- Type: schema.TypeBool,
- Optional: true,
- }
-
- sch["restore"] = &schema.Schema{
- Type: schema.TypeBool,
- Optional: true,
- }
-
- sch["safe"] = &schema.Schema{
- Type: schema.TypeBool,
- Default: true,
- Optional: true,
- }
-
- sch["config_reset"] = &schema.Schema{
- Type: schema.TypeBool,
- Optional: true,
- }
- ///4.4.0
- sch["ha_mode"] = &schema.Schema{
- Type: schema.TypeBool,
- Optional: true,
- }
- sch["sysctl_params"] = &schema.Schema{
- Type: schema.TypeList,
- Optional: true,
- Elem: &schema.Schema{
- Type: schema.TypeMap,
- Elem: &schema.Schema{
- Type: schema.TypeString,
- },
- },
- }
-
- ///
- sch["permanently"] = &schema.Schema{
- Type: schema.TypeBool,
- Optional: true,
- }
- return sch
-}
+/*
+Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
+Authors:
+Petr Krutov,
+Stanislav Solovev,
+Kasim Baybikov,
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
+Orchestration Technology) with Terraform by Hashicorp.
+
+Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
+
+Please see README.md to learn where to place source code so that it
+builds seamlessly.
+
+Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
+*/
+
+package lb
+
+import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+
+func lbResourceSchemaMake() map[string]*schema.Schema {
+ sch := createLBSchema()
+ sch["rg_id"] = &schema.Schema{
+ Type: schema.TypeInt,
+ Required: true,
+ }
+ sch["name"] = &schema.Schema{
+ Type: schema.TypeString,
+ Required: true,
+ }
+ sch["zone_id"] = &schema.Schema{
+ Type: schema.TypeInt,
+ Optional: true,
+ Computed: true,
+ }
+ sch["extnet_id"] = &schema.Schema{
+ Type: schema.TypeInt,
+ Optional: true,
+ }
+
+ sch["vins_id"] = &schema.Schema{
+ Type: schema.TypeInt,
+ Optional: true,
+ }
+ sch["start"] = &schema.Schema{
+ Type: schema.TypeBool,
+ Optional: true,
+ Default: true,
+ }
+ sch["desc"] = &schema.Schema{
+ Type: schema.TypeString,
+ Optional: true,
+ Computed: true,
+ }
+
+ sch["enable"] = &schema.Schema{
+ Type: schema.TypeBool,
+ Optional: true,
+ }
+
+ sch["restart"] = &schema.Schema{
+ Type: schema.TypeBool,
+ Optional: true,
+ }
+
+ sch["restore"] = &schema.Schema{
+ Type: schema.TypeBool,
+ Optional: true,
+ }
+
+ sch["safe"] = &schema.Schema{
+ Type: schema.TypeBool,
+ Default: true,
+ Optional: true,
+ }
+
+ sch["config_reset"] = &schema.Schema{
+ Type: schema.TypeBool,
+ Optional: true,
+ }
+ ///4.4.0
+ sch["ha_mode"] = &schema.Schema{
+ Type: schema.TypeBool,
+ Optional: true,
+ }
+ sch["sysctl_params"] = &schema.Schema{
+ Type: schema.TypeList,
+ Optional: true,
+ Elem: &schema.Schema{
+ Type: schema.TypeMap,
+ Elem: &schema.Schema{
+ Type: schema.TypeString,
+ },
+ },
+ }
+
+ ///
+ sch["permanently"] = &schema.Schema{
+ Type: schema.TypeBool,
+ Optional: true,
+ }
+ return sch
+}
diff --git a/internal/service/cloudapi/lb/lb_schema.go b/internal/service/cloudapi/lb/lb_schema.go
index 841c5f72..962202b7 100644
--- a/internal/service/cloudapi/lb/lb_schema.go
+++ b/internal/service/cloudapi/lb/lb_schema.go
@@ -1,396 +1,396 @@
-/*
-Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
-Authors:
-Petr Krutov,
-Stanislav Solovev,
-Kasim Baybikov,
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-/*
-Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
-Orchestration Technology) with Terraform by Hashicorp.
-
-Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
-
-Please see README.md to learn where to place source code so that it
-builds seamlessly.
-
-Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
-*/
-
-package lb
-
-import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
-
-func createLBSchema() map[string]*schema.Schema {
- return map[string]*schema.Schema{
- "account_id": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "ha_mode": {
- Type: schema.TypeBool,
- Computed: true,
- },
- "backend_haip": {
- Type: schema.TypeString,
- Computed: true,
- },
- "backends": {
- Type: schema.TypeList,
- Computed: true,
- Elem: &schema.Resource{
- Schema: map[string]*schema.Schema{
- "algorithm": {
- Type: schema.TypeString,
- Computed: true,
- },
- "guid": {
- Type: schema.TypeString,
- Computed: true,
- },
- "name": {
- Type: schema.TypeString,
- Computed: true,
- },
- "server_default_settings": {
- Type: schema.TypeList,
- Computed: true,
- Elem: &schema.Resource{
- Schema: map[string]*schema.Schema{
- "downinter": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "fall": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "guid": {
- Type: schema.TypeString,
- Computed: true,
- },
- "inter": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "maxconn": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "maxqueue": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "rise": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "slowstart": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "weight": {
- Type: schema.TypeInt,
- Computed: true,
- },
- },
- },
- },
- "servers": {
- Type: schema.TypeList,
- Computed: true,
- Elem: &schema.Resource{
- Schema: map[string]*schema.Schema{
- "address": {
- Type: schema.TypeString,
- Computed: true,
- },
- "check": {
- Type: schema.TypeString,
- Computed: true,
- },
- "guid": {
- Type: schema.TypeString,
- Computed: true,
- },
- "name": {
- Type: schema.TypeString,
- Computed: true,
- },
- "port": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "server_settings": {
- Type: schema.TypeList,
- Computed: true,
- Elem: &schema.Resource{
- Schema: map[string]*schema.Schema{
- "downinter": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "fall": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "guid": {
- Type: schema.TypeString,
- Computed: true,
- },
- "inter": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "maxconn": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "maxqueue": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "rise": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "slowstart": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "weight": {
- Type: schema.TypeInt,
- Computed: true,
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- "created_by": {
- Type: schema.TypeString,
- Computed: true,
- },
- "created_time": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "deleted_by": {
- Type: schema.TypeString,
- Computed: true,
- },
- "deleted_time": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "desc": {
- Type: schema.TypeString,
- Computed: true,
- },
- "dp_api_user": {
- Type: schema.TypeString,
- Computed: true,
- },
- "extnet_id": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "frontend_haip": {
- Type: schema.TypeString,
- Computed: true,
- },
- "frontends": {
- Type: schema.TypeList,
- Computed: true,
- Elem: &schema.Resource{
- Schema: map[string]*schema.Schema{
- "backend": {
- Type: schema.TypeString,
- Computed: true,
- },
- "bindings": {
- Type: schema.TypeList,
- Computed: true,
- Elem: &schema.Resource{
- Schema: map[string]*schema.Schema{
- "address": {
- Type: schema.TypeString,
- Computed: true,
- },
- "guid": {
- Type: schema.TypeString,
- Computed: true,
- },
- "name": {
- Type: schema.TypeString,
- Computed: true,
- },
- "port": {
- Type: schema.TypeInt,
- Computed: true,
- },
- },
- },
- },
- "guid": {
- Type: schema.TypeString,
- Computed: true,
- },
- "name": {
- Type: schema.TypeString,
- Computed: true,
- },
- },
- },
- },
- "gid": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "guid": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "lb_id": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "manager_id": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "manager_type": {
- Type: schema.TypeString,
- Computed: true,
- },
- "image_id": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "milestones": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "name": {
- Type: schema.TypeString,
- Computed: true,
- },
- "part_k8s": {
- Type: schema.TypeBool,
- Computed: true,
- },
- "primary_node": {
- Type: schema.TypeList,
- Computed: true,
- Elem: &schema.Resource{
- Schema: map[string]*schema.Schema{
- "backend_ip": {
- Type: schema.TypeString,
- Computed: true,
- },
- "compute_id": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "frontend_ip": {
- Type: schema.TypeString,
- Computed: true,
- },
- "guid": {
- Type: schema.TypeString,
- Computed: true,
- },
- "mgmt_ip": {
- Type: schema.TypeString,
- Computed: true,
- },
- "network_id": {
- Type: schema.TypeInt,
- Computed: true,
- },
- },
- },
- },
- "rg_id": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "rg_name": {
- Type: schema.TypeString,
- Computed: true,
- },
- "secondary_node": {
- Type: schema.TypeList,
- Computed: true,
- Elem: &schema.Resource{
- Schema: map[string]*schema.Schema{
- "backend_ip": {
- Type: schema.TypeString,
- Computed: true,
- },
- "compute_id": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "frontend_ip": {
- Type: schema.TypeString,
- Computed: true,
- },
- "guid": {
- Type: schema.TypeString,
- Computed: true,
- },
- "mgmt_ip": {
- Type: schema.TypeString,
- Computed: true,
- },
- "network_id": {
- Type: schema.TypeInt,
- Computed: true,
- },
- },
- },
- },
- "status": {
- Type: schema.TypeString,
- Computed: true,
- },
- "tech_status": {
- Type: schema.TypeString,
- Computed: true,
- },
- "updated_by": {
- Type: schema.TypeString,
- Computed: true,
- },
- "updated_time": {
- Type: schema.TypeInt,
- Computed: true,
- },
- "user_managed": {
- Type: schema.TypeBool,
- Computed: true,
- },
- "vins_id": {
- Type: schema.TypeInt,
- Computed: true,
- },
- }
-}
+/*
+Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
+Authors:
+Petr Krutov,
+Stanislav Solovev,
+Kasim Baybikov,
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
+Orchestration Technology) with Terraform by Hashicorp.
+
+Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
+
+Please see README.md to learn where to place source code so that it
+builds seamlessly.
+
+Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
+*/
+
+package lb
+
+import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+
+func createLBSchema() map[string]*schema.Schema {
+ return map[string]*schema.Schema{
+ "account_id": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "ha_mode": {
+ Type: schema.TypeBool,
+ Computed: true,
+ },
+ "backend_haip": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "backends": {
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "algorithm": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "guid": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "name": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "server_default_settings": {
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "downinter": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "fall": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "guid": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "inter": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "maxconn": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "maxqueue": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "rise": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "slowstart": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "weight": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ },
+ },
+ },
+ "servers": {
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "address": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "check": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "guid": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "name": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "port": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "server_settings": {
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "downinter": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "fall": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "guid": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "inter": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "maxconn": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "maxqueue": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "rise": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "slowstart": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "weight": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ "created_by": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "created_time": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "deleted_by": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "deleted_time": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "desc": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "dp_api_user": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "extnet_id": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "frontend_haip": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "frontends": {
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "backend": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "bindings": {
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "address": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "guid": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "name": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "port": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ },
+ },
+ },
+ "guid": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "name": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ },
+ },
+ },
+ "gid": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "guid": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "lb_id": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "manager_id": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "manager_type": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "image_id": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "milestones": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "name": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "part_k8s": {
+ Type: schema.TypeBool,
+ Computed: true,
+ },
+ "primary_node": {
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "backend_ip": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "compute_id": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "frontend_ip": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "guid": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "mgmt_ip": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "network_id": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ },
+ },
+ },
+ "rg_id": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "rg_name": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "secondary_node": {
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "backend_ip": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "compute_id": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "frontend_ip": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "guid": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "mgmt_ip": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "network_id": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ },
+ },
+ },
+ "status": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "tech_status": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "updated_by": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "updated_time": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "user_managed": {
+ Type: schema.TypeBool,
+ Computed: true,
+ },
+ "vins_id": {
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ }
+}
diff --git a/internal/service/cloudapi/locations/models.go b/internal/service/cloudapi/locations/models.go
index 7c4d76ad..543613cc 100644
--- a/internal/service/cloudapi/locations/models.go
+++ b/internal/service/cloudapi/locations/models.go
@@ -1,36 +1,36 @@
-/*
-Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
-Authors:
-Petr Krutov,
-Stanislav Solovev,
-Kasim Baybikov,
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package locations
-
-type Location struct {
- GridID int `json:"gid"`
- Id int `json:"id"`
- Guid int `json:"guid"`
- LocationCode string `json:"locationCode"`
- Name string `json:"name"`
- NetworkModes []string `json:"network_modes"`
- SDNSupport bool `json:"sdn_support"`
- Flag string `json:"flag"`
- Meta []interface{} `json:"_meta"`
- CKey string `json:"_ckey"`
-}
-
-type LocationsList []Location
+/*
+Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
+Authors:
+Petr Krutov,
+Stanislav Solovev,
+Kasim Baybikov,
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package locations
+
+type Location struct {
+ GridID int `json:"gid"`
+ Id int `json:"id"`
+ Guid int `json:"guid"`
+ LocationCode string `json:"locationCode"`
+ Name string `json:"name"`
+ NetworkModes []string `json:"network_modes"`
+ SDNSupport bool `json:"sdn_support"`
+ Flag string `json:"flag"`
+ Meta []interface{} `json:"_meta"`
+ CKey string `json:"_ckey"`
+}
+
+type LocationsList []Location
diff --git a/internal/service/cloudapi/rg/flattens.go b/internal/service/cloudapi/rg/flattens.go
index 9cf853c3..363f556b 100644
--- a/internal/service/cloudapi/rg/flattens.go
+++ b/internal/service/cloudapi/rg/flattens.go
@@ -352,8 +352,8 @@ func flattenRgListComputes(lc *rg.ListComputes) []map[string]interface{} {
"status": compute.Status,
"tech_status": compute.TechStatus,
"total_disks_size": compute.TotalDisksSize,
- "updated_by": compute.DeletedBy,
- "updated_time": compute.DeletedTime,
+ "updated_by": compute.UpdatedBy,
+ "updated_time": compute.UpdatedTime,
"user_managed": compute.UserManaged,
"vins_connected": compute.VINSConnected,
}
diff --git a/internal/service/cloudapi/rg/resource_rg.go b/internal/service/cloudapi/rg/resource_rg.go
index 5b792373..f9bfc203 100644
--- a/internal/service/cloudapi/rg/resource_rg.go
+++ b/internal/service/cloudapi/rg/resource_rg.go
@@ -128,8 +128,12 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
}
}
}
- if defNetType, ok := d.GetOk("def_net_type"); ok {
- req.DefNet = defNetType.(string) // NOTE: in API default network type is set by "def_net" parameter
+ if _, ok := d.GetOk("def_net"); !ok {
+ if defNetType, ok := d.GetOk("def_net_type"); ok {
+ req.DefNet = defNetType.(string) // NOTE: in API default network type is set by "def_net" parameter
+ }
+ } else {
+ req.DefNet = "NONE"
}
if owner, ok := d.GetOk("owner"); ok {
diff --git a/internal/service/cloudapi/zone/data_source_zone.go b/internal/service/cloudapi/zone/data_source_zone.go
index 38ee5a6a..cf5ac633 100644
--- a/internal/service/cloudapi/zone/data_source_zone.go
+++ b/internal/service/cloudapi/zone/data_source_zone.go
@@ -60,7 +60,7 @@ func dataSourceZoneSchemaMake() map[string]*schema.Schema {
},
"auto_start": {
Type: schema.TypeBool,
- Required: true,
+ Computed: true,
},
"guid": {
Type: schema.TypeInt,
diff --git a/internal/service/cloudapi/zone/flattens.go b/internal/service/cloudapi/zone/flattens.go
index 5af35114..ec267ead 100644
--- a/internal/service/cloudapi/zone/flattens.go
+++ b/internal/service/cloudapi/zone/flattens.go
@@ -1,91 +1,91 @@
-/*
-Copyright (c) 2019-2024 Digital Energy Cloud Solutions LLC. All Rights Reserved.
-Authors:
-Petr Krutov,
-Stanislav Solovev,
-Kasim Baybikov,
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-/*
-Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
-Orchestration Technology) with Terraform by Hashicorp.
-
-Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
-
-Please see README.md to learn where to place source code so that it
-builds seamlessly.
-
-Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
-*/
-
-package zone
-
-import (
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- log "github.com/sirupsen/logrus"
- "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/zone"
-)
-
-func flattenZone(d *schema.ResourceData, item *zone.RecordZone) error {
- log.Debugf("flattenZone: start decoding RecordZone name %q / ID %d",
- item.Name, item.ID)
-
- d.Set("zone_id", int(item.ID))
- d.Set("guid", int(item.GUID))
- d.Set("gid", int(item.GID))
- d.Set("name", item.Name)
- d.Set("description", item.Description)
- d.Set("deletable", item.Deletable)
- d.Set("status", item.Status)
- d.Set("created_time", item.CreatedTime)
- d.Set("updated_time", item.UpdatedTime)
- d.Set("node_ids", item.NodeIDs)
- d.Set("account_ids", item.AccountIDs)
- d.Set("compute_ids", item.ComputeIDs)
- d.Set("extnet_ids", item.ExtnetIDs)
- d.Set("vins_ids", item.VinsIDs)
- d.Set("lb_ids", item.LBIDs)
- d.Set("bservice_ids", item.BserviceIDs)
- d.Set("k8s_ids", item.K8SIDs)
- d.Set("auto_start", item.AutoStart)
-
- log.Debugf("flattenZone: decoded RecordZone name %q / ID %d, complete",
- item.Name, item.ID)
- return nil
-}
-
-func flattenZoneList(zone *zone.ListZones) []map[string]interface{} {
- log.Debugf("flattenZoneList start")
- res := make([]map[string]interface{}, 0, len(zone.Data))
- for _, zone := range zone.Data {
- temp := map[string]interface{}{
- "zone_id": int(zone.ID),
- "guid": int(zone.GUID),
- "gid": int(zone.GID),
- "name": zone.Name,
- "description": zone.Description,
- "deletable": zone.Deletable,
- "status": zone.Status,
- "created_time": zone.CreatedTime,
- "updated_time": zone.UpdatedTime,
- "node_ids": zone.NodeIDs,
- "auto_start": zone.AutoStart,
- }
- res = append(res, temp)
- }
- log.Debugf("flattenZoneList end")
- return res
-
-}
+/*
+Copyright (c) 2019-2024 Digital Energy Cloud Solutions LLC. All Rights Reserved.
+Authors:
+Petr Krutov,
+Stanislav Solovev,
+Kasim Baybikov,
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
+Orchestration Technology) with Terraform by Hashicorp.
+
+Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
+
+Please see README.md to learn where to place source code so that it
+builds seamlessly.
+
+Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
+*/
+
+package zone
+
+import (
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ log "github.com/sirupsen/logrus"
+ "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/zone"
+)
+
+func flattenZone(d *schema.ResourceData, item *zone.RecordZone) error {
+ log.Debugf("flattenZone: start decoding RecordZone name %q / ID %d",
+ item.Name, item.ID)
+
+ d.Set("zone_id", int(item.ID))
+ d.Set("guid", int(item.GUID))
+ d.Set("gid", int(item.GID))
+ d.Set("name", item.Name)
+ d.Set("description", item.Description)
+ d.Set("deletable", item.Deletable)
+ d.Set("status", item.Status)
+ d.Set("created_time", item.CreatedTime)
+ d.Set("updated_time", item.UpdatedTime)
+ d.Set("node_ids", item.NodeIDs)
+ d.Set("account_ids", item.AccountIDs)
+ d.Set("compute_ids", item.ComputeIDs)
+ d.Set("extnet_ids", item.ExtnetIDs)
+ d.Set("vins_ids", item.VinsIDs)
+ d.Set("lb_ids", item.LBIDs)
+ d.Set("bservice_ids", item.BserviceIDs)
+ d.Set("k8s_ids", item.K8SIDs)
+ d.Set("auto_start", item.AutoStart)
+
+ log.Debugf("flattenZone: decoded RecordZone name %q / ID %d, complete",
+ item.Name, item.ID)
+ return nil
+}
+
+func flattenZoneList(zone *zone.ListZones) []map[string]interface{} {
+ log.Debugf("flattenZoneList start")
+ res := make([]map[string]interface{}, 0, len(zone.Data))
+ for _, zone := range zone.Data {
+ temp := map[string]interface{}{
+ "zone_id": int(zone.ID),
+ "guid": int(zone.GUID),
+ "gid": int(zone.GID),
+ "name": zone.Name,
+ "description": zone.Description,
+ "deletable": zone.Deletable,
+ "status": zone.Status,
+ "created_time": zone.CreatedTime,
+ "updated_time": zone.UpdatedTime,
+ "node_ids": zone.NodeIDs,
+ "auto_start": zone.AutoStart,
+ }
+ res = append(res, temp)
+ }
+ log.Debugf("flattenZoneList end")
+ return res
+
+}
diff --git a/internal/service/cloudapi/zone/utility_zone.go b/internal/service/cloudapi/zone/utility_zone.go
index c1ac64bd..32fd92f9 100644
--- a/internal/service/cloudapi/zone/utility_zone.go
+++ b/internal/service/cloudapi/zone/utility_zone.go
@@ -1,62 +1,62 @@
-/*
-Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
-Authors:
-Petr Krutov,
-Stanislav Solovev,
-Kasim Baybikov,
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-/*
-Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
-Orchestration Technology) with Terraform by Hashicorp.
-
-Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
-
-Please see README.md to learn where to place source code so that it
-builds seamlessly.
-
-Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
-*/
-
-package zone
-
-import (
- "context"
- "strconv"
-
- "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/zone"
- "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
-)
-
-func utilityZoneCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.RecordZone, error) {
- c := m.(*controller.ControllerCfg)
- req := zone.GetRequest{}
-
- if d.Id() != "" {
- zoneId, _ := strconv.ParseUint(d.Id(), 10, 64)
- req.ID = zoneId
- } else {
- req.ID = uint64(d.Get("zone_id").(int))
- }
-
- zoneData, err := c.CloudAPI().Zone().Get(ctx, req)
- if err != nil {
- return nil, err
- }
-
- return zoneData, nil
-}
+/*
+Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
+Authors:
+Petr Krutov,
+Stanislav Solovev,
+Kasim Baybikov,
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
+Orchestration Technology) with Terraform by Hashicorp.
+
+Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
+
+Please see README.md to learn where to place source code so that it
+builds seamlessly.
+
+Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
+*/
+
+package zone
+
+import (
+ "context"
+ "strconv"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/zone"
+ "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+)
+
+func utilityZoneCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.RecordZone, error) {
+ c := m.(*controller.ControllerCfg)
+ req := zone.GetRequest{}
+
+ if d.Id() != "" {
+ zoneId, _ := strconv.ParseUint(d.Id(), 10, 64)
+ req.ID = zoneId
+ } else {
+ req.ID = uint64(d.Get("zone_id").(int))
+ }
+
+ zoneData, err := c.CloudAPI().Zone().Get(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+
+ return zoneData, nil
+}
diff --git a/internal/service/cloudapi/zone/utility_zone_list.go b/internal/service/cloudapi/zone/utility_zone_list.go
index 65eb3e5f..d1bfa97a 100644
--- a/internal/service/cloudapi/zone/utility_zone_list.go
+++ b/internal/service/cloudapi/zone/utility_zone_list.go
@@ -1,85 +1,85 @@
-/*
-Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
-Authors:
-Petr Krutov,
-Stanislav Solovev,
-Kasim Baybikov,
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-/*
-Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
-Orchestration Technology) with Terraform by Hashicorp.
-
-Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
-
-Please see README.md to learn where to place source code so that it
-builds seamlessly.
-
-Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
-*/
-
-package zone
-
-import (
- "context"
-
- "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/zone"
- "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
-)
-
-func utilityZoneListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.ListZones, error) {
- c := m.(*controller.ControllerCfg)
- req := zone.ListRequest{}
-
- if byId, ok := d.GetOk("by_id"); ok {
- req.ByID = uint64(byId.(int))
- }
- if gid, ok := d.GetOk("gid"); ok {
- req.GID = uint64(gid.(int))
- }
- if name, ok := d.GetOk("name"); ok {
- req.Name = name.(string)
- }
- if description, ok := d.GetOk("description"); ok {
- req.Description = description.(string)
- }
- if status, ok := d.GetOk("status"); ok {
- req.Status = status.(string)
- }
- if deletable, ok := d.GetOk("deletable"); ok {
- req.Deletable = deletable.(bool)
- }
- if nodeID, ok := d.GetOk("nodeId"); ok {
- req.NodeID = uint64(nodeID.(int))
- }
- if sortBy, ok := d.GetOk("sort_by"); ok {
- req.SortBy = sortBy.(string)
- }
- if size, ok := d.GetOk("size"); ok {
- req.Size = uint64(size.(int))
- }
- if page, ok := d.GetOk("page"); ok {
- req.Page = uint64(page.(int))
- }
-
- zoneList, err := c.CloudAPI().Zone().List(ctx, req)
- if err != nil {
- return nil, err
- }
-
- return zoneList, nil
-}
+/*
+Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
+Authors:
+Petr Krutov,
+Stanislav Solovev,
+Kasim Baybikov,
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
+Orchestration Technology) with Terraform by Hashicorp.
+
+Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
+
+Please see README.md to learn where to place source code so that it
+builds seamlessly.
+
+Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
+*/
+
+package zone
+
+import (
+ "context"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/zone"
+ "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+)
+
+func utilityZoneListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.ListZones, error) {
+ c := m.(*controller.ControllerCfg)
+ req := zone.ListRequest{}
+
+ if byId, ok := d.GetOk("by_id"); ok {
+ req.ByID = uint64(byId.(int))
+ }
+ if gid, ok := d.GetOk("gid"); ok {
+ req.GID = uint64(gid.(int))
+ }
+ if name, ok := d.GetOk("name"); ok {
+ req.Name = name.(string)
+ }
+ if description, ok := d.GetOk("description"); ok {
+ req.Description = description.(string)
+ }
+ if status, ok := d.GetOk("status"); ok {
+ req.Status = status.(string)
+ }
+ if deletable, ok := d.GetOk("deletable"); ok {
+ req.Deletable = deletable.(bool)
+ }
+ if nodeID, ok := d.GetOk("nodeId"); ok {
+ req.NodeID = uint64(nodeID.(int))
+ }
+ if sortBy, ok := d.GetOk("sort_by"); ok {
+ req.SortBy = sortBy.(string)
+ }
+ if size, ok := d.GetOk("size"); ok {
+ req.Size = uint64(size.(int))
+ }
+ if page, ok := d.GetOk("page"); ok {
+ req.Page = uint64(page.(int))
+ }
+
+ zoneList, err := c.CloudAPI().Zone().List(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+
+ return zoneList, nil
+}
diff --git a/internal/service/cloudbroker/k8s/schema.go b/internal/service/cloudbroker/k8s/schema.go
index d6d879cb..219158eb 100644
--- a/internal/service/cloudbroker/k8s/schema.go
+++ b/internal/service/cloudbroker/k8s/schema.go
@@ -1466,14 +1466,14 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
Optional: true,
Description: "insert ssl certificate in x509 pem format",
},
- "chipset": {
- Type: schema.TypeString,
- Optional: true,
- ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
- Default: "Q35",
- Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
- },
- "lb_sysctl_params": {
+ "chipset": {
+ Type: schema.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
+ Default: "Q35",
+ Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
+ },
+ "lb_sysctl_params": {
Type: schema.TypeList,
Optional: true,
Description: "Custom sysctl values for Load Balancer instance. Applied on boot.",
@@ -1810,19 +1810,19 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
),
Description: "Node RAM in MB.",
},
- "chipset": {
- Type: schema.TypeString,
- Optional: true,
- ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
- Default: "Q35",
- Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
- },
- "disk": {
- Type: schema.TypeInt,
- Optional: true,
- Computed: true,
- Description: "Worker node boot disk size. If unspecified or 0, size is defined by OS image size.",
- },
+ "chipset": {
+ Type: schema.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
+ Default: "Q35",
+ Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
+ },
+ "disk": {
+ Type: schema.TypeInt,
+ Optional: true,
+ Computed: true,
+ Description: "Worker node boot disk size. If unspecified or 0, size is defined by OS image size.",
+ },
"labels": {
Type: schema.TypeList,
Computed: true,
diff --git a/internal/service/cloudbroker/kvmvm/flattens.go b/internal/service/cloudbroker/kvmvm/flattens.go
index 590ea1af..07877c52 100644
--- a/internal/service/cloudbroker/kvmvm/flattens.go
+++ b/internal/service/cloudbroker/kvmvm/flattens.go
@@ -110,6 +110,9 @@ func flattenCompute(d *schema.ResourceData, computeRec *compute.RecordCompute, p
d.Set("network_interface_naming", computeRec.NetworkInterfaceNaming)
d.Set("zone_id", computeRec.ZoneID)
d.Set("os_version", computeRec.OSVersion)
+ d.Set("cpu_pin", computeRec.CPUPin)
+ d.Set("numa_affinity", computeRec.NumaAffinity)
+ d.Set("hp_backed", computeRec.HPBacked)
return nil
}
diff --git a/internal/service/cloudbroker/kvmvm/schema.go b/internal/service/cloudbroker/kvmvm/schema.go
index 69eb0152..f1d7698e 100644
--- a/internal/service/cloudbroker/kvmvm/schema.go
+++ b/internal/service/cloudbroker/kvmvm/schema.go
@@ -3531,22 +3531,22 @@ func resourceComputeSchemaMake() map[string]*schema.Schema {
DiffSuppressFunc: networkSubresIPAddreDiffSupperss,
Description: "unique_identifier of LogicalPort on SDN side",
},
- "enabled": {
- Type: schema.TypeBool,
- Optional: true,
- Computed: true,
- Description: "network enable flag",
- },
- "net_mask": {
- Type: schema.TypeInt,
- Optional: true,
- Computed: true,
- Description: "Subnet mask, used only for DPDK and VFNIC network types",
+ "enabled": {
+ Type: schema.TypeBool,
+ Optional: true,
+ Computed: true,
+ Description: "network enable flag",
+ },
+ "net_mask": {
+ Type: schema.TypeInt,
+ Optional: true,
+ Computed: true,
+ Description: "Subnet mask, used only for DPDK and VFNIC network types",
+ },
},
},
+ Description: "Optional network connection(s) for this compute. You may specify several network blocks, one for each connection.",
},
- Description: "Optional network connection(s) for this compute. You may specify several network blocks, one for each connection.",
- },
"libvirt_settings": {
Type: schema.TypeSet,
diff --git a/internal/service/cloudbroker/rg/resource_rg.go b/internal/service/cloudbroker/rg/resource_rg.go
index 5cc70d00..6dadaf51 100644
--- a/internal/service/cloudbroker/rg/resource_rg.go
+++ b/internal/service/cloudbroker/rg/resource_rg.go
@@ -105,8 +105,12 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
req.Owner = owner.(string)
}
- if defNetType, ok := d.GetOk("def_net_type"); ok {
- req.DefNet = defNetType.(string)
+ if _, ok := d.GetOk("def_net"); !ok {
+ if defNetType, ok := d.GetOk("def_net_type"); ok {
+ req.DefNet = defNetType.(string)
+ }
+ } else {
+ req.DefNet = "NONE"
}
if description, ok := d.GetOk("description"); ok {
diff --git a/internal/service/cloudbroker/zone/flattens.go b/internal/service/cloudbroker/zone/flattens.go
index a439331f..e9390862 100644
--- a/internal/service/cloudbroker/zone/flattens.go
+++ b/internal/service/cloudbroker/zone/flattens.go
@@ -1,91 +1,91 @@
-/*
-Copyright (c) 2019-2024 Digital Energy Cloud Solutions LLC. All Rights Reserved.
-Authors:
-Petr Krutov,
-Stanislav Solovev,
-Kasim Baybikov,
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-/*
-Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
-Orchestration Technology) with Terraform by Hashicorp.
-
-Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
-
-Please see README.md to learn where to place source code so that it
-builds seamlessly.
-
-Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
-*/
-
-package zone
-
-import (
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- log "github.com/sirupsen/logrus"
- "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/zone"
-)
-
-func flattenZone(d *schema.ResourceData, item *zone.RecordZone) error {
- log.Debugf("flattenZone: start decoding RecordZone name %q / ID %d",
- item.Name, item.ID)
-
- d.Set("zone_id", int(item.ID))
- d.Set("guid", int(item.GUID))
- d.Set("gid", int(item.GID))
- d.Set("name", item.Name)
- d.Set("description", item.Description)
- d.Set("deletable", item.Deletable)
- d.Set("status", item.Status)
- d.Set("created_time", item.CreatedTime)
- d.Set("updated_time", item.UpdatedTime)
- d.Set("node_ids", item.NodeIDs)
- d.Set("account_ids", item.AccountIDs)
- d.Set("compute_ids", item.ComputeIDs)
- d.Set("extnet_ids", item.ExtnetIDs)
- d.Set("vins_ids", item.VinsIDs)
- d.Set("lb_ids", item.LBIDs)
- d.Set("bservice_ids", item.BserviceIDs)
- d.Set("k8s_ids", item.K8SIDs)
- d.Set("auto_start", item.AutoStart)
-
- log.Debugf("flattenZone: decoded RecordZone name %q / ID %d, complete",
- item.Name, item.ID)
- return nil
-}
-
-func flattenZoneList(zone *zone.ListZones) []map[string]interface{} {
- log.Debugf("flattenZoneList start")
- res := make([]map[string]interface{}, 0, len(zone.Data))
- for _, zone := range zone.Data {
- temp := map[string]interface{}{
- "zone_id": int(zone.ID),
- "guid": int(zone.GUID),
- "gid": int(zone.GID),
- "name": zone.Name,
- "description": zone.Description,
- "deletable": zone.Deletable,
- "status": zone.Status,
- "created_time": zone.CreatedTime,
- "updated_time": zone.UpdatedTime,
- "node_ids": zone.NodeIDs,
- "auto_start": zone.AutoStart,
- }
- res = append(res, temp)
- }
- log.Debugf("flattenZoneList end")
- return res
-
-}
+/*
+Copyright (c) 2019-2024 Digital Energy Cloud Solutions LLC. All Rights Reserved.
+Authors:
+Petr Krutov,
+Stanislav Solovev,
+Kasim Baybikov,
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
+Orchestration Technology) with Terraform by Hashicorp.
+
+Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
+
+Please see README.md to learn where to place source code so that it
+builds seamlessly.
+
+Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
+*/
+
+package zone
+
+import (
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ log "github.com/sirupsen/logrus"
+ "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/zone"
+)
+
+func flattenZone(d *schema.ResourceData, item *zone.RecordZone) error {
+ log.Debugf("flattenZone: start decoding RecordZone name %q / ID %d",
+ item.Name, item.ID)
+
+ d.Set("zone_id", int(item.ID))
+ d.Set("guid", int(item.GUID))
+ d.Set("gid", int(item.GID))
+ d.Set("name", item.Name)
+ d.Set("description", item.Description)
+ d.Set("deletable", item.Deletable)
+ d.Set("status", item.Status)
+ d.Set("created_time", item.CreatedTime)
+ d.Set("updated_time", item.UpdatedTime)
+ d.Set("node_ids", item.NodeIDs)
+ d.Set("account_ids", item.AccountIDs)
+ d.Set("compute_ids", item.ComputeIDs)
+ d.Set("extnet_ids", item.ExtnetIDs)
+ d.Set("vins_ids", item.VinsIDs)
+ d.Set("lb_ids", item.LBIDs)
+ d.Set("bservice_ids", item.BserviceIDs)
+ d.Set("k8s_ids", item.K8SIDs)
+ d.Set("auto_start", item.AutoStart)
+
+ log.Debugf("flattenZone: decoded RecordZone name %q / ID %d, complete",
+ item.Name, item.ID)
+ return nil
+}
+
+func flattenZoneList(zone *zone.ListZones) []map[string]interface{} {
+ log.Debugf("flattenZoneList start")
+ res := make([]map[string]interface{}, 0, len(zone.Data))
+ for _, zone := range zone.Data {
+ temp := map[string]interface{}{
+ "zone_id": int(zone.ID),
+ "guid": int(zone.GUID),
+ "gid": int(zone.GID),
+ "name": zone.Name,
+ "description": zone.Description,
+ "deletable": zone.Deletable,
+ "status": zone.Status,
+ "created_time": zone.CreatedTime,
+ "updated_time": zone.UpdatedTime,
+ "node_ids": zone.NodeIDs,
+ "auto_start": zone.AutoStart,
+ }
+ res = append(res, temp)
+ }
+ log.Debugf("flattenZoneList end")
+ return res
+
+}
diff --git a/internal/service/cloudbroker/zone/utility_zone.go b/internal/service/cloudbroker/zone/utility_zone.go
index 7c4dc595..dc8a2e6b 100644
--- a/internal/service/cloudbroker/zone/utility_zone.go
+++ b/internal/service/cloudbroker/zone/utility_zone.go
@@ -1,159 +1,159 @@
-/*
-Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
-Authors:
-Petr Krutov,
-Stanislav Solovev,
-Kasim Baybikov,
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-/*
-Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
-Orchestration Technology) with Terraform by Hashicorp.
-
-Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
-
-Please see README.md to learn where to place source code so that it
-builds seamlessly.
-
-Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
-*/
-
-package zone
-
-import (
- "context"
- "strconv"
-
- "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/zone"
- "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- log "github.com/sirupsen/logrus"
-)
-
-func utilityZoneCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.RecordZone, error) {
- c := m.(*controller.ControllerCfg)
- req := zone.GetRequest{}
-
- if d.Id() != "" {
- zoneId, _ := strconv.ParseUint(d.Id(), 10, 64)
- req.ID = zoneId
- } else {
- req.ID = uint64(d.Get("zone_id").(int))
- }
-
- zoneData, err := c.CloudBroker().Zone().Get(ctx, req)
- if err != nil {
- return nil, err
- }
-
- return zoneData, nil
-}
-
-func utilityZoneUpdate(ctx context.Context, d *schema.ResourceData, m interface{}, zoneID uint64) error {
- c := m.(*controller.ControllerCfg)
-
- if d.HasChanges("name", "description", "auto_start") {
- req := zone.UpdateRequest{
- ID: zoneID,
- }
-
- if d.HasChange("name") {
- req.Name = d.Get("name").(string)
- }
- if d.HasChange("description") {
- req.Description = d.Get("description").(string)
- }
-
- if d.HasChange("auto_start") {
- req.AutoStart = d.Get("auto_start").(bool)
- }
-
- _, err := c.CloudBroker().Zone().Update(ctx, req)
- if err != nil {
- return err
- }
- log.Debugf("utilityZoneUpdate: update zone with ID: %d, complete with params=%v", zoneID, req)
- }
-
- addedNodes := make([]interface{}, 0)
- removedNodes := make([]interface{}, 0)
-
- old_set, new_set := d.GetChange("node_ids")
- oldSlice := old_set.([]interface{})
- newSlice := new_set.([]interface{})
-
- for _, oldElem := range oldSlice {
- if !containsNodes(newSlice, oldElem) {
- removedNodes = append(removedNodes, oldElem)
- }
- }
-
- for _, newElem := range newSlice {
- if !containsNodes(oldSlice, newElem) {
- addedNodes = append(addedNodes, newElem)
- }
- }
-
- log.Debugf("Found node_ids change with %v deletion(s) and %v addition(s) [zoneID=%v]", len(removedNodes), len(addedNodes), zoneID)
-
- if len(addedNodes) > 0 {
-
- addedUint := make([]uint64, len(addedNodes))
- for i, v := range addedNodes {
- addedUint[i] = uint64(v.(int))
- }
-
- req := zone.AddNodeRequest{
- ID: zoneID,
- NodeIDs: addedUint,
- }
- if _, err := c.CloudBroker().Zone().AddNode(ctx, req); err != nil {
- return err
- }
-
- }
-
- if len(removedNodes) > 0 {
- removedUint := make([]uint64, len(removedNodes))
- for i, v := range removedNodes {
- removedUint[i] = uint64(v.(int))
- }
-
- req := zone.DelNodeRequest{
- ID: zoneID,
- NodeIDs: removedUint,
- }
- log.Debug("del")
- log.Debug(req.NodeIDs)
- if _, err := c.CloudBroker().Zone().DelNode(ctx, req); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func containsNodes(set []interface{}, check interface{}) bool {
- for _, elem := range set {
- elemConv := elem.(int)
- checkConv := check.(int)
- if elemConv == checkConv {
- return true
- }
- }
-
- return false
-}
+/*
+Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
+Authors:
+Petr Krutov,
+Stanislav Solovev,
+Kasim Baybikov,
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
+Orchestration Technology) with Terraform by Hashicorp.
+
+Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
+
+Please see README.md to learn where to place source code so that it
+builds seamlessly.
+
+Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
+*/
+
+package zone
+
+import (
+ "context"
+ "strconv"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/zone"
+ "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ log "github.com/sirupsen/logrus"
+)
+
+func utilityZoneCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.RecordZone, error) {
+ c := m.(*controller.ControllerCfg)
+ req := zone.GetRequest{}
+
+ if d.Id() != "" {
+ zoneId, _ := strconv.ParseUint(d.Id(), 10, 64)
+ req.ID = zoneId
+ } else {
+ req.ID = uint64(d.Get("zone_id").(int))
+ }
+
+ zoneData, err := c.CloudBroker().Zone().Get(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+
+ return zoneData, nil
+}
+
+func utilityZoneUpdate(ctx context.Context, d *schema.ResourceData, m interface{}, zoneID uint64) error {
+ c := m.(*controller.ControllerCfg)
+
+ if d.HasChanges("name", "description", "auto_start") {
+ req := zone.UpdateRequest{
+ ID: zoneID,
+ }
+
+ if d.HasChange("name") {
+ req.Name = d.Get("name").(string)
+ }
+ if d.HasChange("description") {
+ req.Description = d.Get("description").(string)
+ }
+
+ if d.HasChange("auto_start") {
+ req.AutoStart = d.Get("auto_start").(bool)
+ }
+
+ _, err := c.CloudBroker().Zone().Update(ctx, req)
+ if err != nil {
+ return err
+ }
+ log.Debugf("utilityZoneUpdate: update zone with ID: %d, complete with params=%v", zoneID, req)
+ }
+
+ addedNodes := make([]interface{}, 0)
+ removedNodes := make([]interface{}, 0)
+
+ old_set, new_set := d.GetChange("node_ids")
+ oldSlice := old_set.([]interface{})
+ newSlice := new_set.([]interface{})
+
+ for _, oldElem := range oldSlice {
+ if !containsNodes(newSlice, oldElem) {
+ removedNodes = append(removedNodes, oldElem)
+ }
+ }
+
+ for _, newElem := range newSlice {
+ if !containsNodes(oldSlice, newElem) {
+ addedNodes = append(addedNodes, newElem)
+ }
+ }
+
+ log.Debugf("Found node_ids change with %v deletion(s) and %v addition(s) [zoneID=%v]", len(removedNodes), len(addedNodes), zoneID)
+
+ if len(addedNodes) > 0 {
+
+ addedUint := make([]uint64, len(addedNodes))
+ for i, v := range addedNodes {
+ addedUint[i] = uint64(v.(int))
+ }
+
+ req := zone.AddNodeRequest{
+ ID: zoneID,
+ NodeIDs: addedUint,
+ }
+ if _, err := c.CloudBroker().Zone().AddNode(ctx, req); err != nil {
+ return err
+ }
+
+ }
+
+ if len(removedNodes) > 0 {
+ removedUint := make([]uint64, len(removedNodes))
+ for i, v := range removedNodes {
+ removedUint[i] = uint64(v.(int))
+ }
+
+ req := zone.DelNodeRequest{
+ ID: zoneID,
+ NodeIDs: removedUint,
+ }
+ log.Debug("del")
+ log.Debug(req.NodeIDs)
+ if _, err := c.CloudBroker().Zone().DelNode(ctx, req); err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
+func containsNodes(set []interface{}, check interface{}) bool {
+ for _, elem := range set {
+ elemConv := elem.(int)
+ checkConv := check.(int)
+ if elemConv == checkConv {
+ return true
+ }
+ }
+
+ return false
+}
diff --git a/internal/service/cloudbroker/zone/utility_zone_list.go b/internal/service/cloudbroker/zone/utility_zone_list.go
index e17cbf63..febadd32 100644
--- a/internal/service/cloudbroker/zone/utility_zone_list.go
+++ b/internal/service/cloudbroker/zone/utility_zone_list.go
@@ -1,85 +1,85 @@
-/*
-Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
-Authors:
-Petr Krutov,
-Stanislav Solovev,
-Kasim Baybikov,
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-/*
-Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
-Orchestration Technology) with Terraform by Hashicorp.
-
-Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
-
-Please see README.md to learn where to place source code so that it
-builds seamlessly.
-
-Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
-*/
-
-package zone
-
-import (
- "context"
-
- "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/zone"
- "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
-)
-
-func utilityZoneListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.ListZones, error) {
- c := m.(*controller.ControllerCfg)
- req := zone.ListRequest{}
-
- if byId, ok := d.GetOk("by_id"); ok {
- req.ByID = uint64(byId.(int))
- }
- if gid, ok := d.GetOk("gid"); ok {
- req.GID = uint64(gid.(int))
- }
- if name, ok := d.GetOk("name"); ok {
- req.Name = name.(string)
- }
- if description, ok := d.GetOk("description"); ok {
- req.Description = description.(string)
- }
- if status, ok := d.GetOk("status"); ok {
- req.Status = status.(string)
- }
- if deletable, ok := d.GetOk("deletable"); ok {
- req.Deletable = deletable.(bool)
- }
- if nodeID, ok := d.GetOk("nodeId"); ok {
- req.NodeID = uint64(nodeID.(int))
- }
- if sortBy, ok := d.GetOk("sort_by"); ok {
- req.SortBy = sortBy.(string)
- }
- if size, ok := d.GetOk("size"); ok {
- req.Size = uint64(size.(int))
- }
- if page, ok := d.GetOk("page"); ok {
- req.Page = uint64(page.(int))
- }
-
- zoneList, err := c.CloudBroker().Zone().List(ctx, req)
- if err != nil {
- return nil, err
- }
-
- return zoneList, nil
-}
+/*
+Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
+Authors:
+Petr Krutov,
+Stanislav Solovev,
+Kasim Baybikov,
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
+Orchestration Technology) with Terraform by Hashicorp.
+
+Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
+
+Please see README.md to learn where to place source code so that it
+builds seamlessly.
+
+Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
+*/
+
+package zone
+
+import (
+ "context"
+
+ "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/zone"
+ "repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+)
+
+func utilityZoneListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.ListZones, error) {
+ c := m.(*controller.ControllerCfg)
+ req := zone.ListRequest{}
+
+ if byId, ok := d.GetOk("by_id"); ok {
+ req.ByID = uint64(byId.(int))
+ }
+ if gid, ok := d.GetOk("gid"); ok {
+ req.GID = uint64(gid.(int))
+ }
+ if name, ok := d.GetOk("name"); ok {
+ req.Name = name.(string)
+ }
+ if description, ok := d.GetOk("description"); ok {
+ req.Description = description.(string)
+ }
+ if status, ok := d.GetOk("status"); ok {
+ req.Status = status.(string)
+ }
+ if deletable, ok := d.GetOk("deletable"); ok {
+ req.Deletable = deletable.(bool)
+ }
+ if nodeID, ok := d.GetOk("nodeId"); ok {
+ req.NodeID = uint64(nodeID.(int))
+ }
+ if sortBy, ok := d.GetOk("sort_by"); ok {
+ req.SortBy = sortBy.(string)
+ }
+ if size, ok := d.GetOk("size"); ok {
+ req.Size = uint64(size.(int))
+ }
+ if page, ok := d.GetOk("page"); ok {
+ req.Page = uint64(page.(int))
+ }
+
+ zoneList, err := c.CloudBroker().Zone().List(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+
+ return zoneList, nil
+}
diff --git a/internal/service/sdn/access_group/data_decort_sdn_access_group_list.go b/internal/service/sdn/access_group/data_decort_sdn_access_group_list.go
index c6886256..64ea6c8b 100644
--- a/internal/service/sdn/access_group/data_decort_sdn_access_group_list.go
+++ b/internal/service/sdn/access_group/data_decort_sdn_access_group_list.go
@@ -37,4 +37,3 @@ func DataSourceAccessGroupList() *schema.Resource {
Schema: dataSourceAccessGroupListSchemaMake(),
}
}
-
diff --git a/internal/service/sdn/access_group/utility_access_group_list.go b/internal/service/sdn/access_group/utility_access_group_list.go
index 9f84b701..f0c55b15 100644
--- a/internal/service/sdn/access_group/utility_access_group_list.go
+++ b/internal/service/sdn/access_group/utility_access_group_list.go
@@ -49,4 +49,3 @@ func utilityAccessGroupListCheckPresence(ctx context.Context, d *schema.Resource
return accessGroupList, nil
}
-
diff --git a/internal/service/sdn/default_security_policy/data_decort_sdn_default_security_policy_list.go b/internal/service/sdn/default_security_policy/data_decort_sdn_default_security_policy_list.go
index 44758639..02203214 100644
--- a/internal/service/sdn/default_security_policy/data_decort_sdn_default_security_policy_list.go
+++ b/internal/service/sdn/default_security_policy/data_decort_sdn_default_security_policy_list.go
@@ -37,4 +37,3 @@ func DataSourceDefaultSecurityPolicyList() *schema.Resource {
Schema: dataSourceDefaultSecurityPolicyListSchemaMake(),
}
}
-
diff --git a/internal/service/sdn/default_security_policy/schema.go b/internal/service/sdn/default_security_policy/schema.go
index daabaf8a..404f124f 100644
--- a/internal/service/sdn/default_security_policy/schema.go
+++ b/internal/service/sdn/default_security_policy/schema.go
@@ -366,4 +366,3 @@ func dataSourceDefaultSecurityPolicyListSchemaMake() map[string]*schema.Schema {
return res
}
-
diff --git a/internal/service/sdn/default_security_policy/utility_default_security_policy_list.go b/internal/service/sdn/default_security_policy/utility_default_security_policy_list.go
index 5cf41070..a1895903 100644
--- a/internal/service/sdn/default_security_policy/utility_default_security_policy_list.go
+++ b/internal/service/sdn/default_security_policy/utility_default_security_policy_list.go
@@ -37,4 +37,3 @@ func utilityDefaultSecurityPolicyListCheckPresence(ctx context.Context, d *schem
return defaultSecurityPolicyList, nil
}
-
diff --git a/internal/service/sdn/segments/utility_segment_list.go b/internal/service/sdn/segments/utility_segment_list.go
index b034b9d4..52c8ef93 100644
--- a/internal/service/sdn/segments/utility_segment_list.go
+++ b/internal/service/sdn/segments/utility_segment_list.go
@@ -52,7 +52,7 @@ func utilitySegmentListCheckPresence(ctx context.Context, d *schema.ResourceData
if updatedTo, ok := d.GetOk("updated_to"); ok {
req.UpdatedTo = updatedTo.(string)
}
-
+
log.Debugf("utilitySegmentListCheckPresence")
segmentList, err := c.SDN().Segments().List(ctx, req)
if err != nil {
diff --git a/samples/cloudapi/disk/resource_disk/main.tf b/samples/cloudapi/disk/resource_disk/main.tf
index fe9339ce..207a8e56 100644
--- a/samples/cloudapi/disk/resource_disk/main.tf
+++ b/samples/cloudapi/disk/resource_disk/main.tf
@@ -69,15 +69,6 @@ resource "decort_disk" "acl" {
#возможные значенния - "none", "writethrough"
#используется при создании и обновлении
#shareable = false
-
- #установка режима кэширования
- #опциональный параметр
- #тип - строка
- #возможные значенния - "none", "writethrough"
- #значение по умолчанию - none
- #используется при создании
- #cache = "none"
-
}
output "test" {
diff --git a/samples/cloudbroker/flipgroup/data_flipgroup_list/main.tf b/samples/cloudbroker/flipgroup/data_flipgroup_list/main.tf
index cd30bb40..5664dbf4 100644
--- a/samples/cloudbroker/flipgroup/data_flipgroup_list/main.tf
+++ b/samples/cloudbroker/flipgroup/data_flipgroup_list/main.tf
@@ -57,11 +57,6 @@ data "decort_cb_flipgroup_list" "fg" {
#тип - строка
#by_ip = "1.1.1.1.1"
- #фильтр по id ресурсной группы
- #опциональный параметр
- #тип - целое число
- #rg_id = 11111
-
#сортировка по одному из поддерживаемых полей
#опциональный параметр
#тип - строка