1.1.0
This commit is contained in:
79
CHANGELOG.md
79
CHANGELOG.md
@@ -1,8 +1,75 @@
|
||||
## Version 1.0.1
|
||||
## Version 1.1.0
|
||||
|
||||
### Feature
|
||||
### Добавлено
|
||||
|
||||
### Bugfix
|
||||
- Fixed dynamix_lb_list data source in cloudapi/lb for the optional field 'rg_id' to work correctly
|
||||
- Fixex reading configuration data from environment variables
|
||||
- Fixed configuration validation
|
||||
#### audit
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-618 | Datasource `dynamix_audit` в cloudapi/audit |
|
||||
|
||||
#### account
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-603 | Опциональное поле `sort_by` в datasource `dynamix_account_flipgroups_list` в cloudapi/account |
|
||||
|
||||
#### dpdknet
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-617 | Datasources `dynamix_dpdknet и dynamix_dpdknet_list` в cloudapi/dpkknet |
|
||||
|
||||
#### image
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-609 | Опциональное поле `enabled` в datasource `dynamix_image_list` в cloudapi/image |
|
||||
|
||||
#### k8s
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-610 | Опциональные поля `worker_chipset, chipset` в resource `dynamix_k8s_wg` в cloudapi/k8s |
|
||||
| BATF-610 | Опциональные поля `address_vip, chipset` в resource `dynamix_k8s_cp` в cloudapi/k8s |
|
||||
| BATF-610 | Вычисляемые поля `extnet_only, ha_mode, address_vip` в datasource `dynamix_k8s` в cloudapi/k8s |
|
||||
|
||||
#### kvmvm
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-611 | Опциональные поля `pci_devices, chipset, network/weight` в resource `dynamix_kvmvm` в cloudapi/kvmvm |
|
||||
| BATF-611 | Вычисляемые поля `bus_number, libvirt_settings` в resource `dynamix_kvmvm` в cloudapi/kvmvm |
|
||||
| BATF-611 | Вычисляемые поля `pci_devices, chipset, bus_number, libvirt_settings` в datasources `dynamix_kvmvm, dynamix_kvmvm_list, dynamix_kvmvm_list_deleted` в cloudapi/kvmvm |
|
||||
| BATF-652 | Опциональные поля `pci_devices, chipset, network/weight` в resource `dynamix_kvmvm` в cloudapi/kvmvm |
|
||||
|
||||
#### rg
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-613 | Опциональное поле `uniq_pools` в resource `dynamix_resgroup` в cloudapi/rg |
|
||||
|
||||
#### vins
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-616 | Вычисляемые поля `bus_number, mtu и libvirt_settings` в datasource `dynamix_vins и resource dynamix_vins` в cloudapi/vins |
|
||||
| BATF-616 | Опциональное поле `vnf_dev_id` в datasource `dynamix_vins_list` в cloudapi/vins |
|
||||
|
||||
### Исправлено
|
||||
|
||||
#### kvmvm
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-611 | Возможность смены IP сети без отключения сети и остановки ВМ в resource `dynamix_kvmvm` в cloudapi/kvmvm |
|
||||
| BATF-611 | Добавлена поддержка DPDK сетей в resource `dynamix_kvmvm` в cloudapi/kvmvm |
|
||||
|
||||
### Удалено
|
||||
|
||||
#### all
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-620 | Поле `reason` во всех resources |
|
||||
| BATF-623 | Поддержка архитектуры `kvmppc` во всех resources |
|
||||
|
||||
#### account
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-603 | Опциональное поле `recursive_delete` в `resource dynamix_account` в cloudapi/account |
|
||||
|
||||
#### image
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-609 | Опциональное поле `permanently`` в `resources dynamix_account, dynamix_image_virtual` в cloudapi/image |
|
||||
2
Makefile
2
Makefile
@@ -8,7 +8,7 @@ ZIPDIR = ./zip
|
||||
BINARY=${NAME}
|
||||
WORKPATH= ./examples/terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${SECONDNAMESPACE}/${VERSION}/${OS_ARCH}
|
||||
MAINPATH = ./cmd/dynamix/
|
||||
VERSION=1.0.1
|
||||
VERSION=1.1.0
|
||||
OS_ARCH=$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)
|
||||
|
||||
FILES = ${BINARY}_${VERSION}_darwin_amd64\
|
||||
|
||||
38
README.md
38
README.md
@@ -141,3 +141,41 @@
|
||||
| data source dynamix_lb_list_deleted | server_default_settings, server_settings, primary_node, secondary_node |
|
||||
| resource dynamix_lb | server_default_settings, server_settings, primary_node, secondary_node |
|
||||
| resource dynamix_lb_backend | server_settings |
|
||||
|
||||
### Административная группа API
|
||||
|
||||
#### Аккаунты accounts
|
||||
|
||||
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Single (единичная структура):
|
||||
|
||||
| Название ресурса | Поля схемы |
|
||||
|--------------------------|-------------------|
|
||||
| data source dynamix_cb_account_resource_consumption_list | consumed, reserved |
|
||||
| data source dynamix_cb_account_resource_consumption_get | consumed, reserved, resource_limits |
|
||||
| data source dynamix_cb_account_rg_list | computes, reserved, resource_limits, limits, reserved |
|
||||
| resource dynamix_cb_account | resource_limits, computes, machines |
|
||||
| data source dynamix_cb_disk_list_deleted | iotune |
|
||||
| data source dynamix_cb_disk_list_unattached | iotune |
|
||||
| data source dynamix_cb_disk_list | iotune |
|
||||
| data source dynamix_cb_disk_replication | iotune, replication |
|
||||
| data source dynamix_cb_disk | iotune |
|
||||
| resource dynamix_cb_disk_replication | iotune, replication |
|
||||
| resource dynamix_cb_disk | iotune | |
|
||||
|
||||
#### Диски disks
|
||||
|
||||
| Название ресурса | Поля схемы | Изменение по сравнению с terraform-provider-decort | Комментарий |
|
||||
|------------------------------------------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| resource dynamix_cb_disk | iotune, shareable | Если при создании ресурса диска операция настроки лимитов (поле iotune) и/или операция поделиться диском (поле shareable) выполняются некорректно, теперь ресурс создается с предупреждениями (Warnings). Ранее ресурс создавался с ошибками (Errors). | Данное изменение касается только создания ресурса. Обновление ресурса проходит также: если операция изменения iotune и/или shareable выполняется некорректно, возвращаются ошибки (Errors). |
|
||||
| resource dynamix_cb_disk | - | Операция автоматического восстановления диска (для диска, находящегося в корзине) теперь происходит при чтении ресурса. Ранее она происходила при обновлении ресурса. | |
|
||||
| data source dynamix_cb_disk_list_unattached | ckey, meta | Изменилось названия поля с "_ckey" на "ckey" и с "_meta" на "meta". | |
|
||||
|
||||
Следующие поля в terraform-provider-decort имели тип списка (List), а в terraform-provider-dynamix имеют тип Single (единичная структура):
|
||||
|
||||
| Название ресурса | Поля схемы |
|
||||
|------------------------------------------|------------|
|
||||
| data source dynamix_cb_disk_list_unattached | iotune |
|
||||
| data source dynamix_cb_disk | iotune |
|
||||
| data source dynamix_cb_disk_list | iotune |
|
||||
| data source dynamix_cb_disk_list_deleted | iotune |
|
||||
| resource dynamix_cb_disk | iotune |
|
||||
@@ -27,6 +27,7 @@ description: |-
|
||||
- `name` (String) find by name
|
||||
- `page` (Number) page number
|
||||
- `size` (Number) page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `vins_id` (Number) find by vins ID
|
||||
- `vins_name` (String) find by vins name
|
||||
|
||||
47
docs/data-sources/audit.md
Normal file
47
docs/data-sources/audit.md
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "dynamix_audit Data Source - terraform-provider-dynamix"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# dynamix_audit (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `audit_guid` (String)
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `args` (String)
|
||||
- `call` (String)
|
||||
- `guid` (String)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `kwargs` (String)
|
||||
- `remote_addr` (String)
|
||||
- `responsetime` (Number)
|
||||
- `result` (String)
|
||||
- `status_code` (Number)
|
||||
- `tags` (String)
|
||||
- `timestamp` (Number)
|
||||
- `timestamp_end` (Number)
|
||||
- `user` (String)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
|
||||
47
docs/data-sources/dpdknet.md
Normal file
47
docs/data-sources/dpdknet.md
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "dynamix_dpdknet Data Source - terraform-provider-dynamix"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# dynamix_dpdknet (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `dpdk_id` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `account_access` (List of Number)
|
||||
- `compute_ids` (List of Number)
|
||||
- `created_time` (Number)
|
||||
- `desc` (String)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `name` (String)
|
||||
- `ovs_bridge` (String)
|
||||
- `rg_access` (List of Number)
|
||||
- `status` (String)
|
||||
- `updated_time` (Number)
|
||||
- `vlan_id` (Number)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
|
||||
65
docs/data-sources/dpdknet_list.md
Normal file
65
docs/data-sources/dpdknet_list.md
Normal file
@@ -0,0 +1,65 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "dynamix_dpdknet_list Data Source - terraform-provider-dynamix"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# dynamix_dpdknet_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `by_id` (Number)
|
||||
- `compute_ids` (List of Number)
|
||||
- `desc` (String)
|
||||
- `gid` (Number)
|
||||
- `name` (String)
|
||||
- `page` (Number)
|
||||
- `size` (Number)
|
||||
- `sort_by` (String)
|
||||
- `status` (String)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (Attributes List) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Required:
|
||||
|
||||
- `dpdk_id` (Number)
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_access` (List of Number)
|
||||
- `compute_ids` (List of Number)
|
||||
- `created_time` (Number)
|
||||
- `desc` (String)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `name` (String)
|
||||
- `ovs_bridge` (String)
|
||||
- `rg_access` (List of Number)
|
||||
- `status` (String)
|
||||
- `updated_time` (Number)
|
||||
- `vlan_id` (Number)
|
||||
@@ -20,6 +20,7 @@ description: |-
|
||||
- `architecture` (String)
|
||||
- `bootable` (Boolean)
|
||||
- `by_id` (Number)
|
||||
- `enabled` (Boolean)
|
||||
- `hot_resize` (Boolean)
|
||||
- `image_size` (Number)
|
||||
- `name` (String)
|
||||
|
||||
@@ -28,12 +28,15 @@ description: |-
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `acl` (Attributes) (see [below for nested schema](#nestedatt--acl))
|
||||
- `address_vip` (Attributes) (see [below for nested schema](#nestedatt--address_vip))
|
||||
- `bservice_id` (Number)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `extnet_id` (Number)
|
||||
- `extnet_only` (Boolean)
|
||||
- `ha_mode` (Boolean)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `k8sci_id` (Number)
|
||||
- `k8sci_name` (String)
|
||||
@@ -109,6 +112,15 @@ Read-Only:
|
||||
|
||||
|
||||
|
||||
<a id="nestedatt--address_vip"></a>
|
||||
### Nested Schema for `address_vip`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `backend_ip` (String)
|
||||
- `frontend_ip` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--masters"></a>
|
||||
### Nested Schema for `masters`
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ description: |-
|
||||
- `boot_order` (List of String)
|
||||
- `bootdisk_size` (Number)
|
||||
- `cd_image_id` (Number)
|
||||
- `chipset` (String)
|
||||
- `clone_reference` (Number)
|
||||
- `clones` (List of Number)
|
||||
- `computeci_id` (Number)
|
||||
@@ -72,6 +73,7 @@ description: |-
|
||||
- `numa_affinity` (String)
|
||||
- `numa_node_id` (Number)
|
||||
- `os_users` (Attributes List) (see [below for nested schema](#nestedatt--os_users))
|
||||
- `pci_devices` (List of Number)
|
||||
- `pinned` (Boolean)
|
||||
- `ram` (Number)
|
||||
- `reference_id` (String)
|
||||
@@ -185,6 +187,7 @@ Read-Only:
|
||||
- `account_id` (Number)
|
||||
- `acl` (String)
|
||||
- `boot_partition` (Number)
|
||||
- `bus_number` (Number)
|
||||
- `ckey` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_time` (Number)
|
||||
@@ -277,6 +280,7 @@ Read-Only:
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `bus_number` (Number)
|
||||
- `conn_id` (Number)
|
||||
- `conn_type` (String)
|
||||
- `def_gw` (String)
|
||||
@@ -284,8 +288,10 @@ Read-Only:
|
||||
- `flip_group_id` (Number)
|
||||
- `guid` (String)
|
||||
- `ip_address` (String)
|
||||
- `libvirt_settings` (Attributes) (see [below for nested schema](#nestedatt--interfaces--libvirt_settings))
|
||||
- `listen_ssh` (Boolean)
|
||||
- `mac` (String)
|
||||
- `mtu` (Number)
|
||||
- `name` (String)
|
||||
- `net_id` (Number)
|
||||
- `net_type` (String)
|
||||
@@ -297,6 +303,20 @@ Read-Only:
|
||||
- `type` (String)
|
||||
- `vnfs` (List of Number)
|
||||
|
||||
<a id="nestedatt--interfaces--libvirt_settings"></a>
|
||||
### Nested Schema for `interfaces.libvirt_settings`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `event_idx` (String)
|
||||
- `guid` (String)
|
||||
- `ioeventfd` (String)
|
||||
- `queues` (Number)
|
||||
- `rx_queue_size` (Number)
|
||||
- `tx_queue_size` (Number)
|
||||
- `txmode` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--interfaces--qos"></a>
|
||||
### Nested Schema for `interfaces.qos`
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ Read-Only:
|
||||
- `boot_order` (List of String)
|
||||
- `bootdisk_size` (Number)
|
||||
- `cd_image_id` (Number)
|
||||
- `chipset` (String)
|
||||
- `clone_reference` (Number)
|
||||
- `clones` (List of Number)
|
||||
- `compute_id` (Number)
|
||||
@@ -159,6 +160,7 @@ Read-Only:
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `bus_number` (Number)
|
||||
- `disk_id` (Number)
|
||||
- `pci_slot` (Number)
|
||||
|
||||
@@ -168,6 +170,7 @@ Read-Only:
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `bus_number` (Number)
|
||||
- `conn_id` (Number)
|
||||
- `conn_type` (String)
|
||||
- `def_gw` (String)
|
||||
@@ -175,6 +178,7 @@ Read-Only:
|
||||
- `flip_group_id` (Number)
|
||||
- `guid` (String)
|
||||
- `ip_address` (String)
|
||||
- `libvirt_settings` (Attributes) (see [below for nested schema](#nestedatt--items--interfaces--libvirt_settings))
|
||||
- `listen_ssh` (Boolean)
|
||||
- `mac` (String)
|
||||
- `name` (String)
|
||||
@@ -188,6 +192,20 @@ Read-Only:
|
||||
- `type` (String)
|
||||
- `vnfs` (List of Number)
|
||||
|
||||
<a id="nestedatt--items--interfaces--libvirt_settings"></a>
|
||||
### Nested Schema for `items.interfaces.libvirt_settings`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `event_idx` (String)
|
||||
- `guid` (String)
|
||||
- `ioeventfd` (String)
|
||||
- `queues` (Number)
|
||||
- `rx_queue_size` (Number)
|
||||
- `tx_queue_size` (Number)
|
||||
- `txmode` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items--interfaces--qos"></a>
|
||||
### Nested Schema for `items.interfaces.qos`
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ Read-Only:
|
||||
- `boot_order` (List of String)
|
||||
- `bootdisk_size` (Number)
|
||||
- `cd_image_id` (Number)
|
||||
- `chipset` (String)
|
||||
- `clone_reference` (Number)
|
||||
- `clones` (List of Number)
|
||||
- `compute_id` (Number)
|
||||
@@ -157,6 +158,7 @@ Read-Only:
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `bus_number` (Number)
|
||||
- `disk_id` (Number)
|
||||
- `pci_slot` (Number)
|
||||
|
||||
@@ -166,6 +168,7 @@ Read-Only:
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `bus_number` (Number)
|
||||
- `conn_id` (Number)
|
||||
- `conn_type` (String)
|
||||
- `def_gw` (String)
|
||||
@@ -173,6 +176,7 @@ Read-Only:
|
||||
- `flip_group_id` (Number)
|
||||
- `guid` (String)
|
||||
- `ip_address` (String)
|
||||
- `libvirt_settings` (Attributes) (see [below for nested schema](#nestedatt--items--interfaces--libvirt_settings))
|
||||
- `listen_ssh` (Boolean)
|
||||
- `mac` (String)
|
||||
- `name` (String)
|
||||
@@ -186,6 +190,20 @@ Read-Only:
|
||||
- `type` (String)
|
||||
- `vnfs` (List of Number)
|
||||
|
||||
<a id="nestedatt--items--interfaces--libvirt_settings"></a>
|
||||
### Nested Schema for `items.interfaces.libvirt_settings`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `event_idx` (String)
|
||||
- `guid` (String)
|
||||
- `ioeventfd` (String)
|
||||
- `queues` (Number)
|
||||
- `rx_queue_size` (Number)
|
||||
- `tx_queue_size` (Number)
|
||||
- `txmode` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items--interfaces--qos"></a>
|
||||
### Nested Schema for `items.interfaces.qos`
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ description: |-
|
||||
|
||||
### Optional
|
||||
|
||||
- `reason` (String) reason for request
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
@@ -21,7 +21,6 @@ description: |-
|
||||
|
||||
### Optional
|
||||
|
||||
- `reason` (String) reason for action
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
@@ -146,6 +146,7 @@ Read-Only:
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `bus_number` (Number)
|
||||
- `conn_id` (Number)
|
||||
- `conn_type` (String)
|
||||
- `def_gw` (String)
|
||||
@@ -153,8 +154,10 @@ Read-Only:
|
||||
- `flipgroup_id` (Number)
|
||||
- `guid` (String)
|
||||
- `ip_address` (String)
|
||||
- `libvirt_settings` (Attributes) (see [below for nested schema](#nestedatt--vnf_dev--interfaces--libvirt_settings))
|
||||
- `listen_ssh` (Boolean)
|
||||
- `mac` (String)
|
||||
- `mtu` (Number)
|
||||
- `name` (String)
|
||||
- `net_id` (Number)
|
||||
- `net_mask` (Number)
|
||||
@@ -166,6 +169,20 @@ Read-Only:
|
||||
- `type` (String)
|
||||
- `vnfs` (List of Number)
|
||||
|
||||
<a id="nestedatt--vnf_dev--interfaces--libvirt_settings"></a>
|
||||
### Nested Schema for `vnf_dev.interfaces.libvirt_settings`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `event_idx` (String)
|
||||
- `guid` (String)
|
||||
- `ioeventfd` (String)
|
||||
- `queues` (Number)
|
||||
- `rx_queue_size` (Number)
|
||||
- `tx_queue_size` (Number)
|
||||
- `txmode` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--vnf_dev--interfaces--qos"></a>
|
||||
### Nested Schema for `vnf_dev.interfaces.qos`
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ description: |-
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `vnf_dev_id` (Number) Filter by VNF Device id
|
||||
|
||||
### Read-Only
|
||||
|
||||
|
||||
@@ -91,10 +91,6 @@ Required:
|
||||
- `access_type` (String)
|
||||
- `user_id` (String)
|
||||
|
||||
Optional:
|
||||
|
||||
- `recursive_delete` (Boolean)
|
||||
|
||||
|
||||
<a id="nestedatt--acl"></a>
|
||||
### Nested Schema for `acl`
|
||||
|
||||
@@ -29,7 +29,6 @@ description: |-
|
||||
- `iotune` (Attributes) (see [below for nested schema](#nestedatt--iotune))
|
||||
- `permanently` (Boolean) Whether to completely delete the disk, works only with non attached disks
|
||||
- `pool` (String) Pool for disk location
|
||||
- `reason` (String) Reason for deletion
|
||||
- `sep_id` (Number) Storage endpoint provider ID to create disk
|
||||
- `shareable` (Boolean) share disk
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
@@ -27,7 +27,6 @@ description: |-
|
||||
- `detach` (Boolean)
|
||||
- `pause` (Boolean)
|
||||
- `permanently` (Boolean)
|
||||
- `reason` (String)
|
||||
- `reverse` (Boolean)
|
||||
- `start` (Boolean)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
@@ -26,11 +26,10 @@ description: |-
|
||||
|
||||
### Optional
|
||||
|
||||
- `architecture` (String) Binary architecture of this image, one of X86_64 of PPC64_LE
|
||||
- `architecture` (String) Binary architecture of this image, one of X86_64
|
||||
- `hot_resize` (Boolean) Does this machine supports hot resize
|
||||
- `password` (String) Optional password for the image
|
||||
- `password_dl` (String) Password for upload binary media
|
||||
- `permanently` (Boolean)
|
||||
- `pool_name` (String) Pool for image create
|
||||
- `sep_id` (Number) Storage endpoint provider ID
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
@@ -22,7 +22,6 @@ description: |-
|
||||
|
||||
### Optional
|
||||
|
||||
- `permanently` (Boolean)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
@@ -25,6 +25,7 @@ description: |-
|
||||
### Optional
|
||||
|
||||
- `additional_sans` (List of String) is used to define settings and actions that should be performed before any other component in the cluster starts. It allows you to configure things like node registration, network setup, and other initialization tasks. insert a valid JSON string with all levels of nesting.
|
||||
- `chipset` (String) Type of the emulated system
|
||||
- `cluster_config` (String) is used to configure the behavior and settings of the Kube-proxy, which is responsible for network proxying and load balancing within the cluster. It includes parameters such as proxy mode, cluster IP ranges, and other Kube-proxy specific configurations. insert a valid JSON string with all levels of nesting.
|
||||
- `cpu` (Number) Node CPU count.
|
||||
- `desc` (String) Text description of this instance.
|
||||
@@ -39,7 +40,7 @@ description: |-
|
||||
- `kubelet_config` (String) is used to configure the behavior and settings of the Kube-proxy, which is responsible for network proxying and load balancing within the cluster. It includes parameters such as proxy mode, cluster IP ranges, and other Kube-proxy specific configurations. insert a valid JSON string with all levels of nesting.
|
||||
- `lb_sysctl_params` (Attributes List) Custom sysctl values for Load Balancer instance. Applied on boot. (see [below for nested schema](#nestedatt--lb_sysctl_params))
|
||||
- `num` (Number) Number of VMs to create. Can be either 1,3 or 5
|
||||
- `oidc_cert` (String) insert ssl certificate in x509 pem format
|
||||
- `oidc_cert` (String) Insert ssl certificate in x509 pem format
|
||||
- `permanently` (Boolean) whether to completely delete the k8s cluster
|
||||
- `ram` (Number) Node RAM in MB.
|
||||
- `restore` (Boolean) if true, restore the k8s cluster from Recycle Bin
|
||||
@@ -55,6 +56,7 @@ description: |-
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `acl` (Attributes) (see [below for nested schema](#nestedatt--acl))
|
||||
- `address_vip` (Attributes) (see [below for nested schema](#nestedatt--address_vip))
|
||||
- `bservice_id` (Number)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
@@ -145,6 +147,15 @@ Read-Only:
|
||||
|
||||
|
||||
|
||||
<a id="nestedatt--address_vip"></a>
|
||||
### Nested Schema for `address_vip`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `backend_ip` (String)
|
||||
- `frontend_ip` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--detailed_info"></a>
|
||||
### Nested Schema for `detailed_info`
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ description: |-
|
||||
### Optional
|
||||
|
||||
- `annotations` (List of String)
|
||||
- `chipset` (String) Type of the emulated system of work group
|
||||
- `cloud_init` (String)
|
||||
- `cpu` (Number) Worker node CPU count.
|
||||
- `disk` (Number) Worker node boot disk size. If unspecified or 0, size is defined by OS image size.
|
||||
@@ -31,6 +32,7 @@ description: |-
|
||||
- `ram` (Number) Worker node RAM in MB.
|
||||
- `taints` (List of String)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `worker_chipset` (String) Type of the emulated system of worker nodes
|
||||
- `worker_sep_id` (Number)
|
||||
- `worker_sep_pool` (String)
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ description: |-
|
||||
- `auto_start` (Boolean) Flag for redeploy compute
|
||||
- `boot_disk_size` (Number) This compute instance boot disk size in GB. Make sure it is large enough to accomodate selected OS image.
|
||||
- `cd` (Attributes) (see [below for nested schema](#nestedatt--cd))
|
||||
- `chipset` (String) Type of the emulated system, Q35 or i440fx
|
||||
- `cloud_init` (String) Optional cloud_init parameters. Applied when creating new compute instance only, ignored in all other cases.
|
||||
- `cpu_pin` (Boolean) Run VM on dedicated CPUs. To use this feature, the system must be pre-configured by allocating CPUs on the physical node.
|
||||
- `custom_fields` (String) custom fields for Compute. Must be dict
|
||||
@@ -48,6 +49,7 @@ description: |-
|
||||
- `network` (Attributes Set) Optional network connection(s) for this compute. You may specify several network blocks, one for each connection. (see [below for nested schema](#nestedatt--network))
|
||||
- `numa_affinity` (String) Rule for VM placement with NUMA affinity.
|
||||
- `pause` (Boolean)
|
||||
- `pci_devices` (Set of Number) ID of the connected pci devices
|
||||
- `permanently` (Boolean)
|
||||
- `pin_to_stack` (Boolean)
|
||||
- `pool` (String) Pool to use if sepId is set, can be also empty if needed to be chosen by system.
|
||||
@@ -171,6 +173,8 @@ Required:
|
||||
Optional:
|
||||
|
||||
- `ip_address` (String) Optional IP address to assign to this connection. This IP should belong to the selected network and free for use.
|
||||
- `mtu` (Number) Maximum transmission unit, used only for DPDK type, must be 1-9216
|
||||
- `weight` (Number) Weight the network if you need to sort network list, the smallest attach first. zero or null weight attach last
|
||||
|
||||
Read-Only:
|
||||
|
||||
@@ -293,6 +297,7 @@ Read-Only:
|
||||
- `account_id` (Number)
|
||||
- `acl` (String)
|
||||
- `boot_partition` (Number)
|
||||
- `bus_number` (Number)
|
||||
- `ckey` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_time` (Number)
|
||||
@@ -388,6 +393,7 @@ Read-Only:
|
||||
- `account_id` (Number)
|
||||
- `acl` (String)
|
||||
- `boot_partition` (Number)
|
||||
- `bus_number` (Number)
|
||||
- `ckey` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_time` (Number)
|
||||
@@ -480,6 +486,7 @@ Read-Only:
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `bus_number` (Number)
|
||||
- `conn_id` (Number)
|
||||
- `conn_type` (String)
|
||||
- `enabled` (Boolean)
|
||||
@@ -487,8 +494,10 @@ Read-Only:
|
||||
- `get_gw` (String)
|
||||
- `guid` (String)
|
||||
- `ip_address` (String)
|
||||
- `libvirt_settings` (Attributes) (see [below for nested schema](#nestedatt--interfaces--libvirt_settings))
|
||||
- `listen_ssh` (Boolean)
|
||||
- `mac` (String)
|
||||
- `mtu` (Number)
|
||||
- `name` (String)
|
||||
- `net_id` (Number)
|
||||
- `net_type` (String)
|
||||
@@ -500,6 +509,20 @@ Read-Only:
|
||||
- `type` (String)
|
||||
- `vnfs` (List of Number)
|
||||
|
||||
<a id="nestedatt--interfaces--libvirt_settings"></a>
|
||||
### Nested Schema for `interfaces.libvirt_settings`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `event_idx` (String)
|
||||
- `guid` (String)
|
||||
- `ioeventfd` (String)
|
||||
- `queues` (Number)
|
||||
- `rx_queue_size` (Number)
|
||||
- `tx_queue_size` (Number)
|
||||
- `txmode` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--interfaces--qos"></a>
|
||||
### Nested Schema for `interfaces.qos`
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ description: |-
|
||||
- `owner` (String) username - owner of this RG. Leave blank to set current user as owner
|
||||
- `permanently` (Boolean) Set to True if you want force delete non-empty RG
|
||||
- `quota` (Attributes) Quota settings for this resource group. (see [below for nested schema](#nestedatt--quota))
|
||||
- `reason` (String) Set to True if you want force delete non-empty RG
|
||||
- `register_computes` (Boolean) Register computes in registration system
|
||||
- `restore` (Boolean)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `uniq_pools` (List of String) List of strings with pools. Applies only when updating
|
||||
|
||||
### Read-Only
|
||||
|
||||
@@ -60,7 +60,6 @@ description: |-
|
||||
- `rg_id` (Number)
|
||||
- `secret` (String)
|
||||
- `status` (String)
|
||||
- `uniq_pools` (List of String)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `vins` (List of Number)
|
||||
@@ -74,10 +73,6 @@ Required:
|
||||
- `right` (String) Access rights to set, one of 'R', 'RCX' or 'ARCXDU'
|
||||
- `user` (String) User or group name to grant access
|
||||
|
||||
Optional:
|
||||
|
||||
- `reason` (String) Reason for action
|
||||
|
||||
|
||||
<a id="nestedatt--def_net"></a>
|
||||
### Nested Schema for `def_net`
|
||||
@@ -89,7 +84,6 @@ Required:
|
||||
Optional:
|
||||
|
||||
- `net_id` (Number) Network segment ID. If netType is PUBLIC and netId is 0 then default external network segment will be selected. If netType is PRIVATE and netId=0, the first ViNS defined for this RG will be selected. Otherwise, netId identifies either existing external network segment or ViNS.
|
||||
- `reason` (String) Reason for action
|
||||
|
||||
|
||||
<a id="nestedatt--quota"></a>
|
||||
|
||||
@@ -203,6 +203,7 @@ Read-Only:
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `bus_number` (Number)
|
||||
- `conn_id` (Number)
|
||||
- `conn_type` (String)
|
||||
- `def_gw` (String)
|
||||
@@ -210,8 +211,10 @@ Read-Only:
|
||||
- `flipgroup_id` (Number)
|
||||
- `guid` (String)
|
||||
- `ip_address` (String)
|
||||
- `libvirt_settings` (Attributes) (see [below for nested schema](#nestedatt--vnf_dev--interfaces--libvirt_settings))
|
||||
- `listen_ssh` (Boolean)
|
||||
- `mac` (String)
|
||||
- `mtu` (Number)
|
||||
- `name` (String)
|
||||
- `net_id` (Number)
|
||||
- `net_mask` (Number)
|
||||
@@ -223,6 +226,20 @@ Read-Only:
|
||||
- `type` (String)
|
||||
- `vnfs` (List of Number)
|
||||
|
||||
<a id="nestedatt--vnf_dev--interfaces--libvirt_settings"></a>
|
||||
### Nested Schema for `vnf_dev.interfaces.libvirt_settings`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `event_idx` (String)
|
||||
- `guid` (String)
|
||||
- `ioeventfd` (String)
|
||||
- `queues` (Number)
|
||||
- `rx_queue_size` (Number)
|
||||
- `tx_queue_size` (Number)
|
||||
- `txmode` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--vnf_dev--interfaces--qos"></a>
|
||||
### Nested Schema for `vnf_dev.interfaces.qos`
|
||||
|
||||
|
||||
38
go.mod
38
go.mod
@@ -9,21 +9,10 @@ require (
|
||||
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
|
||||
github.com/hashicorp/terraform-plugin-log v0.9.0
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.8.1
|
||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.9.2
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v1.2.1 // indirect
|
||||
github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect
|
||||
github.com/Masterminds/goutils v1.1.1 // indirect
|
||||
github.com/Masterminds/semver/v3 v3.2.0 // indirect
|
||||
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
|
||||
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
|
||||
github.com/armon/go-radix v1.0.0 // indirect
|
||||
github.com/bgentry/speakeasy v0.1.0 // indirect
|
||||
github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect
|
||||
github.com/cloudflare/circl v1.3.7 // indirect
|
||||
github.com/fatih/color v1.16.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
@@ -31,51 +20,26 @@ require (
|
||||
github.com/go-playground/validator/v10 v10.21.0 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/hashicorp/cli v1.1.6 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-hclog v1.5.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-plugin v1.6.0 // indirect
|
||||
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
||||
github.com/hashicorp/go-version v1.7.0 // indirect
|
||||
github.com/hashicorp/hc-install v0.7.0 // indirect
|
||||
github.com/hashicorp/terraform-exec v0.21.0 // indirect
|
||||
github.com/hashicorp/terraform-json v0.22.1 // indirect
|
||||
github.com/hashicorp/terraform-plugin-docs v0.19.4 // indirect
|
||||
github.com/hashicorp/terraform-plugin-go v0.23.0 // indirect
|
||||
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
|
||||
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
|
||||
github.com/hashicorp/yamux v0.1.1 // indirect
|
||||
github.com/huandu/xstrings v1.3.3 // indirect
|
||||
github.com/imdario/mergo v0.3.15 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/oklog/run v1.0.0 // indirect
|
||||
github.com/posener/complete v1.2.3 // indirect
|
||||
github.com/shopspring/decimal v1.3.1 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||
github.com/yuin/goldmark v1.7.1 // indirect
|
||||
github.com/yuin/goldmark-meta v1.1.0 // indirect
|
||||
github.com/zclconf/go-cty v1.14.4 // indirect
|
||||
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
|
||||
golang.org/x/crypto v0.24.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.26.0 // indirect
|
||||
golang.org/x/sys v0.21.0 // indirect
|
||||
golang.org/x/text v0.16.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
|
||||
google.golang.org/grpc v1.63.2 // indirect
|
||||
google.golang.org/protobuf v1.34.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.3.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
121
go.sum
121
go.sum
@@ -1,30 +1,7 @@
|
||||
github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
|
||||
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||
github.com/Kunde21/markdownfmt/v3 v3.1.0 h1:KiZu9LKs+wFFBQKhrZJrFZwtLnCCWJahL+S+E/3VnM0=
|
||||
github.com/Kunde21/markdownfmt/v3 v3.1.0/go.mod h1:tPXN1RTyOzJwhfHoon9wUr4HGYmWgVxSQN6VBJDkrVc=
|
||||
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
|
||||
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
||||
github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g=
|
||||
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
|
||||
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
|
||||
github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
|
||||
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97LyUpzH9P6Hrlg=
|
||||
github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
|
||||
github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
|
||||
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=
|
||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||
github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I=
|
||||
github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
|
||||
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
|
||||
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
|
||||
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
||||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
|
||||
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
|
||||
@@ -43,39 +20,14 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
||||
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/hashicorp/cli v1.1.6 h1:CMOV+/LJfL1tXCOKrgAX0uRKnzjj/mpmqNXloRSy2K8=
|
||||
github.com/hashicorp/cli v1.1.6/go.mod h1:MPon5QYlgjjo0BSoAiN0ESeT5fRzDjVRp+uioJ0piz4=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU=
|
||||
github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
||||
github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c=
|
||||
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||
github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A=
|
||||
github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI=
|
||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
|
||||
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
|
||||
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||
github.com/hashicorp/hc-install v0.7.0 h1:Uu9edVqjKQxxuD28mR5TikkKDd/p55S8vzPC1659aBk=
|
||||
github.com/hashicorp/hc-install v0.7.0/go.mod h1:ELmmzZlGnEcqoUMKUuykHaPCIR1sYLYX+KSggWSKZuA=
|
||||
github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVWkd/RG0D2XQ=
|
||||
github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg=
|
||||
github.com/hashicorp/terraform-json v0.22.1 h1:xft84GZR0QzjPVWs4lRUwvTcPnegqlyS7orfb5Ltvec=
|
||||
github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A=
|
||||
github.com/hashicorp/terraform-plugin-docs v0.19.4 h1:G3Bgo7J22OMtegIgn8Cd/CaSeyEljqjH3G39w28JK4c=
|
||||
github.com/hashicorp/terraform-plugin-docs v0.19.4/go.mod h1:4pLASsatTmRynVzsjEhbXZ6s7xBlUw/2Kt0zfrq8HxA=
|
||||
github.com/hashicorp/terraform-plugin-framework v1.9.0 h1:caLcDoxiRucNi2hk8+j3kJwkKfvHznubyFsJMWfZqKU=
|
||||
github.com/hashicorp/terraform-plugin-framework v1.9.0/go.mod h1:qBXLDn69kM97NNVi/MQ9qgd1uWWsVftGSnygYG1tImM=
|
||||
github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 h1:gm5b1kHgFFhaKFhm4h2TgvMUlNzFAtUqlcOWnWPm+9E=
|
||||
@@ -92,53 +44,27 @@ github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S
|
||||
github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc=
|
||||
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
|
||||
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
|
||||
github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4=
|
||||
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
|
||||
github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
|
||||
github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
|
||||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
|
||||
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
|
||||
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
|
||||
github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
|
||||
github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
|
||||
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
|
||||
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
|
||||
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo=
|
||||
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
|
||||
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
|
||||
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
|
||||
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
@@ -146,62 +72,22 @@ github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IU
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U=
|
||||
github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||
github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc=
|
||||
github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0=
|
||||
github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8=
|
||||
github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
|
||||
go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw=
|
||||
go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
|
||||
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
|
||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
|
||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
|
||||
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
|
||||
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
|
||||
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY=
|
||||
@@ -211,11 +97,8 @@ google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH
|
||||
google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.8.1 h1:wpxjnVO7hGaQVWbtFoYVbNoeFxk0QUnEfDsPuWjiNk0=
|
||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.8.1/go.mod h1:OaUynHHuSjWMzpfyoL4au6oLcUogqUkPPBKA15pbHWo=
|
||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.9.2 h1:MPH1tMQrDN1Gri4FrQP3cx60uR3uZioEDb707D88/7c=
|
||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.9.2/go.mod h1:OaUynHHuSjWMzpfyoL4au6oLcUogqUkPPBKA15pbHWo=
|
||||
|
||||
@@ -3,8 +3,10 @@ package provider
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/account"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/audit"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/bservice"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/disks"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/dpdknet"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/extnet"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/flipgroup"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/image"
|
||||
@@ -17,6 +19,8 @@ import (
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/vins"
|
||||
cbAccount "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/account"
|
||||
cbAudit "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/audit"
|
||||
cbDisks "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/disks"
|
||||
cbK8ci "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/k8ci"
|
||||
cbLb "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/lb"
|
||||
cbNode "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/node"
|
||||
cbRG "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/rg"
|
||||
@@ -43,6 +47,8 @@ func newDataSourcesMap() []func() datasource.DataSource {
|
||||
account.NewDataSourceAccountReservedUnits,
|
||||
account.NewDataSourceAccountGetResourceConsumptionList,
|
||||
|
||||
audit.NewDataSourceAudit,
|
||||
|
||||
bservice.NewDataSourceBService,
|
||||
bservice.NewDataSourceBServiceList,
|
||||
bservice.NewDataSourceBServiceGroup,
|
||||
@@ -59,6 +65,9 @@ func newDataSourcesMap() []func() datasource.DataSource {
|
||||
disks.NewDataSourceDiskSnapshotList,
|
||||
disks.NewDataSourceDiskReplication,
|
||||
|
||||
dpdknet.NewDataSourceDPDK,
|
||||
dpdknet.NewDataSourceDPDKList,
|
||||
|
||||
extnet.NewDataSourceExtNet,
|
||||
extnet.NewDataSourceExtNetComputesList,
|
||||
extnet.NewDataSourceExtNetDefault,
|
||||
@@ -147,9 +156,23 @@ func newDataSourcesMap() []func() datasource.DataSource {
|
||||
cbAudit.NewDataSourceAuditLinkedJobs,
|
||||
cbAudit.NewDataSourceAuditList,
|
||||
|
||||
cbDisks.NewDataSourceDiskListDeleted,
|
||||
cbDisks.NewDataSourceDiskListTypesDetailed,
|
||||
cbDisks.NewDataSourceDiskListTypes,
|
||||
cbDisks.NewDataSourceDiskListUnattached,
|
||||
cbDisks.NewdataSourceDiskList,
|
||||
cbDisks.NewDataSourceDiskReplication,
|
||||
cbDisks.NewDataSourceDiskSnapshotList,
|
||||
cbDisks.NewDataSourceDiskSnapshot,
|
||||
cbDisks.NewDataSourceDisk,
|
||||
|
||||
cbNode.NewDataSourceNode,
|
||||
cbNode.NewDataSourceNodeList,
|
||||
|
||||
cbK8ci.NewDataSourceK8CI,
|
||||
cbK8ci.NewDataSourceK8CIList,
|
||||
cbK8ci.NewDataSourceK8CIListDeleted,
|
||||
|
||||
cbLb.NewDataSourceLB,
|
||||
cbLb.NewDataSourceLBList,
|
||||
cbLb.NewDataSourceLBListDeleted,
|
||||
|
||||
@@ -142,7 +142,7 @@ func (p *DynamixProvider) Configure(ctx context.Context, req provider.ConfigureR
|
||||
return
|
||||
}
|
||||
|
||||
// Set up default values, values from env and save user provided values into decortConfig
|
||||
// Set up default values, values from env and save user provided values into dynamixConfig
|
||||
dynamixConfig := dynamixProviderConfig{}
|
||||
dynamixConfig.new(config)
|
||||
|
||||
|
||||
@@ -12,8 +12,11 @@ import (
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/lb"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/rg"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/vins"
|
||||
cbLb "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/lb"
|
||||
cbAccount "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/account"
|
||||
cbDisks "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/disks"
|
||||
cbK8CI "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/k8ci"
|
||||
cbLb "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/lb"
|
||||
cbRG "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/rg"
|
||||
cbVFpool "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/vfpool"
|
||||
cbVins "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/vins"
|
||||
)
|
||||
@@ -43,11 +46,18 @@ func newResourcesMap() []func() resource.Resource {
|
||||
|
||||
cbAccount.NewResourceAccount,
|
||||
|
||||
cbDisks.NewResourceDiskReplications,
|
||||
cbDisks.NewResourceDiskSnapshot,
|
||||
cbDisks.NewResourceDisk,
|
||||
|
||||
cbK8CI.NewResourceK8Ci,
|
||||
|
||||
cbLb.NewResourceLB,
|
||||
cbLb.NewResourceLBBackend,
|
||||
cbLb.NewResourceLBBackendServer,
|
||||
cbLb.NewResourceLBFrontend,
|
||||
cbLb.NewResourceLBFrontendBind,
|
||||
cbRG.NewResourceRG,
|
||||
cbVFpool.NewResourceVFPool,
|
||||
cbVins.NewResourceVINS,
|
||||
cbVins.NewResourceVINSStaticRoute,
|
||||
|
||||
@@ -37,6 +37,7 @@ func AccountFlipgroupsListDataSource(ctx context.Context, state *models.DataSour
|
||||
ExtNetID: state.ExtNetID,
|
||||
ByIP: state.ByIP,
|
||||
FLIPGroupID: state.FLIPGroupID,
|
||||
SortBy: state.SortBy,
|
||||
Page: state.Page,
|
||||
Size: state.Size,
|
||||
Timeouts: state.Timeouts,
|
||||
|
||||
@@ -14,6 +14,7 @@ type DataSourceAccountFlipgroupsListModel struct {
|
||||
ExtNetID types.Int64 `tfsdk:"extnet_id"`
|
||||
ByIP types.String `tfsdk:"by_ip"`
|
||||
FLIPGroupID types.Int64 `tfsdk:"flipgroup_id"`
|
||||
SortBy types.String `tfsdk:"sort_by"`
|
||||
Page types.Int64 `tfsdk:"page"`
|
||||
Size types.Int64 `tfsdk:"size"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
@@ -50,9 +50,8 @@ type ResourceAccountModel struct {
|
||||
}
|
||||
|
||||
type UsersModel struct {
|
||||
UserID types.String `tfsdk:"user_id"`
|
||||
AccessType types.String `tfsdk:"access_type"`
|
||||
RecursiveDelete types.Bool `tfsdk:"recursive_delete"`
|
||||
UserID types.String `tfsdk:"user_id"`
|
||||
AccessType types.String `tfsdk:"access_type"`
|
||||
}
|
||||
|
||||
type ResourceLimitsInAccountResourceModel struct {
|
||||
|
||||
@@ -37,6 +37,10 @@ func MakeSchemaDataSourceAccountFlipgroupsList() map[string]schema.Attribute {
|
||||
Optional: true,
|
||||
Description: "find by flipgroup id",
|
||||
},
|
||||
"sort_by": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "sort by one of supported fields, format +|-(field)",
|
||||
},
|
||||
"page": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "page number",
|
||||
|
||||
@@ -38,10 +38,6 @@ func MakeSchemaResourceAccount() map[string]schema.Attribute {
|
||||
"access_type": schema.StringAttribute{
|
||||
Required: true,
|
||||
},
|
||||
"recursive_delete": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
// default is false
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -33,6 +33,9 @@ func AccountFlipgroupsListCheckPresence(ctx context.Context, plan *models.DataSo
|
||||
if !plan.FLIPGroupID.IsNull() {
|
||||
flipgroupsListReq.FLIPGroupID = uint64(plan.FLIPGroupID.ValueInt64())
|
||||
}
|
||||
if !plan.SortBy.IsNull() {
|
||||
flipgroupsListReq.SortBy = plan.SortBy.ValueString()
|
||||
}
|
||||
if !plan.Page.IsNull() {
|
||||
flipgroupsListReq.Page = uint64(plan.Page.ValueInt64())
|
||||
}
|
||||
|
||||
@@ -298,9 +298,8 @@ func AddDeleteUsersAccount(ctx context.Context, accountId uint64, plan, state *m
|
||||
|
||||
for _, user := range deletedUsers {
|
||||
delUserReq := account.DeleteUserRequest{
|
||||
AccountID: accountId,
|
||||
UserID: user.UserID.ValueString(),
|
||||
RecursiveDelete: user.RecursiveDelete.ValueBool(), // default false
|
||||
AccountID: accountId,
|
||||
UserID: user.UserID.ValueString(),
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "AddDeleteUsersAccount: before calling CloudAPI().Account().DeleteUser", map[string]any{"account_id": accountId, "req": delUserReq})
|
||||
|
||||
91
internal/service/cloudapi/audit/data_source_audit.go
Normal file
91
internal/service/cloudapi/audit/data_source_audit.go
Normal file
@@ -0,0 +1,91 @@
|
||||
package audit
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/constants"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/audit/flattens"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/audit/models"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/audit/schemas"
|
||||
)
|
||||
|
||||
// Ensure the implementation satisfies the expected interfaces.
|
||||
var (
|
||||
_ datasource.DataSource = &dataSourceAudit{}
|
||||
)
|
||||
|
||||
func NewDataSourceAudit() datasource.DataSource {
|
||||
return &dataSourceAudit{}
|
||||
}
|
||||
|
||||
// dataSourceAudit is the data source implementation.
|
||||
type dataSourceAudit struct {
|
||||
client *decort.DecortClient
|
||||
}
|
||||
|
||||
func (d *dataSourceAudit) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||
// Read Terraform configuration data into the model
|
||||
var state models.DataSourceAudit
|
||||
resp.Diagnostics.Append(req.Config.Get(ctx, &state)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Read dataSourceAudit: Error get state")
|
||||
return
|
||||
}
|
||||
auditGuid := state.AuditGuid.ValueString()
|
||||
tflog.Info(ctx, "Read dataSourceAudit: got state successfully", map[string]any{"audit_guid": auditGuid})
|
||||
|
||||
// Set timeouts
|
||||
readTimeout, diags := state.Timeouts.Read(ctx, constants.Timeout180s)
|
||||
resp.Diagnostics.Append(diags...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Read dataSourceAudit: Error set timeout")
|
||||
return
|
||||
}
|
||||
tflog.Info(ctx, "Read dataSourceAudit: set timeouts successfully", map[string]any{
|
||||
"audit_guid": auditGuid,
|
||||
"readTimeout": readTimeout})
|
||||
|
||||
ctx, cancel := context.WithTimeout(ctx, readTimeout)
|
||||
defer cancel()
|
||||
|
||||
// Map response body to schema
|
||||
resp.Diagnostics.Append(flattens.AuditDataSource(ctx, &state, d.client)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Read dataSourceAudit: Error flatten")
|
||||
return
|
||||
}
|
||||
|
||||
// Set refreshed state
|
||||
resp.Diagnostics.Append(resp.State.Set(ctx, &state)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Read dataSourceAudit: Error set state")
|
||||
return
|
||||
}
|
||||
tflog.Info(ctx, "End read dataSourceAudit", map[string]any{"audit_guid": auditGuid})
|
||||
}
|
||||
|
||||
func (d *dataSourceAudit) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||
resp.Schema = schema.Schema{
|
||||
Attributes: schemas.MakeSchemaDataSourceAudit(),
|
||||
Blocks: map[string]schema.Block{
|
||||
"timeouts": timeouts.Block(ctx),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (d *dataSourceAudit) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
|
||||
resp.TypeName = req.ProviderTypeName + "_audit"
|
||||
}
|
||||
|
||||
// Configure adds the provider configured client to the data source.
|
||||
func (d *dataSourceAudit) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||
tflog.Info(ctx, "Get Configure dataSourceAudit")
|
||||
d.client = client.DataSource(ctx, &req, resp)
|
||||
tflog.Info(ctx, "Getting Configure dataSourceAudit successfully")
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package flattens
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/diag"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/audit/models"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/audit/utilities"
|
||||
)
|
||||
|
||||
func AuditDataSource(ctx context.Context, state *models.DataSourceAudit, c *decort.DecortClient) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Start flattens.AuditDataSource")
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
|
||||
auditGuid := state.AuditGuid.ValueString()
|
||||
|
||||
recordAudit, diags := utilities.AuditDataSourceCheckPresence(ctx, auditGuid, c)
|
||||
if diags.HasError() {
|
||||
return diags
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "flattens.AuditDataSource: before flatten", map[string]any{"audit_guid": auditGuid})
|
||||
|
||||
*state = models.DataSourceAudit{
|
||||
AuditGuid: state.AuditGuid,
|
||||
Timeouts: state.Timeouts,
|
||||
|
||||
Arguments: types.StringValue(recordAudit.Arguments),
|
||||
Call: types.StringValue(recordAudit.Call),
|
||||
GUID: types.StringValue(recordAudit.GUID),
|
||||
ID: types.StringValue(recordAudit.GUID),
|
||||
Kwargs: types.StringValue(recordAudit.Kwargs),
|
||||
RemoteAddr: types.StringValue(recordAudit.RemoteAddr),
|
||||
ResponseTime: types.Float64Value(recordAudit.ResponseTime),
|
||||
Result: types.StringValue(recordAudit.Result),
|
||||
StatusCode: types.Int64Value(int64(recordAudit.StatusCode)),
|
||||
Tags: types.StringValue(recordAudit.Tags),
|
||||
Timestamp: types.Float64Value(recordAudit.Timestamp),
|
||||
TimestampEnd: types.Float64Value(recordAudit.TimestampEnd),
|
||||
User: types.StringValue(recordAudit.User),
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "End flattens.AuditDataSource", map[string]any{"audit_guid": auditGuid})
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceAudit struct {
|
||||
//required field
|
||||
AuditGuid types.String `tfsdk:"audit_guid"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
//response field
|
||||
Arguments types.String `tfsdk:"args"`
|
||||
Call types.String `tfsdk:"call"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
ID types.String `tfsdk:"id"`
|
||||
Kwargs types.String `tfsdk:"kwargs"`
|
||||
RemoteAddr types.String `tfsdk:"remote_addr"`
|
||||
ResponseTime types.Float64 `tfsdk:"responsetime"`
|
||||
Result types.String `tfsdk:"result"`
|
||||
StatusCode types.Int64 `tfsdk:"status_code"`
|
||||
Tags types.String `tfsdk:"tags"`
|
||||
Timestamp types.Float64 `tfsdk:"timestamp"`
|
||||
TimestampEnd types.Float64 `tfsdk:"timestamp_end"`
|
||||
User types.String `tfsdk:"user"`
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceAudit() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
"audit_guid": schema.StringAttribute{
|
||||
Required: true,
|
||||
},
|
||||
"args": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"call": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"guid": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"kwargs": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"remote_addr": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"responsetime": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"result": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"status_code": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"tags": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"timestamp": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"timestamp_end": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"user": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package utilities
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/diag"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/audit"
|
||||
)
|
||||
|
||||
func AuditDataSourceCheckPresence(ctx context.Context, auditGuid string, c *decort.DecortClient) (*audit.RecordAudit, diag.Diagnostics) {
|
||||
tflog.Info(ctx, fmt.Sprintf("AuditDataSourceCheckPresence: Get info about audit with ID - %v", auditGuid))
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
|
||||
recordAudit, err := c.CloudAPI().Audit().Get(ctx, audit.GetRequest{AuditGuid: auditGuid})
|
||||
if err != nil {
|
||||
diags.AddError(fmt.Sprintf("Cannot get info about audit with ID %v", auditGuid), err.Error())
|
||||
return nil, diags
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "AuditDataSourceCheckPresence: response from CloudBroker().Audit().Get", map[string]any{"audit_guid": auditGuid, "response": recordAudit})
|
||||
|
||||
return recordAudit, nil
|
||||
}
|
||||
@@ -52,7 +52,6 @@ func DiskResource(ctx context.Context, plan *models.ResourceDiskModel, c *decort
|
||||
Type: plan.Type,
|
||||
Detach: plan.Detach,
|
||||
Permanently: plan.Permanently,
|
||||
Reason: plan.Reason,
|
||||
Shareable: plan.Shareable,
|
||||
Timeouts: plan.Timeouts,
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ func DiskReplicationResource(ctx context.Context, state *models.ResourceRecordDi
|
||||
Start: state.Start,
|
||||
Detach: state.Detach,
|
||||
Permanently: state.Permanently,
|
||||
Reason: state.Reason,
|
||||
Id: types.StringValue(strconv.Itoa(int(recordDisk.Replication.DiskID))),
|
||||
ACL: types.StringValue(string(diskAcl)),
|
||||
AccountID: types.Int64Value(int64(recordDisk.AccountID)),
|
||||
|
||||
@@ -20,7 +20,6 @@ type ResourceDiskModel struct {
|
||||
Type types.String `tfsdk:"type"`
|
||||
Detach types.Bool `tfsdk:"detach"`
|
||||
Permanently types.Bool `tfsdk:"permanently"`
|
||||
Reason types.String `tfsdk:"reason"`
|
||||
Shareable types.Bool `tfsdk:"shareable"`
|
||||
IOTune types.Object `tfsdk:"iotune"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
@@ -17,7 +17,6 @@ type ResourceRecordDiskReplicationModel struct {
|
||||
Start types.Bool `tfsdk:"start"`
|
||||
Detach types.Bool `tfsdk:"detach"`
|
||||
Permanently types.Bool `tfsdk:"permanently"`
|
||||
Reason types.String `tfsdk:"reason"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
|
||||
@@ -312,10 +312,6 @@ func (r *resourceDisk) Delete(ctx context.Context, req resource.DeleteRequest, r
|
||||
Permanently: state.Permanently.ValueBool(), // default false
|
||||
}
|
||||
|
||||
if !state.Reason.IsNull() {
|
||||
delReq.Reason = state.Reason.ValueString()
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "Delete resourceDisk: before call CloudAPI().Disks().Delete", map[string]any{"req": delReq})
|
||||
_, err := r.client.CloudAPI().Disks().Delete(ctx, delReq)
|
||||
if err != nil {
|
||||
|
||||
@@ -284,10 +284,6 @@ func (r *resourceDiskReplication) Delete(ctx context.Context, req resource.Delet
|
||||
Permanently: state.Permanently.ValueBool(), // default false
|
||||
}
|
||||
|
||||
if !state.Reason.IsNull() {
|
||||
delReq.Reason = state.Reason.ValueString()
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "Delete resourceDiskReplication: before call CloudAPI().Disks().Delete", map[string]any{"req": delReq})
|
||||
_, err := r.client.CloudAPI().Disks().Delete(ctx, delReq)
|
||||
if err != nil {
|
||||
|
||||
@@ -64,10 +64,6 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
|
||||
Description: "Whether to completely delete the disk, works only with non attached disks",
|
||||
// default is false
|
||||
},
|
||||
"reason": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "Reason for deletion",
|
||||
},
|
||||
"shareable": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
|
||||
@@ -39,9 +39,6 @@ func MakeSchemaResourceDiskReplication() map[string]schema.Attribute {
|
||||
"permanently": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"reason": schema.StringAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
// computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
|
||||
@@ -193,7 +193,6 @@ func RestoreDisk(ctx context.Context, diskId uint64, c *decort.DecortClient) dia
|
||||
|
||||
restoreReq := disks.RestoreRequest{
|
||||
DiskID: diskId,
|
||||
Reason: "Terraform automatic restore",
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "RestoreDisk: before calling CloudAPI().Disks().Restore", map[string]any{"diskId": diskId, "req": restoreReq})
|
||||
|
||||
91
internal/service/cloudapi/dpdknet/data_source_dpdknet.go
Normal file
91
internal/service/cloudapi/dpdknet/data_source_dpdknet.go
Normal file
@@ -0,0 +1,91 @@
|
||||
package dpdknet
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/constants"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/dpdknet/flattens"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/dpdknet/models"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/dpdknet/schemas"
|
||||
)
|
||||
|
||||
// Ensure the implementation satisfies the expected interfaces.
|
||||
var (
|
||||
_ datasource.DataSource = &dataSourceDPDK{}
|
||||
)
|
||||
|
||||
func NewDataSourceDPDK() datasource.DataSource {
|
||||
return &dataSourceDPDK{}
|
||||
}
|
||||
|
||||
// dataSourceDPDK is the data source implementation.
|
||||
type dataSourceDPDK struct {
|
||||
client *decort.DecortClient
|
||||
}
|
||||
|
||||
func (d *dataSourceDPDK) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||
// Read Terraform configuration data into the model
|
||||
var state models.DataSourceDPDKModel
|
||||
resp.Diagnostics.Append(req.Config.Get(ctx, &state)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Read dataSourceDPDK: Error get state")
|
||||
return
|
||||
}
|
||||
dpdkId := uint64(state.DPDKID.ValueInt64())
|
||||
tflog.Info(ctx, "Read dataSourceDPDK: got state successfully", map[string]any{"dpdk_id": dpdkId})
|
||||
|
||||
// Set timeouts
|
||||
readTimeout, diags := state.Timeouts.Read(ctx, constants.Timeout180s)
|
||||
resp.Diagnostics.Append(diags...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Read dataSourceDPDK: Error set timeout")
|
||||
return
|
||||
}
|
||||
tflog.Info(ctx, "Read dataSourceDPDK: set timeouts successfully", map[string]any{
|
||||
"dpdk_id": dpdkId,
|
||||
"readTimeout": readTimeout})
|
||||
|
||||
ctx, cancel := context.WithTimeout(ctx, readTimeout)
|
||||
defer cancel()
|
||||
|
||||
// Map response body to schema
|
||||
resp.Diagnostics.Append(flattens.DPDKDataSource(ctx, &state, d.client)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Read dataSourceDPDK: Error flatten")
|
||||
return
|
||||
}
|
||||
|
||||
// Set refreshed state
|
||||
resp.Diagnostics.Append(resp.State.Set(ctx, &state)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Read dataSourceDPDK: Error set state")
|
||||
return
|
||||
}
|
||||
tflog.Info(ctx, "End read dataSourceDPDK", map[string]any{"dpdk_id": dpdkId})
|
||||
}
|
||||
|
||||
func (d *dataSourceDPDK) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||
resp.Schema = schema.Schema{
|
||||
Attributes: schemas.MakeSchemaDataSourceDPDK(),
|
||||
Blocks: map[string]schema.Block{
|
||||
"timeouts": timeouts.Block(ctx),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (d *dataSourceDPDK) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
|
||||
resp.TypeName = req.ProviderTypeName + "_dpdknet"
|
||||
}
|
||||
|
||||
// Configure adds the provider configured client to the data source.
|
||||
func (d *dataSourceDPDK) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||
tflog.Info(ctx, "Get Configure dataSourceDPDK")
|
||||
d.client = client.DataSource(ctx, &req, resp)
|
||||
tflog.Info(ctx, "Getting Configure dataSourceDPDK successfully")
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package dpdknet
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/constants"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/dpdknet/flattens"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/dpdknet/models"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/dpdknet/schemas"
|
||||
)
|
||||
|
||||
// Ensure the implementation satisfies the expected interfaces.
|
||||
var (
|
||||
_ datasource.DataSource = &dataSourceDPDKList{}
|
||||
)
|
||||
|
||||
func NewDataSourceDPDKList() datasource.DataSource {
|
||||
return &dataSourceDPDKList{}
|
||||
}
|
||||
|
||||
// dataSourceDPDKList is the data source implementation.
|
||||
type dataSourceDPDKList struct {
|
||||
client *decort.DecortClient
|
||||
}
|
||||
|
||||
func (d *dataSourceDPDKList) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||
// Read Terraform configuration data into the model
|
||||
var state models.DataSourceDPDKListModel
|
||||
resp.Diagnostics.Append(req.Config.Get(ctx, &state)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Read dataSourceDPDKList: Error get state")
|
||||
return
|
||||
}
|
||||
|
||||
// Set timeouts
|
||||
readTimeout, diags := state.Timeouts.Read(ctx, constants.Timeout180s)
|
||||
resp.Diagnostics.Append(diags...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Read dataSourceDPDKList: Error set timeout")
|
||||
return
|
||||
}
|
||||
tflog.Info(ctx, "Read dataSourceDPDKList: set timeouts successfully", map[string]any{
|
||||
"readTimeout": readTimeout})
|
||||
|
||||
ctx, cancel := context.WithTimeout(ctx, readTimeout)
|
||||
defer cancel()
|
||||
|
||||
// Map response body to schema
|
||||
resp.Diagnostics.Append(flattens.DPDKListDataSource(ctx, &state, d.client)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Read dataSourceDPDKList: Error flatten")
|
||||
return
|
||||
}
|
||||
|
||||
// Set refreshed state
|
||||
resp.Diagnostics.Append(resp.State.Set(ctx, &state)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Read dataSourceDPDKList: Error set state")
|
||||
return
|
||||
}
|
||||
tflog.Info(ctx, "End read dataSourceDPDKList")
|
||||
}
|
||||
|
||||
func (d *dataSourceDPDKList) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||
resp.Schema = schema.Schema{
|
||||
Attributes: schemas.MakeSchemaDataSourceDPDKList(),
|
||||
Blocks: map[string]schema.Block{
|
||||
"timeouts": timeouts.Block(ctx),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (d *dataSourceDPDKList) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
|
||||
resp.TypeName = req.ProviderTypeName + "_dpdknet_list"
|
||||
}
|
||||
|
||||
// Configure adds the provider configured client to the data source.
|
||||
func (d *dataSourceDPDKList) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||
tflog.Info(ctx, "Get Configure dataSourceDPDKList")
|
||||
d.client = client.DataSource(ctx, &req, resp)
|
||||
tflog.Info(ctx, "Getting Configure dataSourceDPDKList successfully")
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package flattens
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/terraform-plugin-framework/diag"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/flattens"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/dpdknet/models"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/dpdknet/utilities"
|
||||
)
|
||||
|
||||
func DPDKDataSource(ctx context.Context, state *models.DataSourceDPDKModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Start flattens.DPDKDataSource")
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
|
||||
dpdkId := uint64(state.DPDKID.ValueInt64())
|
||||
|
||||
recordDPDK, diags := utilities.DPDKDataSourceCheckPresence(ctx, dpdkId, c)
|
||||
if diags.HasError() {
|
||||
return diags
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "flattens.DPDKDataSource: before flatten", map[string]any{"dpdk_id": dpdkId})
|
||||
|
||||
id := uuid.New()
|
||||
*state = models.DataSourceDPDKModel{
|
||||
DPDKID: state.DPDKID,
|
||||
Timeouts: state.Timeouts,
|
||||
|
||||
Id: types.StringValue(id.String()),
|
||||
AccountAccess: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordDPDK.AccountAccess),
|
||||
CreatedTime: types.Int64Value(int64(recordDPDK.CreatedTime)),
|
||||
Desc: types.StringValue(recordDPDK.Description),
|
||||
GID: types.Int64Value(int64(recordDPDK.GID)),
|
||||
GUID: types.Int64Value(int64(recordDPDK.GUID)),
|
||||
Name: types.StringValue(recordDPDK.Name),
|
||||
RGAccess: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordDPDK.RGAccess),
|
||||
Status: types.StringValue(recordDPDK.Status),
|
||||
OVSBridge: types.StringValue(recordDPDK.OVSBridge),
|
||||
VlanID: types.Int64Value(int64(recordDPDK.VlanID)),
|
||||
ComputeIDs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordDPDK.ComputeIDs),
|
||||
UpdatedTime: types.Int64Value(int64(recordDPDK.UpdatedTime)),
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "End flattens.DPDKDataSource", map[string]any{"dpdk_id": dpdkId})
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package flattens
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/terraform-plugin-framework/diag"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/flattens"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/dpdknet/models"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/dpdknet/utilities"
|
||||
)
|
||||
|
||||
func DPDKListDataSource(ctx context.Context, state *models.DataSourceDPDKListModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Start flattens.DPDKListDataSource")
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
|
||||
dpdkList, err := utilities.DPDKListDataSourceCheckPresence(ctx, state, c)
|
||||
if err != nil {
|
||||
diags.AddError("Cannot get info about list DPDK", err.Error())
|
||||
return diags
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "flattens.DPDKListDataSource: before flatten")
|
||||
|
||||
id := uuid.New()
|
||||
*state = models.DataSourceDPDKListModel{
|
||||
ByID: state.ByID,
|
||||
GID: state.GID,
|
||||
Name: state.Name,
|
||||
Desc: state.Desc,
|
||||
Status: state.Status,
|
||||
ComputeIDs: state.ComputeIDs,
|
||||
SortBy: state.SortBy,
|
||||
Page: state.Page,
|
||||
Size: state.Size,
|
||||
Timeouts: state.Timeouts,
|
||||
|
||||
Id: types.StringValue(id.String()),
|
||||
}
|
||||
|
||||
items := make([]models.ItemDPDKListModel, 0, len(dpdkList.Data))
|
||||
for _, dpdkItem := range dpdkList.Data {
|
||||
|
||||
item := models.ItemDPDKListModel{
|
||||
AccountAccess: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, dpdkItem.AccountAccess),
|
||||
CreatedTime: types.Int64Value(int64(dpdkItem.CreatedTime)),
|
||||
Desc: types.StringValue(dpdkItem.Description),
|
||||
DPDKID: types.Int64Value(int64(dpdkItem.ID)),
|
||||
GID: types.Int64Value(int64(dpdkItem.GID)),
|
||||
GUID: types.Int64Value(int64(dpdkItem.GUID)),
|
||||
Name: types.StringValue(dpdkItem.Name),
|
||||
RGAccess: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, dpdkItem.RGAccess),
|
||||
Status: types.StringValue(dpdkItem.Status),
|
||||
OVSBridge: types.StringValue(dpdkItem.OVSBridge),
|
||||
VlanID: types.Int64Value(int64(dpdkItem.VlanID)),
|
||||
ComputeIDs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, dpdkItem.ComputeIDs),
|
||||
UpdatedTime: types.Int64Value(int64(dpdkItem.UpdatedTime)),
|
||||
}
|
||||
|
||||
items = append(items, item)
|
||||
}
|
||||
|
||||
state.Items = items
|
||||
state.EntryCount = types.Int64Value(int64(dpdkList.EntryCount))
|
||||
|
||||
tflog.Info(ctx, "End flattens.DPDKListDataSource")
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceDPDKModel struct {
|
||||
//required field
|
||||
DPDKID types.Int64 `tfsdk:"dpdk_id"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
//response field
|
||||
AccountAccess types.List `tfsdk:"account_access"`
|
||||
CreatedTime types.Int64 `tfsdk:"created_time"`
|
||||
Desc types.String `tfsdk:"desc"`
|
||||
GID types.Int64 `tfsdk:"gid"`
|
||||
GUID types.Int64 `tfsdk:"guid"`
|
||||
Id types.String `tfsdk:"id"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
RGAccess types.List `tfsdk:"rg_access"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
OVSBridge types.String `tfsdk:"ovs_bridge"`
|
||||
VlanID types.Int64 `tfsdk:"vlan_id"`
|
||||
ComputeIDs types.List `tfsdk:"compute_ids"`
|
||||
UpdatedTime types.Int64 `tfsdk:"updated_time"`
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceDPDKListModel struct {
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// optional attributes
|
||||
ByID types.Int64 `tfsdk:"by_id"`
|
||||
GID types.Int64 `tfsdk:"gid"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
Desc types.String `tfsdk:"desc"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
ComputeIDs types.List `tfsdk:"compute_ids"`
|
||||
SortBy types.String `tfsdk:"sort_by"`
|
||||
Page types.Int64 `tfsdk:"page"`
|
||||
Size types.Int64 `tfsdk:"size"`
|
||||
|
||||
// computed attributes
|
||||
Id types.String `tfsdk:"id"`
|
||||
Items []ItemDPDKListModel `tfsdk:"items"`
|
||||
EntryCount types.Int64 `tfsdk:"entry_count"`
|
||||
}
|
||||
|
||||
type ItemDPDKListModel struct {
|
||||
DPDKID types.Int64 `tfsdk:"dpdk_id"`
|
||||
AccountAccess types.List `tfsdk:"account_access"`
|
||||
CreatedTime types.Int64 `tfsdk:"created_time"`
|
||||
Desc types.String `tfsdk:"desc"`
|
||||
GID types.Int64 `tfsdk:"gid"`
|
||||
GUID types.Int64 `tfsdk:"guid"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
RGAccess types.List `tfsdk:"rg_access"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
OVSBridge types.String `tfsdk:"ovs_bridge"`
|
||||
VlanID types.Int64 `tfsdk:"vlan_id"`
|
||||
ComputeIDs types.List `tfsdk:"compute_ids"`
|
||||
UpdatedTime types.Int64 `tfsdk:"updated_time"`
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceDPDK() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
"dpdk_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
},
|
||||
"account_access": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"created_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"desc": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"gid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"guid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"rg_access": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ovs_bridge": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vlan_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"compute_ids": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"updated_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceDPDKList() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// optional attributes
|
||||
"by_id": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
},
|
||||
"gid": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"desc": schema.StringAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"compute_ids": schema.ListAttribute{
|
||||
Optional: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"sort_by": schema.StringAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"page": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
},
|
||||
"size": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
},
|
||||
|
||||
// computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"items": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"dpdk_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
},
|
||||
"account_access": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"created_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"desc": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"gid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"guid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"rg_access": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ovs_bridge": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vlan_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"compute_ids": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"updated_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package utilities
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/diag"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/dpdknet"
|
||||
)
|
||||
|
||||
func DPDKDataSourceCheckPresence(ctx context.Context, dpdkId uint64, c *decort.DecortClient) (*dpdknet.RecordDPDKNet, diag.Diagnostics) {
|
||||
tflog.Info(ctx, fmt.Sprintf("DPDKDataSourceCheckPresence: Get info about DPDK net with ID - %d", dpdkId))
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
|
||||
recordDPDK, err := c.CloudAPI().DPDKNet().Get(ctx, dpdknet.GetRequest{DPDKID: dpdkId})
|
||||
if err != nil {
|
||||
diags.AddError(fmt.Sprintf("Cannot get info about DPDK net with ID %d", dpdkId), err.Error())
|
||||
return nil, diags
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "DPDKDataSourceCheckPresence: response from CloudBroker().DPDKNet().Get", map[string]any{"dpdk_id": dpdkId, "response": recordDPDK})
|
||||
|
||||
return recordDPDK, nil
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package utilities
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/dpdknet"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/dpdknet/models"
|
||||
)
|
||||
|
||||
func DPDKListDataSourceCheckPresence(ctx context.Context, plan *models.DataSourceDPDKListModel, c *decort.DecortClient) (*dpdknet.ListDPDKNet, error) {
|
||||
tflog.Info(ctx, fmt.Sprintf("DPDKListDataSourceCheckPresence: Get DPDK list info"))
|
||||
|
||||
listDPDKReq := dpdknet.ListRequest{}
|
||||
|
||||
if !plan.ByID.IsNull() {
|
||||
listDPDKReq.ByID = uint64(plan.ByID.ValueInt64())
|
||||
}
|
||||
if !plan.GID.IsNull() {
|
||||
listDPDKReq.GID = uint64(plan.GID.ValueInt64())
|
||||
}
|
||||
if !plan.Name.IsNull() {
|
||||
listDPDKReq.Name = plan.Name.ValueString()
|
||||
}
|
||||
if !plan.Desc.IsNull() {
|
||||
listDPDKReq.Description = plan.Desc.ValueString()
|
||||
}
|
||||
if !plan.Status.IsNull() {
|
||||
listDPDKReq.Status = plan.Status.ValueString()
|
||||
}
|
||||
if !plan.ComputeIDs.IsNull() {
|
||||
computeIDs := make([]uint64, 0, len(plan.ComputeIDs.Elements()))
|
||||
diags := plan.ComputeIDs.ElementsAs(ctx, &computeIDs, false)
|
||||
if diags.HasError() {
|
||||
tflog.Error(ctx, "DPDKListDataSourceCheckPresence: cannot populate computeIDs with plan.ComputeIDs List elements")
|
||||
return nil, fmt.Errorf("cannot populate computeIDs with plan.ComputeIDs List elements")
|
||||
}
|
||||
listDPDKReq.ComputeIDs = computeIDs
|
||||
}
|
||||
if !plan.SortBy.IsNull() {
|
||||
listDPDKReq.SortBy = plan.SortBy.ValueString()
|
||||
}
|
||||
if !plan.Page.IsNull() {
|
||||
listDPDKReq.Page = uint64(plan.Page.ValueInt64())
|
||||
}
|
||||
if !plan.Size.IsNull() {
|
||||
listDPDKReq.Size = uint64(plan.Size.ValueInt64())
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "DPDKListDataSourceCheckPresence: before call CloudAPI().DPDKNet().List", map[string]any{"response": listDPDKReq})
|
||||
dpdkList, err := c.CloudAPI().DPDKNet().List(ctx, listDPDKReq)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot get info about data source list DPDK net with error: %w", err)
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "DPDKListDataSourceCheckPresence: response from CloudAPI().DPDKNet().List", map[string]any{"response": dpdkList})
|
||||
|
||||
return dpdkList, err
|
||||
}
|
||||
@@ -67,7 +67,8 @@ func FlipgroupListDataSourceCheckPresence(ctx context.Context, plan *models.Data
|
||||
for _, val := range plan.CliendIDs.Elements() {
|
||||
result = append(result, uint64(val.(types.Int64).ValueInt64()))
|
||||
}
|
||||
listFlipgroupReq.ClientIDs = result
|
||||
//TODO fix it
|
||||
//listFlipgroupReq.ClientIDs = result
|
||||
}
|
||||
|
||||
if !plan.Status.IsNull() {
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
account "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/disks"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/dpdknet"
|
||||
extnet "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/extnet"
|
||||
image "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/image"
|
||||
k8ci "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8ci"
|
||||
@@ -448,6 +449,30 @@ func ExistVFPool(ctx context.Context, vfpoolId uint64, c *decort.DecortClient) e
|
||||
return nil
|
||||
}
|
||||
|
||||
func ExistDPDK(ctx context.Context, dpdkId uint64, c *decort.DecortClient) error {
|
||||
|
||||
req := dpdknet.ListRequest{
|
||||
ByID: dpdkId,
|
||||
}
|
||||
|
||||
dpdkList, err := c.CloudAPI().DPDKNet().List(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(dpdkList.Data) == 0 {
|
||||
return fmt.Errorf("DPDK net with ID %v not found", dpdkId)
|
||||
}
|
||||
|
||||
for _, item := range dpdkList.Data {
|
||||
if item.Status != "ENABLED" {
|
||||
return fmt.Errorf("DPDK net with ID %v must be enabled", dpdkId)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func ExistSnapshotInCompute(ctx context.Context, computeID uint64, label string, c *decort.DecortClient) error {
|
||||
req := compute.SnapshotListRequest{
|
||||
ComputeID: computeID,
|
||||
|
||||
@@ -42,6 +42,7 @@ func DataSourceImageList(ctx context.Context, state *models.ListImagesModel, c *
|
||||
Bootable: state.Bootable,
|
||||
SortBy: state.SortBy,
|
||||
Page: state.Page,
|
||||
Enabled: state.Enabled,
|
||||
Size: state.Size,
|
||||
Timeouts: state.Timeouts,
|
||||
Id: types.StringValue(id.String()),
|
||||
|
||||
@@ -48,7 +48,6 @@ func ResourceImage(ctx context.Context, plan *models.ImageResourceModel, c *deco
|
||||
SepID: types.Int64Value(int64(image.SepID)),
|
||||
PoolName: types.StringValue(image.Pool),
|
||||
Architecture: types.StringValue(image.Architecture),
|
||||
Permanently: plan.Permanently,
|
||||
ImageId: types.Int64Value(int64(image.ID)),
|
||||
Timeouts: plan.Timeouts,
|
||||
Id: types.StringValue(strconv.Itoa(int(image.ID))),
|
||||
|
||||
@@ -33,7 +33,6 @@ func ResourceImageVirtual(ctx context.Context, plan *models.ImageVirtualResource
|
||||
*plan = models.ImageVirtualResourceModel{
|
||||
ImageName: types.StringValue(image.Name),
|
||||
LinkTo: types.Int64Value(int64(image.LinkTo)),
|
||||
Permanently: plan.Permanently,
|
||||
Timeouts: plan.Timeouts,
|
||||
Id: types.StringValue(strconv.Itoa(int(image.ID))),
|
||||
LastUpdated: plan.LastUpdated,
|
||||
|
||||
@@ -22,6 +22,7 @@ type ListImagesModel struct {
|
||||
SortBy types.String `tfsdk:"sort_by"`
|
||||
Page types.Int64 `tfsdk:"page"`
|
||||
Size types.Int64 `tfsdk:"size"`
|
||||
Enabled types.Bool `tfsdk:"enabled"`
|
||||
|
||||
// responce fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
|
||||
@@ -23,7 +23,6 @@ type ImageResourceModel struct {
|
||||
SepID types.Int64 `tfsdk:"sep_id"`
|
||||
PoolName types.String `tfsdk:"pool_name"`
|
||||
Architecture types.String `tfsdk:"architecture"`
|
||||
Permanently types.Bool `tfsdk:"permanently"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
// responce fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
|
||||
@@ -7,10 +7,9 @@ import (
|
||||
|
||||
type ImageVirtualResourceModel struct {
|
||||
// request fields
|
||||
ImageName types.String `tfsdk:"image_name"`
|
||||
LinkTo types.Int64 `tfsdk:"link_to"`
|
||||
Permanently types.Bool `tfsdk:"permanently"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
ImageName types.String `tfsdk:"image_name"`
|
||||
LinkTo types.Int64 `tfsdk:"link_to"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
// responce fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
LastUpdated types.String `tfsdk:"last_updated"`
|
||||
|
||||
@@ -234,15 +234,8 @@ func (r *resourceImage) Delete(ctx context.Context, req resource.DeleteRequest,
|
||||
ctx, cancel := context.WithTimeout(ctx, deleteTimeout)
|
||||
defer cancel()
|
||||
|
||||
var permanently bool
|
||||
if state.Permanently.IsNull() {
|
||||
permanently = true
|
||||
} else {
|
||||
permanently = state.Permanently.ValueBool()
|
||||
}
|
||||
|
||||
// Delete image
|
||||
_, err := r.client.CloudAPI().Image().Delete(ctx, image.DeleteRequest{ImageID: uint64(state.ImageId.ValueInt64()), Permanently: permanently})
|
||||
_, err := r.client.CloudAPI().Image().Delete(ctx, image.DeleteRequest{ImageID: uint64(state.ImageId.ValueInt64())})
|
||||
if err != nil {
|
||||
resp.Diagnostics.AddError("Error deleting image with error: ", err.Error())
|
||||
return
|
||||
|
||||
@@ -229,15 +229,8 @@ func (r *resourceImageVirtual) Delete(ctx context.Context, req resource.DeleteRe
|
||||
ctx, cancel := context.WithTimeout(ctx, deleteTimeout)
|
||||
defer cancel()
|
||||
|
||||
var permanently bool
|
||||
if state.Permanently.IsNull() {
|
||||
permanently = true
|
||||
} else {
|
||||
permanently = state.Permanently.ValueBool()
|
||||
}
|
||||
|
||||
// Delete image
|
||||
_, err := r.client.CloudAPI().Image().Delete(ctx, image.DeleteRequest{ImageID: uint64(state.ImageId.ValueInt64()), Permanently: permanently})
|
||||
_, err := r.client.CloudAPI().Image().Delete(ctx, image.DeleteRequest{ImageID: uint64(state.ImageId.ValueInt64())})
|
||||
if err != nil {
|
||||
resp.Diagnostics.AddError("Error deleting image virtual with error: ", err.Error())
|
||||
return
|
||||
|
||||
@@ -54,6 +54,9 @@ func MakeSchemaDataSourceImageList() map[string]schema.Attribute {
|
||||
"size": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
},
|
||||
"enabled": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
// computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
|
||||
@@ -84,12 +84,9 @@ func MakeSchemaResourceImage() map[string]schema.Attribute {
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
Validators: []validator.String{
|
||||
stringvalidator.OneOf("X86_64", "PPC64_LE"),
|
||||
stringvalidator.OneOf("X86_64"),
|
||||
},
|
||||
Description: "Binary architecture of this image, one of X86_64 of PPC64_LE",
|
||||
},
|
||||
"permanently": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
Description: "Binary architecture of this image, one of X86_64",
|
||||
},
|
||||
// computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
|
||||
@@ -18,10 +18,6 @@ func MakeSchemaResourceImageVirtual() map[string]schema.Attribute {
|
||||
Required: true,
|
||||
Description: "ID of real image to link this virtual image to upon creation",
|
||||
},
|
||||
// optional attributes
|
||||
"permanently": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
// computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
|
||||
@@ -56,6 +56,9 @@ func ImageListCheckPresence(ctx context.Context, state *models.ListImagesModel,
|
||||
if !state.Size.IsNull() {
|
||||
req.Size = uint64(state.Size.ValueInt64())
|
||||
}
|
||||
if !state.Enabled.IsNull() {
|
||||
req.Enabled = state.Enabled.ValueBool()
|
||||
}
|
||||
if !state.Page.IsNull() {
|
||||
req.Page = uint64(state.Page.ValueInt64())
|
||||
}
|
||||
|
||||
@@ -60,31 +60,34 @@ func DataSourceK8s(ctx context.Context, state *models.RecordK8SDataSourceModel,
|
||||
id := uuid.New()
|
||||
|
||||
*state = models.RecordK8SDataSourceModel{
|
||||
K8SID: state.K8SID,
|
||||
Timeouts: state.Timeouts,
|
||||
Id: types.StringValue(id.String()),
|
||||
ACL: flattenACLDataSource(ctx, &cluster.ACL),
|
||||
AccountID: types.Int64Value(int64(cluster.AccountID)),
|
||||
AccountName: types.StringValue(cluster.AccountName),
|
||||
BServiceID: types.Int64Value(int64(cluster.BServiceID)),
|
||||
K8CI: types.Int64Value(int64(cluster.CIID)),
|
||||
CreatedBy: types.StringValue(cluster.CreatedBy),
|
||||
CreatedTime: types.Int64Value(int64(cluster.CreatedTime)),
|
||||
DeletedBy: types.StringValue(cluster.DeletedBy),
|
||||
DeletedTime: types.Int64Value(int64(cluster.DeletedTime)),
|
||||
K8CIName: types.StringValue(cluster.K8CIName),
|
||||
Masters: flattenMasterGroup(ctx, &cluster.K8SGroups.Masters, masterComputeList),
|
||||
Workers: flattenK8sGroup(ctx, &cluster.K8SGroups.Workers, workersComputeList),
|
||||
LBID: types.Int64Value(int64(cluster.LBID)),
|
||||
Name: types.StringValue(cluster.Name),
|
||||
NetworkPlugin: types.StringValue(cluster.NetworkPlugin),
|
||||
RGID: types.Int64Value(int64(cluster.RGID)),
|
||||
RGName: types.StringValue(cluster.RGName),
|
||||
Status: types.StringValue(cluster.Status),
|
||||
TechStatus: types.StringValue(cluster.TechStatus),
|
||||
UpdatedBy: types.StringValue(cluster.UpdatedBy),
|
||||
UpdatedTime: types.Int64Value(int64(cluster.UpdatedTime)),
|
||||
VinsId: types.Int64Value(int64(k8sList.Data[0].VINSID)),
|
||||
K8SID: state.K8SID,
|
||||
Timeouts: state.Timeouts,
|
||||
Id: types.StringValue(id.String()),
|
||||
ACL: flattenACLDataSource(ctx, &cluster.ACL),
|
||||
AccountID: types.Int64Value(int64(cluster.AccountID)),
|
||||
AccountName: types.StringValue(cluster.AccountName),
|
||||
K8SAddressVIP: flattenAddressVIP(ctx, cluster.AddressVIP),
|
||||
BServiceID: types.Int64Value(int64(cluster.BServiceID)),
|
||||
K8CI: types.Int64Value(int64(cluster.CIID)),
|
||||
CreatedBy: types.StringValue(cluster.CreatedBy),
|
||||
CreatedTime: types.Int64Value(int64(cluster.CreatedTime)),
|
||||
DeletedBy: types.StringValue(cluster.DeletedBy),
|
||||
DeletedTime: types.Int64Value(int64(cluster.DeletedTime)),
|
||||
ExtnetOnly: types.BoolValue(cluster.ExtnetOnly),
|
||||
HighlyAvailableLB: types.BoolValue(cluster.HighlyAvailableLB),
|
||||
K8CIName: types.StringValue(cluster.K8CIName),
|
||||
Masters: flattenMasterGroup(ctx, &cluster.K8SGroups.Masters, masterComputeList),
|
||||
Workers: flattenK8sGroup(ctx, &cluster.K8SGroups.Workers, workersComputeList),
|
||||
LBID: types.Int64Value(int64(cluster.LBID)),
|
||||
Name: types.StringValue(cluster.Name),
|
||||
NetworkPlugin: types.StringValue(cluster.NetworkPlugin),
|
||||
RGID: types.Int64Value(int64(cluster.RGID)),
|
||||
RGName: types.StringValue(cluster.RGName),
|
||||
Status: types.StringValue(cluster.Status),
|
||||
TechStatus: types.StringValue(cluster.TechStatus),
|
||||
UpdatedBy: types.StringValue(cluster.UpdatedBy),
|
||||
UpdatedTime: types.Int64Value(int64(cluster.UpdatedTime)),
|
||||
VinsId: types.Int64Value(int64(k8sList.Data[0].VINSID)),
|
||||
}
|
||||
|
||||
if cluster.LBID != 0 {
|
||||
@@ -106,6 +109,18 @@ func DataSourceK8s(ctx context.Context, state *models.RecordK8SDataSourceModel,
|
||||
return nil
|
||||
}
|
||||
|
||||
func flattenAddressVIP(ctx context.Context, addressedVip k8s.K8SAddressVIP) *models.K8SAddressVIP {
|
||||
tflog.Info(ctx, "Start flattenAddressVIP")
|
||||
|
||||
res := models.K8SAddressVIP{
|
||||
BackendIP: types.StringValue(addressedVip.BackendIP),
|
||||
FrontendIP: types.StringValue(addressedVip.FrontendIP),
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "End flattenAddressVIP")
|
||||
return &res
|
||||
}
|
||||
|
||||
func flattenMasterGroup(ctx context.Context, mastersGroup *k8s.MasterGroup, masters []*compute.RecordCompute) *models.MasterGroupDataSourceModel {
|
||||
tflog.Info(ctx, "Start flattenMasterGroup")
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/diag"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
|
||||
@@ -67,6 +68,7 @@ func K8SCPResource(ctx context.Context, plan *models.ResourceK8SCPModel, c *deco
|
||||
Description: plan.Description,
|
||||
ExtNetOnly: plan.ExtNetOnly,
|
||||
OidcCertificate: plan.OidcCertificate,
|
||||
Chipset: plan.Chipset,
|
||||
Start: plan.Start,
|
||||
Enabled: plan.Enabled,
|
||||
Permanently: plan.Permanently,
|
||||
@@ -90,6 +92,7 @@ func K8SCPResource(ctx context.Context, plan *models.ResourceK8SCPModel, c *deco
|
||||
CreatedTime: types.Int64Value(int64(cluster.CreatedTime)),
|
||||
DeletedBy: types.StringValue(cluster.DeletedBy),
|
||||
DeletedTime: types.Int64Value(int64(cluster.DeletedTime)),
|
||||
K8SAddressVIP: flattenK8SAddressVIP(ctx, cluster.AddressVIP),
|
||||
K8SID: types.Int64Value(int64(cluster.ID)),
|
||||
K8CIName: types.StringValue(cluster.K8CIName),
|
||||
LBID: types.Int64Value(int64(cluster.LBID)),
|
||||
@@ -126,6 +129,23 @@ func K8SCPResource(ctx context.Context, plan *models.ResourceK8SCPModel, c *deco
|
||||
return nil
|
||||
}
|
||||
|
||||
func flattenK8SAddressVIP(ctx context.Context, addressedVip k8s.K8SAddressVIP) basetypes.ObjectValue {
|
||||
tflog.Info(ctx, "Start flattenAddressVIP")
|
||||
|
||||
temp := models.AddressVIPModel{
|
||||
BackendIP: types.StringValue(addressedVip.BackendIP),
|
||||
FrontendIP: types.StringValue(addressedVip.FrontendIP),
|
||||
}
|
||||
|
||||
res, err := types.ObjectValueFrom(ctx, models.AddressVIP, temp)
|
||||
if err != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("Error flattenK8SAddressVIP struct to obj", err))
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "End flattenAddressVIP")
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenDetailedInfo(ctx context.Context, di *k8s.ListDetailedInfo, computes []*compute.RecordCompute) types.List {
|
||||
tflog.Info(ctx, "Start flattenDetailedInfo")
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@ func K8SWGResource(ctx context.Context, plan *models.ResourceK8SWGModel, c *deco
|
||||
WorkerSEPPool: plan.WorkerSEPPool,
|
||||
CloudInit: plan.CloudInit,
|
||||
Timeouts: plan.Timeouts,
|
||||
Chipset: plan.Chipset,
|
||||
WorkerChipset: plan.WorkerChipset,
|
||||
Id: types.StringValue(strconv.Itoa(int(wg.ID))),
|
||||
WorkerGroupId: types.Int64Value(int64(wg.ID)),
|
||||
LastUpdated: plan.LastUpdated,
|
||||
|
||||
@@ -10,32 +10,40 @@ type RecordK8SDataSourceModel struct {
|
||||
K8SID types.Int64 `tfsdk:"k8s_id"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
ACL *RecordACLDataSourceModel `tfsdk:"acl"`
|
||||
AccountID types.Int64 `tfsdk:"account_id"`
|
||||
AccountName types.String `tfsdk:"account_name"`
|
||||
BServiceID types.Int64 `tfsdk:"bservice_id"`
|
||||
K8CI types.Int64 `tfsdk:"k8sci_id"`
|
||||
CreatedBy types.String `tfsdk:"created_by"`
|
||||
CreatedTime types.Int64 `tfsdk:"created_time"`
|
||||
DeletedBy types.String `tfsdk:"deleted_by"`
|
||||
DeletedTime types.Int64 `tfsdk:"deleted_time"`
|
||||
ExtNetID types.Int64 `tfsdk:"extnet_id"`
|
||||
K8CIName types.String `tfsdk:"k8sci_name"`
|
||||
Masters *MasterGroupDataSourceModel `tfsdk:"masters"`
|
||||
Workers []ItemK8SGroupDataSourceModel `tfsdk:"workers"`
|
||||
LBID types.Int64 `tfsdk:"lb_id"`
|
||||
LBIP types.String `tfsdk:"lb_ip"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
NetworkPlugin types.String `tfsdk:"network_plugin"`
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
RGName types.String `tfsdk:"rg_name"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
TechStatus types.String `tfsdk:"tech_status"`
|
||||
UpdatedBy types.String `tfsdk:"updated_by"`
|
||||
UpdatedTime types.Int64 `tfsdk:"updated_time"`
|
||||
Kubeconfig types.String `tfsdk:"kubeconfig"`
|
||||
VinsId types.Int64 `tfsdk:"vins_id"`
|
||||
Id types.String `tfsdk:"id"`
|
||||
ACL *RecordACLDataSourceModel `tfsdk:"acl"`
|
||||
AccountID types.Int64 `tfsdk:"account_id"`
|
||||
AccountName types.String `tfsdk:"account_name"`
|
||||
BServiceID types.Int64 `tfsdk:"bservice_id"`
|
||||
K8CI types.Int64 `tfsdk:"k8sci_id"`
|
||||
CreatedBy types.String `tfsdk:"created_by"`
|
||||
CreatedTime types.Int64 `tfsdk:"created_time"`
|
||||
DeletedBy types.String `tfsdk:"deleted_by"`
|
||||
ExtnetOnly types.Bool `tfsdk:"extnet_only"`
|
||||
HighlyAvailableLB types.Bool `tfsdk:"ha_mode"`
|
||||
K8SAddressVIP *K8SAddressVIP `tfsdk:"address_vip"`
|
||||
DeletedTime types.Int64 `tfsdk:"deleted_time"`
|
||||
ExtNetID types.Int64 `tfsdk:"extnet_id"`
|
||||
K8CIName types.String `tfsdk:"k8sci_name"`
|
||||
Masters *MasterGroupDataSourceModel `tfsdk:"masters"`
|
||||
Workers []ItemK8SGroupDataSourceModel `tfsdk:"workers"`
|
||||
LBID types.Int64 `tfsdk:"lb_id"`
|
||||
LBIP types.String `tfsdk:"lb_ip"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
NetworkPlugin types.String `tfsdk:"network_plugin"`
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
RGName types.String `tfsdk:"rg_name"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
TechStatus types.String `tfsdk:"tech_status"`
|
||||
UpdatedBy types.String `tfsdk:"updated_by"`
|
||||
UpdatedTime types.Int64 `tfsdk:"updated_time"`
|
||||
Kubeconfig types.String `tfsdk:"kubeconfig"`
|
||||
VinsId types.Int64 `tfsdk:"vins_id"`
|
||||
}
|
||||
|
||||
type K8SAddressVIP struct {
|
||||
BackendIP types.String `tfsdk:"backend_ip"`
|
||||
FrontendIP types.String `tfsdk:"frontend_ip"`
|
||||
}
|
||||
|
||||
type RecordACLDataSourceModel struct {
|
||||
|
||||
@@ -16,6 +16,7 @@ type ResourceK8SCPModel struct {
|
||||
SEPPool types.String `tfsdk:"sep_pool"`
|
||||
Num types.Int64 `tfsdk:"num"`
|
||||
CPU types.Int64 `tfsdk:"cpu"`
|
||||
Chipset types.String `tfsdk:"chipset"`
|
||||
RAM types.Int64 `tfsdk:"ram"`
|
||||
Disk types.Int64 `tfsdk:"disk"`
|
||||
ExtNetID types.Int64 `tfsdk:"extnet_id"`
|
||||
@@ -51,6 +52,7 @@ type ResourceK8SCPModel struct {
|
||||
DeletedTime types.Int64 `tfsdk:"deleted_time"`
|
||||
K8SID types.Int64 `tfsdk:"k8s_id"`
|
||||
K8CIName types.String `tfsdk:"k8s_ci_name"`
|
||||
K8SAddressVIP types.Object `tfsdk:"address_vip"`
|
||||
LBID types.Int64 `tfsdk:"lb_id"`
|
||||
LBIP types.String `tfsdk:"lb_ip"`
|
||||
MasterGroupId types.Int64 `tfsdk:"master_group_id"`
|
||||
@@ -63,6 +65,11 @@ type ResourceK8SCPModel struct {
|
||||
Kubeconfig types.String `tfsdk:"kubeconfig"`
|
||||
}
|
||||
|
||||
type AddressVIPModel struct {
|
||||
BackendIP types.String `tfsdk:"backend_ip"`
|
||||
FrontendIP types.String `tfsdk:"frontend_ip"`
|
||||
}
|
||||
|
||||
type RecordACLModel struct {
|
||||
AccountACL types.List `tfsdk:"account_acl"`
|
||||
K8SACL types.List `tfsdk:"k8s_acl"`
|
||||
@@ -93,6 +100,11 @@ type ItemInterfacesModel struct {
|
||||
IpAddress types.String `tfsdk:"ip_address"`
|
||||
}
|
||||
|
||||
var AddressVIP map[string]attr.Type = map[string]attr.Type{
|
||||
"backend_ip": types.StringType,
|
||||
"frontend_ip": types.StringType,
|
||||
}
|
||||
|
||||
var ItemInterfaces map[string]attr.Type = map[string]attr.Type{
|
||||
"def_gw": types.StringType,
|
||||
"ip_address": types.StringType,
|
||||
|
||||
@@ -11,8 +11,10 @@ type ResourceK8SWGModel struct {
|
||||
K8SID types.Int64 `tfsdk:"k8s_id"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
Num types.Int64 `tfsdk:"num"`
|
||||
WorkerChipset types.String `tfsdk:"worker_chipset"`
|
||||
CPU types.Int64 `tfsdk:"cpu"`
|
||||
RAM types.Int64 `tfsdk:"ram"`
|
||||
Chipset types.String `tfsdk:"chipset"`
|
||||
Disk types.Int64 `tfsdk:"disk"`
|
||||
Annotations types.List `tfsdk:"annotations"`
|
||||
Labels types.List `tfsdk:"labels"`
|
||||
|
||||
@@ -122,6 +122,23 @@ func MakeSchemaDataSourceK8S() map[string]schema.Attribute {
|
||||
"extnet_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"extnet_only": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ha_mode": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"address_vip": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"backend_ip": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"frontend_ip": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"k8sci_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
@@ -126,7 +126,14 @@ func MakeSchemaResourceK8SCP() map[string]schema.Attribute {
|
||||
},
|
||||
"oidc_cert": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "insert ssl certificate in x509 pem format",
|
||||
Description: "Insert ssl certificate in x509 pem format",
|
||||
},
|
||||
"chipset": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "Type of the emulated system",
|
||||
Validators: []validator.String{
|
||||
stringvalidator.OneOfCaseInsensitive("Q35", "i440fx"),
|
||||
},
|
||||
},
|
||||
"lb_sysctl_params": schema.ListNestedAttribute{
|
||||
Optional: true,
|
||||
@@ -302,6 +309,17 @@ func MakeSchemaResourceK8SCP() map[string]schema.Attribute {
|
||||
"account_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"address_vip": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"backend_ip": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"frontend_ip": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"bservice_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
|
||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
||||
@@ -28,11 +29,25 @@ func MakeSchemaResourceK8SWG() map[string]schema.Attribute {
|
||||
Computed: true,
|
||||
Description: "Number of worker nodes to create.",
|
||||
},
|
||||
"worker_chipset": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "Type of the emulated system of worker nodes",
|
||||
Validators: []validator.String{
|
||||
stringvalidator.OneOfCaseInsensitive("Q35", "i440fx"),
|
||||
},
|
||||
},
|
||||
"cpu": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Description: "Worker node CPU count.",
|
||||
},
|
||||
"chipset": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "Type of the emulated system of work group",
|
||||
Validators: []validator.String{
|
||||
stringvalidator.OneOfCaseInsensitive("Q35", "i440fx"),
|
||||
},
|
||||
},
|
||||
"ram": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
|
||||
@@ -100,6 +100,10 @@ func CreateRequestResourceK8CP(ctx context.Context, plan *models.ResourceK8SCPMo
|
||||
req.OidcCertificate = plan.OidcCertificate.ValueString()
|
||||
}
|
||||
|
||||
if !plan.Chipset.IsNull() {
|
||||
req.Chipset = plan.Chipset.ValueString()
|
||||
}
|
||||
|
||||
if !plan.Description.IsNull() {
|
||||
req.Description = plan.Description.ValueString()
|
||||
}
|
||||
@@ -427,7 +431,7 @@ func K8SCPDeleteMaster(ctx context.Context, plan *models.ResourceK8SCPModel, sta
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
|
||||
deleteMasterComp := make([]string, 0)
|
||||
deleteMasterComp := make([]uint64, 0)
|
||||
|
||||
for i, val := range state.DetailedInfo.Elements() {
|
||||
if i == 2 {
|
||||
@@ -437,15 +441,16 @@ func K8SCPDeleteMaster(ctx context.Context, plan *models.ResourceK8SCPModel, sta
|
||||
if err != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("Error flattenDetailedInfo struct to obj", err), map[string]any{"k8s_id": plan.Id.ValueString()})
|
||||
}
|
||||
id := obj.Attributes()["compute_id"]
|
||||
id := obj.Attributes()["compute_id"].(types.Int64).ValueInt64()
|
||||
|
||||
deleteMasterComp = append(deleteMasterComp, id.String())
|
||||
deleteMasterComp = append(deleteMasterComp, uint64(id))
|
||||
}
|
||||
|
||||
req := k8s.DeleteMasterFromGroupRequest{
|
||||
K8SID: uint64(state.K8SID.ValueInt64()),
|
||||
MasterGroupID: uint64(state.MasterGroupId.ValueInt64()),
|
||||
MasterIDs: deleteMasterComp,
|
||||
//TODO fix it
|
||||
//MasterIDs: deleteMasterComp,
|
||||
}
|
||||
|
||||
_, err := c.CloudAPI().K8S().DeleteMasterFromGroup(ctx, req)
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8s"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/tasks"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/k8s/models"
|
||||
)
|
||||
|
||||
@@ -76,6 +77,9 @@ func CreateRequestResourceK8WG(ctx context.Context, plan *models.ResourceK8SWGMo
|
||||
if !plan.CloudInit.IsNull() {
|
||||
req.UserData = plan.CloudInit.ValueString()
|
||||
}
|
||||
if !plan.Chipset.IsNull() {
|
||||
req.Chipset = plan.Chipset.ValueString()
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "End CreateRequestResourceK8WG", map[string]any{"name": plan.Name.ValueString()})
|
||||
return req
|
||||
@@ -87,14 +91,44 @@ func ResourceK8SWGCreate(ctx context.Context, plan *models.ResourceK8SWGModel, c
|
||||
diags := diag.Diagnostics{}
|
||||
|
||||
// Make request and get response
|
||||
wgId, err := c.CloudAPI().K8S().WorkersGroupAdd(ctx, CreateRequestResourceK8WG(ctx, plan))
|
||||
resp, err := c.CloudAPI().K8S().WorkersGroupAdd(ctx, CreateRequestResourceK8WG(ctx, plan))
|
||||
if err != nil {
|
||||
tflog.Error(ctx, "Error response for create k8s_wg")
|
||||
diags.AddError("Unable to Create K8SWG", err.Error())
|
||||
return diags
|
||||
}
|
||||
|
||||
plan.Id = types.StringValue(strconv.Itoa(int(wgId)))
|
||||
taskReq := tasks.GetRequest{
|
||||
AuditID: strings.Trim(resp, `"`),
|
||||
}
|
||||
for {
|
||||
task, err := c.CloudAPI().Tasks().Get(ctx, taskReq)
|
||||
if err != nil {
|
||||
diags.AddError("The audit cannot be found", err.Error())
|
||||
return diags
|
||||
}
|
||||
|
||||
tflog.Info(ctx, fmt.Sprintf("ResourceK8SWGCreate instance creating - %s", task.Stage))
|
||||
|
||||
if task.Completed {
|
||||
if task.Error != "" {
|
||||
diags.AddError("Cannot create k8s wg instance:", task.Error)
|
||||
return diags
|
||||
}
|
||||
|
||||
result, err := task.Result.ID()
|
||||
if err != nil {
|
||||
diags.AddError("Cannot get wg ID:", err.Error())
|
||||
return diags
|
||||
}
|
||||
plan.Id = types.StringValue(strconv.Itoa(result))
|
||||
plan.LastUpdated = types.StringValue(time.Now().Format(time.RFC850))
|
||||
break
|
||||
}
|
||||
|
||||
time.Sleep(time.Second * 20)
|
||||
}
|
||||
|
||||
plan.LastUpdated = types.StringValue(time.Now().Format(time.RFC850))
|
||||
|
||||
wg, k8sId, err := K8SWGResourceCheckPresence(ctx, plan, c)
|
||||
@@ -185,6 +219,7 @@ func K8SWGUpdateNumWorkers(ctx context.Context, plan, state *models.ResourceK8SW
|
||||
K8SID: k8sId,
|
||||
WorkersGroupID: wg.ID,
|
||||
Num: uint64(newNum) - wg.Num,
|
||||
Chipset: plan.WorkerChipset.ValueString(),
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "Add workers in wg with id", map[string]any{"wg_id": state.WorkerGroupId.ValueInt64(), "k8s_id": state.K8SID.ValueInt64()})
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/flattens"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/kvmvm/models"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/kvmvm/utilities"
|
||||
)
|
||||
@@ -26,6 +27,8 @@ func DataSourceCompute(ctx context.Context, state *models.RecordComputeModel, c
|
||||
return diags
|
||||
}
|
||||
|
||||
pciDevicesList, err := utilities.ComputePCIDevicesListCheckPresence(ctx, state, c)
|
||||
|
||||
id := uuid.New()
|
||||
|
||||
customFields, _ := json.Marshal(computeRecord.CustomFields)
|
||||
@@ -44,6 +47,7 @@ func DataSourceCompute(ctx context.Context, state *models.RecordComputeModel, c
|
||||
AffinityWeight: types.Int64Value(int64(computeRecord.AffinityWeight)),
|
||||
AntiAffinityRules: flattenAffinityRule(ctx, &computeRecord.AntiAffinityRules),
|
||||
Architecture: types.StringValue(computeRecord.Architecture),
|
||||
Chipset: types.StringValue(computeRecord.Chipset),
|
||||
BootDiskSize: types.Int64Value(int64(computeRecord.BootDiskSize)),
|
||||
CdImageId: types.Int64Value(int64(computeRecord.CdImageId)),
|
||||
CloneReference: types.Int64Value(int64(computeRecord.CloneReference)),
|
||||
@@ -81,6 +85,7 @@ func DataSourceCompute(ctx context.Context, state *models.RecordComputeModel, c
|
||||
NumaNodeId: types.Int64Value(int64(computeRecord.NumaNodeId)),
|
||||
OSUsers: flattenOSUsers(ctx, &computeRecord.OSUsers),
|
||||
Pinned: types.BoolValue(computeRecord.Pinned),
|
||||
PCIDevices: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, flattenPCI(ctx, pciDevicesList)),
|
||||
RAM: types.Int64Value(int64(computeRecord.RAM)),
|
||||
ReferenceID: types.StringValue(computeRecord.ReferenceID),
|
||||
Registered: types.BoolValue(computeRecord.Registered),
|
||||
@@ -189,6 +194,7 @@ func flattenDisks(ctx context.Context, disks *compute.ListComputeDisks) []models
|
||||
ACL: types.StringValue(string(acl)),
|
||||
AccountID: types.Int64Value(int64(item.AccountID)),
|
||||
BootPartition: types.Int64Value(int64(item.BootPartition)),
|
||||
BusNumber: types.Int64Value(int64(item.BusNumber)),
|
||||
CreatedTime: types.Int64Value(int64(item.CreatedTime)),
|
||||
DeletedTime: types.Int64Value(int64(item.CreatedTime)),
|
||||
Description: types.StringValue(item.Description),
|
||||
@@ -290,6 +296,7 @@ func flattenInterfaces(ctx context.Context, interfaces *compute.ListInterfaces)
|
||||
res := make([]models.ItemInterfaceModel, 0, len(*interfaces))
|
||||
for _, item := range *interfaces {
|
||||
temp := models.ItemInterfaceModel{
|
||||
BusNumber: types.Int64Value(int64(item.BusNumber)),
|
||||
ConnID: types.Int64Value(int64(item.ConnID)),
|
||||
ConnType: types.StringValue(item.ConnType),
|
||||
DefGW: types.StringValue(item.DefGW),
|
||||
@@ -297,14 +304,24 @@ func flattenInterfaces(ctx context.Context, interfaces *compute.ListInterfaces)
|
||||
FLIPGroupID: types.Int64Value(int64(item.FLIPGroupID)),
|
||||
GUID: types.StringValue(item.GUID),
|
||||
IPAddress: types.StringValue(item.IPAddress),
|
||||
ListenSSH: types.BoolValue(item.ListenSSH),
|
||||
MAC: types.StringValue(item.MAC),
|
||||
Name: types.StringValue(item.Name),
|
||||
NetID: types.Int64Value(int64(item.NetID)),
|
||||
NetMask: types.Int64Value(int64(item.NetMask)),
|
||||
NetType: types.StringValue(item.NetType),
|
||||
NodeID: types.Int64Value(int64(item.NodeID)),
|
||||
PCISlot: types.Int64Value(item.PCISlot),
|
||||
LibvirtSettings: &models.LibvirtModel{
|
||||
GUID: types.StringValue(item.LibvirtSettings.GUID),
|
||||
TXMode: types.StringValue(item.LibvirtSettings.TXMode),
|
||||
IOEventFD: types.StringValue(item.LibvirtSettings.IOEventFD),
|
||||
EventIDx: types.StringValue(item.LibvirtSettings.EventIDx),
|
||||
Queues: types.Int64Value(int64(item.LibvirtSettings.Queues)),
|
||||
RXQueueSize: types.Int64Value(int64(item.LibvirtSettings.RXQueueSize)),
|
||||
TXQueueSize: types.Int64Value(int64(item.LibvirtSettings.TXQueueSize)),
|
||||
},
|
||||
ListenSSH: types.BoolValue(item.ListenSSH),
|
||||
MAC: types.StringValue(item.MAC),
|
||||
MTU: types.Int64Value(int64(item.MTU)),
|
||||
Name: types.StringValue(item.Name),
|
||||
NetID: types.Int64Value(int64(item.NetID)),
|
||||
NetMask: types.Int64Value(int64(item.NetMask)),
|
||||
NetType: types.StringValue(item.NetType),
|
||||
NodeID: types.Int64Value(int64(item.NodeID)),
|
||||
PCISlot: types.Int64Value(item.PCISlot),
|
||||
QOS: &models.QOSModel{
|
||||
ERate: types.Int64Value(int64(item.QOS.ERate)),
|
||||
GUID: types.StringValue(item.QOS.GUID),
|
||||
@@ -365,3 +382,15 @@ func flattenOSUsers(ctx context.Context, osUsers *compute.ListOSUser) []models.I
|
||||
tflog.Info(ctx, "End flattenOSUsers")
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenPCI(ctx context.Context, pciList *compute.ListPCIDevices) []uint64 {
|
||||
tflog.Info(ctx, "Start flattenPCI")
|
||||
res := make([]uint64, 0, len(pciList.Data))
|
||||
|
||||
for _, v := range pciList.Data {
|
||||
res = append(res, v.ID)
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "End flattenPCI")
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ func flattenItemsList(ctx context.Context, computes *compute.ListComputes) []mod
|
||||
BootDiskSize: types.Int64Value(int64(item.BootDiskSize)),
|
||||
CdImageId: types.Int64Value(int64(item.CdImageId)),
|
||||
CloneReference: types.Int64Value(int64(item.CloneReference)),
|
||||
Chipset: types.StringValue(item.Chipset),
|
||||
ComputeCIID: types.Int64Value(int64(item.ComputeCIID)),
|
||||
CPU: types.Int64Value(int64(item.CPU)),
|
||||
CPUPin: types.BoolValue(item.CPUPin),
|
||||
@@ -195,8 +196,9 @@ func flattenDisksInList(ctx context.Context, disks *compute.ListInfoDisks) []mod
|
||||
res := make([]models.DiskInListModel, 0, len(*disks))
|
||||
for _, item := range *disks {
|
||||
temp := models.DiskInListModel{
|
||||
DiskId: types.Int64Value(int64(item.ID)),
|
||||
PCISlot: types.Int64Value(item.PCISlot),
|
||||
BusNumber: types.Int64Value(int64(item.BusNumber)),
|
||||
DiskId: types.Int64Value(int64(item.ID)),
|
||||
PCISlot: types.Int64Value(item.PCISlot),
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
@@ -213,6 +215,7 @@ func flattenInterfaceInList(ctx context.Context, interfaces *compute.ListInterfa
|
||||
res := make([]models.ItemVNFInterfaceInListModel, 0, len(*interfaces))
|
||||
for _, item := range *interfaces {
|
||||
temp := models.ItemVNFInterfaceInListModel{
|
||||
BusNumber: types.Int64Value(int64(item.BusNumber)),
|
||||
ConnID: types.Int64Value(int64(item.ConnID)),
|
||||
ConnType: types.StringValue(item.ConnType),
|
||||
DefGW: types.StringValue(item.DefGW),
|
||||
@@ -220,14 +223,23 @@ func flattenInterfaceInList(ctx context.Context, interfaces *compute.ListInterfa
|
||||
FLIPGroupID: types.Int64Value(int64(item.FLIPGroupID)),
|
||||
GUID: types.StringValue(item.GUID),
|
||||
IPAddress: types.StringValue(item.IPAddress),
|
||||
ListenSSH: types.BoolValue(item.ListenSSH),
|
||||
MAC: types.StringValue(item.MAC),
|
||||
Name: types.StringValue(item.Name),
|
||||
NetID: types.Int64Value(int64(item.NetID)),
|
||||
NetMask: types.Int64Value(int64(item.NetMask)),
|
||||
NetType: types.StringValue(item.NetType),
|
||||
NodeID: types.Int64Value(int64(item.NodeID)),
|
||||
PCISlot: types.Int64Value(item.PCISlot),
|
||||
LibvirtSettings: &models.LibvirtModel{
|
||||
GUID: types.StringValue(item.LibvirtSettings.GUID),
|
||||
TXMode: types.StringValue(item.LibvirtSettings.TXMode),
|
||||
IOEventFD: types.StringValue(item.LibvirtSettings.IOEventFD),
|
||||
EventIDx: types.StringValue(item.LibvirtSettings.EventIDx),
|
||||
Queues: types.Int64Value(int64(item.LibvirtSettings.Queues)),
|
||||
RXQueueSize: types.Int64Value(int64(item.LibvirtSettings.RXQueueSize)),
|
||||
TXQueueSize: types.Int64Value(int64(item.LibvirtSettings.TXQueueSize)),
|
||||
},
|
||||
ListenSSH: types.BoolValue(item.ListenSSH),
|
||||
MAC: types.StringValue(item.MAC),
|
||||
Name: types.StringValue(item.Name),
|
||||
NetID: types.Int64Value(int64(item.NetID)),
|
||||
NetMask: types.Int64Value(int64(item.NetMask)),
|
||||
NetType: types.StringValue(item.NetType),
|
||||
NodeID: types.Int64Value(int64(item.NodeID)),
|
||||
PCISlot: types.Int64Value(item.PCISlot),
|
||||
QOS: &models.QOSInListModel{
|
||||
ERate: types.Int64Value(int64(item.QOS.ERate)),
|
||||
GUID: types.StringValue(item.QOS.GUID),
|
||||
|
||||
@@ -72,6 +72,7 @@ func flattenItemsListDeleted(ctx context.Context, computes *compute.ListComputes
|
||||
Architecture: types.StringValue(item.Architecture),
|
||||
BootDiskSize: types.Int64Value(int64(item.BootDiskSize)),
|
||||
CdImageId: types.Int64Value(int64(item.CdImageId)),
|
||||
Chipset: types.StringValue(item.Chipset),
|
||||
CloneReference: types.Int64Value(int64(item.CloneReference)),
|
||||
ComputeCIID: types.Int64Value(int64(item.ComputeCIID)),
|
||||
CPU: types.Int64Value(int64(item.CPU)),
|
||||
@@ -193,8 +194,9 @@ func flattenDisksInListDeleted(ctx context.Context, disks *compute.ListInfoDisks
|
||||
res := make([]models.DiskInListDeletedModel, 0, len(*disks))
|
||||
for _, item := range *disks {
|
||||
temp := models.DiskInListDeletedModel{
|
||||
DiskId: types.Int64Value(int64(item.ID)),
|
||||
PCISlot: types.Int64Value(item.PCISlot),
|
||||
BusNumber: types.Int64Value(int64(item.BusNumber)),
|
||||
DiskId: types.Int64Value(int64(item.ID)),
|
||||
PCISlot: types.Int64Value(item.PCISlot),
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
@@ -211,6 +213,7 @@ func flattenInterfaceInListDeleted(ctx context.Context, interfaces *compute.List
|
||||
res := make([]models.ItemVNFInterfaceInListDeletedModel, 0, len(*interfaces))
|
||||
for _, item := range *interfaces {
|
||||
temp := models.ItemVNFInterfaceInListDeletedModel{
|
||||
BusNumber: types.Int64Value(int64(item.BusNumber)),
|
||||
ConnID: types.Int64Value(int64(item.ConnID)),
|
||||
ConnType: types.StringValue(item.ConnType),
|
||||
DefGW: types.StringValue(item.DefGW),
|
||||
@@ -218,14 +221,23 @@ func flattenInterfaceInListDeleted(ctx context.Context, interfaces *compute.List
|
||||
FLIPGroupID: types.Int64Value(int64(item.FLIPGroupID)),
|
||||
GUID: types.StringValue(item.GUID),
|
||||
IPAddress: types.StringValue(item.IPAddress),
|
||||
ListenSSH: types.BoolValue(item.ListenSSH),
|
||||
MAC: types.StringValue(item.MAC),
|
||||
Name: types.StringValue(item.Name),
|
||||
NetID: types.Int64Value(int64(item.NetID)),
|
||||
NetMask: types.Int64Value(int64(item.NetMask)),
|
||||
NetType: types.StringValue(item.NetType),
|
||||
NodeID: types.Int64Value(int64(item.NodeID)),
|
||||
PCISlot: types.Int64Value(item.PCISlot),
|
||||
LibvirtSettings: &models.LibvirtModel{
|
||||
GUID: types.StringValue(item.LibvirtSettings.GUID),
|
||||
TXMode: types.StringValue(item.LibvirtSettings.TXMode),
|
||||
IOEventFD: types.StringValue(item.LibvirtSettings.IOEventFD),
|
||||
EventIDx: types.StringValue(item.LibvirtSettings.EventIDx),
|
||||
Queues: types.Int64Value(int64(item.LibvirtSettings.Queues)),
|
||||
RXQueueSize: types.Int64Value(int64(item.LibvirtSettings.RXQueueSize)),
|
||||
TXQueueSize: types.Int64Value(int64(item.LibvirtSettings.TXQueueSize)),
|
||||
},
|
||||
ListenSSH: types.BoolValue(item.ListenSSH),
|
||||
MAC: types.StringValue(item.MAC),
|
||||
Name: types.StringValue(item.Name),
|
||||
NetID: types.Int64Value(int64(item.NetID)),
|
||||
NetMask: types.Int64Value(int64(item.NetMask)),
|
||||
NetType: types.StringValue(item.NetType),
|
||||
NodeID: types.Int64Value(int64(item.NodeID)),
|
||||
PCISlot: types.Int64Value(item.PCISlot),
|
||||
QOS: &models.QOSInListModel{
|
||||
ERate: types.Int64Value(int64(item.QOS.ERate)),
|
||||
GUID: types.StringValue(item.QOS.GUID),
|
||||
|
||||
@@ -49,15 +49,17 @@ func ComputeResource(ctx context.Context, plan *models.ResourceComputeModel, c *
|
||||
AffinityRules: plan.AffinityRules,
|
||||
AntiAffinityRules: plan.AntiAffinityRules,
|
||||
CustomFields: types.StringValue(string(customFields)),
|
||||
Chipset: types.StringValue(recordItemCompute.Chipset),
|
||||
Stateless: plan.Stateless,
|
||||
SepId: types.Int64Value(int64(bootdisk.SepID)),
|
||||
Pool: types.StringValue(bootdisk.Pool),
|
||||
ExtraDisks: plan.ExtraDisks,
|
||||
Network: flattenNetwork(ctx, &recordItemCompute.Interfaces),
|
||||
Network: flattenNetwork(ctx, plan.Network, &recordItemCompute.Interfaces),
|
||||
Tags: plan.Tags,
|
||||
PortForwarding: plan.PortForwarding,
|
||||
UserAccess: plan.UserAccess,
|
||||
Snapshot: plan.Snapshot,
|
||||
PCIDevices: plan.PCIDevices,
|
||||
Rollback: plan.Rollback,
|
||||
CD: plan.CD,
|
||||
PinToStack: plan.PinToStack,
|
||||
@@ -205,6 +207,7 @@ func flattenDisk(ctx context.Context, disk *compute.ItemComputeDisk) types.Objec
|
||||
ACL: types.StringValue(string(acl)),
|
||||
AccountID: types.Int64Value(int64(disk.AccountID)),
|
||||
BootPartition: types.Int64Value(int64(disk.BootPartition)),
|
||||
BusNumber: types.Int64Value(int64(disk.BusNumber)),
|
||||
CreatedTime: types.Int64Value(int64(disk.CreatedTime)),
|
||||
DeletedTime: types.Int64Value(int64(disk.DeletedTime)),
|
||||
Description: types.StringValue(disk.Description),
|
||||
@@ -385,25 +388,28 @@ func flattenResourceInterfaces(ctx context.Context, interfaces *compute.ListInte
|
||||
|
||||
for _, item := range *interfaces {
|
||||
temp := models.ItemResourceInterfacesModel{
|
||||
ConnID: types.Int64Value(int64(item.ConnID)),
|
||||
ConnType: types.StringValue(item.ConnType),
|
||||
GetGW: types.StringValue(item.DefGW),
|
||||
Enabled: types.BoolValue(item.Enabled),
|
||||
FLIPGroupID: types.Int64Value(int64(item.FLIPGroupID)),
|
||||
GUID: types.StringValue(item.GUID),
|
||||
IPAddress: types.StringValue(item.IPAddress),
|
||||
ListenSSH: types.BoolValue(item.ListenSSH),
|
||||
MAC: types.StringValue(item.MAC),
|
||||
Name: types.StringValue(item.Name),
|
||||
NetID: types.Int64Value(int64(item.NetID)),
|
||||
NetMask: types.Int64Value(int64(item.NetMask)),
|
||||
NetType: types.StringValue(item.NetType),
|
||||
NodeID: types.Int64Value(int64(item.NodeID)),
|
||||
PCISlot: types.Int64Value(item.PCISlot),
|
||||
QOS: flattenQOS(ctx, &item.QOS),
|
||||
Target: types.StringValue(item.Target),
|
||||
Type: types.StringValue(item.Type),
|
||||
VNFs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, item.VNFs),
|
||||
BusNumber: types.Int64Value(int64(item.BusNumber)),
|
||||
ConnID: types.Int64Value(int64(item.ConnID)),
|
||||
ConnType: types.StringValue(item.ConnType),
|
||||
GetGW: types.StringValue(item.DefGW),
|
||||
Enabled: types.BoolValue(item.Enabled),
|
||||
FLIPGroupID: types.Int64Value(int64(item.FLIPGroupID)),
|
||||
GUID: types.StringValue(item.GUID),
|
||||
IPAddress: types.StringValue(item.IPAddress),
|
||||
ListenSSH: types.BoolValue(item.ListenSSH),
|
||||
MAC: types.StringValue(item.MAC),
|
||||
MTU: types.Int64Value(int64(item.MTU)),
|
||||
Name: types.StringValue(item.Name),
|
||||
NetID: types.Int64Value(int64(item.NetID)),
|
||||
NetMask: types.Int64Value(int64(item.NetMask)),
|
||||
NetType: types.StringValue(item.NetType),
|
||||
NodeID: types.Int64Value(int64(item.NodeID)),
|
||||
PCISlot: types.Int64Value(item.PCISlot),
|
||||
QOS: flattenQOS(ctx, &item.QOS),
|
||||
LibvirtSettings: flattenLibvirtSetttings(ctx, &item.LibvirtSettings),
|
||||
Target: types.StringValue(item.Target),
|
||||
Type: types.StringValue(item.Type),
|
||||
VNFs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, item.VNFs),
|
||||
}
|
||||
obj, err := types.ObjectValueFrom(ctx, models.ItemInterfaces, temp)
|
||||
if err != nil {
|
||||
@@ -439,6 +445,27 @@ func flattenQOS(ctx context.Context, QOS *compute.QOS) types.Object {
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenLibvirtSetttings(ctx context.Context, settings *compute.LibvirtSettings) types.Object {
|
||||
tflog.Info(ctx, "Start flattenLibvirtSetttings")
|
||||
temp := models.LibvirtModel{
|
||||
GUID: types.StringValue(settings.GUID),
|
||||
TXMode: types.StringValue(settings.TXMode),
|
||||
IOEventFD: types.StringValue(settings.IOEventFD),
|
||||
EventIDx: types.StringValue(settings.EventIDx),
|
||||
Queues: types.Int64Value(int64(settings.Queues)),
|
||||
RXQueueSize: types.Int64Value(int64(settings.RXQueueSize)),
|
||||
TXQueueSize: types.Int64Value(int64(settings.TXQueueSize)),
|
||||
}
|
||||
|
||||
res, err := types.ObjectValueFrom(ctx, models.ItemLibvirtSettings, temp)
|
||||
if err != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("Error flattenLibvirtSetttings struct to obj", err))
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "End flattenLibvirtSetttings")
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenSnapSets(ctx context.Context, snapSets *compute.ListSnapSets) types.List {
|
||||
tflog.Info(ctx, "Start flattenSnapSets")
|
||||
tempSlice := make([]types.Object, 0, len(*snapSets))
|
||||
@@ -465,7 +492,7 @@ func flattenSnapSets(ctx context.Context, snapSets *compute.ListSnapSets) types.
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenNetwork(ctx context.Context, interfaces *compute.ListInterfaces) types.Set {
|
||||
func flattenNetwork(ctx context.Context, networks types.Set, interfaces *compute.ListInterfaces) types.Set {
|
||||
tflog.Info(ctx, "Start flattenNetwork")
|
||||
|
||||
tempSlice := make([]types.Object, 0, len(*interfaces))
|
||||
@@ -476,6 +503,8 @@ func flattenNetwork(ctx context.Context, interfaces *compute.ListInterfaces) typ
|
||||
NetId: types.Int64Value(int64(item.NetID)),
|
||||
IpAddress: types.StringValue(item.IPAddress),
|
||||
Mac: types.StringValue(item.MAC),
|
||||
Weight: flattenNetworkWeight(ctx, networks, item),
|
||||
MTU: types.Int64Value(int64(item.MTU)),
|
||||
}
|
||||
obj, err := types.ObjectValueFrom(ctx, models.ItemNetwork, temp)
|
||||
if err != nil {
|
||||
@@ -492,3 +521,16 @@ func flattenNetwork(ctx context.Context, interfaces *compute.ListInterfaces) typ
|
||||
tflog.Info(ctx, "End flattenNetwork")
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenNetworkWeight(ctx context.Context, networks types.Set, item compute.ItemVNFInterface) types.Int64 {
|
||||
tflog.Info(ctx, "Start flattenNetworkWeight")
|
||||
networkList := networks.Elements()
|
||||
for _, network := range networkList {
|
||||
networkMap := network.(types.Object).Attributes()
|
||||
if uint64(networkMap["net_id"].(types.Int64).ValueInt64()) == item.NetID && networkMap["net_type"].(types.String).ValueString() == item.NetType {
|
||||
return types.Int64Value(networkMap["weight"].(types.Int64).ValueInt64())
|
||||
}
|
||||
}
|
||||
tflog.Info(ctx, "End flattenNetworkWeight")
|
||||
return types.Int64Value(0)
|
||||
}
|
||||
|
||||
@@ -59,14 +59,17 @@ func resourceComputeInputChecks(ctx context.Context, plan *models.ResourceComput
|
||||
diags.AddError(fmt.Sprintf("Cannot create compute because extnet ID %d is not allowed or does not exist", extNetId), err.Error())
|
||||
}
|
||||
case "VFNIC":
|
||||
if strings.EqualFold(plan.Driver.ValueString(), "KVM_PPC") {
|
||||
diags.AddError("can't create compute because 'VFNIC' net_type is not allowed for driver 'KVM_PPC'", "")
|
||||
}
|
||||
vfpoolId := uint64(elemMap["net_id"].(types.Int64).ValueInt64())
|
||||
err = ic.ExistVFPool(ctx, vfpoolId, c)
|
||||
if err != nil {
|
||||
diags.AddError(fmt.Sprintf("Cannot create compute because vfpool ID %d is not allowed or does not exist", vfpoolId), err.Error())
|
||||
}
|
||||
case "DPDK":
|
||||
dpdkId := uint64(elemMap["net_id"].(types.Int64).ValueInt64())
|
||||
err = ic.ExistDPDK(ctx, dpdkId, c)
|
||||
if err != nil {
|
||||
diags.AddError(fmt.Sprintf("Cannot create compute because DPDK net ID %d is not allowed or does not exist", dpdkId), err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ type RecordComputeModel struct {
|
||||
AffinityWeight types.Int64 `tfsdk:"affinity_weight"`
|
||||
AntiAffinityRules []ItemRuleModel `tfsdk:"anti_affinity_rules"`
|
||||
Architecture types.String `tfsdk:"arch"`
|
||||
Chipset types.String `tfsdk:"chipset"`
|
||||
BootOrder types.List `tfsdk:"boot_order"`
|
||||
BootDiskSize types.Int64 `tfsdk:"bootdisk_size"`
|
||||
CdImageId types.Int64 `tfsdk:"cd_image_id"`
|
||||
@@ -57,6 +58,7 @@ type RecordComputeModel struct {
|
||||
NumaAffinity types.String `tfsdk:"numa_affinity"`
|
||||
NumaNodeId types.Int64 `tfsdk:"numa_node_id"`
|
||||
OSUsers []ItemOSUserModel `tfsdk:"os_users"`
|
||||
PCIDevices types.List `tfsdk:"pci_devices"`
|
||||
Pinned types.Bool `tfsdk:"pinned"`
|
||||
RAM types.Int64 `tfsdk:"ram"`
|
||||
ReferenceID types.String `tfsdk:"reference_id"`
|
||||
@@ -109,6 +111,7 @@ type ItemDiskModel struct {
|
||||
ACL types.String `tfsdk:"acl"`
|
||||
AccountID types.Int64 `tfsdk:"account_id"`
|
||||
BootPartition types.Int64 `tfsdk:"boot_partition"`
|
||||
BusNumber types.Int64 `tfsdk:"bus_number"`
|
||||
CreatedTime types.Int64 `tfsdk:"created_time"`
|
||||
DeletedTime types.Int64 `tfsdk:"deleted_time"`
|
||||
Description types.String `tfsdk:"desc"`
|
||||
@@ -149,25 +152,28 @@ type ItemDiskModel struct {
|
||||
}
|
||||
|
||||
type ItemInterfaceModel struct {
|
||||
ConnID types.Int64 `tfsdk:"conn_id"`
|
||||
ConnType types.String `tfsdk:"conn_type"`
|
||||
DefGW types.String `tfsdk:"def_gw"`
|
||||
Enabled types.Bool `tfsdk:"enabled"`
|
||||
FLIPGroupID types.Int64 `tfsdk:"flip_group_id"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
IPAddress types.String `tfsdk:"ip_address"`
|
||||
ListenSSH types.Bool `tfsdk:"listen_ssh"`
|
||||
MAC types.String `tfsdk:"mac"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
NetID types.Int64 `tfsdk:"net_id"`
|
||||
NetMask types.Int64 `tfsdk:"netmask"`
|
||||
NetType types.String `tfsdk:"net_type"`
|
||||
NodeID types.Int64 `tfsdk:"node_id"`
|
||||
PCISlot types.Int64 `tfsdk:"pci_slot"`
|
||||
QOS *QOSModel `tfsdk:"qos"`
|
||||
Target types.String `tfsdk:"target"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
VNFs types.List `tfsdk:"vnfs"`
|
||||
BusNumber types.Int64 `tfsdk:"bus_number"`
|
||||
ConnID types.Int64 `tfsdk:"conn_id"`
|
||||
ConnType types.String `tfsdk:"conn_type"`
|
||||
DefGW types.String `tfsdk:"def_gw"`
|
||||
Enabled types.Bool `tfsdk:"enabled"`
|
||||
FLIPGroupID types.Int64 `tfsdk:"flip_group_id"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
IPAddress types.String `tfsdk:"ip_address"`
|
||||
LibvirtSettings *LibvirtModel `tfsdk:"libvirt_settings"`
|
||||
ListenSSH types.Bool `tfsdk:"listen_ssh"`
|
||||
MAC types.String `tfsdk:"mac"`
|
||||
MTU types.Int64 `tfsdk:"mtu"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
NetID types.Int64 `tfsdk:"net_id"`
|
||||
NetMask types.Int64 `tfsdk:"netmask"`
|
||||
NetType types.String `tfsdk:"net_type"`
|
||||
NodeID types.Int64 `tfsdk:"node_id"`
|
||||
PCISlot types.Int64 `tfsdk:"pci_slot"`
|
||||
QOS *QOSModel `tfsdk:"qos"`
|
||||
Target types.String `tfsdk:"target"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
VNFs types.List `tfsdk:"vnfs"`
|
||||
}
|
||||
|
||||
type QOSModel struct {
|
||||
@@ -177,6 +183,16 @@ type QOSModel struct {
|
||||
InRate types.Int64 `tfsdk:"in_rate"`
|
||||
}
|
||||
|
||||
type LibvirtModel struct {
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
TXMode types.String `tfsdk:"txmode"`
|
||||
IOEventFD types.String `tfsdk:"ioeventfd"`
|
||||
EventIDx types.String `tfsdk:"event_idx"`
|
||||
Queues types.Int64 `tfsdk:"queues"`
|
||||
RXQueueSize types.Int64 `tfsdk:"rx_queue_size"`
|
||||
TXQueueSize types.Int64 `tfsdk:"tx_queue_size"`
|
||||
}
|
||||
|
||||
type ItemSnapSetModel struct {
|
||||
Disks types.List `tfsdk:"disks"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
|
||||
@@ -43,6 +43,7 @@ type ItemComputeModel struct {
|
||||
CdImageId types.Int64 `tfsdk:"cd_image_id"`
|
||||
CloneReference types.Int64 `tfsdk:"clone_reference"`
|
||||
Clones types.List `tfsdk:"clones"`
|
||||
Chipset types.String `tfsdk:"chipset"`
|
||||
ComputeCIID types.Int64 `tfsdk:"computeci_id"`
|
||||
CPU types.Int64 `tfsdk:"cpus"`
|
||||
CPUPin types.Bool `tfsdk:"cpu_pin"`
|
||||
@@ -112,30 +113,33 @@ type ItemRuleInListModel struct {
|
||||
}
|
||||
|
||||
type DiskInListModel struct {
|
||||
DiskId types.Int64 `tfsdk:"disk_id"`
|
||||
PCISlot types.Int64 `tfsdk:"pci_slot"`
|
||||
BusNumber types.Int64 `tfsdk:"bus_number"`
|
||||
DiskId types.Int64 `tfsdk:"disk_id"`
|
||||
PCISlot types.Int64 `tfsdk:"pci_slot"`
|
||||
}
|
||||
|
||||
type ItemVNFInterfaceInListModel struct {
|
||||
ConnID types.Int64 `tfsdk:"conn_id"`
|
||||
ConnType types.String `tfsdk:"conn_type"`
|
||||
DefGW types.String `tfsdk:"def_gw"`
|
||||
Enabled types.Bool `tfsdk:"enabled"`
|
||||
FLIPGroupID types.Int64 `tfsdk:"flip_group_id"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
IPAddress types.String `tfsdk:"ip_address"`
|
||||
ListenSSH types.Bool `tfsdk:"listen_ssh"`
|
||||
MAC types.String `tfsdk:"mac"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
NetID types.Int64 `tfsdk:"net_id"`
|
||||
NetMask types.Int64 `tfsdk:"netmask"`
|
||||
NetType types.String `tfsdk:"net_type"`
|
||||
NodeID types.Int64 `tfsdk:"node_id"`
|
||||
PCISlot types.Int64 `tfsdk:"pci_slot"`
|
||||
QOS *QOSInListModel `tfsdk:"qos"`
|
||||
Target types.String `tfsdk:"target"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
VNFs types.List `tfsdk:"vnfs"`
|
||||
BusNumber types.Int64 `tfsdk:"bus_number"`
|
||||
ConnID types.Int64 `tfsdk:"conn_id"`
|
||||
ConnType types.String `tfsdk:"conn_type"`
|
||||
DefGW types.String `tfsdk:"def_gw"`
|
||||
Enabled types.Bool `tfsdk:"enabled"`
|
||||
FLIPGroupID types.Int64 `tfsdk:"flip_group_id"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
IPAddress types.String `tfsdk:"ip_address"`
|
||||
LibvirtSettings *LibvirtModel `tfsdk:"libvirt_settings"`
|
||||
ListenSSH types.Bool `tfsdk:"listen_ssh"`
|
||||
MAC types.String `tfsdk:"mac"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
NetID types.Int64 `tfsdk:"net_id"`
|
||||
NetMask types.Int64 `tfsdk:"netmask"`
|
||||
NetType types.String `tfsdk:"net_type"`
|
||||
NodeID types.Int64 `tfsdk:"node_id"`
|
||||
PCISlot types.Int64 `tfsdk:"pci_slot"`
|
||||
QOS *QOSInListModel `tfsdk:"qos"`
|
||||
Target types.String `tfsdk:"target"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
VNFs types.List `tfsdk:"vnfs"`
|
||||
}
|
||||
|
||||
type QOSInListModel struct {
|
||||
|
||||
@@ -39,6 +39,7 @@ type ItemListDeletedComputeModel struct {
|
||||
BootOrder types.List `tfsdk:"boot_order"`
|
||||
BootDiskSize types.Int64 `tfsdk:"bootdisk_size"`
|
||||
CdImageId types.Int64 `tfsdk:"cd_image_id"`
|
||||
Chipset types.String `tfsdk:"chipset"`
|
||||
CloneReference types.Int64 `tfsdk:"clone_reference"`
|
||||
Clones types.List `tfsdk:"clones"`
|
||||
ComputeCIID types.Int64 `tfsdk:"computeci_id"`
|
||||
@@ -110,30 +111,33 @@ type ItemRuleInListDeletedModel struct {
|
||||
}
|
||||
|
||||
type DiskInListDeletedModel struct {
|
||||
DiskId types.Int64 `tfsdk:"disk_id"`
|
||||
PCISlot types.Int64 `tfsdk:"pci_slot"`
|
||||
BusNumber types.Int64 `tfsdk:"bus_number"`
|
||||
DiskId types.Int64 `tfsdk:"disk_id"`
|
||||
PCISlot types.Int64 `tfsdk:"pci_slot"`
|
||||
}
|
||||
|
||||
type ItemVNFInterfaceInListDeletedModel struct {
|
||||
ConnID types.Int64 `tfsdk:"conn_id"`
|
||||
ConnType types.String `tfsdk:"conn_type"`
|
||||
DefGW types.String `tfsdk:"def_gw"`
|
||||
Enabled types.Bool `tfsdk:"enabled"`
|
||||
FLIPGroupID types.Int64 `tfsdk:"flip_group_id"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
IPAddress types.String `tfsdk:"ip_address"`
|
||||
ListenSSH types.Bool `tfsdk:"listen_ssh"`
|
||||
MAC types.String `tfsdk:"mac"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
NetID types.Int64 `tfsdk:"net_id"`
|
||||
NetMask types.Int64 `tfsdk:"netmask"`
|
||||
NetType types.String `tfsdk:"net_type"`
|
||||
NodeID types.Int64 `tfsdk:"node_id"`
|
||||
PCISlot types.Int64 `tfsdk:"pci_slot"`
|
||||
QOS *QOSInListModel `tfsdk:"qos"`
|
||||
Target types.String `tfsdk:"target"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
VNFs types.List `tfsdk:"vnfs"`
|
||||
BusNumber types.Int64 `tfsdk:"bus_number"`
|
||||
ConnID types.Int64 `tfsdk:"conn_id"`
|
||||
ConnType types.String `tfsdk:"conn_type"`
|
||||
DefGW types.String `tfsdk:"def_gw"`
|
||||
Enabled types.Bool `tfsdk:"enabled"`
|
||||
FLIPGroupID types.Int64 `tfsdk:"flip_group_id"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
IPAddress types.String `tfsdk:"ip_address"`
|
||||
LibvirtSettings *LibvirtModel `tfsdk:"libvirt_settings"`
|
||||
ListenSSH types.Bool `tfsdk:"listen_ssh"`
|
||||
MAC types.String `tfsdk:"mac"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
NetID types.Int64 `tfsdk:"net_id"`
|
||||
NetMask types.Int64 `tfsdk:"netmask"`
|
||||
NetType types.String `tfsdk:"net_type"`
|
||||
NodeID types.Int64 `tfsdk:"node_id"`
|
||||
PCISlot types.Int64 `tfsdk:"pci_slot"`
|
||||
QOS *QOSInListModel `tfsdk:"qos"`
|
||||
Target types.String `tfsdk:"target"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
VNFs types.List `tfsdk:"vnfs"`
|
||||
}
|
||||
|
||||
type QOSInListDeletedModel struct {
|
||||
|
||||
@@ -23,6 +23,7 @@ type ResourceComputeModel struct {
|
||||
AffinityRules types.Set `tfsdk:"affinity_rules"`
|
||||
AntiAffinityRules types.Set `tfsdk:"anti_affinity_rules"`
|
||||
CustomFields types.String `tfsdk:"custom_fields"`
|
||||
Chipset types.String `tfsdk:"chipset"`
|
||||
Stateless types.Bool `tfsdk:"stateless"`
|
||||
SepId types.Int64 `tfsdk:"sep_id"`
|
||||
Pool types.String `tfsdk:"pool"`
|
||||
@@ -32,6 +33,7 @@ type ResourceComputeModel struct {
|
||||
PortForwarding types.Set `tfsdk:"port_forwarding"`
|
||||
UserAccess types.Set `tfsdk:"user_access"`
|
||||
Snapshot types.Set `tfsdk:"snapshot"`
|
||||
PCIDevices types.Set `tfsdk:"pci_devices"`
|
||||
Rollback types.Object `tfsdk:"rollback"`
|
||||
CD types.Object `tfsdk:"cd"`
|
||||
PinToStack types.Bool `tfsdk:"pin_to_stack"`
|
||||
@@ -124,6 +126,7 @@ type ItemResourceDiskModel struct {
|
||||
ACL types.String `tfsdk:"acl"`
|
||||
AccountID types.Int64 `tfsdk:"account_id"`
|
||||
BootPartition types.Int64 `tfsdk:"boot_partition"`
|
||||
BusNumber types.Int64 `tfsdk:"bus_number"`
|
||||
CreatedTime types.Int64 `tfsdk:"created_time"`
|
||||
DeletedTime types.Int64 `tfsdk:"deleted_time"`
|
||||
Description types.String `tfsdk:"desc"`
|
||||
@@ -175,28 +178,33 @@ type ItemNetworkModel struct {
|
||||
NetId types.Int64 `tfsdk:"net_id"`
|
||||
IpAddress types.String `tfsdk:"ip_address"`
|
||||
Mac types.String `tfsdk:"mac"`
|
||||
Weight types.Int64 `tfsdk:"weight"`
|
||||
MTU types.Int64 `tfsdk:"mtu"`
|
||||
}
|
||||
|
||||
type ItemResourceInterfacesModel struct {
|
||||
ConnID types.Int64 `tfsdk:"conn_id"`
|
||||
ConnType types.String `tfsdk:"conn_type"`
|
||||
GetGW types.String `tfsdk:"get_gw"`
|
||||
Enabled types.Bool `tfsdk:"enabled"`
|
||||
FLIPGroupID types.Int64 `tfsdk:"flip_group_id"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
IPAddress types.String `tfsdk:"ip_address"`
|
||||
ListenSSH types.Bool `tfsdk:"listen_ssh"`
|
||||
MAC types.String `tfsdk:"mac"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
NetID types.Int64 `tfsdk:"net_id"`
|
||||
NetMask types.Int64 `tfsdk:"netmask"`
|
||||
NetType types.String `tfsdk:"net_type"`
|
||||
NodeID types.Int64 `tfsdk:"node_id"`
|
||||
PCISlot types.Int64 `tfsdk:"pci_slot"`
|
||||
QOS types.Object `tfsdk:"qos"`
|
||||
Target types.String `tfsdk:"target"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
VNFs types.List `tfsdk:"vnfs"`
|
||||
BusNumber types.Int64 `tfsdk:"bus_number"`
|
||||
ConnID types.Int64 `tfsdk:"conn_id"`
|
||||
ConnType types.String `tfsdk:"conn_type"`
|
||||
GetGW types.String `tfsdk:"get_gw"`
|
||||
Enabled types.Bool `tfsdk:"enabled"`
|
||||
FLIPGroupID types.Int64 `tfsdk:"flip_group_id"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
IPAddress types.String `tfsdk:"ip_address"`
|
||||
ListenSSH types.Bool `tfsdk:"listen_ssh"`
|
||||
MAC types.String `tfsdk:"mac"`
|
||||
MTU types.Int64 `tfsdk:"mtu"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
NetID types.Int64 `tfsdk:"net_id"`
|
||||
NetMask types.Int64 `tfsdk:"netmask"`
|
||||
NetType types.String `tfsdk:"net_type"`
|
||||
NodeID types.Int64 `tfsdk:"node_id"`
|
||||
PCISlot types.Int64 `tfsdk:"pci_slot"`
|
||||
QOS types.Object `tfsdk:"qos"`
|
||||
LibvirtSettings types.Object `tfsdk:"libvirt_settings"`
|
||||
Target types.String `tfsdk:"target"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
VNFs types.List `tfsdk:"vnfs"`
|
||||
}
|
||||
|
||||
type ItemResourceRulesModel struct {
|
||||
@@ -212,6 +220,8 @@ var ItemNetwork = map[string]attr.Type{
|
||||
"net_id": types.Int64Type,
|
||||
"ip_address": types.StringType,
|
||||
"mac": types.StringType,
|
||||
"weight": types.Int64Type,
|
||||
"mtu": types.Int64Type,
|
||||
}
|
||||
|
||||
var ItemDisk = map[string]attr.Type{
|
||||
@@ -219,6 +229,7 @@ var ItemDisk = map[string]attr.Type{
|
||||
"acl": types.StringType,
|
||||
"account_id": types.Int64Type,
|
||||
"boot_partition": types.Int64Type,
|
||||
"bus_number": types.Int64Type,
|
||||
"created_time": types.Int64Type,
|
||||
"deleted_time": types.Int64Type,
|
||||
"desc": types.StringType,
|
||||
@@ -293,25 +304,28 @@ var ItemACL = map[string]attr.Type{
|
||||
}
|
||||
|
||||
var ItemInterfaces = map[string]attr.Type{
|
||||
"conn_id": types.Int64Type,
|
||||
"conn_type": types.StringType,
|
||||
"get_gw": types.StringType,
|
||||
"enabled": types.BoolType,
|
||||
"flip_group_id": types.Int64Type,
|
||||
"guid": types.StringType,
|
||||
"ip_address": types.StringType,
|
||||
"listen_ssh": types.BoolType,
|
||||
"mac": types.StringType,
|
||||
"name": types.StringType,
|
||||
"net_id": types.Int64Type,
|
||||
"netmask": types.Int64Type,
|
||||
"net_type": types.StringType,
|
||||
"node_id": types.Int64Type,
|
||||
"pci_slot": types.Int64Type,
|
||||
"qos": types.ObjectType{AttrTypes: ItemQos},
|
||||
"target": types.StringType,
|
||||
"type": types.StringType,
|
||||
"vnfs": types.ListType{ElemType: types.Int64Type},
|
||||
"bus_number": types.Int64Type,
|
||||
"conn_id": types.Int64Type,
|
||||
"conn_type": types.StringType,
|
||||
"get_gw": types.StringType,
|
||||
"enabled": types.BoolType,
|
||||
"flip_group_id": types.Int64Type,
|
||||
"guid": types.StringType,
|
||||
"ip_address": types.StringType,
|
||||
"listen_ssh": types.BoolType,
|
||||
"mac": types.StringType,
|
||||
"mtu": types.Int64Type,
|
||||
"name": types.StringType,
|
||||
"net_id": types.Int64Type,
|
||||
"netmask": types.Int64Type,
|
||||
"net_type": types.StringType,
|
||||
"node_id": types.Int64Type,
|
||||
"pci_slot": types.Int64Type,
|
||||
"qos": types.ObjectType{AttrTypes: ItemQos},
|
||||
"libvirt_settings": types.ObjectType{AttrTypes: ItemLibvirtSettings},
|
||||
"target": types.StringType,
|
||||
"type": types.StringType,
|
||||
"vnfs": types.ListType{ElemType: types.Int64Type},
|
||||
}
|
||||
|
||||
var ItemQos = map[string]attr.Type{
|
||||
@@ -321,6 +335,16 @@ var ItemQos = map[string]attr.Type{
|
||||
"in_rate": types.Int64Type,
|
||||
}
|
||||
|
||||
var ItemLibvirtSettings = map[string]attr.Type{
|
||||
"guid": types.StringType,
|
||||
"txmode": types.StringType,
|
||||
"ioeventfd": types.StringType,
|
||||
"event_idx": types.StringType,
|
||||
"queues": types.Int64Type,
|
||||
"rx_queue_size": types.Int64Type,
|
||||
"tx_queue_size": types.Int64Type,
|
||||
}
|
||||
|
||||
var ItemOSUsers = map[string]attr.Type{
|
||||
"guid": types.StringType,
|
||||
"login": types.StringType,
|
||||
|
||||
@@ -142,6 +142,11 @@ func (r *resourceCompute) Create(ctx context.Context, req resource.CreateRequest
|
||||
resp.Diagnostics.Append(utilities.ComputeResourceCDInsert(ctx, &plan, r.client)...)
|
||||
}
|
||||
|
||||
// attach PCI devices to compute if needed, warnings added to resp.Diagnostics in case of failure.
|
||||
if !plan.PCIDevices.IsNull() {
|
||||
resp.Diagnostics.Append(utilities.ComputeResourcePCIDevice(ctx, &plan, r.client)...)
|
||||
}
|
||||
|
||||
// pin to stack if needed, warnings added to resp.Diagnostics in case of failure.
|
||||
if !plan.PinToStack.IsNull() && plan.PinToStack.ValueBool() {
|
||||
resp.Diagnostics.Append(utilities.ComputeResourcePinToStack(ctx, &plan, r.client)...)
|
||||
@@ -319,9 +324,18 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
|
||||
}
|
||||
}
|
||||
|
||||
// PCI device(s) update if needed
|
||||
if !plan.PCIDevices.Equal(state.PCIDevices) {
|
||||
resp.Diagnostics.Append(utilities.ComputeResourcePCIDeviceUpdate(ctx, &state, &plan, r.client)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Update resourceCompute: Error update PCI device(s) list")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Compute parameters update if needed
|
||||
if (!plan.Description.IsUnknown() && !plan.Description.Equal(state.Description)) || !plan.Name.Equal(state.Name) ||
|
||||
!plan.NumaAffinity.Equal(state.NumaAffinity) || !plan.CPUPin.Equal(state.CPUPin) || !plan.HPBacked.Equal(state.HPBacked) {
|
||||
!plan.NumaAffinity.Equal(state.NumaAffinity) || !plan.CPUPin.Equal(state.CPUPin) || !plan.HPBacked.Equal(state.HPBacked) || (!plan.Chipset.IsUnknown() && !plan.Chipset.Equal(state.Chipset)) {
|
||||
resp.Diagnostics.Append(utilities.ComputeResourceComputeUpdate(ctx, &state, &plan, r.client)...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
tflog.Error(ctx, "Update resourceCompute: Error update compute parameters")
|
||||
@@ -494,25 +508,11 @@ func (r *resourceCompute) Delete(ctx context.Context, req resource.DeleteRequest
|
||||
ctx, cancel := context.WithTimeout(ctx, readTimeout)
|
||||
defer cancel()
|
||||
|
||||
var permanently bool
|
||||
if state.Permanently.IsNull() {
|
||||
permanently = true
|
||||
} else {
|
||||
permanently = state.Permanently.ValueBool()
|
||||
}
|
||||
|
||||
var detach bool
|
||||
if state.DetachDisks.IsNull() {
|
||||
detach = true
|
||||
} else {
|
||||
detach = state.DetachDisks.ValueBool()
|
||||
}
|
||||
|
||||
// Delete existing Compute
|
||||
delReq := compute.DeleteRequest{
|
||||
ComputeID: uint64(state.ComputeId.ValueInt64()),
|
||||
Permanently: permanently,
|
||||
DetachDisks: detach,
|
||||
Permanently: state.Permanently.ValueBool(),
|
||||
DetachDisks: state.DetachDisks.ValueBool(),
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "Delete resourceCompute: calling CloudAPI().Compute().Delete", map[string]any{
|
||||
|
||||
@@ -160,6 +160,9 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
|
||||
"arch": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"chipset": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"boot_order": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
@@ -223,6 +226,9 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
|
||||
"boot_partition": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"bus_number": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"created_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
@@ -447,6 +453,9 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"bus_number": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"conn_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
@@ -468,12 +477,41 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
|
||||
"ip_address": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"libvirt_settings": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"guid": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"txmode": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ioeventfd": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"event_idx": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"queues": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"rx_queue_size": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"tx_queue_size": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"listen_ssh": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"mac": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"mtu": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
@@ -583,6 +621,10 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
|
||||
},
|
||||
},
|
||||
},
|
||||
"pci_devices": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"pinned": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
@@ -166,6 +166,9 @@ func MakeSchemaDataSourceComputeList() map[string]schema.Attribute {
|
||||
"arch": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"chipset": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"boot_order": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
@@ -217,6 +220,9 @@ func MakeSchemaDataSourceComputeList() map[string]schema.Attribute {
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"bus_number": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
@@ -248,6 +254,9 @@ func MakeSchemaDataSourceComputeList() map[string]schema.Attribute {
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"bus_number": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"conn_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
@@ -310,6 +319,32 @@ func MakeSchemaDataSourceComputeList() map[string]schema.Attribute {
|
||||
},
|
||||
},
|
||||
},
|
||||
"libvirt_settings": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"guid": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"txmode": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ioeventfd": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"event_idx": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"queues": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"rx_queue_size": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"tx_queue_size": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"target": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
@@ -158,6 +158,9 @@ func MakeSchemaDataSourceComputeListDeleted() map[string]schema.Attribute {
|
||||
"arch": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"chipset": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"boot_order": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
@@ -209,6 +212,9 @@ func MakeSchemaDataSourceComputeListDeleted() map[string]schema.Attribute {
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"bus_number": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
@@ -240,6 +246,9 @@ func MakeSchemaDataSourceComputeListDeleted() map[string]schema.Attribute {
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"bus_number": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"conn_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
@@ -261,6 +270,32 @@ func MakeSchemaDataSourceComputeListDeleted() map[string]schema.Attribute {
|
||||
"ip_address": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"libvirt_settings": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"guid": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"txmode": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ioeventfd": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"event_idx": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"queues": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"rx_queue_size": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"tx_queue_size": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"listen_ssh": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user