Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 91ba361af9 | |||
| f49d9f8860 | |||
| 20050bc169 | |||
| e2ee45ee14 | |||
|
|
294680282e | ||
|
|
2bc0fbae9a | ||
|
|
2453a32d01 | ||
|
|
0602a4b693 | ||
|
|
28b60de115 | ||
|
|
b705ce4aab | ||
|
|
83ca627cea | ||
|
|
739289fbb8 |
33
CHANGELOG.md
33
CHANGELOG.md
@@ -1,6 +1,31 @@
|
|||||||
## Version 4.3.7
|
## Version 4.5.3
|
||||||
|
|
||||||
## Bugfix
|
### Bugfix
|
||||||
- Fixed bug with get request. Update cloudapi/vins
|
- Change field Value in schema resource kvmvm in blocks affinity_rules and anti_affinity_rules from required to optional in cloudapi and cloudbroker
|
||||||
- Updated decort-golang-sdk version
|
- Change the format ID in resource k8s_wg from wg_id to k8s_id#wg_id
|
||||||
|
- Fix scripts intall.bat and intall.sh
|
||||||
|
- Increased timeouts for resources account, disk, cdrom_image, image, virtual_image, k8s_wg, vins, rg in cloudbroker so that they match the same from cloudapi
|
||||||
|
- Increased timeouts for resources pcidevice, sep, sep_config in cloudbroker
|
||||||
|
- Fix bug in affinity_rules in cloudbroker/kvmvm
|
||||||
|
- Add field NeedReboot in cloudapi/kvmvm in data_source, data_source_list and resource schemas
|
||||||
|
- Fix bug with field ExtNetID in CreateInRGRequest in cloudapi/vins and cloudbroker/vins
|
||||||
|
- Add boolean field Safe in Restart func in resource cloudapi/lb
|
||||||
|
- Add field force_resize in Resize func in resource cloudapi/kvmvm and cloudbroker/kvmvm
|
||||||
|
- Fix bug in cloudBroker/kvmvm with disk and extra_disks
|
||||||
|
- Change logic from disk delete and disk add to disk rename when disk.disk_name field is changed in resource cloudapi/kvmvm and cloudbroker/kvmvm
|
||||||
|
- Fix allowed network plugin value from "weawenet" to "weavenet" for k8ci, k8s resources in cloudbroker and for k8s resource in cloudapi
|
||||||
|
- Fix bug with deleting decort_bservice resource when setting enable=false in cloudapi/bservice
|
||||||
|
- Fix panic in data source decort_bservice_snapshot_list in cloudapi/bservice
|
||||||
|
- Fix panic in data source decort_rg_affinity_groups_list in cloudapi/rg
|
||||||
|
- Fix change description in resource decort_cb_kvmvm in cloudbroker
|
||||||
|
- Computed field bootdisk_size has been renamed to boot_disk_size in data sources decort_kvmvm, decort_kvmvm_list, decort_cb_kvmvm_list in cloudapi and cloudbroker
|
||||||
|
- Change request logic for delete resource decort_cb_k8s_cp in cloudbroker
|
||||||
|
- Fix schema in datasource decort_cb_kvmvm in cloudbroker, fields boot_disk_id, sep_id, pool, extra_disks, network, net_id, net_type, ip_address, mac have been removes
|
||||||
|
- Fix panic with RG in cloudapi
|
||||||
|
- Fix permanently field for disks delete in decort_kvmvm in cloudapi/kvmvm and decort_cb_kvmvm in cloudbroker/kvmvm
|
||||||
|
- Fix bug with enable request duplication
|
||||||
|
|
||||||
|
### Feature
|
||||||
|
|
||||||
|
- Add RAM divisibility validation in compute, k8s, k8s_cp and k8s_wg resources in cloudapi and cloudbroker
|
||||||
|
- Add "permanently" flag in k8s, k8s_cp in cloudapi
|
||||||
2
Makefile
2
Makefile
@@ -7,7 +7,7 @@ ZIPDIR = ./zip
|
|||||||
BINARY=${NAME}
|
BINARY=${NAME}
|
||||||
WORKPATH= ./examples/terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAMESPACE}/${VERSION}/${OS_ARCH}
|
WORKPATH= ./examples/terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAMESPACE}/${VERSION}/${OS_ARCH}
|
||||||
MAINPATH = ./cmd/decort/
|
MAINPATH = ./cmd/decort/
|
||||||
VERSION=4.3.7
|
VERSION=4.5.3
|
||||||
OS_ARCH=$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)
|
OS_ARCH=$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)
|
||||||
|
|
||||||
FILES = ${BINARY}_${VERSION}_darwin_amd64\
|
FILES = ${BINARY}_${VERSION}_darwin_amd64\
|
||||||
|
|||||||
55
README.md
55
README.md
@@ -6,6 +6,8 @@ Terraform provider для платформы Digital Energy Cloud Orchestration
|
|||||||
|
|
||||||
| Версия DECORT API | Версия провайдера Terraform |
|
| Версия DECORT API | Версия провайдера Terraform |
|
||||||
| ------ | ------ |
|
| ------ | ------ |
|
||||||
|
| 3.8.9 | 4.5.x |
|
||||||
|
| 3.8.8 | 4.4.x |
|
||||||
| 3.8.7 | 4.3.x |
|
| 3.8.7 | 4.3.x |
|
||||||
| 3.8.6 | 4.0.x, 4.1.x, 4.2.x |
|
| 3.8.6 | 4.0.x, 4.1.x, 4.2.x |
|
||||||
| 3.8.5 | 3.4.x |
|
| 3.8.5 | 3.4.x |
|
||||||
@@ -25,21 +27,42 @@ Terraform provider для платформы Digital Energy Cloud Orchestration
|
|||||||
|
|
||||||
## Возможности провайдера
|
## Возможности провайдера
|
||||||
|
|
||||||
- Работа с Compute instances,
|
- Режим пользователя:
|
||||||
- Работа с disks,
|
- Работа с accounts,
|
||||||
- Работа с k8s,
|
- Работа с bservice,
|
||||||
- Работа с image,
|
- Работа с disks,
|
||||||
- Работа с reource groups,
|
- Работа с extnets,
|
||||||
- Работа с VINS,
|
- Работа с flipgroups,
|
||||||
- Работа с pfw,
|
- Работа с image,
|
||||||
- Работа с accounts,
|
- Работа с k8s,
|
||||||
- Работа с snapshots,
|
- Работа с Compute instances,
|
||||||
- Работа с bservice,
|
- Работа с load balancer,
|
||||||
- Работа с extnets,
|
- Работа с locations,
|
||||||
- Работа с locations,
|
- Работа с pfw,
|
||||||
- Работа с load balancer.
|
- Работа с resource groups,
|
||||||
|
- Работа с snapshots,
|
||||||
|
- Работа с stacks,
|
||||||
|
- Работа с VINS.
|
||||||
|
|
||||||
Вики проекта: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
- Режим администратора:
|
||||||
|
- Работа с accounts,
|
||||||
|
- Работа с audits,
|
||||||
|
- Работа с disks,
|
||||||
|
- Работа с extnets,
|
||||||
|
- Работа с flipgroups,
|
||||||
|
- Работа с grids,
|
||||||
|
- Работа с images,
|
||||||
|
- Работа с k8ci,
|
||||||
|
- Работа с k8s,
|
||||||
|
- Работа с Compute instances,
|
||||||
|
- Работа с load balancer,
|
||||||
|
- Работа с pci device,
|
||||||
|
- Работа с resource groups,
|
||||||
|
- Работа с seps,
|
||||||
|
- Работа с stacks,
|
||||||
|
- Работа с VINS.
|
||||||
|
|
||||||
|
Со списком и описанием функционала всех групп можно ознамоиться на Вики проекта: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
|
||||||
## Установка
|
## Установка
|
||||||
Начиная с версии провайдера `4.3.0` в релизном архиве находятся скрипты-инсталляторы.
|
Начиная с версии провайдера `4.3.0` в релизном архиве находятся скрипты-инсталляторы.
|
||||||
@@ -86,7 +109,7 @@ terraform {
|
|||||||
9. Добавьте в файл блок с инициализацией провайдера.
|
9. Добавьте в файл блок с инициализацией провайдера.
|
||||||
```terraform
|
```terraform
|
||||||
provider "decort" {
|
provider "decort" {
|
||||||
authenticator = "oauth2"
|
authenticator = "decs3o"
|
||||||
controller_url = "https://mr4.digitalenergy.online"
|
controller_url = "https://mr4.digitalenergy.online"
|
||||||
oauth2_url = "https://sso.digitalenergy.online"
|
oauth2_url = "https://sso.digitalenergy.online"
|
||||||
allow_unverified_ssl = true
|
allow_unverified_ssl = true
|
||||||
@@ -172,7 +195,7 @@ ${host_name}/${namespace}/${type}
|
|||||||
8. Добавьте в файл блок с инициализацией провайдера.
|
8. Добавьте в файл блок с инициализацией провайдера.
|
||||||
```terraform
|
```terraform
|
||||||
provider "decort" {
|
provider "decort" {
|
||||||
authenticator = "oauth2"
|
authenticator = "decs3o"
|
||||||
controller_url = "https://mr4.digitalenergy.online"
|
controller_url = "https://mr4.digitalenergy.online"
|
||||||
oauth2_url = "https://sso.digitalenergy.online"
|
oauth2_url = "https://sso.digitalenergy.online"
|
||||||
allow_unverified_ssl = true
|
allow_unverified_ssl = true
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ Two ways for starting:
|
|||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
provider "decort" {
|
provider "decort" {
|
||||||
authenticator = "oauth2"
|
authenticator = "decs3o"
|
||||||
#controller_url = <DECORT_CONTROLLER_URL>
|
#controller_url = <DECORT_CONTROLLER_URL>
|
||||||
controller_url = "https://ds1.digitalenergy.online"
|
controller_url = "https://ds1.digitalenergy.online"
|
||||||
#oauth2_url = <DECORT_SSO_URL>
|
#oauth2_url = <DECORT_SSO_URL>
|
||||||
|
|||||||
58
go.mod
58
go.mod
@@ -3,52 +3,53 @@ module repository.basistech.ru/BASIS/terraform-provider-decort
|
|||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/golang-jwt/jwt/v4 v4.4.3
|
|
||||||
github.com/google/uuid v1.3.0
|
github.com/google/uuid v1.3.0
|
||||||
github.com/hashicorp/terraform-plugin-docs v0.13.0
|
github.com/hashicorp/terraform-plugin-docs v0.13.0
|
||||||
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1
|
github.com/hashicorp/terraform-plugin-sdk/v2 v2.30.0
|
||||||
github.com/sirupsen/logrus v1.9.0
|
github.com/sirupsen/logrus v1.9.0
|
||||||
golang.org/x/net v0.12.0
|
golang.org/x/net v0.17.0
|
||||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.5.8
|
repository.basistech.ru/BASIS/decort-golang-sdk v1.7.7
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Masterminds/goutils v1.1.1 // indirect
|
github.com/Masterminds/goutils v1.1.1 // indirect
|
||||||
github.com/Masterminds/semver/v3 v3.2.0 // indirect
|
github.com/Masterminds/semver/v3 v3.2.0 // indirect
|
||||||
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
|
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
|
||||||
|
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
|
||||||
github.com/agext/levenshtein v1.2.3 // indirect
|
github.com/agext/levenshtein v1.2.3 // indirect
|
||||||
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
|
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
|
||||||
github.com/armon/go-radix v1.0.0 // indirect
|
github.com/armon/go-radix v1.0.0 // indirect
|
||||||
github.com/bgentry/speakeasy v0.1.0 // indirect
|
github.com/bgentry/speakeasy v0.1.0 // indirect
|
||||||
|
github.com/cloudflare/circl v1.3.3 // indirect
|
||||||
github.com/fatih/color v1.13.0 // indirect
|
github.com/fatih/color v1.13.0 // indirect
|
||||||
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
||||||
github.com/go-playground/locales v0.14.1 // indirect
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
github.com/go-playground/validator/v10 v10.14.1 // indirect
|
github.com/go-playground/validator/v10 v10.15.4 // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.3 // indirect
|
||||||
github.com/google/go-cmp v0.5.9 // indirect
|
github.com/google/go-cmp v0.6.0 // indirect
|
||||||
github.com/google/go-querystring v1.1.0 // indirect
|
github.com/google/go-querystring v1.1.0 // indirect
|
||||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||||
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
|
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||||
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
|
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
|
||||||
github.com/hashicorp/go-hclog v1.4.0 // indirect
|
github.com/hashicorp/go-hclog v1.5.0 // indirect
|
||||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||||
github.com/hashicorp/go-plugin v1.4.8 // indirect
|
github.com/hashicorp/go-plugin v1.5.1 // indirect
|
||||||
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
||||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||||
github.com/hashicorp/hc-install v0.4.0 // indirect
|
github.com/hashicorp/hc-install v0.6.1 // indirect
|
||||||
github.com/hashicorp/hcl/v2 v2.15.0 // indirect
|
github.com/hashicorp/hcl/v2 v2.19.1 // indirect
|
||||||
github.com/hashicorp/logutils v1.0.0 // indirect
|
github.com/hashicorp/logutils v1.0.0 // indirect
|
||||||
github.com/hashicorp/terraform-exec v0.17.3 // indirect
|
github.com/hashicorp/terraform-exec v0.19.0 // indirect
|
||||||
github.com/hashicorp/terraform-json v0.14.0 // indirect
|
github.com/hashicorp/terraform-json v0.17.1 // indirect
|
||||||
github.com/hashicorp/terraform-plugin-go v0.14.2 // indirect
|
github.com/hashicorp/terraform-plugin-go v0.19.0 // indirect
|
||||||
github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect
|
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
|
||||||
github.com/hashicorp/terraform-registry-address v0.1.0 // indirect
|
github.com/hashicorp/terraform-registry-address v0.2.2 // indirect
|
||||||
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
|
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
|
||||||
github.com/hashicorp/yamux v0.1.1 // indirect
|
github.com/hashicorp/yamux v0.1.1 // indirect
|
||||||
github.com/huandu/xstrings v1.4.0 // indirect
|
github.com/huandu/xstrings v1.4.0 // indirect
|
||||||
github.com/imdario/mergo v0.3.13 // indirect
|
github.com/imdario/mergo v0.3.15 // indirect
|
||||||
github.com/leodido/go-urn v1.2.4 // indirect
|
github.com/leodido/go-urn v1.2.4 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.16 // indirect
|
github.com/mattn/go-isatty v0.0.16 // indirect
|
||||||
@@ -64,15 +65,16 @@ require (
|
|||||||
github.com/shopspring/decimal v1.3.1 // indirect
|
github.com/shopspring/decimal v1.3.1 // indirect
|
||||||
github.com/spf13/cast v1.5.0 // indirect
|
github.com/spf13/cast v1.5.0 // indirect
|
||||||
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
|
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
|
||||||
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
|
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
|
||||||
github.com/vmihailenco/tagparser v0.1.2 // indirect
|
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||||
github.com/zclconf/go-cty v1.12.1 // indirect
|
github.com/zclconf/go-cty v1.14.1 // indirect
|
||||||
golang.org/x/crypto v0.11.0 // indirect
|
golang.org/x/crypto v0.15.0 // indirect
|
||||||
golang.org/x/sys v0.10.0 // indirect
|
golang.org/x/mod v0.13.0 // indirect
|
||||||
golang.org/x/text v0.11.0 // indirect
|
golang.org/x/sys v0.14.0 // indirect
|
||||||
|
golang.org/x/text v0.14.0 // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
|
||||||
google.golang.org/grpc v1.51.0 // indirect
|
google.golang.org/grpc v1.57.1 // indirect
|
||||||
google.golang.org/protobuf v1.28.1 // indirect
|
google.golang.org/protobuf v1.31.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
238
go.sum
238
go.sum
@@ -1,4 +1,4 @@
|
|||||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
|
||||||
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
|
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/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
||||||
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
||||||
@@ -7,73 +7,57 @@ github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYr
|
|||||||
github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk=
|
github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk=
|
||||||
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
|
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/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
|
||||||
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
|
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
|
||||||
github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=
|
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg=
|
||||||
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
|
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
|
||||||
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ=
|
github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ=
|
||||||
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
|
|
||||||
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
|
|
||||||
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
|
|
||||||
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
|
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
|
||||||
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
||||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
|
||||||
github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I=
|
|
||||||
github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
|
|
||||||
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
|
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
|
||||||
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
|
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
|
||||||
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
|
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
|
||||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||||
github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
|
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/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
|
||||||
github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=
|
github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=
|
||||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
|
||||||
|
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
|
||||||
|
github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs=
|
||||||
|
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
|
||||||
|
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
|
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
||||||
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
|
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
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.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
|
||||||
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
|
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
|
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
|
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
|
||||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
|
||||||
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
|
github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
|
||||||
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
github.com/go-git/go-git/v5 v5.9.0 h1:cD9SFA7sHVRdJ7AYck1ZaAa/yeuBvGPxwXDL8cxrObY=
|
||||||
github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
|
||||||
github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34=
|
|
||||||
github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
|
||||||
github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0=
|
|
||||||
github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4=
|
|
||||||
github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc=
|
|
||||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
github.com/go-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k=
|
github.com/go-playground/validator/v10 v10.15.4 h1:zMXza4EpOdooxPel5xDqXEdXG5r+WggpvnAKMsalBjs=
|
||||||
github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
github.com/go-playground/validator/v10 v10.15.4/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||||
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
|
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
|
||||||
github.com/golang-jwt/jwt/v4 v4.4.3 h1:Hxl6lhQFj4AnOX6MLrsCb/+7tCj7DxP7VA+2rDIq5AU=
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
||||||
github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
|
||||||
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
|
||||||
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
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/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.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
@@ -86,47 +70,44 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv
|
|||||||
github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU=
|
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-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.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
|
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-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
||||||
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI=
|
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI=
|
||||||
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
|
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
|
||||||
github.com/hashicorp/go-hclog v1.4.0 h1:ctuWFGrhFha8BnnzxqeRGidlEcQkDyL5u8J8t5eA11I=
|
github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c=
|
||||||
github.com/hashicorp/go-hclog v1.4.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
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.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 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||||
github.com/hashicorp/go-plugin v1.4.8 h1:CHGwpxYDOttQOY7HOWgETU9dyVjOXzniXDqJcYJE1zM=
|
github.com/hashicorp/go-plugin v1.5.1 h1:oGm7cWBaYIp3lJpx1RUEfLWophprE2EV/KUeqBYo+6k=
|
||||||
github.com/hashicorp/go-plugin v1.4.8/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s=
|
github.com/hashicorp/go-plugin v1.5.1/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4=
|
||||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
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 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
|
||||||
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
|
||||||
github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
|
||||||
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
|
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
|
||||||
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||||
github.com/hashicorp/hc-install v0.4.0 h1:cZkRFr1WVa0Ty6x5fTvL1TuO1flul231rWkGH92oYYk=
|
github.com/hashicorp/hc-install v0.6.1 h1:IGxShH7AVhPaSuSJpKtVi/EFORNjO+OYVJJrAtGG2mY=
|
||||||
github.com/hashicorp/hc-install v0.4.0/go.mod h1:5d155H8EC5ewegao9A4PUTMNPZaq+TbOzkJJZ4vrXeI=
|
github.com/hashicorp/hc-install v0.6.1/go.mod h1:0fW3jpg+wraYSnFDJ6Rlie3RvLf1bIqVIkzoon4KoVE=
|
||||||
github.com/hashicorp/hcl/v2 v2.15.0 h1:CPDXO6+uORPjKflkWCCwoWc9uRp+zSIPcCQ+BrxV7m8=
|
github.com/hashicorp/hcl/v2 v2.19.1 h1://i05Jqznmb2EXqa39Nsvyan2o5XyMowW5fnCKW5RPI=
|
||||||
github.com/hashicorp/hcl/v2 v2.15.0/go.mod h1:JRmR89jycNkrrqnMmvPDMd56n1rQJ2Q6KocSLCMCXng=
|
github.com/hashicorp/hcl/v2 v2.19.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE=
|
||||||
github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=
|
github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=
|
||||||
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
||||||
github.com/hashicorp/terraform-exec v0.17.3 h1:MX14Kvnka/oWGmIkyuyvL6POx25ZmKrjlaclkx3eErU=
|
github.com/hashicorp/terraform-exec v0.19.0 h1:FpqZ6n50Tk95mItTSS9BjeOVUb4eg81SpgVtZNNtFSM=
|
||||||
github.com/hashicorp/terraform-exec v0.17.3/go.mod h1:+NELG0EqQekJzhvikkeQsOAZpsw0cv/03rbeQJqscAI=
|
github.com/hashicorp/terraform-exec v0.19.0/go.mod h1:tbxUpe3JKruE9Cuf65mycSIT8KiNPZ0FkuTE3H4urQg=
|
||||||
github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s=
|
github.com/hashicorp/terraform-json v0.17.1 h1:eMfvh/uWggKmY7Pmb3T85u86E2EQg6EQHgyRwf3RkyA=
|
||||||
github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM=
|
github.com/hashicorp/terraform-json v0.17.1/go.mod h1:Huy6zt6euxaY9knPAFKjUITn8QxUFIe9VuSzb4zn/0o=
|
||||||
github.com/hashicorp/terraform-plugin-docs v0.13.0 h1:6e+VIWsVGb6jYJewfzq2ok2smPzZrt1Wlm9koLeKazY=
|
github.com/hashicorp/terraform-plugin-docs v0.13.0 h1:6e+VIWsVGb6jYJewfzq2ok2smPzZrt1Wlm9koLeKazY=
|
||||||
github.com/hashicorp/terraform-plugin-docs v0.13.0/go.mod h1:W0oCmHAjIlTHBbvtppWHe8fLfZ2BznQbuv8+UD8OucQ=
|
github.com/hashicorp/terraform-plugin-docs v0.13.0/go.mod h1:W0oCmHAjIlTHBbvtppWHe8fLfZ2BznQbuv8+UD8OucQ=
|
||||||
github.com/hashicorp/terraform-plugin-go v0.14.2 h1:rhsVEOGCnY04msNymSvbUsXfRLKh9znXZmHlf5e8mhE=
|
github.com/hashicorp/terraform-plugin-go v0.19.0 h1:BuZx/6Cp+lkmiG0cOBk6Zps0Cb2tmqQpDM3iAtnhDQU=
|
||||||
github.com/hashicorp/terraform-plugin-go v0.14.2/go.mod h1:Q12UjumPNGiFsZffxOsA40Tlz1WVXt2Evh865Zj0+UA=
|
github.com/hashicorp/terraform-plugin-go v0.19.0/go.mod h1:EhRSkEPNoylLQntYsk5KrDHTZJh9HQoumZXbOGOXmec=
|
||||||
github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs=
|
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
|
||||||
github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4=
|
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
|
||||||
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1 h1:zHcMbxY0+rFO9gY99elV/XC/UnQVg7FhRCbj1i5b7vM=
|
github.com/hashicorp/terraform-plugin-sdk/v2 v2.30.0 h1:X7vB6vn5tON2b49ILa4W7mFAsndeqJ7bZFOGbVO+0Cc=
|
||||||
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1/go.mod h1:+tNlb0wkfdsDJ7JEiERLz4HzM19HyiuIoGzTsM7rPpw=
|
github.com/hashicorp/terraform-plugin-sdk/v2 v2.30.0/go.mod h1:ydFcxbdj6klCqYEPkPvdvFKiNGKZLUs+896ODUXCyao=
|
||||||
github.com/hashicorp/terraform-registry-address v0.1.0 h1:W6JkV9wbum+m516rCl5/NjKxCyTVaaUBbzYcMzBDO3U=
|
github.com/hashicorp/terraform-registry-address v0.2.2 h1:lPQBg403El8PPicg/qONZJDC6YlgCVbWDtNmmZKtBno=
|
||||||
github.com/hashicorp/terraform-registry-address v0.1.0/go.mod h1:EnyO2jYO6j29DTHbJcm00E5nQTFeTtyZH3H5ycydQ5A=
|
github.com/hashicorp/terraform-registry-address v0.2.2/go.mod h1:LtwNbCihUoUZ3RYriyS2wF/lGPB6gF9ICLRtuDk7hSo=
|
||||||
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0=
|
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
|
||||||
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg=
|
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 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
|
||||||
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
|
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
|
||||||
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||||
@@ -135,28 +116,19 @@ github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq
|
|||||||
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
|
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
|
||||||
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
github.com/huandu/xstrings v1.4.0/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.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||||
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
|
||||||
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
|
github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
|
||||||
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
|
|
||||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
||||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c=
|
||||||
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
|
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
|
||||||
github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE=
|
|
||||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck=
|
|
||||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
|
||||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
|
||||||
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
|
|
||||||
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||||
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
|
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
|
||||||
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
|
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
|
||||||
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
|
|
||||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||||
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||||
@@ -172,8 +144,6 @@ github.com/mitchellh/cli v1.1.5/go.mod h1:v8+iFts2sPIKUV1ltktPXMCC8fumSKFItNcD2c
|
|||||||
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
|
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 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
|
||||||
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
|
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
|
||||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
|
||||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
|
||||||
github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
|
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/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
|
||||||
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
|
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
|
||||||
@@ -183,11 +153,9 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR
|
|||||||
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
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 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
|
||||||
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
|
||||||
github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
|
github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
|
||||||
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
|
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||||
@@ -196,24 +164,20 @@ github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSg
|
|||||||
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
|
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
|
||||||
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
|
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
|
||||||
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
|
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
|
||||||
github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4=
|
|
||||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
|
||||||
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
||||||
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
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 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
|
||||||
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
|
||||||
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||||
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||||
|
github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM=
|
||||||
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
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 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
|
||||||
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
|
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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
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.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
@@ -226,64 +190,46 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
|
|||||||
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
||||||
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=
|
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=
|
||||||
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
||||||
github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U=
|
github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU=
|
||||||
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
|
github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
|
||||||
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
|
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
||||||
github.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vbd1qPqc=
|
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
||||||
github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
|
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
||||||
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
|
|
||||||
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
|
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
|
github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA=
|
||||||
github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
|
github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
|
||||||
github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
|
|
||||||
github.com/zclconf/go-cty v1.12.1 h1:PcupnljUm9EIvbgSHQnHhUr3fO6oFmkOrvs2BAFNXXY=
|
|
||||||
github.com/zclconf/go-cty v1.12.1/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA=
|
|
||||||
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
|
|
||||||
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
|
||||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
|
||||||
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
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.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||||
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
|
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||||
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
|
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||||
|
golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA=
|
||||||
|
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||||
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
|
||||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
|
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
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.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||||
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
|
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
|
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
||||||
|
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
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/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sync v0.1.0/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-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
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-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/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-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-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-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
@@ -293,51 +239,51 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/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.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.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
|
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
|
||||||
|
golang.org/x/sys v0.14.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-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.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||||
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
|
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
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.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
|
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||||
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
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.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/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
|
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||||
|
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
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=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
|
||||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
|
||||||
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
|
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
|
||||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||||
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 h1:jmIfw8+gSvXcZSgaFAGyInDXeWzUhvYH57G/5GKMn70=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM=
|
||||||
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
|
||||||
google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U=
|
google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg=
|
||||||
google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww=
|
google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
|
||||||
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
||||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
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.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.5.8 h1:NQ9cEZmWhqXzG3Gxsh0zkQjnqR/HI7JWbN9+EOqGUnE=
|
repository.basistech.ru/BASIS/decort-golang-sdk v1.7.7 h1:VIF+NXXfYec8DtlTcPae+CjB0fhH8ovBQxKMwEnLgE8=
|
||||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.5.8/go.mod h1:szsTGa73O75ckCWVGJPvTtRbhA/ubuYrYhMkPjvHlmE=
|
repository.basistech.ru/BASIS/decort-golang-sdk v1.7.7/go.mod h1:7fj8sgGZFiiExewQeqckCS4WxwOmU0oP6BO6mi1Lpkw=
|
||||||
|
|||||||
@@ -37,3 +37,6 @@ const MaxCpusPerCompute = 128
|
|||||||
|
|
||||||
// MinRamPerCompute sets minimum amount of RAM per compute in MB
|
// MinRamPerCompute sets minimum amount of RAM per compute in MB
|
||||||
const MinRamPerCompute = 128
|
const MinRamPerCompute = 128
|
||||||
|
|
||||||
|
// RAMDivisibility sets divisibility of RAM value
|
||||||
|
const RAMDivisibility = 128
|
||||||
|
|||||||
@@ -1,32 +1,33 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package constants
|
package constants
|
||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
// timeouts for API calls from CRUD functions of Terraform plugin
|
// timeouts for API calls from CRUD functions of Terraform plugin
|
||||||
var Timeout30s = time.Second * 30
|
var Timeout30s = time.Second * 30
|
||||||
var Timeout60s = time.Second * 60
|
var Timeout60s = time.Second * 60
|
||||||
var Timeout180s = time.Second * 180
|
var Timeout180s = time.Second * 180
|
||||||
var Timeout300s = time.Second * 300
|
var Timeout300s = time.Second * 300
|
||||||
var Timeout600s = time.Second * 600
|
var Timeout600s = time.Second * 600
|
||||||
var Timeout20m = time.Minute * 20
|
var Timeout900s = time.Second * 900
|
||||||
var Timeout30m = time.Minute * 30
|
var Timeout20m = time.Minute * 20
|
||||||
|
var Timeout30m = time.Minute * 30
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
@@ -21,17 +21,15 @@ limitations under the License.
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
// "time"
|
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/config"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/config"
|
||||||
@@ -39,31 +37,37 @@ import (
|
|||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker"
|
||||||
|
|
||||||
jwt "github.com/golang-jwt/jwt/v4"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
// enumerated constants that define authentication modes
|
// enumerated constants that define authentication modes
|
||||||
const (
|
const (
|
||||||
MODE_UNDEF = iota // this is the invalid mode - it should never be seen
|
MODE_UNDEF = iota // this is the invalid mode - it should never be seen
|
||||||
MODE_LEGACY = iota
|
MODE_LEGACY
|
||||||
MODE_OAUTH2 = iota
|
MODE_DECS3O
|
||||||
MODE_JWT = iota
|
MODE_JWT
|
||||||
|
MODE_BVS
|
||||||
)
|
)
|
||||||
|
|
||||||
type ControllerCfg struct {
|
type ControllerCfg struct {
|
||||||
controller_url string // always required
|
controller_url string // always required
|
||||||
auth_mode_code int // always required
|
auth_mode_code int // always required
|
||||||
auth_mode_txt string // always required, it is a text representation of auth mode
|
auth_mode_txt string // always required, it is a text representation of auth mode
|
||||||
|
bvs_user string // required for bvs mode
|
||||||
|
bvs_password string // required for bvs mode
|
||||||
|
domain string // required for bvs mode
|
||||||
|
token config.Token // obtained from BVS provider on successful login in bvs mode
|
||||||
|
path_cfg string // the path of the configuration file entry
|
||||||
|
path_token string // the path of the token file entry
|
||||||
|
time_to_refresh int64 // the number of minutes before the expiration of the token, a refresh will be made
|
||||||
legacy_user string // required for legacy mode
|
legacy_user string // required for legacy mode
|
||||||
legacy_password string // required for legacy mode
|
legacy_password string // required for legacy mode
|
||||||
legacy_sid string // obtained from DECORT controller on successful login in legacy mode
|
legacy_sid string // obtained from DECORT controller on successful login in legacy mode
|
||||||
jwt string // obtained from Outh2 provider on successful login in oauth2 mode, required in jwt mode
|
jwt string // obtained from Outh2 provider on successful login in decs3o mode, required in jwt mode
|
||||||
app_id string // required for oauth2 mode
|
app_id string // required for decs3o and bvs mode
|
||||||
app_secret string // required for oauth2 mode
|
app_secret string // required for decs3o and bvs mode
|
||||||
oauth2_url string // always required
|
oauth2_url string // required for decs3o and bvs mode
|
||||||
decort_username string // assigned to either legacy_user (legacy mode) or Oauth2 user (oauth2 mode) upon successful verification
|
decort_username string // assigned to either legacy_user (legacy mode) or Oauth2 user (decs3o mode) upon successful verification
|
||||||
cc_client *http.Client // assigned when all initial checks successfully passed
|
cc_client *http.Client // assigned when all initial checks successfully passed
|
||||||
caller interfaces.Caller
|
caller interfaces.Caller
|
||||||
}
|
}
|
||||||
@@ -86,17 +90,24 @@ func ControllerConfigure(d *schema.ResourceData) (*ControllerCfg, error) {
|
|||||||
legacy_user: d.Get("user").(string),
|
legacy_user: d.Get("user").(string),
|
||||||
legacy_password: d.Get("password").(string),
|
legacy_password: d.Get("password").(string),
|
||||||
legacy_sid: "",
|
legacy_sid: "",
|
||||||
|
bvs_user: d.Get("bvs_user").(string),
|
||||||
|
bvs_password: d.Get("bvs_password").(string),
|
||||||
|
domain: d.Get("domain").(string),
|
||||||
jwt: d.Get("jwt").(string),
|
jwt: d.Get("jwt").(string),
|
||||||
app_id: d.Get("app_id").(string),
|
app_id: d.Get("app_id").(string),
|
||||||
app_secret: d.Get("app_secret").(string),
|
app_secret: d.Get("app_secret").(string),
|
||||||
oauth2_url: d.Get("oauth2_url").(string),
|
oauth2_url: d.Get("oauth2_url").(string),
|
||||||
decort_username: "",
|
decort_username: "",
|
||||||
|
token: config.Token{},
|
||||||
|
path_cfg: d.Get("path_cfg").(string),
|
||||||
|
path_token: d.Get("path_token").(string),
|
||||||
|
time_to_refresh: int64(d.Get("time_to_refresh").(int)),
|
||||||
}
|
}
|
||||||
|
|
||||||
allow_unverified_ssl := d.Get("allow_unverified_ssl").(bool)
|
allow_unverified_ssl := d.Get("allow_unverified_ssl").(bool)
|
||||||
|
|
||||||
if ret_config.controller_url == "" {
|
if ret_config.controller_url == "" {
|
||||||
return nil, fmt.Errorf("Empty DECORT cloud controller URL provided.")
|
return nil, fmt.Errorf("empty DECORT cloud controller URL provided")
|
||||||
}
|
}
|
||||||
|
|
||||||
// this should have already been done by StateFunc defined in Schema, but we want to be sure
|
// this should have already been done by StateFunc defined in Schema, but we want to be sure
|
||||||
@@ -105,33 +116,53 @@ func ControllerConfigure(d *schema.ResourceData) (*ControllerCfg, error) {
|
|||||||
switch ret_config.auth_mode_txt {
|
switch ret_config.auth_mode_txt {
|
||||||
case "jwt":
|
case "jwt":
|
||||||
if ret_config.jwt == "" {
|
if ret_config.jwt == "" {
|
||||||
return nil, fmt.Errorf("Authenticator mode 'jwt' specified but no JWT provided.")
|
return nil, fmt.Errorf("authenticator mode 'jwt' specified but no JWT provided")
|
||||||
}
|
}
|
||||||
ret_config.auth_mode_code = MODE_JWT
|
ret_config.auth_mode_code = MODE_JWT
|
||||||
case "oauth2":
|
case "decs3o":
|
||||||
if ret_config.oauth2_url == "" {
|
if ret_config.oauth2_url == "" {
|
||||||
return nil, fmt.Errorf("Authenticator mode 'oauth2' specified but no OAuth2 URL provided.")
|
return nil, fmt.Errorf("authenticator mode 'decs3o' specified but no OAuth2 URL provided")
|
||||||
}
|
}
|
||||||
if ret_config.app_id == "" {
|
if ret_config.app_id == "" {
|
||||||
return nil, fmt.Errorf("Authenticator mode 'oauth2' specified but no Application ID provided.")
|
return nil, fmt.Errorf("authenticator mode 'decs3o' specified but no Application ID provided")
|
||||||
}
|
}
|
||||||
if ret_config.app_secret == "" {
|
if ret_config.app_secret == "" {
|
||||||
return nil, fmt.Errorf("Authenticator mode 'oauth2' specified but no Secret ID provided.")
|
return nil, fmt.Errorf("authenticator mode 'decs3o' specified but no Secret ID provided")
|
||||||
}
|
}
|
||||||
ret_config.auth_mode_code = MODE_OAUTH2
|
ret_config.auth_mode_code = MODE_DECS3O
|
||||||
case "legacy":
|
case "legacy":
|
||||||
//
|
//
|
||||||
ret_config.legacy_user = d.Get("user").(string)
|
ret_config.legacy_user = d.Get("user").(string)
|
||||||
if ret_config.legacy_user == "" {
|
if ret_config.legacy_user == "" {
|
||||||
return nil, fmt.Errorf("Authenticator mode 'legacy' specified but no user provided.")
|
return nil, fmt.Errorf("authenticator mode 'legacy' specified but no user provided")
|
||||||
}
|
}
|
||||||
ret_config.legacy_password = d.Get("password").(string)
|
ret_config.legacy_password = d.Get("password").(string)
|
||||||
if ret_config.legacy_password == "" {
|
if ret_config.legacy_password == "" {
|
||||||
return nil, fmt.Errorf("Authenticator mode 'legacy' specified but no password provided.")
|
return nil, fmt.Errorf("authenticator mode 'legacy' specified but no password provided")
|
||||||
}
|
}
|
||||||
ret_config.auth_mode_code = MODE_LEGACY
|
ret_config.auth_mode_code = MODE_LEGACY
|
||||||
|
case "bvs":
|
||||||
|
if ret_config.bvs_user == "" {
|
||||||
|
return nil, fmt.Errorf("authenticator mode 'bvs' specified but no user provided")
|
||||||
|
}
|
||||||
|
if ret_config.bvs_password == "" {
|
||||||
|
return nil, fmt.Errorf("authenticator mode 'bvs' specified but no password provided")
|
||||||
|
}
|
||||||
|
if ret_config.oauth2_url == "" {
|
||||||
|
return nil, fmt.Errorf("authenticator mode 'bvs' specified but no bvs URL provided")
|
||||||
|
}
|
||||||
|
if ret_config.app_id == "" {
|
||||||
|
return nil, fmt.Errorf("authenticator mode 'bvs' specified but no Application ID provided")
|
||||||
|
}
|
||||||
|
if ret_config.app_secret == "" {
|
||||||
|
return nil, fmt.Errorf("authenticator mode 'bvs' specified but no Secret ID provided")
|
||||||
|
}
|
||||||
|
if ret_config.domain == "" {
|
||||||
|
return nil, fmt.Errorf("authenticator mode 'bvs' specified but no Domain provided")
|
||||||
|
}
|
||||||
|
ret_config.auth_mode_code = MODE_BVS
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("Unknown authenticator mode %q provided.", ret_config.auth_mode_txt)
|
return nil, fmt.Errorf("unknown authenticator mode %q provided", ret_config.auth_mode_txt)
|
||||||
}
|
}
|
||||||
|
|
||||||
if allow_unverified_ssl {
|
if allow_unverified_ssl {
|
||||||
@@ -167,30 +198,30 @@ func ControllerConfigure(d *schema.ResourceData) (*ControllerCfg, error) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
case MODE_OAUTH2:
|
case MODE_DECS3O:
|
||||||
// on success getOAuth2JWT will set config.jwt to the obtained JWT, so there is no
|
// on success getDECS3OJWT will set config.jwt to the obtained JWT, so there is no
|
||||||
// need to set it once again here
|
// need to set it once again here
|
||||||
_, err := ret_config.getOAuth2JWT()
|
// _, err := ret_config.getDECS3OJWT()
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return nil, err
|
// return nil, err
|
||||||
}
|
// }
|
||||||
// we are not verifying the JWT when parsing because actual verification is done on the
|
// we are not verifying the JWT when parsing because actual verification is done on the
|
||||||
// OVC controller side. Here we do parsing solely to extract Oauth2 user name (claim "user")
|
// OVC controller side. Here we do parsing solely to extract Oauth2 user name (claim "user")
|
||||||
// and JWT issuer name (claim "iss")
|
// and JWT issuer name (claim "iss")
|
||||||
parser := jwt.Parser{}
|
// parser := jwt.Parser{}
|
||||||
token, _, err := parser.ParseUnverified(ret_config.jwt, jwt.MapClaims{})
|
// token, _, err := parser.ParseUnverified(ret_config.jwt, jwt.MapClaims{})
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return nil, err
|
// return nil, err
|
||||||
}
|
// }
|
||||||
if claims, ok := token.Claims.(jwt.MapClaims); ok {
|
// if claims, ok := token.Claims.(jwt.MapClaims); ok {
|
||||||
var tbuf bytes.Buffer
|
// var tbuf bytes.Buffer
|
||||||
tbuf.WriteString(claims["username"].(string))
|
// tbuf.WriteString(claims["username"].(string))
|
||||||
tbuf.WriteString("@")
|
// tbuf.WriteString("@")
|
||||||
tbuf.WriteString(claims["iss"].(string))
|
// tbuf.WriteString(claims["iss"].(string))
|
||||||
ret_config.decort_username = tbuf.String()
|
// ret_config.decort_username = tbuf.String()
|
||||||
} else {
|
// } else {
|
||||||
return nil, fmt.Errorf("Failed to extract user and iss fields from JWT token in oauth2 mode.")
|
// return nil, fmt.Errorf("failed to extract user and iss fields from JWT token in oauth2 mode")
|
||||||
}
|
// }
|
||||||
|
|
||||||
sdkConf := config.Config{
|
sdkConf := config.Config{
|
||||||
AppID: ret_config.app_id,
|
AppID: ret_config.app_id,
|
||||||
@@ -201,10 +232,27 @@ func ControllerConfigure(d *schema.ResourceData) (*ControllerCfg, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret_config.caller = decort.New(sdkConf)
|
ret_config.caller = decort.New(sdkConf)
|
||||||
|
case MODE_BVS:
|
||||||
|
|
||||||
|
sdkConf := config.BVSConfig{
|
||||||
|
AppID: ret_config.app_id,
|
||||||
|
AppSecret: ret_config.app_secret,
|
||||||
|
SSOURL: ret_config.oauth2_url,
|
||||||
|
DecortURL: ret_config.controller_url,
|
||||||
|
SSLSkipVerify: allow_unverified_ssl,
|
||||||
|
Username: ret_config.bvs_user,
|
||||||
|
Password: ret_config.bvs_password,
|
||||||
|
Domain: ret_config.domain,
|
||||||
|
Token: ret_config.token,
|
||||||
|
PathCfg: ret_config.path_cfg,
|
||||||
|
PathToken: ret_config.path_token,
|
||||||
|
TimeToRefresh: ret_config.time_to_refresh,
|
||||||
|
}
|
||||||
|
|
||||||
|
ret_config.caller = decort.NewBVS(sdkConf)
|
||||||
default:
|
default:
|
||||||
// FYI, this should never happen due to all above checks, but we want to be fool proof
|
// FYI, this should never happen due to all above checks, but we want to be fool proof
|
||||||
return nil, fmt.Errorf("Unknown authenticator mode code %d provided.", ret_config.auth_mode_code)
|
return nil, fmt.Errorf("unknown authenticator mode code %d provided", ret_config.auth_mode_code)
|
||||||
}
|
}
|
||||||
|
|
||||||
// All checks passed successfully, credentials corresponding to the selected authenticator mode
|
// All checks passed successfully, credentials corresponding to the selected authenticator mode
|
||||||
@@ -212,57 +260,57 @@ func ControllerConfigure(d *schema.ResourceData) (*ControllerCfg, error) {
|
|||||||
return ret_config, nil
|
return ret_config, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (config *ControllerCfg) GetDecortUsername() string {
|
// func (config *ControllerCfg) GetDecortUsername() string {
|
||||||
return config.decort_username
|
// return config.decort_username
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (config *ControllerCfg) getOAuth2JWT() (string, error) {
|
// func (config *ControllerCfg) getDECS3OJWT() (string, error) {
|
||||||
// Obtain JWT from the Oauth2 provider using application ID and application secret provided in config.
|
// // Obtain JWT from the Oauth2 provider using application ID and application secret provided in config.
|
||||||
if config.auth_mode_code == MODE_UNDEF {
|
// if config.auth_mode_code == MODE_UNDEF {
|
||||||
return "", fmt.Errorf("getOAuth2JWT method called for undefined authorization mode.")
|
// return "", fmt.Errorf("getOAuth2JWT method called for undefined authorization mode")
|
||||||
}
|
// }
|
||||||
if config.auth_mode_code != MODE_OAUTH2 {
|
// if config.auth_mode_code != MODE_DECS3O {
|
||||||
return "", fmt.Errorf("getOAuth2JWT method called for incompatible authorization mode %q.", config.auth_mode_txt)
|
// return "", fmt.Errorf("getOAuth2JWT method called for incompatible authorization mode %q", config.auth_mode_txt)
|
||||||
}
|
// }
|
||||||
|
|
||||||
params := url.Values{}
|
// params := url.Values{}
|
||||||
params.Add("grant_type", "client_credentials")
|
// params.Add("grant_type", "client_credentials")
|
||||||
params.Add("client_id", config.app_id)
|
// params.Add("client_id", config.app_id)
|
||||||
params.Add("client_secret", config.app_secret)
|
// params.Add("client_secret", config.app_secret)
|
||||||
params.Add("response_type", "id_token")
|
// params.Add("response_type", "id_token")
|
||||||
params.Add("validity", "3600")
|
// params.Add("validity", "3600")
|
||||||
params_str := params.Encode()
|
// params_str := params.Encode()
|
||||||
|
|
||||||
req, err := http.NewRequest("POST", config.oauth2_url+"/v1/oauth/access_token", strings.NewReader(params_str))
|
// req, err := http.NewRequest("POST", config.oauth2_url+"/v1/oauth/access_token", strings.NewReader(params_str))
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return "", err
|
// return "", err
|
||||||
}
|
// }
|
||||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
// req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||||
req.Header.Set("Content-Length", strconv.Itoa(len(params_str)))
|
// req.Header.Set("Content-Length", strconv.Itoa(len(params_str)))
|
||||||
|
|
||||||
resp, err := config.cc_client.Do(req)
|
// resp, err := config.cc_client.Do(req)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return "", err
|
// return "", err
|
||||||
}
|
// }
|
||||||
if resp.StatusCode != http.StatusOK {
|
// if resp.StatusCode != http.StatusOK {
|
||||||
// fmt.Println("response Status:", resp.Status)
|
// // fmt.Println("response Status:", resp.Status)
|
||||||
// fmt.Println("response Headers:", resp.Header)
|
// // fmt.Println("response Headers:", resp.Header)
|
||||||
// fmt.Println("response Headers:", req.URL)
|
// // fmt.Println("response Headers:", req.URL)
|
||||||
return "", fmt.Errorf("getOauth2JWT: unexpected status code %d when obtaining JWT from %q for APP_ID %q, request Body %q",
|
// return "", fmt.Errorf("getOauth2JWT: unexpected status code %d when obtaining JWT from %q for APP_ID %q, request Body %q",
|
||||||
resp.StatusCode, req.URL, config.app_id, params_str)
|
// resp.StatusCode, req.URL, config.app_id, params_str)
|
||||||
}
|
// }
|
||||||
defer resp.Body.Close()
|
// defer resp.Body.Close()
|
||||||
|
|
||||||
responseData, err := ioutil.ReadAll(resp.Body)
|
// responseData, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return "", err
|
// return "", err
|
||||||
}
|
// }
|
||||||
|
|
||||||
// validation successful - store JWT in the corresponding field of the ControllerCfg structure
|
// // validation successful - store JWT in the corresponding field of the ControllerCfg structure
|
||||||
config.jwt = strings.TrimSpace(string(responseData))
|
// config.jwt = strings.TrimSpace(string(responseData))
|
||||||
|
|
||||||
return config.jwt, nil
|
// return config.jwt, nil
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (config *ControllerCfg) validateJWT(jwt string) (bool, error) {
|
func (config *ControllerCfg) validateJWT(jwt string) (bool, error) {
|
||||||
/*
|
/*
|
||||||
@@ -273,13 +321,13 @@ func (config *ControllerCfg) validateJWT(jwt string) (bool, error) {
|
|||||||
*/
|
*/
|
||||||
if jwt == "" {
|
if jwt == "" {
|
||||||
if config.jwt == "" {
|
if config.jwt == "" {
|
||||||
return false, fmt.Errorf("validateJWT method called, but no meaningful JWT provided.")
|
return false, fmt.Errorf("validateJWT method called, but no meaningful JWT provided")
|
||||||
}
|
}
|
||||||
jwt = config.jwt
|
jwt = config.jwt
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.oauth2_url == "" {
|
if config.oauth2_url == "" {
|
||||||
return false, fmt.Errorf("validateJWT method called, but no OAuth2 URL provided.")
|
return false, fmt.Errorf("validateJWT method called, but no OAuth2 URL provided")
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := http.NewRequest("POST", config.controller_url+"/restmachine/cloudapi/account/list", nil)
|
req, err := http.NewRequest("POST", config.controller_url+"/restmachine/cloudapi/account/list", nil)
|
||||||
@@ -296,7 +344,7 @@ func (config *ControllerCfg) validateJWT(jwt string) (bool, error) {
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
return false, fmt.Errorf("validateJWT: unexpected status code %d when validating JWT against %q.",
|
return false, fmt.Errorf("validateJWT: unexpected status code %d when validating JWT against %q",
|
||||||
resp.StatusCode, req.URL)
|
resp.StatusCode, req.URL)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
@@ -312,10 +360,10 @@ func (config *ControllerCfg) validateLegacyUser() (bool, error) {
|
|||||||
reason, the method will return false and error.
|
reason, the method will return false and error.
|
||||||
*/
|
*/
|
||||||
if config.auth_mode_code == MODE_UNDEF {
|
if config.auth_mode_code == MODE_UNDEF {
|
||||||
return false, fmt.Errorf("validateLegacyUser method called for undefined authorization mode.")
|
return false, fmt.Errorf("validateLegacyUser method called for undefined authorization mode")
|
||||||
}
|
}
|
||||||
if config.auth_mode_code != MODE_LEGACY {
|
if config.auth_mode_code != MODE_LEGACY {
|
||||||
return false, fmt.Errorf("validateLegacyUser method called for incompatible authorization mode %q.", config.auth_mode_txt)
|
return false, fmt.Errorf("validateLegacyUser method called for incompatible authorization mode %q", config.auth_mode_txt)
|
||||||
}
|
}
|
||||||
|
|
||||||
params := url.Values{}
|
params := url.Values{}
|
||||||
@@ -336,12 +384,12 @@ func (config *ControllerCfg) validateLegacyUser() (bool, error) {
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
return false, fmt.Errorf("validateLegacyUser: unexpected status code %d when validating legacy user %q against %q.",
|
return false, fmt.Errorf("validateLegacyUser: unexpected status code %d when validating legacy user %q against %q",
|
||||||
resp.StatusCode, config.legacy_user, config.controller_url)
|
resp.StatusCode, config.legacy_user, config.controller_url)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
responseData, err := ioutil.ReadAll(resp.Body)
|
responseData, err := io.ReadAll(req.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -353,21 +401,32 @@ func (config *ControllerCfg) validateLegacyUser() (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (config *ControllerCfg) CloudAPI() *cloudapi.CloudAPI {
|
func (config *ControllerCfg) CloudAPI() *cloudapi.CloudAPI {
|
||||||
if config.auth_mode_code == MODE_LEGACY {
|
switch config.auth_mode_code {
|
||||||
|
case MODE_LEGACY:
|
||||||
client, _ := config.caller.(*decort.LegacyDecortClient)
|
client, _ := config.caller.(*decort.LegacyDecortClient)
|
||||||
return client.CloudAPI()
|
return client.CloudAPI()
|
||||||
|
case MODE_DECS3O:
|
||||||
|
client, _ := config.caller.(*decort.DecortClient)
|
||||||
|
return client.CloudAPI()
|
||||||
|
case MODE_BVS:
|
||||||
|
client, _ := config.caller.(*decort.BVSDecortClient)
|
||||||
|
return client.CloudAPI()
|
||||||
|
default:
|
||||||
|
return &cloudapi.CloudAPI{}
|
||||||
}
|
}
|
||||||
|
|
||||||
client, _ := config.caller.(*decort.DecortClient)
|
|
||||||
return client.CloudAPI()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (config *ControllerCfg) CloudBroker() *cloudbroker.CloudBroker {
|
func (config *ControllerCfg) CloudBroker() *cloudbroker.CloudBroker {
|
||||||
if config.auth_mode_code == MODE_LEGACY {
|
switch config.auth_mode_code {
|
||||||
|
case MODE_LEGACY:
|
||||||
client, _ := config.caller.(*decort.LegacyDecortClient)
|
client, _ := config.caller.(*decort.LegacyDecortClient)
|
||||||
return client.CloudBroker()
|
return client.CloudBroker()
|
||||||
|
case MODE_DECS3O:
|
||||||
|
client, _ := config.caller.(*decort.DecortClient)
|
||||||
|
return client.CloudBroker()
|
||||||
|
case MODE_BVS:
|
||||||
|
client, _ := config.caller.(*decort.BVSDecortClient)
|
||||||
|
return client.CloudBroker()
|
||||||
|
default:
|
||||||
|
return &cloudbroker.CloudBroker{}
|
||||||
}
|
}
|
||||||
|
|
||||||
client, _ := config.caller.(*decort.DecortClient)
|
|
||||||
return client.CloudBroker()
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +1,65 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Authors:
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
you may not use this file except in compliance with the License.
|
Nikita Sorokin, <nesorokin@basistech.ru>
|
||||||
You may obtain a copy of the License at
|
Tim Tkachev, <tvtkachev@basistech.ru>
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
Unless required by applicable law or agreed to in writing, software
|
You may obtain a copy of the License at
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
Unless required by applicable law or agreed to in writing, software
|
||||||
*/
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
/*
|
See the License for the specific language governing permissions and
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
limitations under the License.
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
*/
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Please see README.md to learn where to place source code so that it
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
builds seamlessly.
|
|
||||||
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
|
||||||
*/
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
package snapshot
|
|
||||||
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
const snapshotCreateAPI = "/restmachine/cloudbroker/compute/snapshotCreate"
|
*/
|
||||||
const snapshotDeleteAPI = "/restmachine/cloudbroker/compute/snapshotDelete"
|
|
||||||
const snapshotRollbackAPI = "/restmachine/cloudbroker/compute/snapshotRollback"
|
package dc
|
||||||
const snapshotListAPI = "/restmachine/cloudbroker/compute/snapshotList"
|
|
||||||
|
import "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
|
||||||
|
func ErrorsToDiagnostics(errs []error) diag.Diagnostics {
|
||||||
|
if len(errs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
diags := diag.Diagnostics{}
|
||||||
|
|
||||||
|
for _, err := range errs {
|
||||||
|
diags = append(diags, diag.Diagnostic{
|
||||||
|
Severity: diag.Error,
|
||||||
|
Summary: err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return diags
|
||||||
|
}
|
||||||
|
|
||||||
|
func ErrorsToWarnings(errs []error) Warnings {
|
||||||
|
w := Warnings{}
|
||||||
|
|
||||||
|
for _, err := range errs {
|
||||||
|
w.Add(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return w
|
||||||
|
}
|
||||||
@@ -1,159 +1,254 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package provider
|
package provider
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/account"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/account"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/bservice"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/bservice"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/disks"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/disks"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/extnet"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/extnet"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/flipgroup"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/flipgroup"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/image"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/image"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/k8s"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/k8s"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/kvmvm"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/kvmvm"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/lb"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/lb"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/locations"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/locations"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/rg"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/rg"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/snapshot"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/snapshot"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/vins"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/stack"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/vins"
|
||||||
cb_account "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/account"
|
|
||||||
cb_disks "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/disks"
|
cb_account "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/account"
|
||||||
cb_extnet "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/extnet"
|
cb_audit "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/audit"
|
||||||
cb_grid "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/grid"
|
cb_disks "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/disks"
|
||||||
cb_image "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/image"
|
cb_extnet "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/extnet"
|
||||||
cb_pcidevice "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/pcidevice"
|
cb_flipgroup "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/flipgroup"
|
||||||
cb_rg "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/rg"
|
cb_grid "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/grid"
|
||||||
cb_sep "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/sep"
|
cb_image "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/image"
|
||||||
cb_vgpu "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/vgpu"
|
cb_kvmvm "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/kvmvm"
|
||||||
)
|
cb_lb "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/lb"
|
||||||
|
cb_pcidevice "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/pcidevice"
|
||||||
func newDataSourcesMap() map[string]*schema.Resource {
|
cb_rg "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/rg"
|
||||||
return map[string]*schema.Resource{
|
cb_sep "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/sep"
|
||||||
"decort_account": account.DataSourceAccount(),
|
cb_stack "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/stack"
|
||||||
"decort_resgroup": rg.DataSourceResgroup(),
|
cb_vins "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/vins"
|
||||||
"decort_kvmvm": kvmvm.DataSourceCompute(),
|
|
||||||
"decort_kvmvm_list": kvmvm.DataSourceComputeList(),
|
// cb_vgpu "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/vgpu"
|
||||||
"decort_kvmvm_audits": kvmvm.DataSourceComputeAudits(),
|
cb_k8ci "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/k8ci"
|
||||||
"decort_kvmvm_get_audits": kvmvm.DataSourceComputeGetAudits(),
|
cb_k8s "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/k8s"
|
||||||
"decort_kvmvm_get_console_url": kvmvm.DataSourceComputeGetConsoleUrl(),
|
)
|
||||||
"decort_kvmvm_get_log": kvmvm.DataSourceComputeGetLog(),
|
|
||||||
"decort_kvmvm_pfw_list": kvmvm.DataSourceComputePfwList(),
|
func newDataSourcesMap() map[string]*schema.Resource {
|
||||||
"decort_kvmvm_user_list": kvmvm.DataSourceComputeUserList(),
|
return map[string]*schema.Resource{
|
||||||
"decort_kvmvm_snapshot_usage": kvmvm.DataSourceComputeSnapshotUsage(),
|
"decort_account": account.DataSourceAccount(),
|
||||||
"decort_k8s": k8s.DataSourceK8s(),
|
"decort_resgroup": rg.DataSourceResgroup(),
|
||||||
"decort_k8s_list": k8s.DataSourceK8sList(),
|
"decort_kvmvm": kvmvm.DataSourceCompute(),
|
||||||
"decort_k8s_list_deleted": k8s.DataSourceK8sListDeleted(),
|
"decort_kvmvm_list": kvmvm.DataSourceComputeList(),
|
||||||
"decort_k8s_wg": k8s.DataSourceK8sWg(),
|
"decort_kvmvm_audits": kvmvm.DataSourceComputeAudits(),
|
||||||
"decort_k8s_wg_list": k8s.DataSourceK8sWgList(),
|
"decort_kvmvm_get_audits": kvmvm.DataSourceComputeGetAudits(),
|
||||||
"decort_k8s_computes": k8s.DataSourceK8sComputes(),
|
"decort_kvmvm_get_console_url": kvmvm.DataSourceComputeGetConsoleUrl(),
|
||||||
"decort_k8ci_list": k8s.DataSourceK8CIList(),
|
"decort_kvmvm_get_log": kvmvm.DataSourceComputeGetLog(),
|
||||||
"decort_vins": vins.DataSourceVins(),
|
"decort_kvmvm_pfw_list": kvmvm.DataSourceComputePfwList(),
|
||||||
"decort_vins_list": vins.DataSourceVinsList(),
|
"decort_kvmvm_user_list": kvmvm.DataSourceComputeUserList(),
|
||||||
"decort_vins_audits": vins.DataSourceVinsAudits(),
|
"decort_kvmvm_snapshot_usage": kvmvm.DataSourceComputeSnapshotUsage(),
|
||||||
"decort_vins_ip_list": vins.DataSourceVinsIpList(),
|
"decort_k8s": k8s.DataSourceK8s(),
|
||||||
"decort_vins_list_deleted": vins.DataSourceVinsListDeleted(),
|
"decort_k8s_list": k8s.DataSourceK8sList(),
|
||||||
"decort_vins_ext_net_list": vins.DataSourceVinsExtNetList(),
|
"decort_k8s_list_deleted": k8s.DataSourceK8sListDeleted(),
|
||||||
"decort_vins_nat_rule_list": vins.DataSourceVinsNatRuleList(),
|
"decort_k8s_wg": k8s.DataSourceK8sWg(),
|
||||||
"decort_snapshot_list": snapshot.DataSourceSnapshotList(),
|
"decort_k8s_wg_list": k8s.DataSourceK8sWgList(),
|
||||||
"decort_disk": disks.DataSourceDisk(),
|
"decort_k8s_computes": k8s.DataSourceK8sComputes(),
|
||||||
"decort_disk_list": disks.DataSourceDiskList(),
|
"decort_k8ci_list": k8s.DataSourceK8CIList(),
|
||||||
"decort_rg_list": rg.DataSourceRgList(),
|
"decort_vins": vins.DataSourceVins(),
|
||||||
"decort_rg_affinity_group_computes": rg.DataSourceRgAffinityGroupComputes(),
|
"decort_vins_list": vins.DataSourceVinsList(),
|
||||||
"decort_rg_affinity_groups_list": rg.DataSourceRgAffinityGroupsList(),
|
"decort_vins_audits": vins.DataSourceVinsAudits(),
|
||||||
"decort_rg_affinity_groups_get": rg.DataSourceRgAffinityGroupsGet(),
|
"decort_vins_ip_list": vins.DataSourceVinsIpList(),
|
||||||
"decort_rg_audits": rg.DataSourceRgAudits(),
|
"decort_vins_list_deleted": vins.DataSourceVinsListDeleted(),
|
||||||
"decort_rg_list_computes": rg.DataSourceRgListComputes(),
|
"decort_vins_ext_net_list": vins.DataSourceVinsExtNetList(),
|
||||||
"decort_rg_list_deleted": rg.DataSourceRgListDeleted(),
|
"decort_vins_nat_rule_list": vins.DataSourceVinsNatRuleList(),
|
||||||
"decort_rg_list_lb": rg.DataSourceRgListLb(),
|
"decort_vins_static_route_list": vins.DataSourceStaticRouteList(),
|
||||||
"decort_rg_list_pfw": rg.DataSourceRgListPfw(),
|
"decort_vins_static_route": vins.DataSourceStaticRoute(),
|
||||||
"decort_rg_list_vins": rg.DataSourceRgListVins(),
|
"decort_snapshot_list": snapshot.DataSourceSnapshotList(),
|
||||||
"decort_rg_usage": rg.DataSourceRgUsage(),
|
"decort_disk": disks.DataSourceDisk(),
|
||||||
"decort_disk_list_types_detailed": disks.DataSourceDiskListTypesDetailed(),
|
"decort_disk_list": disks.DataSourceDiskList(),
|
||||||
"decort_disk_list_types": disks.DataSourceDiskListTypes(),
|
"decort_rg_list": rg.DataSourceRgList(),
|
||||||
"decort_disk_list_deleted": disks.DataSourceDiskListDeleted(),
|
"decort_rg_affinity_group_computes": rg.DataSourceRgAffinityGroupComputes(),
|
||||||
"decort_disk_list_unattached": disks.DataSourceDiskListUnattached(),
|
"decort_rg_affinity_groups_list": rg.DataSourceRgAffinityGroupsList(),
|
||||||
"decort_disk_snapshot": disks.DataSourceDiskSnapshot(),
|
"decort_rg_affinity_groups_get": rg.DataSourceRgAffinityGroupsGet(),
|
||||||
"decort_disk_snapshot_list": disks.DataSourceDiskSnapshotList(),
|
"decort_rg_audits": rg.DataSourceRgAudits(),
|
||||||
"decort_account_list": account.DataSourceAccountList(),
|
"decort_rg_list_computes": rg.DataSourceRgListComputes(),
|
||||||
"decort_account_computes_list": account.DataSourceAccountComputesList(),
|
"decort_rg_list_deleted": rg.DataSourceRgListDeleted(),
|
||||||
"decort_account_disks_list": account.DataSourceAccountDisksList(),
|
"decort_rg_list_lb": rg.DataSourceRgListLb(),
|
||||||
"decort_account_vins_list": account.DataSourceAccountVinsList(),
|
"decort_rg_list_pfw": rg.DataSourceRgListPfw(),
|
||||||
"decort_account_audits_list": account.DataSourceAccountAuditsList(),
|
"decort_rg_list_vins": rg.DataSourceRgListVins(),
|
||||||
"decort_account_rg_list": account.DataSourceAccountRGList(),
|
"decort_rg_usage": rg.DataSourceRgUsage(),
|
||||||
"decort_account_consumed_units": account.DataSourceAccountConsumedUnits(),
|
"decort_disk_list_types_detailed": disks.DataSourceDiskListTypesDetailed(),
|
||||||
"decort_account_consumed_units_by_type": account.DataSourceAccountConsumedUnitsByType(),
|
"decort_disk_list_types": disks.DataSourceDiskListTypes(),
|
||||||
"decort_account_reserved_units": account.DataSourceAccountReservedUnits(),
|
"decort_disk_list_deleted": disks.DataSourceDiskListDeleted(),
|
||||||
"decort_account_templates_list": account.DataSourceAccountTemplatessList(),
|
"decort_disk_list_unattached": disks.DataSourceDiskListUnattached(),
|
||||||
"decort_account_deleted_list": account.DataSourceAccountDeletedList(),
|
"decort_disk_snapshot": disks.DataSourceDiskSnapshot(),
|
||||||
"decort_account_flipgroups_list": account.DataSourceAccountFlipGroupsList(),
|
"decort_disk_snapshot_list": disks.DataSourceDiskSnapshotList(),
|
||||||
"decort_bservice_list": bservice.DataSourceBasicServiceList(),
|
"decort_account_list": account.DataSourceAccountList(),
|
||||||
"decort_bservice": bservice.DataSourceBasicService(),
|
"decort_account_computes_list": account.DataSourceAccountComputesList(),
|
||||||
"decort_bservice_snapshot_list": bservice.DataSourceBasicServiceSnapshotList(),
|
"decort_account_disks_list": account.DataSourceAccountDisksList(),
|
||||||
"decort_bservice_group": bservice.DataSourceBasicServiceGroup(),
|
"decort_account_vins_list": account.DataSourceAccountVinsList(),
|
||||||
"decort_bservice_deleted_list": bservice.DataSourceBasicServiceDeletedList(),
|
"decort_account_audits_list": account.DataSourceAccountAuditsList(),
|
||||||
"decort_extnet_list": extnet.DataSourceExtnetList(),
|
"decort_account_rg_list": account.DataSourceAccountRGList(),
|
||||||
"decort_extnet_computes_list": extnet.DataSourceExtnetComputesList(),
|
"decort_account_consumed_units": account.DataSourceAccountConsumedUnits(),
|
||||||
"decort_extnet": extnet.DataSourceExtnet(),
|
"decort_account_consumed_units_by_type": account.DataSourceAccountConsumedUnitsByType(),
|
||||||
"decort_extnet_default": extnet.DataSourceExtnetDefault(),
|
"decort_account_reserved_units": account.DataSourceAccountReservedUnits(),
|
||||||
"decort_locations_list": locations.DataSourceLocationsList(),
|
"decort_account_templates_list": account.DataSourceAccountTemplatessList(),
|
||||||
"decort_location_url": locations.DataSourceLocationUrl(),
|
"decort_account_deleted_list": account.DataSourceAccountDeletedList(),
|
||||||
"decort_image_list": image.DataSourceImageList(),
|
"decort_account_flipgroups_list": account.DataSourceAccountFlipGroupsList(),
|
||||||
"decort_image": image.DataSourceImage(),
|
"decort_bservice_list": bservice.DataSourceBasicServiceList(),
|
||||||
"decort_lb": lb.DataSourceLB(),
|
"decort_bservice": bservice.DataSourceBasicService(),
|
||||||
"decort_lb_list": lb.DataSourceLBList(),
|
"decort_bservice_snapshot_list": bservice.DataSourceBasicServiceSnapshotList(),
|
||||||
"decort_lb_list_deleted": lb.DataSourceLBListDeleted(),
|
"decort_bservice_group": bservice.DataSourceBasicServiceGroup(),
|
||||||
"decort_flipgroup": flipgroup.DataSourceFlipgroup(),
|
"decort_bservice_deleted_list": bservice.DataSourceBasicServiceDeletedList(),
|
||||||
"decort_flipgroup_list": flipgroup.DataSourceFlipGroupList(),
|
"decort_extnet_list": extnet.DataSourceExtnetList(),
|
||||||
|
"decort_extnet_computes_list": extnet.DataSourceExtnetComputesList(),
|
||||||
"decort_cb_account": cb_account.DataSourceAccount(),
|
"decort_extnet": extnet.DataSourceExtnet(),
|
||||||
"decort_cb_account_list": cb_account.DataSourceAccountList(),
|
"decort_extnet_default": extnet.DataSourceExtnetDefault(),
|
||||||
"decort_cb_account_computes_list": cb_account.DataSourceAccountComputesList(),
|
"decort_locations_list": locations.DataSourceLocationsList(),
|
||||||
"decort_cb_account_deleted_list": cb_account.DataSourceAccountDeletedList(),
|
"decort_location_url": locations.DataSourceLocationUrl(),
|
||||||
"decort_cb_account_disks_list": cb_account.DataSourceAccountDisksList(),
|
"decort_image_list": image.DataSourceImageList(),
|
||||||
"decort_cb_account_flipgroups_list": cb_account.DataSourceAccountFlipGroupsList(),
|
"decort_image": image.DataSourceImage(),
|
||||||
"decort_cb_account_rg_list": cb_account.DataSourceAccountRGList(),
|
"decort_lb": lb.DataSourceLB(),
|
||||||
"decort_cb_account_vins_list": cb_account.DataSourceAccountVinsList(),
|
"decort_lb_list": lb.DataSourceLBList(),
|
||||||
"decort_cb_account_audits_list": cb_account.DataSourceAccountAuditsList(),
|
"decort_lb_list_deleted": lb.DataSourceLBListDeleted(),
|
||||||
"decort_cb_extnet": cb_extnet.DataSourceExtnetCB(),
|
"decort_flipgroup": flipgroup.DataSourceFlipgroup(),
|
||||||
"decort_cb_extnet_list": cb_extnet.DataSourceExtnetListCB(),
|
"decort_flipgroup_list": flipgroup.DataSourceFlipGroupList(),
|
||||||
"decort_cb_extnet_default": cb_extnet.DataSourceExtnetDefaultCB(),
|
"decort_stack": stack.DataSourceStack(),
|
||||||
"decort_cb_disk": cb_disks.DataSourceDisk(),
|
"decort_stack_list": stack.DataSourceStackList(),
|
||||||
"decort_cb_disk_list": cb_disks.DataSourceDiskList(),
|
"decort_account_resource_consumption_list": account.DataSourceAccountResourceConsumptionList(),
|
||||||
"decort_cb_image": cb_image.DataSourceImage(),
|
"decort_account_resource_consumption_get": account.DataSourceAccountResourceConsumptionGet(),
|
||||||
"decort_cb_grid": cb_grid.DataSourceGrid(),
|
"decort_kvmvm_list_deleted": kvmvm.DataSourceComputeListDeleted(),
|
||||||
"decort_cb_grid_list": cb_grid.DataSourceGridList(),
|
"decort_kvmvm_vgpu_list": kvmvm.DataSourceComputeVGPUList(),
|
||||||
"decort_cb_image_list": cb_image.DataSourceImageList(),
|
"decort_kvmvm_pci_device_list": kvmvm.DataSourceComputePCIDeviceList(),
|
||||||
"decort_cb_image_list_stacks": cb_image.DataSourceImageListStacks(),
|
"decort_k8s_wg_cloud_init": k8s.DataSourceK8sWgCloudInit(),
|
||||||
"decort_cb_pcidevice": cb_pcidevice.DataSourcePcidevice(),
|
"decort_rg_resource_consumption_list": rg.DataSourceRGResourceConsumptionList(),
|
||||||
"decort_cb_pcidevice_list": cb_pcidevice.DataSourcePcideviceList(),
|
"decort_rg_resource_consumption_get": rg.DataSourceRGResourceConsumptionGet(),
|
||||||
"decort_cb_sep_list": cb_sep.DataSourceSepList(),
|
|
||||||
"decort_cb_sep": cb_sep.DataSourceSep(),
|
"decort_cb_account": cb_account.DataSourceAccount(),
|
||||||
"decort_cb_sep_consumption": cb_sep.DataSourceSepConsumption(),
|
"decort_cb_account_list": cb_account.DataSourceAccountList(),
|
||||||
"decort_cb_sep_disk_list": cb_sep.DataSourceSepDiskList(),
|
"decort_cb_account_computes_list": cb_account.DataSourceAccountComputesList(),
|
||||||
"decort_cb_sep_config": cb_sep.DataSourceSepConfig(),
|
"decort_cb_account_list_deleted": cb_account.DataSourceAccountDeletedList(),
|
||||||
"decort_cb_sep_pool": cb_sep.DataSourceSepPool(),
|
"decort_cb_account_disks_list": cb_account.DataSourceAccountDisksList(),
|
||||||
"decort_cb_vgpu": cb_vgpu.DataSourceVGPU(),
|
"decort_cb_account_flipgroups_list": cb_account.DataSourceAccountFlipGroupsList(),
|
||||||
"decort_cb_rg_list": cb_rg.DataSourceRgList(),
|
"decort_cb_account_rg_list": cb_account.DataSourceAccountRGList(),
|
||||||
}
|
"decort_cb_account_vins_list": cb_account.DataSourceAccountVinsList(),
|
||||||
|
"decort_cb_account_resource_consumption_get": cb_account.DataSourceAccountResourceConsumptionGet(),
|
||||||
}
|
"decort_cb_account_resource_consumption_list": cb_account.DataSourceAccountResourceConsumptionList(),
|
||||||
|
"decort_cb_account_audits_list": cb_account.DataSourceAccountAuditsList(),
|
||||||
|
"decort_cb_audit": cb_audit.DataSourceAudit(),
|
||||||
|
"decort_cb_audit_list": cb_audit.DataSourceAuditList(),
|
||||||
|
"decort_cb_audit_linked_jobs": cb_audit.DataSourceAuditLinkedJobs(),
|
||||||
|
"decort_cb_extnet": cb_extnet.DataSourceExtnetCB(),
|
||||||
|
"decort_cb_extnet_list": cb_extnet.DataSourceExtnetListCB(),
|
||||||
|
"decort_cb_extnet_default": cb_extnet.DataSourceExtnetDefaultCB(),
|
||||||
|
"decort_cb_extnet_static_route_list": cb_extnet.DataSourceStaticRouteList(),
|
||||||
|
"decort_cb_extnet_static_route": cb_extnet.DataSourceStaticRoute(),
|
||||||
|
"decort_cb_image": cb_image.DataSourceImage(),
|
||||||
|
"decort_cb_grid": cb_grid.DataSourceGrid(),
|
||||||
|
"decort_cb_grid_get_status": cb_grid.DataSourceGridGetStatus(),
|
||||||
|
"decort_cb_grid_post_status": cb_grid.DataSourceGridPostStatus(),
|
||||||
|
"decort_cb_grid_get_diagnosis": cb_grid.DataSourceGridGetDiagnosis(),
|
||||||
|
"decort_cb_grid_post_diagnosis": cb_grid.DataSourceGridPostDiagnosis(),
|
||||||
|
"decort_cb_grid_list": cb_grid.DataSourceGridList(),
|
||||||
|
"decort_cb_grid_list_emails": cb_grid.DataSourceGridListEmails(),
|
||||||
|
"decort_cb_grid_list_consumption": cb_grid.DataSourceGridListConsumption(),
|
||||||
|
"decort_cb_grid_get_consumption": cb_grid.DataSourceGridGetConsumption(),
|
||||||
|
"decort_cb_image_list": cb_image.DataSourceImageList(),
|
||||||
|
"decort_cb_image_list_stacks": cb_image.DataSourceImageListStacks(),
|
||||||
|
"decort_cb_kvmvm": cb_kvmvm.DataSourceCompute(),
|
||||||
|
"decort_cb_kvmvm_affinity_relations": cb_kvmvm.DataSourceComputeAffinityRelations(),
|
||||||
|
"decort_cb_kvmvm_audits": cb_kvmvm.DataSourceComputeAudits(),
|
||||||
|
"decort_cb_kvmvm_boot_order_get": cb_kvmvm.DataSourceComputeBootOrderGet(),
|
||||||
|
"decort_cb_kvmvm_get_audits": cb_kvmvm.DataSourceComputeGetAudits(),
|
||||||
|
"decort_cb_kvmvm_get_console_url": cb_kvmvm.DataSourceComputeGetConsoleUrl(),
|
||||||
|
"decort_cb_kvmvm_get_log": cb_kvmvm.DataSourceComputeGetLog(),
|
||||||
|
"decort_cb_kvmvm_list": cb_kvmvm.DataSourceComputeList(),
|
||||||
|
"decort_cb_kvmvm_list_deleted": cb_kvmvm.DataSourceComputeListDeleted(),
|
||||||
|
"decort_cb_kvmvm_migrate_storage_info": cb_kvmvm.DataSourceComputeMigrateStorageInfo(),
|
||||||
|
"decort_cb_kvmvm_pci_device_list": cb_kvmvm.DataSourceComputePCIDeviceList(),
|
||||||
|
"decort_cb_kvmvm_pfw_list": cb_kvmvm.DataSourceComputePfwList(),
|
||||||
|
"decort_cb_kvmvm_snapshot_list": cb_kvmvm.DataSourceComputeSnapshotList(),
|
||||||
|
"decort_cb_kvmvm_snapshot_usage": cb_kvmvm.DataSourceComputeSnapshotUsage(),
|
||||||
|
"decort_cb_kvmvm_user_list": cb_kvmvm.DataSourceComputeUserList(),
|
||||||
|
"decort_cb_kvmvm_vgpu_list": cb_kvmvm.DataSourceComputeVGPUList(),
|
||||||
|
"decort_cb_disk": cb_disks.DataSourceDisk(),
|
||||||
|
"decort_cb_disk_list": cb_disks.DataSourceDiskList(),
|
||||||
|
"decort_cb_disk_list_deleted": cb_disks.DataSourceDiskListDeleted(),
|
||||||
|
"decort_cb_disk_list_types": cb_disks.DataSourceDiskListTypes(),
|
||||||
|
"decort_cb_disk_list_types_detailed": cb_disks.DataSourceDiskListTypesDetailed(),
|
||||||
|
"decort_cb_disk_list_unattached": cb_disks.DataSourceDiskListUnattached(),
|
||||||
|
"decort_cb_disk_snapshot": cb_disks.DataSourceDiskSnapshot(),
|
||||||
|
"decort_cb_disk_snapshot_list": cb_disks.DataSourceDiskSnapshotList(),
|
||||||
|
"decort_cb_pcidevice": cb_pcidevice.DataSourcePcidevice(),
|
||||||
|
"decort_cb_pcidevice_list": cb_pcidevice.DataSourcePcideviceList(),
|
||||||
|
"decort_cb_rg": cb_rg.DataSourceResgroup(),
|
||||||
|
"decort_cb_rg_affinity_group_computes": cb_rg.DataSourceRgAffinityGroupComputes(),
|
||||||
|
"decort_cb_rg_affinity_groups_get": cb_rg.DataSourceRgAffinityGroupsGet(),
|
||||||
|
"decort_cb_rg_affinity_groups_list": cb_rg.DataSourceRgAffinityGroupsList(),
|
||||||
|
"decort_cb_rg_resource_consumption_get": cb_rg.DataSourceRGResourceConsumptionGet(),
|
||||||
|
"decort_cb_rg_resource_consumption_list": cb_rg.DataSourceRGResourceConsumptionList(),
|
||||||
|
"decort_cb_rg_audits": cb_rg.DataSourceRgAudits(),
|
||||||
|
"decort_cb_rg_list": cb_rg.DataSourceRgList(),
|
||||||
|
"decort_cb_rg_list_deleted": cb_rg.DataSourceRgListDeleted(),
|
||||||
|
"decort_cb_rg_list_computes": cb_rg.DataSourceRgListComputes(),
|
||||||
|
"decort_cb_rg_list_lb": cb_rg.DataSourceRgListLb(),
|
||||||
|
"decort_cb_rg_list_pfw": cb_rg.DataSourceRgListPfw(),
|
||||||
|
"decort_cb_rg_list_vins": cb_rg.DataSourceRgListVins(),
|
||||||
|
"decort_cb_rg_usage": cb_rg.DataSourceRgUsage(),
|
||||||
|
"decort_cb_sep_list": cb_sep.DataSourceSepList(),
|
||||||
|
"decort_cb_sep": cb_sep.DataSourceSep(),
|
||||||
|
"decort_cb_sep_consumption": cb_sep.DataSourceSepConsumption(),
|
||||||
|
"decort_cb_sep_disk_list": cb_sep.DataSourceSepDiskList(),
|
||||||
|
"decort_cb_sep_config": cb_sep.DataSourceSepConfig(),
|
||||||
|
"decort_cb_sep_pool": cb_sep.DataSourceSepPool(),
|
||||||
|
"decort_cb_lb": cb_lb.DataSourceLB(),
|
||||||
|
"decort_cb_lb_list": cb_lb.DataSourceLBList(),
|
||||||
|
"decort_cb_lb_list_deleted": cb_lb.DataSourceLBListDeleted(),
|
||||||
|
"decort_cb_flipgroup_list": cb_flipgroup.DataSourceFlipgroupList(),
|
||||||
|
"decort_cb_flipgroup": cb_flipgroup.DataSourceFlipgroup(),
|
||||||
|
"decort_cb_stack_list": cb_stack.DataSourceStacksList(),
|
||||||
|
"decort_cb_stack": cb_stack.DataSourceStack(),
|
||||||
|
"decort_cb_vins": cb_vins.DataSourceVins(),
|
||||||
|
"decort_cb_vins_list": cb_vins.DataSourceVinsList(),
|
||||||
|
"decort_cb_vins_audits": cb_vins.DataSourceVinsAudits(),
|
||||||
|
"decort_cb_vins_ip_list": cb_vins.DataSourceVinsIpList(),
|
||||||
|
"decort_cb_vins_list_deleted": cb_vins.DataSourceVinsListDeleted(),
|
||||||
|
"decort_cb_vins_ext_net_list": cb_vins.DataSourceVinsExtNetList(),
|
||||||
|
"decort_cb_vins_nat_rule_list": cb_vins.DataSourceVinsNatRuleList(),
|
||||||
|
"decort_cb_vins_static_route": cb_vins.DataSourceStaticRoute(),
|
||||||
|
"decort_cb_vins_static_route_list": cb_vins.DataSourceStaticRouteList(),
|
||||||
|
"decort_cb_k8ci": cb_k8ci.DataSourceK8CI(),
|
||||||
|
"decort_cb_k8ci_list": cb_k8ci.DataSourceK8CIList(),
|
||||||
|
"decort_cb_k8ci_list_deleted": cb_k8ci.DataSourceK8CIListDeleted(),
|
||||||
|
"decort_cb_k8s": cb_k8s.DataSourceK8s(),
|
||||||
|
"decort_cb_k8s_list": cb_k8s.DataSourceK8sList(),
|
||||||
|
"decort_cb_k8s_list_deleted": cb_k8s.DataSourceK8sListDeleted(),
|
||||||
|
"decort_cb_k8s_wg": cb_k8s.DataSourceK8sWg(),
|
||||||
|
"decort_cb_k8s_wg_cloud_init": cb_k8s.DataSourceK8sWgCloudInit(),
|
||||||
|
"decort_cb_k8s_wg_list": cb_k8s.DataSourceK8sWgList(),
|
||||||
|
"decort_cb_k8s_computes": cb_k8s.DataSourceK8sComputes(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ func Provider() *schema.Provider {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
StateFunc: statefuncs.StateFuncToLower,
|
StateFunc: statefuncs.StateFuncToLower,
|
||||||
ValidateFunc: validation.StringInSlice([]string{"oauth2", "legacy", "jwt"}, true), // ignore case while validating
|
ValidateFunc: validation.StringInSlice([]string{"decs3o", "legacy", "jwt", "bvs"}, true), // ignore case while validating
|
||||||
Description: "Authentication mode to use when connecting to DECORT cloud API. Should be one of 'oauth2', 'legacy' or 'jwt'.",
|
Description: "Authentication mode to use when connecting to DECORT cloud API. Should be one of 'decs3o', 'legacy', 'jwt' or 'bvs'.",
|
||||||
},
|
},
|
||||||
|
|
||||||
"oauth2_url": {
|
"oauth2_url": {
|
||||||
@@ -49,7 +49,7 @@ func Provider() *schema.Provider {
|
|||||||
Optional: true,
|
Optional: true,
|
||||||
StateFunc: statefuncs.StateFuncToLower,
|
StateFunc: statefuncs.StateFuncToLower,
|
||||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_OAUTH2_URL", nil),
|
DefaultFunc: schema.EnvDefaultFunc("DECORT_OAUTH2_URL", nil),
|
||||||
Description: "OAuth2 application URL in 'oauth2' authentication mode.",
|
Description: "OAuth2 application URL in 'decs3o' and 'bvs' authentication mode.",
|
||||||
},
|
},
|
||||||
|
|
||||||
"controller_url": {
|
"controller_url": {
|
||||||
@@ -74,18 +74,39 @@ func Provider() *schema.Provider {
|
|||||||
Description: "User password for DECORT cloud API operations in 'legacy' authentication mode.",
|
Description: "User password for DECORT cloud API operations in 'legacy' authentication mode.",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"bvs_user": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
DefaultFunc: schema.EnvDefaultFunc("DECORT_BVS_USER", nil),
|
||||||
|
Description: "User name for DECORT cloud API operations in 'bvs' authentication mode.",
|
||||||
|
},
|
||||||
|
|
||||||
|
"bvs_password": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
DefaultFunc: schema.EnvDefaultFunc("DECORT_BVS_PASSWORD", nil),
|
||||||
|
Description: "User password for DECORT cloud API operations in 'bvs' authentication mode.",
|
||||||
|
},
|
||||||
|
|
||||||
|
"domain": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
DefaultFunc: schema.EnvDefaultFunc("DECORT_DOMAIN", nil),
|
||||||
|
Description: "User password for DECORT cloud API operations in 'bvs' authentication mode.",
|
||||||
|
},
|
||||||
|
|
||||||
"app_id": {
|
"app_id": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_APP_ID", nil),
|
DefaultFunc: schema.EnvDefaultFunc("DECORT_APP_ID", nil),
|
||||||
Description: "Application ID to access DECORT cloud API in 'oauth2' authentication mode.",
|
Description: "Application ID to access DECORT cloud API in 'decs3o' and 'bvs' authentication mode.",
|
||||||
},
|
},
|
||||||
|
|
||||||
"app_secret": {
|
"app_secret": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_APP_SECRET", nil),
|
DefaultFunc: schema.EnvDefaultFunc("DECORT_APP_SECRET", nil),
|
||||||
Description: "Application secret to access DECORT cloud API in 'oauth2' authentication mode.",
|
Description: "Application secret to access DECORT cloud API in 'decs3o' and 'bvs' authentication mode.",
|
||||||
},
|
},
|
||||||
|
|
||||||
"jwt": {
|
"jwt": {
|
||||||
@@ -101,6 +122,25 @@ func Provider() *schema.Provider {
|
|||||||
Default: false,
|
Default: false,
|
||||||
Description: "If true, DECORT API will not verify SSL certificates. Use this with caution and in trusted environments only!",
|
Description: "If true, DECORT API will not verify SSL certificates. Use this with caution and in trusted environments only!",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"path_cfg": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "The path of the configuration file entry",
|
||||||
|
},
|
||||||
|
|
||||||
|
"path_token": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "The path of the token file entry",
|
||||||
|
},
|
||||||
|
|
||||||
|
"time_to_refresh": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "The number of minutes before the expiration of the token, a refresh will be made",
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
ResourcesMap: newResourcesMap(),
|
ResourcesMap: newResourcesMap(),
|
||||||
|
|||||||
@@ -1,94 +1,103 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package provider
|
package provider
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/account"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/account"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/bservice"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/bservice"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/disks"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/disks"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/flipgroup"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/flipgroup"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/image"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/image"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/k8s"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/k8s"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/kvmvm"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/kvmvm"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/lb"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/lb"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/pfw"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/pfw"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/rg"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/rg"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/snapshot"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/snapshot"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/vins"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/vins"
|
||||||
|
|
||||||
cb_account "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/account"
|
cb_account "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/account"
|
||||||
cb_disks "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/disks"
|
cb_disks "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/disks"
|
||||||
cb_extnet "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/extnet"
|
cb_extnet "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/extnet"
|
||||||
cb_image "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/image"
|
cb_flipgroup "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/flipgroup"
|
||||||
cb_k8s "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/k8s"
|
cb_image "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/image"
|
||||||
cb_kvmvm "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/kvmvm"
|
cb_k8s "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/k8s"
|
||||||
cb_pcidevice "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/pcidevice"
|
cb_kvmvm "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/kvmvm"
|
||||||
cb_pfw "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/pfw"
|
cb_lb "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/lb"
|
||||||
cb_rg "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/rg"
|
cb_pcidevice "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/pcidevice"
|
||||||
cb_sep "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/sep"
|
cb_rg "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/rg"
|
||||||
cb_snapshot "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/snapshot"
|
cb_sep "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/sep"
|
||||||
cb_vins "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/vins"
|
cb_k8ci "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/k8ci"
|
||||||
)
|
cb_vins "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/vins"
|
||||||
|
)
|
||||||
func newResourcesMap() map[string]*schema.Resource {
|
|
||||||
return map[string]*schema.Resource{
|
func newResourcesMap() map[string]*schema.Resource {
|
||||||
"decort_resgroup": rg.ResourceResgroup(),
|
return map[string]*schema.Resource{
|
||||||
"decort_kvmvm": kvmvm.ResourceCompute(),
|
"decort_resgroup": rg.ResourceResgroup(),
|
||||||
"decort_disk": disks.ResourceDisk(),
|
"decort_kvmvm": kvmvm.ResourceCompute(),
|
||||||
"decort_disk_snapshot": disks.ResourceDiskSnapshot(),
|
"decort_disk": disks.ResourceDisk(),
|
||||||
"decort_vins": vins.ResourceVins(),
|
"decort_disk_snapshot": disks.ResourceDiskSnapshot(),
|
||||||
"decort_pfw": pfw.ResourcePfw(),
|
"decort_vins": vins.ResourceVins(),
|
||||||
"decort_k8s": k8s.ResourceK8s(),
|
"decort_pfw": pfw.ResourcePfw(),
|
||||||
"decort_k8s_wg": k8s.ResourceK8sWg(),
|
"decort_k8s": k8s.ResourceK8s(),
|
||||||
"decort_k8s_cp": k8s.ResourceK8sCP(),
|
"decort_k8s_wg": k8s.ResourceK8sWg(),
|
||||||
"decort_snapshot": snapshot.ResourceSnapshot(),
|
"decort_k8s_cp": k8s.ResourceK8sCP(),
|
||||||
"decort_account": account.ResourceAccount(),
|
"decort_snapshot": snapshot.ResourceSnapshot(),
|
||||||
"decort_bservice": bservice.ResourceBasicService(),
|
"decort_account": account.ResourceAccount(),
|
||||||
"decort_bservice_group": bservice.ResourceBasicServiceGroup(),
|
"decort_bservice": bservice.ResourceBasicService(),
|
||||||
"decort_image": image.ResourceImage(),
|
"decort_bservice_group": bservice.ResourceBasicServiceGroup(),
|
||||||
"decort_image_virtual": image.ResourceImageVirtual(),
|
"decort_image": image.ResourceImage(),
|
||||||
"decort_lb": lb.ResourceLB(),
|
"decort_image_virtual": image.ResourceImageVirtual(),
|
||||||
"decort_lb_backend": lb.ResourceLBBackend(),
|
"decort_lb": lb.ResourceLB(),
|
||||||
"decort_lb_backend_server": lb.ResourceLBBackendServer(),
|
"decort_lb_backend": lb.ResourceLBBackend(),
|
||||||
"decort_lb_frontend": lb.ResourceLBFrontend(),
|
"decort_lb_backend_server": lb.ResourceLBBackendServer(),
|
||||||
"decort_lb_frontend_bind": lb.ResourceLBFrontendBind(),
|
"decort_lb_frontend": lb.ResourceLBFrontend(),
|
||||||
"decort_flipgroup": flipgroup.ResourceFlipgroup(),
|
"decort_lb_frontend_bind": lb.ResourceLBFrontendBind(),
|
||||||
|
"decort_flipgroup": flipgroup.ResourceFlipgroup(),
|
||||||
"decort_cb_account": cb_account.ResourceAccount(),
|
"decort_vins_static_route": vins.ResourceStaticRoute(),
|
||||||
"decort_cb_extnet": cb_extnet.ResourceExtnetCB(),
|
|
||||||
"decort_cb_disk": cb_disks.ResourceDisk(),
|
"decort_cb_account": cb_account.ResourceAccount(),
|
||||||
"decort_cb_image": cb_image.ResourceImage(),
|
"decort_cb_extnet": cb_extnet.ResourceExtnetCB(),
|
||||||
"decort_cb_virtual_image": cb_image.ResourceVirtualImage(),
|
"decort_cb_extnet_static_route": cb_extnet.ResourceStaticRoute(),
|
||||||
"decort_cb_cdrom_image": cb_image.ResourceCDROMImage(),
|
"decort_cb_disk": cb_disks.ResourceDisk(),
|
||||||
"decort_cb_delete_images": cb_image.ResourceDeleteImages(),
|
"decort_cb_disk_snapshot": cb_disks.ResourceDiskSnapshot(),
|
||||||
"decort_cb_pcidevice": cb_pcidevice.ResourcePcidevice(),
|
"decort_cb_image": cb_image.ResourceImage(),
|
||||||
"decort_cb_sep": cb_sep.ResourceSep(),
|
"decort_cb_virtual_image": cb_image.ResourceVirtualImage(),
|
||||||
"decort_cb_sep_config": cb_sep.ResourceSepConfig(),
|
"decort_cb_cdrom_image": cb_image.ResourceCDROMImage(),
|
||||||
"decort_cb_resgroup": cb_rg.ResourceResgroup(),
|
"decort_cb_pcidevice": cb_pcidevice.ResourcePcidevice(),
|
||||||
"decort_cb_kvmvm": cb_kvmvm.ResourceCompute(),
|
"decort_cb_sep": cb_sep.ResourceSep(),
|
||||||
"decort_cb_vins": cb_vins.ResourceVins(),
|
"decort_cb_sep_config": cb_sep.ResourceSepConfig(),
|
||||||
"decort_cb_pfw": cb_pfw.ResourcePfw(),
|
"decort_cb_kvmvm": cb_kvmvm.ResourceCompute(),
|
||||||
"decort_cb_k8s": cb_k8s.ResourceK8s(),
|
"decort_cb_vins": cb_vins.ResourceVins(),
|
||||||
"decort_cb_k8s_wg": cb_k8s.ResourceK8sWg(),
|
"decort_cb_k8ci": cb_k8ci.ResourceK8CI(),
|
||||||
"decort_cb_snapshot": cb_snapshot.ResourceSnapshot(),
|
"decort_cb_k8s_cp": cb_k8s.ResourceK8sCP(),
|
||||||
}
|
"decort_cb_k8s_wg": cb_k8s.ResourceK8sWg(),
|
||||||
}
|
"decort_cb_vins_static_route": cb_vins.ResourceStaticRoute(),
|
||||||
|
"decort_cb_flipgroup": cb_flipgroup.ResourceFlipgroup(),
|
||||||
|
"decort_cb_lb": cb_lb.ResourceLB(),
|
||||||
|
"decort_cb_lb_backend": cb_lb.ResourceLBBackend(),
|
||||||
|
"decort_cb_lb_backend_server": cb_lb.ResourceLBBackendServer(),
|
||||||
|
"decort_cb_lb_frontend": cb_lb.ResourceLBFrontend(),
|
||||||
|
"decort_cb_lb_frontend_bind": cb_lb.ResourceLBFrontendBind(),
|
||||||
|
"decort_cb_rg": cb_rg.ResourceResgroup(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import (
|
|||||||
func dataSourceAccountRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
acc, err := utilityAccountCheckPresence(ctx, d, m)
|
acc, err := utilityAccountCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +100,10 @@ func resourceLimitsSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeFloat,
|
Type: schema.TypeFloat,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"cu_dm": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"cu_i": {
|
"cu_i": {
|
||||||
Type: schema.TypeFloat,
|
Type: schema.TypeFloat,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
|||||||
@@ -1,127 +1,128 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountAuditsList(aal account.ListAudits) []map[string]interface{} {
|
func flattenAccountAuditsList(aal account.ListAudits) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, aa := range aal {
|
for _, aa := range aal {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"call": aa.Call,
|
"call": aa.Call,
|
||||||
"responsetime": aa.ResponseTime,
|
"responsetime": aa.ResponseTime,
|
||||||
"statuscode": aa.StatusCode,
|
"statuscode": aa.StatusCode,
|
||||||
"timestamp": aa.Timestamp,
|
"timestamp": aa.Timestamp,
|
||||||
"user": aa.User,
|
"user": aa.User,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceAccountAuditsListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountAuditsListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
accountAuditsList, err := utilityAccountAuditsListCheckPresence(ctx, d, m)
|
accountAuditsList, err := utilityAccountAuditsListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenAccountAuditsList(accountAuditsList))
|
d.SetId(id.String())
|
||||||
|
d.Set("items", flattenAccountAuditsList(accountAuditsList))
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceAccountAuditsListSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceAccountAuditsListSchemaMake() map[string]*schema.Schema {
|
||||||
"account_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the account",
|
Required: true,
|
||||||
},
|
Description: "ID of the account",
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"items": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Description: "Search Result",
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Description: "Search Result",
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"call": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeString,
|
"call": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"responsetime": {
|
},
|
||||||
Type: schema.TypeFloat,
|
"responsetime": {
|
||||||
Computed: true,
|
Type: schema.TypeFloat,
|
||||||
},
|
Computed: true,
|
||||||
"statuscode": {
|
},
|
||||||
Type: schema.TypeInt,
|
"statuscode": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"timestamp": {
|
},
|
||||||
Type: schema.TypeFloat,
|
"timestamp": {
|
||||||
Computed: true,
|
Type: schema.TypeFloat,
|
||||||
},
|
Computed: true,
|
||||||
"user": {
|
},
|
||||||
Type: schema.TypeString,
|
"user": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func DataSourceAccountAuditsList() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceAccountAuditsList() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceAccountAuditsListRead,
|
|
||||||
|
ReadContext: dataSourceAccountAuditsListRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceAccountAuditsListSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceAccountAuditsListSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,257 +1,258 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountComputesList(acl *account.ListComputes) []map[string]interface{} {
|
func flattenAccountComputesList(acl *account.ListComputes) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, acc := range acl.Data {
|
for _, acc := range acl.Data {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"account_id": acc.AccountID,
|
"account_id": acc.AccountID,
|
||||||
"account_name": acc.AccountName,
|
"account_name": acc.AccountName,
|
||||||
"cpus": acc.CPUs,
|
"cpus": acc.CPUs,
|
||||||
"created_by": acc.CreatedBy,
|
"created_by": acc.CreatedBy,
|
||||||
"created_time": acc.CreatedTime,
|
"created_time": acc.CreatedTime,
|
||||||
"deleted_by": acc.DeletedBy,
|
"deleted_by": acc.DeletedBy,
|
||||||
"deleted_time": acc.DeletedTime,
|
"deleted_time": acc.DeletedTime,
|
||||||
"compute_id": acc.ComputeID,
|
"compute_id": acc.ComputeID,
|
||||||
"compute_name": acc.ComputeName,
|
"compute_name": acc.ComputeName,
|
||||||
"ram": acc.RAM,
|
"ram": acc.RAM,
|
||||||
"registered": acc.Registered,
|
"registered": acc.Registered,
|
||||||
"rg_id": acc.RGID,
|
"rg_id": acc.RGID,
|
||||||
"rg_name": acc.RGName,
|
"rg_name": acc.RGName,
|
||||||
"status": acc.Status,
|
"status": acc.Status,
|
||||||
"tech_status": acc.TechStatus,
|
"tech_status": acc.TechStatus,
|
||||||
"total_disks_size": acc.TotalDisksSize,
|
"total_disks_size": acc.TotalDisksSize,
|
||||||
"updated_by": acc.UpdatedBy,
|
"updated_by": acc.UpdatedBy,
|
||||||
"updated_time": acc.UpdatedTime,
|
"updated_time": acc.UpdatedTime,
|
||||||
"user_managed": acc.UserManaged,
|
"user_managed": acc.UserManaged,
|
||||||
"vins_connected": acc.VINSConnected,
|
"vins_connected": acc.VINSConnected,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceAccountComputesListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountComputesListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
accountComputesList, err := utilityAccountComputesListCheckPresence(ctx, d, m)
|
accountComputesList, err := utilityAccountComputesListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenAccountComputesList(accountComputesList))
|
d.SetId(id.String())
|
||||||
d.Set("entry_count", accountComputesList.EntryCount)
|
d.Set("items", flattenAccountComputesList(accountComputesList))
|
||||||
|
d.Set("entry_count", accountComputesList.EntryCount)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceAccountComputesListSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceAccountComputesListSchemaMake() map[string]*schema.Schema {
|
||||||
"account_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the account",
|
Required: true,
|
||||||
},
|
Description: "ID of the account",
|
||||||
"compute_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"compute_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by compute ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by compute ID",
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by compute name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by compute name",
|
||||||
"rg_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"rg_name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by RG name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by RG name",
|
||||||
"rg_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"rg_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by RG ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by RG ID",
|
||||||
"tech_status": {
|
},
|
||||||
Type: schema.TypeString,
|
"tech_status": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by tech. status",
|
Optional: true,
|
||||||
},
|
Description: "Filter by tech. status",
|
||||||
"ip_address": {
|
},
|
||||||
Type: schema.TypeString,
|
"ip_address": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by IP address",
|
Optional: true,
|
||||||
},
|
Description: "Filter by IP address",
|
||||||
"extnet_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"extnet_name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by extnet name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by extnet name",
|
||||||
"extnet_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"extnet_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by extnet ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by extnet ID",
|
||||||
"page": {
|
},
|
||||||
Type: schema.TypeInt,
|
"page": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page number",
|
Optional: true,
|
||||||
},
|
Description: "Page number",
|
||||||
"size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"size": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page size",
|
Optional: true,
|
||||||
},
|
Description: "Page size",
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"items": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Description: "Search Result",
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Description: "Search Result",
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"account_id": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"account_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"account_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"cpus": {
|
},
|
||||||
Type: schema.TypeInt,
|
"cpus": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"created_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"created_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"created_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"created_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"deleted_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"deleted_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"compute_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"compute_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"compute_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"compute_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"ram": {
|
},
|
||||||
Type: schema.TypeInt,
|
"ram": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"registered": {
|
},
|
||||||
Type: schema.TypeBool,
|
"registered": {
|
||||||
Computed: true,
|
Type: schema.TypeBool,
|
||||||
},
|
Computed: true,
|
||||||
"rg_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"rg_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"rg_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"rg_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"tech_status": {
|
},
|
||||||
Type: schema.TypeString,
|
"tech_status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"total_disks_size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"total_disks_size": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"updated_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"updated_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"updated_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"updated_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"user_managed": {
|
},
|
||||||
Type: schema.TypeBool,
|
"user_managed": {
|
||||||
Computed: true,
|
Type: schema.TypeBool,
|
||||||
},
|
Computed: true,
|
||||||
"vins_connected": {
|
},
|
||||||
Type: schema.TypeInt,
|
"vins_connected": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"entry_count": {
|
},
|
||||||
Type: schema.TypeInt,
|
"entry_count": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
}
|
},
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func DataSourceAccountComputesList() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceAccountComputesList() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceAccountComputesListRead,
|
|
||||||
|
ReadContext: dataSourceAccountComputesListRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceAccountComputesListSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceAccountComputesListSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,110 +1,116 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceAccountConsumedUnitsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountConsumedUnitsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
accountConsumedUnits, err := utilityAccountConsumedUnitsCheckPresence(ctx, d, m)
|
accountConsumedUnits, err := utilityAccountConsumedUnitsCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("cu_c", accountConsumedUnits.CUC)
|
d.SetId(id.String())
|
||||||
d.Set("cu_d", accountConsumedUnits.CUD)
|
d.Set("cu_c", accountConsumedUnits.CUC)
|
||||||
d.Set("cu_i", accountConsumedUnits.CUI)
|
d.Set("cu_d", accountConsumedUnits.CUD)
|
||||||
d.Set("cu_m", accountConsumedUnits.CUM)
|
d.Set("cu_dm", accountConsumedUnits.CUDM)
|
||||||
d.Set("cu_np", accountConsumedUnits.CUNP)
|
d.Set("cu_i", accountConsumedUnits.CUI)
|
||||||
d.Set("gpu_units", accountConsumedUnits.GPUUnits)
|
d.Set("cu_m", accountConsumedUnits.CUM)
|
||||||
|
d.Set("cu_np", accountConsumedUnits.CUNP)
|
||||||
return nil
|
d.Set("gpu_units", accountConsumedUnits.GPUUnits)
|
||||||
}
|
|
||||||
|
return nil
|
||||||
func dataSourceAccountConsumedUnitsSchemaMake() map[string]*schema.Schema {
|
}
|
||||||
res := map[string]*schema.Schema{
|
|
||||||
"account_id": {
|
func dataSourceAccountConsumedUnitsSchemaMake() map[string]*schema.Schema {
|
||||||
Type: schema.TypeInt,
|
res := map[string]*schema.Schema{
|
||||||
Required: true,
|
"account_id": {
|
||||||
Description: "ID of the account",
|
Type: schema.TypeInt,
|
||||||
},
|
Required: true,
|
||||||
"cu_c": {
|
Description: "ID of the account",
|
||||||
Type: schema.TypeFloat,
|
},
|
||||||
Computed: true,
|
"cu_c": {
|
||||||
},
|
Type: schema.TypeFloat,
|
||||||
"cu_d": {
|
Computed: true,
|
||||||
Type: schema.TypeFloat,
|
},
|
||||||
Computed: true,
|
"cu_d": {
|
||||||
},
|
Type: schema.TypeFloat,
|
||||||
"cu_i": {
|
Computed: true,
|
||||||
Type: schema.TypeFloat,
|
},
|
||||||
Computed: true,
|
"cu_dm": {
|
||||||
},
|
Type: schema.TypeFloat,
|
||||||
"cu_m": {
|
Computed: true,
|
||||||
Type: schema.TypeFloat,
|
},
|
||||||
Computed: true,
|
"cu_i": {
|
||||||
},
|
Type: schema.TypeFloat,
|
||||||
"cu_np": {
|
Computed: true,
|
||||||
Type: schema.TypeFloat,
|
},
|
||||||
Computed: true,
|
"cu_m": {
|
||||||
},
|
Type: schema.TypeFloat,
|
||||||
"gpu_units": {
|
Computed: true,
|
||||||
Type: schema.TypeFloat,
|
},
|
||||||
Computed: true,
|
"cu_np": {
|
||||||
},
|
Type: schema.TypeFloat,
|
||||||
}
|
Computed: true,
|
||||||
return res
|
},
|
||||||
}
|
"gpu_units": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
func DataSourceAccountConsumedUnits() *schema.Resource {
|
Computed: true,
|
||||||
return &schema.Resource{
|
},
|
||||||
SchemaVersion: 1,
|
}
|
||||||
|
return res
|
||||||
ReadContext: dataSourceAccountConsumedUnitsRead,
|
}
|
||||||
|
|
||||||
Timeouts: &schema.ResourceTimeout{
|
func DataSourceAccountConsumedUnits() *schema.Resource {
|
||||||
Read: &constants.Timeout30s,
|
return &schema.Resource{
|
||||||
Default: &constants.Timeout60s,
|
SchemaVersion: 1,
|
||||||
},
|
|
||||||
|
ReadContext: dataSourceAccountConsumedUnitsRead,
|
||||||
Schema: dataSourceAccountConsumedUnitsSchemaMake(),
|
|
||||||
}
|
Timeouts: &schema.ResourceTimeout{
|
||||||
}
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceAccountConsumedUnitsSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,90 +1,91 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceAccountConsumedUnitsByTypeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountConsumedUnitsByTypeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
result, err := utilityAccountConsumedUnitsByTypeCheckPresence(ctx, d, m)
|
result, err := utilityAccountConsumedUnitsByTypeCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("cu_result", result)
|
d.SetId(id.String())
|
||||||
|
d.Set("cu_result", result)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceAccountConsumedUnitsByTypeSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceAccountConsumedUnitsByTypeSchemaMake() map[string]*schema.Schema {
|
||||||
"account_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the account",
|
Required: true,
|
||||||
},
|
Description: "ID of the account",
|
||||||
"cu_type": {
|
},
|
||||||
Type: schema.TypeString,
|
"cu_type": {
|
||||||
Required: true,
|
Type: schema.TypeString,
|
||||||
Description: "cloud unit resource type",
|
Required: true,
|
||||||
},
|
Description: "cloud unit resource type",
|
||||||
"cu_result": {
|
},
|
||||||
Type: schema.TypeFloat,
|
"cu_result": {
|
||||||
Computed: true,
|
Type: schema.TypeFloat,
|
||||||
},
|
Computed: true,
|
||||||
}
|
},
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func DataSourceAccountConsumedUnitsByType() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceAccountConsumedUnitsByType() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceAccountConsumedUnitsByTypeRead,
|
|
||||||
|
ReadContext: dataSourceAccountConsumedUnitsByTypeRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceAccountConsumedUnitsByTypeSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceAccountConsumedUnitsByTypeSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,77 +1,78 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceAccountDeletedListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountDeletedListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
accountDeletedList, err := utilityAccountDeletedListCheckPresence(ctx, d, m)
|
accountDeletedList, err := utilityAccountDeletedListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenAccountList(accountDeletedList))
|
d.SetId(id.String())
|
||||||
d.Set("entry_count", accountDeletedList.EntryCount)
|
d.Set("items", flattenAccountList(accountDeletedList))
|
||||||
|
d.Set("entry_count", accountDeletedList.EntryCount)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceAccountDeletedListSchemaMake() map[string]*schema.Schema {
|
|
||||||
temp := dataSourceAccountListSchemaMake()
|
func dataSourceAccountDeletedListSchemaMake() map[string]*schema.Schema {
|
||||||
delete(temp, "status")
|
temp := dataSourceAccountListSchemaMake()
|
||||||
return temp
|
delete(temp, "status")
|
||||||
}
|
return temp
|
||||||
|
}
|
||||||
func DataSourceAccountDeletedList() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceAccountDeletedList() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceAccountDeletedListRead,
|
|
||||||
|
ReadContext: dataSourceAccountDeletedListRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceAccountDeletedListSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceAccountDeletedListSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,171 +1,172 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountDisksList(adl *account.ListDisks) []map[string]interface{} {
|
func flattenAccountDisksList(adl *account.ListDisks) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, ad := range adl.Data {
|
for _, ad := range adl.Data {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"disk_id": ad.ID,
|
"disk_id": ad.ID,
|
||||||
"disk_name": ad.Name,
|
"disk_name": ad.Name,
|
||||||
"pool": ad.Pool,
|
"pool": ad.Pool,
|
||||||
"sep_id": ad.SEPID,
|
"sep_id": ad.SEPID,
|
||||||
"shareable": ad.Shareable,
|
"shareable": ad.Shareable,
|
||||||
"size_max": ad.SizeMax,
|
"size_max": ad.SizeMax,
|
||||||
"type": ad.Type,
|
"type": ad.Type,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceAccountDisksListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountDisksListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
accountDisksList, err := utilityAccountDisksListCheckPresence(ctx, d, m)
|
accountDisksList, err := utilityAccountDisksListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenAccountDisksList(accountDisksList))
|
d.SetId(id.String())
|
||||||
d.Set("entry_count", accountDisksList.EntryCount)
|
d.Set("items", flattenAccountDisksList(accountDisksList))
|
||||||
|
d.Set("entry_count", accountDisksList.EntryCount)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceAccountDisksListSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceAccountDisksListSchemaMake() map[string]*schema.Schema {
|
||||||
"account_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the account",
|
Required: true,
|
||||||
},
|
Description: "ID of the account",
|
||||||
"disk_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"disk_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by disk ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by disk ID",
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by disk name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by disk name",
|
||||||
"disk_max_size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"disk_max_size": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by disk max size",
|
Optional: true,
|
||||||
},
|
Description: "Filter by disk max size",
|
||||||
"type": {
|
},
|
||||||
Type: schema.TypeString,
|
"type": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by disk type",
|
Optional: true,
|
||||||
},
|
Description: "Filter by disk type",
|
||||||
"page": {
|
},
|
||||||
Type: schema.TypeInt,
|
"page": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page number",
|
Optional: true,
|
||||||
},
|
Description: "Page number",
|
||||||
"size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"size": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page size",
|
Optional: true,
|
||||||
},
|
Description: "Page size",
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"items": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Description: "Search Result",
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Description: "Search Result",
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"disk_id": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"disk_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"disk_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"disk_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"pool": {
|
},
|
||||||
Type: schema.TypeString,
|
"pool": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"sep_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"sep_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"shareable": {
|
},
|
||||||
Type: schema.TypeBool,
|
"shareable": {
|
||||||
Computed: true,
|
Type: schema.TypeBool,
|
||||||
},
|
Computed: true,
|
||||||
"size_max": {
|
},
|
||||||
Type: schema.TypeInt,
|
"size_max": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"type": {
|
},
|
||||||
Type: schema.TypeString,
|
"type": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"entry_count": {
|
},
|
||||||
Type: schema.TypeInt,
|
"entry_count": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
}
|
},
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func DataSourceAccountDisksList() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceAccountDisksList() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceAccountDisksListRead,
|
|
||||||
|
ReadContext: dataSourceAccountDisksListRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceAccountDisksListSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceAccountDisksListSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,252 +1,253 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountFlipGroupsList(afgl *account.ListFLIPGroups) []map[string]interface{} {
|
func flattenAccountFlipGroupsList(afgl *account.ListFLIPGroups) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, afg := range afgl.Data {
|
for _, afg := range afgl.Data {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"account_id": afg.AccountID,
|
"account_id": afg.AccountID,
|
||||||
"client_type": afg.ClientType,
|
"client_type": afg.ClientType,
|
||||||
"conn_type": afg.ConnType,
|
"conn_type": afg.ConnType,
|
||||||
"created_by": afg.CreatedBy,
|
"created_by": afg.CreatedBy,
|
||||||
"created_time": afg.CreatedTime,
|
"created_time": afg.CreatedTime,
|
||||||
"default_gw": afg.DefaultGW,
|
"default_gw": afg.DefaultGW,
|
||||||
"deleted_by": afg.DeletedBy,
|
"deleted_by": afg.DeletedBy,
|
||||||
"deleted_time": afg.DeletedTime,
|
"deleted_time": afg.DeletedTime,
|
||||||
"desc": afg.Description,
|
"desc": afg.Description,
|
||||||
"gid": afg.GID,
|
"gid": afg.GID,
|
||||||
"guid": afg.GUID,
|
"guid": afg.GUID,
|
||||||
"fg_id": afg.ID,
|
"fg_id": afg.ID,
|
||||||
"ip": afg.IP,
|
"ip": afg.IP,
|
||||||
"milestones": afg.Milestones,
|
"milestones": afg.Milestones,
|
||||||
"fg_name": afg.Name,
|
"fg_name": afg.Name,
|
||||||
"net_id": afg.NetID,
|
"net_id": afg.NetID,
|
||||||
"net_type": afg.NetType,
|
"net_type": afg.NetType,
|
||||||
"netmask": afg.NetMask,
|
"netmask": afg.NetMask,
|
||||||
"status": afg.Status,
|
"status": afg.Status,
|
||||||
"updated_by": afg.UpdatedBy,
|
"updated_by": afg.UpdatedBy,
|
||||||
"updated_time": afg.UpdatedTime,
|
"updated_time": afg.UpdatedTime,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceAccountFlipGroupsListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountFlipGroupsListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
accountFlipGroupsList, err := utilityAccountFlipGroupsListCheckPresence(ctx, d, m)
|
accountFlipGroupsList, err := utilityAccountFlipGroupsListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenAccountFlipGroupsList(accountFlipGroupsList))
|
d.SetId(id.String())
|
||||||
d.Set("entry_count", accountFlipGroupsList.EntryCount)
|
d.Set("items", flattenAccountFlipGroupsList(accountFlipGroupsList))
|
||||||
|
d.Set("entry_count", accountFlipGroupsList.EntryCount)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceAccountFlipGroupsListSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceAccountFlipGroupsListSchemaMake() map[string]*schema.Schema {
|
||||||
"account_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the account",
|
Required: true,
|
||||||
},
|
Description: "ID of the account",
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by name",
|
||||||
"vins_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"vins_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by ViNS ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by ViNS ID",
|
||||||
"vins_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"vins_name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by ViNS name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by ViNS name",
|
||||||
"extnet_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"extnet_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by extnet ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by extnet ID",
|
||||||
"by_ip": {
|
},
|
||||||
Type: schema.TypeString,
|
"by_ip": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by IP",
|
Optional: true,
|
||||||
},
|
Description: "Filter by IP",
|
||||||
"flipgroup_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"flipgroup_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by flipgroup ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by flipgroup ID",
|
||||||
"page": {
|
},
|
||||||
Type: schema.TypeInt,
|
"page": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page number",
|
Optional: true,
|
||||||
},
|
Description: "Page number",
|
||||||
"size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"size": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page size",
|
Optional: true,
|
||||||
},
|
Description: "Page size",
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"items": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Description: "Search Result",
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Description: "Search Result",
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"account_id": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"client_type": {
|
},
|
||||||
Type: schema.TypeString,
|
"client_type": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"conn_type": {
|
},
|
||||||
Type: schema.TypeString,
|
"conn_type": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"created_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"created_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"created_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"created_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"default_gw": {
|
},
|
||||||
Type: schema.TypeString,
|
"default_gw": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"deleted_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"deleted_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"desc": {
|
},
|
||||||
Type: schema.TypeString,
|
"desc": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"gid": {
|
},
|
||||||
Type: schema.TypeInt,
|
"gid": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"guid": {
|
},
|
||||||
Type: schema.TypeInt,
|
"guid": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"fg_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"fg_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"ip": {
|
},
|
||||||
Type: schema.TypeString,
|
"ip": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"milestones": {
|
},
|
||||||
Type: schema.TypeInt,
|
"milestones": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"fg_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"fg_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"net_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"net_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"net_type": {
|
},
|
||||||
Type: schema.TypeString,
|
"net_type": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"netmask": {
|
},
|
||||||
Type: schema.TypeInt,
|
"netmask": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"updated_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"updated_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"updated_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"updated_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"entry_count": {
|
},
|
||||||
Type: schema.TypeInt,
|
"entry_count": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
}
|
},
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func DataSourceAccountFlipGroupsList() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceAccountFlipGroupsList() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceAccountFlipGroupsListRead,
|
|
||||||
|
ReadContext: dataSourceAccountFlipGroupsListRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceAccountFlipGroupsListSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceAccountFlipGroupsListSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,137 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package account
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
)
|
||||||
|
|
||||||
|
func dataSourceAccountResourceConsumptionGetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
accountResourceConsumptionRec, err := utilityAccountResourceConsumptionGetCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
id := uuid.New()
|
||||||
|
d.SetId(id.String())
|
||||||
|
flattenResourceConsumption(d, accountResourceConsumptionRec)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceAccountResourceConsumptionGetSchemaMake() map[string]*schema.Schema {
|
||||||
|
res := map[string]*schema.Schema{
|
||||||
|
"account_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
|
"consumed": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: dataSourceAccResourceSchemaMake(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"reserved": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: dataSourceAccResourceSchemaMake(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"resource_limits": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: dataSourceResourceLimitsSchemaMake(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceResourceLimitsSchemaMake() map[string]*schema.Schema {
|
||||||
|
res := map[string]*schema.Schema{
|
||||||
|
"cu_c": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"cu_d": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"cu_dm": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"cu_i": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"cu_m": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"cu_np": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"gpu_units": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceAccountResourceConsumptionGet() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceAccountResourceConsumptionGetRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceAccountResourceConsumptionGetSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,209 +1,210 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountList(al *account.ListAccounts) []map[string]interface{} {
|
func flattenAccountList(al *account.ListAccounts) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, acc := range al.Data {
|
for _, acc := range al.Data {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"acl": flattenRgAcl(acc.ACL),
|
"acl": flattenRgAcl(acc.ACL),
|
||||||
"created_time": acc.CreatedTime,
|
"created_time": acc.CreatedTime,
|
||||||
"deleted_time": acc.DeletedTime,
|
"deleted_time": acc.DeletedTime,
|
||||||
"account_id": acc.ID,
|
"account_id": acc.ID,
|
||||||
"account_name": acc.Name,
|
"account_name": acc.Name,
|
||||||
"status": acc.Status,
|
"status": acc.Status,
|
||||||
"updated_time": acc.UpdatedTime,
|
"updated_time": acc.UpdatedTime,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenRgAcl(rgAcls []account.RecordACL) []map[string]interface{} {
|
func flattenRgAcl(rgAcls []account.RecordACL) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, rgAcl := range rgAcls {
|
for _, rgAcl := range rgAcls {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"explicit": rgAcl.IsExplicit,
|
"explicit": rgAcl.IsExplicit,
|
||||||
"guid": rgAcl.GUID,
|
"guid": rgAcl.GUID,
|
||||||
"right": rgAcl.Rights,
|
"right": rgAcl.Rights,
|
||||||
"status": rgAcl.Status,
|
"status": rgAcl.Status,
|
||||||
"type": rgAcl.Type,
|
"type": rgAcl.Type,
|
||||||
"user_group_id": rgAcl.UgroupID,
|
"user_group_id": rgAcl.UgroupID,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceAccountListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
accountList, err := utilityAccountListCheckPresence(ctx, d, m)
|
accountList, err := utilityAccountListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenAccountList(accountList))
|
d.SetId(id.String())
|
||||||
d.Set("entry_count", accountList.EntryCount)
|
d.Set("items", flattenAccountList(accountList))
|
||||||
|
d.Set("entry_count", accountList.EntryCount)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceAccountListSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceAccountListSchemaMake() map[string]*schema.Schema {
|
||||||
"by_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"by_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by ID",
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by name",
|
||||||
"acl": {
|
},
|
||||||
Type: schema.TypeString,
|
"acl": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by ACL",
|
Optional: true,
|
||||||
},
|
Description: "Filter by ACL",
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by status",
|
Optional: true,
|
||||||
},
|
Description: "Filter by status",
|
||||||
"page": {
|
},
|
||||||
Type: schema.TypeInt,
|
"page": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page number",
|
Optional: true,
|
||||||
},
|
Description: "Page number",
|
||||||
"size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"size": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page size",
|
Optional: true,
|
||||||
},
|
Description: "Page size",
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"items": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"acl": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeList,
|
"acl": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"explicit": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeBool,
|
"explicit": {
|
||||||
Computed: true,
|
Type: schema.TypeBool,
|
||||||
},
|
Computed: true,
|
||||||
"guid": {
|
},
|
||||||
Type: schema.TypeString,
|
"guid": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"right": {
|
},
|
||||||
Type: schema.TypeString,
|
"right": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"type": {
|
},
|
||||||
Type: schema.TypeString,
|
"type": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"user_group_id": {
|
},
|
||||||
Type: schema.TypeString,
|
"user_group_id": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"created_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"created_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"deleted_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"account_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"account_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"account_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"updated_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"updated_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"entry_count": {
|
},
|
||||||
Type: schema.TypeInt,
|
"entry_count": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
}
|
},
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func DataSourceAccountList() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceAccountList() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceAccountListRead,
|
|
||||||
|
ReadContext: dataSourceAccountListRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceAccountListSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceAccountListSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,110 +1,116 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceAccountReservedUnitsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountReservedUnitsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
accountReservedUnits, err := utilityAccountReservedUnitsCheckPresence(ctx, d, m)
|
accountReservedUnits, err := utilityAccountReservedUnitsCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("cu_c", accountReservedUnits.CUC)
|
d.SetId(id.String())
|
||||||
d.Set("cu_d", accountReservedUnits.CUD)
|
d.Set("cu_c", accountReservedUnits.CUC)
|
||||||
d.Set("cu_i", accountReservedUnits.CUI)
|
d.Set("cu_d", accountReservedUnits.CUD)
|
||||||
d.Set("cu_m", accountReservedUnits.CUM)
|
d.Set("cu_dm", accountReservedUnits.CUDM)
|
||||||
d.Set("cu_np", accountReservedUnits.CUNP)
|
d.Set("cu_i", accountReservedUnits.CUI)
|
||||||
d.Set("gpu_units", accountReservedUnits.GPUUnits)
|
d.Set("cu_m", accountReservedUnits.CUM)
|
||||||
|
d.Set("cu_np", accountReservedUnits.CUNP)
|
||||||
return nil
|
d.Set("gpu_units", accountReservedUnits.GPUUnits)
|
||||||
}
|
|
||||||
|
return nil
|
||||||
func dataSourceAccountReservedUnitsSchemaMake() map[string]*schema.Schema {
|
}
|
||||||
res := map[string]*schema.Schema{
|
|
||||||
"account_id": {
|
func dataSourceAccountReservedUnitsSchemaMake() map[string]*schema.Schema {
|
||||||
Type: schema.TypeInt,
|
res := map[string]*schema.Schema{
|
||||||
Required: true,
|
"account_id": {
|
||||||
Description: "ID of the account",
|
Type: schema.TypeInt,
|
||||||
},
|
Required: true,
|
||||||
"cu_c": {
|
Description: "ID of the account",
|
||||||
Type: schema.TypeFloat,
|
},
|
||||||
Computed: true,
|
"cu_c": {
|
||||||
},
|
Type: schema.TypeFloat,
|
||||||
"cu_d": {
|
Computed: true,
|
||||||
Type: schema.TypeFloat,
|
},
|
||||||
Computed: true,
|
"cu_d": {
|
||||||
},
|
Type: schema.TypeFloat,
|
||||||
"cu_i": {
|
Computed: true,
|
||||||
Type: schema.TypeFloat,
|
},
|
||||||
Computed: true,
|
"cu_dm": {
|
||||||
},
|
Type: schema.TypeFloat,
|
||||||
"cu_m": {
|
Computed: true,
|
||||||
Type: schema.TypeFloat,
|
},
|
||||||
Computed: true,
|
"cu_i": {
|
||||||
},
|
Type: schema.TypeFloat,
|
||||||
"cu_np": {
|
Computed: true,
|
||||||
Type: schema.TypeFloat,
|
},
|
||||||
Computed: true,
|
"cu_m": {
|
||||||
},
|
Type: schema.TypeFloat,
|
||||||
"gpu_units": {
|
Computed: true,
|
||||||
Type: schema.TypeFloat,
|
},
|
||||||
Computed: true,
|
"cu_np": {
|
||||||
},
|
Type: schema.TypeFloat,
|
||||||
}
|
Computed: true,
|
||||||
return res
|
},
|
||||||
}
|
"gpu_units": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
func DataSourceAccountReservedUnits() *schema.Resource {
|
Computed: true,
|
||||||
return &schema.Resource{
|
},
|
||||||
SchemaVersion: 1,
|
}
|
||||||
|
return res
|
||||||
ReadContext: dataSourceAccountReservedUnitsRead,
|
}
|
||||||
|
|
||||||
Timeouts: &schema.ResourceTimeout{
|
func DataSourceAccountReservedUnits() *schema.Resource {
|
||||||
Read: &constants.Timeout30s,
|
return &schema.Resource{
|
||||||
Default: &constants.Timeout60s,
|
SchemaVersion: 1,
|
||||||
},
|
|
||||||
|
ReadContext: dataSourceAccountReservedUnitsRead,
|
||||||
Schema: dataSourceAccountReservedUnitsSchemaMake(),
|
|
||||||
}
|
Timeouts: &schema.ResourceTimeout{
|
||||||
}
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceAccountReservedUnitsSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,170 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package account
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
)
|
||||||
|
|
||||||
|
func dataSourceAccountResourceConsumptionListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
accountResourceConsumptionList, err := utilityAccountResourceConsumptionListCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
id := uuid.New()
|
||||||
|
d.SetId(id.String())
|
||||||
|
d.Set("items", flattenAccResourceConsumption(accountResourceConsumptionList))
|
||||||
|
d.Set("entry_count", accountResourceConsumptionList.EntryCount)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceAccountResourceConsumptionListSchemaMake() map[string]*schema.Schema {
|
||||||
|
res := map[string]*schema.Schema{
|
||||||
|
"items": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"account_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"consumed": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: dataSourceAccResourceSchemaMake(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"reserved": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: dataSourceAccResourceSchemaMake(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"entry_count": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceSepsSchemaMake() map[string]*schema.Schema {
|
||||||
|
res := map[string]*schema.Schema{
|
||||||
|
"sep_id": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"data_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"disk_size": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"disk_size_max": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceAccResourceSchemaMake() map[string]*schema.Schema {
|
||||||
|
res := map[string]*schema.Schema{
|
||||||
|
"cpu": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"disk_size": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"disk_size_max": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"ext_ips": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"ext_traffic": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"gpu": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"ram": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"seps": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: dataSourceSepsSchemaMake(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceAccountResourceConsumptionList() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceAccountResourceConsumptionListRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceAccountResourceConsumptionListSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,371 +1,372 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountRGList(argl *account.ListRG) []map[string]interface{} {
|
func flattenAccountRGList(argl *account.ListRG) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, arg := range argl.Data {
|
for _, arg := range argl.Data {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"computes": flattenAccRGComputes(arg.Computes),
|
"computes": flattenAccRGComputes(arg.Computes),
|
||||||
"resources": flattenAccRGResources(arg.Resources),
|
"resources": flattenAccRGResources(arg.Resources),
|
||||||
"created_by": arg.CreatedBy,
|
"created_by": arg.CreatedBy,
|
||||||
"created_time": arg.CreatedTime,
|
"created_time": arg.CreatedTime,
|
||||||
"deleted_by": arg.DeletedBy,
|
"deleted_by": arg.DeletedBy,
|
||||||
"deleted_time": arg.DeletedTime,
|
"deleted_time": arg.DeletedTime,
|
||||||
"rg_id": arg.RGID,
|
"rg_id": arg.RGID,
|
||||||
"milestones": arg.Milestones,
|
"milestones": arg.Milestones,
|
||||||
"rg_name": arg.RGName,
|
"rg_name": arg.RGName,
|
||||||
"status": arg.Status,
|
"status": arg.Status,
|
||||||
"updated_by": arg.UpdatedBy,
|
"updated_by": arg.UpdatedBy,
|
||||||
"updated_time": arg.UpdatedTime,
|
"updated_time": arg.UpdatedTime,
|
||||||
"vinses": arg.VINSes,
|
"vinses": arg.VINSes,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenAccRGComputes(argc account.RGComputes) []map[string]interface{} {
|
func flattenAccRGComputes(argc account.RGComputes) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"started": argc.Started,
|
"started": argc.Started,
|
||||||
"stopped": argc.Stopped,
|
"stopped": argc.Stopped,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenAccResourceHack(r account.LimitsRG) []map[string]interface{} {
|
func flattenAccResourceHack(r account.LimitsRG) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"cpu": r.CPU,
|
"cpu": r.CPU,
|
||||||
"disksize": r.DiskSize,
|
"disksize": r.DiskSize,
|
||||||
"extips": r.ExtIPs,
|
"extips": r.ExtIPs,
|
||||||
"exttraffic": r.ExtTraffic,
|
"exttraffic": r.ExtTraffic,
|
||||||
"gpu": r.GPU,
|
"gpu": r.GPU,
|
||||||
"ram": r.RAM,
|
"ram": r.RAM,
|
||||||
//"seps": flattenAccountSeps(r.SEPs),
|
//"seps": flattenAccountSeps(r.SEPs),
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenAccResourceRg(r account.Resource) []map[string]interface{} {
|
func flattenAccResourceRg(r account.Resource) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"cpu": r.CPU,
|
"cpu": r.CPU,
|
||||||
"disksize": r.DiskSize,
|
"disksize": r.DiskSize,
|
||||||
"extips": r.ExtIPs,
|
"extips": r.ExtIPs,
|
||||||
"exttraffic": r.ExtTraffic,
|
"exttraffic": r.ExtTraffic,
|
||||||
"gpu": r.GPU,
|
"gpu": r.GPU,
|
||||||
"ram": r.RAM,
|
"ram": r.RAM,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenAccRGResources(argr account.RGResources) []map[string]interface{} {
|
func flattenAccRGResources(argr account.RGResources) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"consumed": flattenAccResourceRg(argr.Consumed),
|
"consumed": flattenAccResourceRg(argr.Consumed),
|
||||||
"limits": flattenAccResourceHack(argr.Limits),
|
"limits": flattenAccResourceHack(argr.Limits),
|
||||||
"reserved": flattenAccResourceRg(argr.Reserved),
|
"reserved": flattenAccResourceRg(argr.Reserved),
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceAccountRGListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountRGListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
accountRGList, err := utilityAccountRGListCheckPresence(ctx, d, m)
|
accountRGList, err := utilityAccountRGListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenAccountRGList(accountRGList))
|
d.SetId(id.String())
|
||||||
d.Set("entry_count", accountRGList.EntryCount)
|
d.Set("items", flattenAccountRGList(accountRGList))
|
||||||
|
d.Set("entry_count", accountRGList.EntryCount)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceAccountRGListSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceAccountRGListSchemaMake() map[string]*schema.Schema {
|
||||||
"account_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the account",
|
Required: true,
|
||||||
},
|
Description: "ID of the account",
|
||||||
"page": {
|
},
|
||||||
Type: schema.TypeInt,
|
"page": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page number",
|
Optional: true,
|
||||||
},
|
Description: "Page number",
|
||||||
"size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"size": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page size",
|
Optional: true,
|
||||||
},
|
Description: "Page size",
|
||||||
"rg_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"rg_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by RG ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by RG ID",
|
||||||
"vins_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"vins_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by ViNS ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by ViNS ID",
|
||||||
"vm_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"vm_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by VM ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by VM ID",
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by name",
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by status",
|
Optional: true,
|
||||||
},
|
Description: "Filter by status",
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"items": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Description: "Search Result",
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Description: "Search Result",
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"computes": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeList,
|
"computes": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"started": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"started": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"stopped": {
|
},
|
||||||
Type: schema.TypeInt,
|
"stopped": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"resources": {
|
},
|
||||||
Type: schema.TypeList,
|
"resources": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"consumed": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeList,
|
"consumed": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"cpu": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"cpu": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"disksize": {
|
},
|
||||||
Type: schema.TypeInt,
|
"disksize": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"extips": {
|
},
|
||||||
Type: schema.TypeInt,
|
"extips": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"exttraffic": {
|
},
|
||||||
Type: schema.TypeInt,
|
"exttraffic": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"gpu": {
|
},
|
||||||
Type: schema.TypeInt,
|
"gpu": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"ram": {
|
},
|
||||||
Type: schema.TypeInt,
|
"ram": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
"limits": {
|
|
||||||
Type: schema.TypeList,
|
"limits": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"cpu": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"cpu": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"disksize": {
|
},
|
||||||
Type: schema.TypeInt,
|
"disksize": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"extips": {
|
},
|
||||||
Type: schema.TypeInt,
|
"extips": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"exttraffic": {
|
},
|
||||||
Type: schema.TypeInt,
|
"exttraffic": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"gpu": {
|
},
|
||||||
Type: schema.TypeInt,
|
"gpu": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"ram": {
|
},
|
||||||
Type: schema.TypeInt,
|
"ram": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"reserved": {
|
},
|
||||||
Type: schema.TypeList,
|
"reserved": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"cpu": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"cpu": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"disksize": {
|
},
|
||||||
Type: schema.TypeInt,
|
"disksize": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"extips": {
|
},
|
||||||
Type: schema.TypeInt,
|
"extips": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"exttraffic": {
|
},
|
||||||
Type: schema.TypeInt,
|
"exttraffic": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"gpu": {
|
},
|
||||||
Type: schema.TypeInt,
|
"gpu": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"ram": {
|
},
|
||||||
Type: schema.TypeInt,
|
"ram": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
"created_by": {
|
|
||||||
Type: schema.TypeString,
|
"created_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"created_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"created_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"deleted_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"deleted_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"rg_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"rg_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"milestones": {
|
},
|
||||||
Type: schema.TypeInt,
|
"milestones": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"rg_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"rg_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"updated_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"updated_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"updated_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"updated_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"vinses": {
|
},
|
||||||
Type: schema.TypeInt,
|
"vinses": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"entry_count": {
|
},
|
||||||
Type: schema.TypeInt,
|
"entry_count": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
}
|
},
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func DataSourceAccountRGList() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceAccountRGList() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceAccountRGListRead,
|
|
||||||
|
ReadContext: dataSourceAccountRGListRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceAccountRGListSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceAccountRGListSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,156 +1,186 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountTemplatesList(atl *account.ListTemplates) []map[string]interface{} {
|
func flattenAccountTemplatesList(atl *account.ListTemplates) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(atl.Data))
|
||||||
for _, at := range atl.Data {
|
for _, at := range atl.Data {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"unc_path": at.UNCPath,
|
"unc_path": at.UNCPath,
|
||||||
"account_id": at.AccountID,
|
"account_id": at.AccountID,
|
||||||
"desc": at.Description,
|
"desc": at.Description,
|
||||||
"template_id": at.ID,
|
"template_id": at.ID,
|
||||||
"template_name": at.Name,
|
"template_name": at.Name,
|
||||||
"public": at.Public,
|
"public": at.Public,
|
||||||
"size": at.Size,
|
"size": at.Size,
|
||||||
"status": at.Status,
|
"status": at.Status,
|
||||||
"type": at.Type,
|
"type": at.Type,
|
||||||
"username": at.Username,
|
"username": at.Username,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceAccountTemplatesListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountTemplatesListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
accountTemplatesList, err := utilityAccountTemplatesListCheckPresence(ctx, d, m)
|
accountTemplatesList, err := utilityAccountTemplatesListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenAccountTemplatesList(accountTemplatesList))
|
d.SetId(id.String())
|
||||||
|
d.Set("items", flattenAccountTemplatesList(accountTemplatesList))
|
||||||
return nil
|
d.Set("entry_count", accountTemplatesList.EntryCount)
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceAccountTemplatesListSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceAccountTemplatesListSchemaMake() map[string]*schema.Schema {
|
||||||
"account_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the account",
|
Required: true,
|
||||||
},
|
Description: "ID of the account",
|
||||||
"include_deleted": {
|
},
|
||||||
Type: schema.TypeBool,
|
"include_deleted": {
|
||||||
Optional: true,
|
Type: schema.TypeBool,
|
||||||
},
|
Optional: true,
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"image_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Search Result",
|
Optional: true,
|
||||||
Elem: &schema.Resource{
|
Description: "Find by image id",
|
||||||
Schema: map[string]*schema.Schema{
|
},
|
||||||
"unc_path": {
|
"name": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Optional: true,
|
||||||
},
|
Description: "Filter by name",
|
||||||
"account_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"type": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Optional: true,
|
||||||
"desc": {
|
Description: "Filter by type",
|
||||||
Type: schema.TypeString,
|
},
|
||||||
Computed: true,
|
"page": {
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
"template_id": {
|
Optional: true,
|
||||||
Type: schema.TypeInt,
|
Description: "Page number",
|
||||||
Computed: true,
|
},
|
||||||
},
|
"size": {
|
||||||
"template_name": {
|
Type: schema.TypeInt,
|
||||||
Type: schema.TypeString,
|
Optional: true,
|
||||||
Computed: true,
|
Description: "Page size",
|
||||||
},
|
},
|
||||||
"public": {
|
"items": {
|
||||||
Type: schema.TypeBool,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
Description: "Search Result",
|
||||||
"size": {
|
Elem: &schema.Resource{
|
||||||
Type: schema.TypeInt,
|
Schema: map[string]*schema.Schema{
|
||||||
Computed: true,
|
"unc_path": {
|
||||||
},
|
Type: schema.TypeString,
|
||||||
"status": {
|
Computed: true,
|
||||||
Type: schema.TypeString,
|
},
|
||||||
Computed: true,
|
"account_id": {
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
"type": {
|
Computed: true,
|
||||||
Type: schema.TypeString,
|
},
|
||||||
Computed: true,
|
"desc": {
|
||||||
},
|
Type: schema.TypeString,
|
||||||
"username": {
|
Computed: true,
|
||||||
Type: schema.TypeString,
|
},
|
||||||
Computed: true,
|
"template_id": {
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
"template_name": {
|
||||||
}
|
Type: schema.TypeString,
|
||||||
return res
|
Computed: true,
|
||||||
}
|
},
|
||||||
|
"public": {
|
||||||
func DataSourceAccountTemplatessList() *schema.Resource {
|
Type: schema.TypeBool,
|
||||||
return &schema.Resource{
|
Computed: true,
|
||||||
SchemaVersion: 1,
|
},
|
||||||
|
"size": {
|
||||||
ReadContext: dataSourceAccountTemplatesListRead,
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
},
|
||||||
Read: &constants.Timeout30s,
|
"status": {
|
||||||
Default: &constants.Timeout60s,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
|
},
|
||||||
Schema: dataSourceAccountTemplatesListSchemaMake(),
|
"type": {
|
||||||
}
|
Type: schema.TypeString,
|
||||||
}
|
Computed: true,
|
||||||
|
},
|
||||||
|
"username": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"entry_count": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceAccountTemplatessList() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceAccountTemplatesListRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceAccountTemplatesListSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,222 +1,223 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountVinsList(avl *account.ListVINS) []map[string]interface{} {
|
func flattenAccountVinsList(avl *account.ListVINS) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, av := range avl.Data {
|
for _, av := range avl.Data {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"account_id": av.AccountID,
|
"account_id": av.AccountID,
|
||||||
"account_name": av.AccountName,
|
"account_name": av.AccountName,
|
||||||
"computes": av.Computes,
|
"computes": av.Computes,
|
||||||
"created_by": av.CreatedBy,
|
"created_by": av.CreatedBy,
|
||||||
"created_time": av.CreatedTime,
|
"created_time": av.CreatedTime,
|
||||||
"deleted_by": av.DeletedBy,
|
"deleted_by": av.DeletedBy,
|
||||||
"deleted_time": av.DeletedTime,
|
"deleted_time": av.DeletedTime,
|
||||||
"external_ip": av.ExternalIP,
|
"external_ip": av.ExternalIP,
|
||||||
"vin_id": av.ID,
|
"vin_id": av.ID,
|
||||||
"vin_name": av.Name,
|
"vin_name": av.Name,
|
||||||
"network": av.Network,
|
"network": av.Network,
|
||||||
"pri_vnf_dev_id": av.PriVNFDevID,
|
"pri_vnf_dev_id": av.PriVNFDevID,
|
||||||
"rg_id": av.RGID,
|
"rg_id": av.RGID,
|
||||||
"rg_name": av.RGName,
|
"rg_name": av.RGName,
|
||||||
"status": av.Status,
|
"status": av.Status,
|
||||||
"updated_by": av.UpdatedBy,
|
"updated_by": av.UpdatedBy,
|
||||||
"updated_time": av.UpdatedTime,
|
"updated_time": av.UpdatedTime,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceAccountVinsListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountVinsListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
accountVinsList, err := utilityAccountVinsListCheckPresence(ctx, d, m)
|
accountVinsList, err := utilityAccountVinsListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenAccountVinsList(accountVinsList))
|
d.SetId(id.String())
|
||||||
d.Set("entry_count", accountVinsList.EntryCount)
|
d.Set("items", flattenAccountVinsList(accountVinsList))
|
||||||
|
d.Set("entry_count", accountVinsList.EntryCount)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceAccountVinsListSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceAccountVinsListSchemaMake() map[string]*schema.Schema {
|
||||||
"account_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the account",
|
Required: true,
|
||||||
},
|
Description: "ID of the account",
|
||||||
"vins_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"vins_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by ViNS ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by ViNS ID",
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by name",
|
||||||
"rg_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"rg_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by RG ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by RG ID",
|
||||||
"ext_ip": {
|
},
|
||||||
Type: schema.TypeString,
|
"ext_ip": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by external IP",
|
Optional: true,
|
||||||
},
|
Description: "Filter by external IP",
|
||||||
"page": {
|
},
|
||||||
Type: schema.TypeInt,
|
"page": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page number",
|
Optional: true,
|
||||||
},
|
Description: "Page number",
|
||||||
"size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"size": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page size",
|
Optional: true,
|
||||||
},
|
Description: "Page size",
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"items": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Description: "Search Result",
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Description: "Search Result",
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"account_id": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"account_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"account_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"computes": {
|
},
|
||||||
Type: schema.TypeInt,
|
"computes": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"created_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"created_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"created_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"created_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"deleted_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"deleted_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"external_ip": {
|
},
|
||||||
Type: schema.TypeString,
|
"external_ip": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"vin_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"vin_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"vin_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"vin_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"network": {
|
},
|
||||||
Type: schema.TypeString,
|
"network": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"pri_vnf_dev_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"pri_vnf_dev_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"rg_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"rg_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"rg_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"rg_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"updated_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"updated_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"updated_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"updated_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"entry_count": {
|
},
|
||||||
Type: schema.TypeInt,
|
"entry_count": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
}
|
},
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func DataSourceAccountVinsList() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceAccountVinsList() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceAccountVinsListRead,
|
|
||||||
|
ReadContext: dataSourceAccountVinsListRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceAccountVinsListSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceAccountVinsListSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func flattenAccount(d *schema.ResourceData, acc account.RecordAccount) error {
|
|||||||
d.Set("guid", acc.GUID)
|
d.Set("guid", acc.GUID)
|
||||||
d.Set("account_id", acc.ID)
|
d.Set("account_id", acc.ID)
|
||||||
d.Set("account_name", acc.Name)
|
d.Set("account_name", acc.Name)
|
||||||
d.Set("resource_limits", flattenRgResourceLimits(acc.ResourceLimits))
|
d.Set("resource_limits", flattenAccResourceLimits(acc.ResourceLimits))
|
||||||
d.Set("send_access_emails", acc.SendAccessEmails)
|
d.Set("send_access_emails", acc.SendAccessEmails)
|
||||||
d.Set("status", acc.Status)
|
d.Set("status", acc.Status)
|
||||||
d.Set("updated_time", acc.UpdatedTime)
|
d.Set("updated_time", acc.UpdatedTime)
|
||||||
@@ -79,11 +79,19 @@ func flattenAccAcl(acls []account.RecordACL) []map[string]interface{} {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenRgResourceLimits(rl account.ResourceLimits) []map[string]interface{} {
|
func flattenResourceConsumption(d *schema.ResourceData, acc *account.RecordResourceConsumption) {
|
||||||
|
d.Set("account_id", acc.AccountID)
|
||||||
|
d.Set("consumed", flattenAccResource(acc.Consumed))
|
||||||
|
d.Set("reserved", flattenAccResource(acc.Reserved))
|
||||||
|
d.Set("resource_limits", flattenAccResourceLimits(acc.ResourceLimits))
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenAccResourceLimits(rl account.ResourceLimits) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"cu_c": rl.CUC,
|
"cu_c": rl.CUC,
|
||||||
"cu_d": rl.CUD,
|
"cu_d": rl.CUD,
|
||||||
|
"cu_dm": rl.CUDM,
|
||||||
"cu_i": rl.CUI,
|
"cu_i": rl.CUI,
|
||||||
"cu_m": rl.CUM,
|
"cu_m": rl.CUM,
|
||||||
"cu_np": rl.CUNP,
|
"cu_np": rl.CUNP,
|
||||||
@@ -124,14 +132,28 @@ func flattenAccountSeps(seps map[string]map[string]account.DiskUsage) []map[stri
|
|||||||
func flattenAccResource(r account.Resource) []map[string]interface{} {
|
func flattenAccResource(r account.Resource) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"cpu": r.CPU,
|
"cpu": r.CPU,
|
||||||
"disksize": r.DiskSize,
|
"disk_size": r.DiskSize,
|
||||||
"extips": r.ExtIPs,
|
"disk_size_max": r.DiskSizeMax,
|
||||||
"exttraffic": r.ExtTraffic,
|
"ext_ips": r.ExtIPs,
|
||||||
"gpu": r.GPU,
|
"ext_traffic": r.ExtTraffic,
|
||||||
"ram": r.RAM,
|
"gpu": r.GPU,
|
||||||
"seps": flattenAccountSeps(r.SEPs),
|
"ram": r.RAM,
|
||||||
|
"seps": flattenAccountSeps(r.SEPs),
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func flattenAccResourceConsumption(lrc *account.ListResourceConsumption) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0, len(lrc.Data))
|
||||||
|
for _, rc := range lrc.Data {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"consumed": flattenAccResource(rc.Consumed),
|
||||||
|
"reserved": flattenAccResource(rc.Reserved),
|
||||||
|
"account_id": rc.AccountID,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package account
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
func utilityAccountResourceConsumptionGetCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*account.RecordResourceConsumption, error) {
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
|
||||||
|
id := uint64(d.Get("account_id").(int))
|
||||||
|
|
||||||
|
req:= account.GetResourceConsumptionRequest {
|
||||||
|
AccountID: id,
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Debugf("utilityAccountResourceConsumptionGetCheckPresence: load")
|
||||||
|
accountResourceConsumptionRec, err := c.CloudAPI().Account().GetResourceConsumption(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return accountResourceConsumptionRec, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package account
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
func utilityAccountResourceConsumptionListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*account.ListResourceConsumption, error) {
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
|
||||||
|
log.Debugf("utilityAccountResourceConsumptionListCheckPresence: load")
|
||||||
|
accountResourceConsumptionList, err := c.CloudAPI().Account().ListResourceConsumption(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return accountResourceConsumptionList, nil
|
||||||
|
}
|
||||||
@@ -44,9 +44,8 @@ import (
|
|||||||
|
|
||||||
func utilityAccountTemplatesListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*account.ListTemplates, error) {
|
func utilityAccountTemplatesListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*account.ListTemplates, error) {
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
var id uint64
|
|
||||||
|
|
||||||
id = uint64(d.Get("account_id").(int))
|
id := uint64(d.Get("account_id").(int))
|
||||||
|
|
||||||
req := account.ListTemplatesRequest{
|
req := account.ListTemplatesRequest{
|
||||||
AccountID: id,
|
AccountID: id,
|
||||||
@@ -55,6 +54,21 @@ func utilityAccountTemplatesListCheckPresence(ctx context.Context, d *schema.Res
|
|||||||
if include_deleted, ok := d.GetOk("include_deleted"); ok {
|
if include_deleted, ok := d.GetOk("include_deleted"); ok {
|
||||||
req.IncludeDeleted = include_deleted.(bool)
|
req.IncludeDeleted = include_deleted.(bool)
|
||||||
}
|
}
|
||||||
|
if imageId, ok := d.GetOk("image_id"); ok {
|
||||||
|
req.ImageID = uint64(imageId.(int))
|
||||||
|
}
|
||||||
|
if name, ok := d.GetOk("name"); ok {
|
||||||
|
req.Name = name.(string)
|
||||||
|
}
|
||||||
|
if typeTemplates, ok := d.GetOk("type"); ok {
|
||||||
|
req.Type = typeTemplates.(string)
|
||||||
|
}
|
||||||
|
if page, ok := d.GetOk("page"); ok {
|
||||||
|
req.Page = uint64(page.(int))
|
||||||
|
}
|
||||||
|
if size, ok := d.GetOk("size"); ok {
|
||||||
|
req.Size = uint64(size.(int))
|
||||||
|
}
|
||||||
|
|
||||||
log.Debugf("utilityAccountTemplatesListCheckPresence: load")
|
log.Debugf("utilityAccountTemplatesListCheckPresence: load")
|
||||||
accountTemplatesList, err := c.CloudAPI().Account().ListTemplates(ctx, req)
|
accountTemplatesList, err := c.CloudAPI().Account().ListTemplates(ctx, req)
|
||||||
|
|||||||
@@ -1,297 +1,298 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceBasicServiceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceBasicServiceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
bs, err := utilityBasicServiceCheckPresence(ctx, d, m)
|
bs, err := utilityBasicServiceCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
d.SetId(strconv.FormatUint(bs.ID, 10))
|
|
||||||
|
d.SetId(strconv.FormatUint(bs.ID, 10))
|
||||||
flattenService(d, bs)
|
|
||||||
|
flattenService(d, bs)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceBasicServiceSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceBasicServiceSchemaMake() map[string]*schema.Schema {
|
||||||
"service_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"service_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Required: true,
|
||||||
"account_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"account_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"account_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"base_domain": {
|
},
|
||||||
Type: schema.TypeString,
|
"base_domain": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"computes": {
|
},
|
||||||
Type: schema.TypeList,
|
"computes": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"account_id": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"architecture": {
|
},
|
||||||
Type: schema.TypeString,
|
"architecture": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"compgroup_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"compgroup_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"compgroup_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"compgroup_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"compgroup_role": {
|
},
|
||||||
Type: schema.TypeString,
|
"compgroup_role": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"rg_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"rg_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"stack_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"stack_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"tech_status": {
|
},
|
||||||
Type: schema.TypeString,
|
"tech_status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
"cpu_total": {
|
|
||||||
Type: schema.TypeInt,
|
"cpu_total": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"created_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"created_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"created_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"created_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"deleted_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"deleted_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"disk_total": {
|
},
|
||||||
Type: schema.TypeString,
|
"disk_total": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"gid": {
|
},
|
||||||
Type: schema.TypeInt,
|
"gid": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"groups": {
|
},
|
||||||
Type: schema.TypeList,
|
"groups": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"computes": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"computes": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"consistency": {
|
},
|
||||||
Type: schema.TypeBool,
|
"consistency": {
|
||||||
Computed: true,
|
Type: schema.TypeBool,
|
||||||
},
|
Computed: true,
|
||||||
"id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"tech_status": {
|
},
|
||||||
Type: schema.TypeString,
|
"tech_status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"groups_name": {
|
},
|
||||||
Type: schema.TypeList,
|
// "groups_name": {
|
||||||
Computed: true,
|
// Type: schema.TypeList,
|
||||||
Elem: &schema.Schema{
|
// Computed: true,
|
||||||
Type: schema.TypeString,
|
// Elem: &schema.Schema{
|
||||||
},
|
// Type: schema.TypeString,
|
||||||
},
|
// },
|
||||||
"guid": {
|
// },
|
||||||
Type: schema.TypeInt,
|
"guid": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"milestones": {
|
},
|
||||||
Type: schema.TypeInt,
|
"milestones": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"service_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"service_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"parent_srv_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"parent_srv_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"parent_srv_type": {
|
},
|
||||||
Type: schema.TypeString,
|
"parent_srv_type": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"ram_total": {
|
},
|
||||||
Type: schema.TypeInt,
|
"ram_total": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"rg_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"rg_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"rg_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"rg_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"snapshots": {
|
},
|
||||||
Type: schema.TypeList,
|
"snapshots": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"guid": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeString,
|
"guid": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"label": {
|
},
|
||||||
Type: schema.TypeString,
|
"label": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"timestamp": {
|
},
|
||||||
Type: schema.TypeInt,
|
"timestamp": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"valid": {
|
},
|
||||||
Type: schema.TypeBool,
|
"valid": {
|
||||||
Computed: true,
|
Type: schema.TypeBool,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
"ssh_key": {
|
|
||||||
Type: schema.TypeString,
|
"ssh_key": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"ssh_user": {
|
},
|
||||||
Type: schema.TypeString,
|
"ssh_user": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"tech_status": {
|
},
|
||||||
Type: schema.TypeString,
|
"tech_status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"updated_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"updated_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"updated_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"updated_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"user_managed": {
|
},
|
||||||
Type: schema.TypeBool,
|
"user_managed": {
|
||||||
Computed: true,
|
Type: schema.TypeBool,
|
||||||
},
|
Computed: true,
|
||||||
}
|
},
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func DataSourceBasicService() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceBasicService() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceBasicServiceRead,
|
|
||||||
|
ReadContext: dataSourceBasicServiceRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceBasicServiceSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceBasicServiceSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,84 +1,85 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceBasicServiceDeletedListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceBasicServiceDeletedListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
basicServiceDeletedList, err := utilityBasicServiceDeletedListCheckPresence(ctx, d, m)
|
basicServiceDeletedList, err := utilityBasicServiceDeletedListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenBasicServiceList(basicServiceDeletedList))
|
d.SetId(id.String())
|
||||||
d.Set("entry_count", basicServiceDeletedList.EntryCount)
|
d.Set("items", flattenBasicServiceList(basicServiceDeletedList))
|
||||||
|
d.Set("entry_count", basicServiceDeletedList.EntryCount)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceBasicServiceDeletedListSchemaMake() map[string]*schema.Schema {
|
|
||||||
temp := dataSourceBasicServiceListSchemaMake()
|
func dataSourceBasicServiceDeletedListSchemaMake() map[string]*schema.Schema {
|
||||||
|
temp := dataSourceBasicServiceListSchemaMake()
|
||||||
delete(temp, "by_id")
|
|
||||||
delete(temp, "name")
|
delete(temp, "by_id")
|
||||||
delete(temp, "rg_name")
|
delete(temp, "name")
|
||||||
delete(temp, "status")
|
delete(temp, "rg_name")
|
||||||
delete(temp, "tech_status")
|
delete(temp, "status")
|
||||||
delete(temp, "account_name")
|
delete(temp, "tech_status")
|
||||||
|
delete(temp, "account_name")
|
||||||
return temp
|
|
||||||
}
|
return temp
|
||||||
|
}
|
||||||
func DataSourceBasicServiceDeletedList() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceBasicServiceDeletedList() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceBasicServiceDeletedListRead,
|
|
||||||
|
ReadContext: dataSourceBasicServiceDeletedListRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceBasicServiceDeletedListSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceBasicServiceDeletedListSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,304 +1,305 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceBasicServiceGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceBasicServiceGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
bsg, err := utilityBasicServiceGroupCheckPresence(ctx, d, m)
|
bsg, err := utilityBasicServiceGroupCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("account_id", bsg.AccountID)
|
d.SetId(id.String())
|
||||||
d.Set("account_name", bsg.AccountName)
|
d.Set("account_id", bsg.AccountID)
|
||||||
d.Set("computes", flattenBSGroupComputes(bsg.Computes))
|
d.Set("account_name", bsg.AccountName)
|
||||||
d.Set("consistency", bsg.Consistency)
|
d.Set("computes", flattenBSGroupComputes(bsg.Computes))
|
||||||
d.Set("cpu", bsg.CPU)
|
d.Set("consistency", bsg.Consistency)
|
||||||
d.Set("created_by", bsg.CreatedBy)
|
d.Set("cpu", bsg.CPU)
|
||||||
d.Set("created_time", bsg.CreatedTime)
|
d.Set("created_by", bsg.CreatedBy)
|
||||||
d.Set("deleted_by", bsg.DeletedBy)
|
d.Set("created_time", bsg.CreatedTime)
|
||||||
d.Set("deleted_time", bsg.DeletedTime)
|
d.Set("deleted_by", bsg.DeletedBy)
|
||||||
d.Set("disk", bsg.Disk)
|
d.Set("deleted_time", bsg.DeletedTime)
|
||||||
d.Set("driver", bsg.Driver)
|
d.Set("disk", bsg.Disk)
|
||||||
d.Set("extnets", bsg.ExtNets)
|
d.Set("driver", bsg.Driver)
|
||||||
d.Set("gid", bsg.GID)
|
d.Set("extnets", bsg.ExtNets)
|
||||||
d.Set("guid", bsg.GUID)
|
d.Set("gid", bsg.GID)
|
||||||
d.Set("image_id", bsg.ImageID)
|
d.Set("guid", bsg.GUID)
|
||||||
d.Set("milestones", bsg.Milestones)
|
d.Set("image_id", bsg.ImageID)
|
||||||
d.Set("compgroup_name", bsg.Name)
|
d.Set("milestones", bsg.Milestones)
|
||||||
d.Set("parents", bsg.Parents)
|
d.Set("compgroup_name", bsg.Name)
|
||||||
d.Set("ram", bsg.RAM)
|
d.Set("parents", bsg.Parents)
|
||||||
d.Set("rg_id", bsg.RGID)
|
d.Set("ram", bsg.RAM)
|
||||||
d.Set("rg_name", bsg.RGName)
|
d.Set("rg_id", bsg.RGID)
|
||||||
d.Set("role", bsg.Role)
|
d.Set("rg_name", bsg.RGName)
|
||||||
d.Set("sep_id", bsg.SEPID)
|
d.Set("role", bsg.Role)
|
||||||
d.Set("seq_no", bsg.SeqNo)
|
d.Set("sep_id", bsg.SEPID)
|
||||||
d.Set("status", bsg.Status)
|
d.Set("seq_no", bsg.SeqNo)
|
||||||
d.Set("tech_status", bsg.TechStatus)
|
d.Set("status", bsg.Status)
|
||||||
d.Set("timeout_start", bsg.TimeoutStart)
|
d.Set("tech_status", bsg.TechStatus)
|
||||||
d.Set("updated_by", bsg.UpdatedBy)
|
d.Set("timeout_start", bsg.TimeoutStart)
|
||||||
d.Set("updated_time", bsg.UpdatedTime)
|
d.Set("updated_by", bsg.UpdatedBy)
|
||||||
d.Set("vinses", bsg.VINSes)
|
d.Set("updated_time", bsg.UpdatedTime)
|
||||||
return nil
|
d.Set("vinses", bsg.VINSes)
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func flattenBSGroupOSUsers(bsgosus bservice.ListOSUsers) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
func flattenBSGroupOSUsers(bsgosus bservice.ListOSUsers) []map[string]interface{} {
|
||||||
for _, bsgosu := range bsgosus {
|
res := make([]map[string]interface{}, 0)
|
||||||
temp := map[string]interface{}{
|
for _, bsgosu := range bsgosus {
|
||||||
"login": bsgosu.Login,
|
temp := map[string]interface{}{
|
||||||
"password": bsgosu.Password,
|
"login": bsgosu.Login,
|
||||||
}
|
"password": bsgosu.Password,
|
||||||
res = append(res, temp)
|
}
|
||||||
}
|
res = append(res, temp)
|
||||||
|
}
|
||||||
return res
|
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func flattenBSGroupComputes(bsgcs bservice.ListGroupComputes) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
func flattenBSGroupComputes(bsgcs bservice.ListGroupComputes) []map[string]interface{} {
|
||||||
for _, bsgc := range bsgcs {
|
res := make([]map[string]interface{}, 0)
|
||||||
temp := map[string]interface{}{
|
for _, bsgc := range bsgcs {
|
||||||
"id": bsgc.ID,
|
temp := map[string]interface{}{
|
||||||
"ip_addresses": bsgc.IPAddresses,
|
"id": bsgc.ID,
|
||||||
"name": bsgc.Name,
|
"ip_addresses": bsgc.IPAddresses,
|
||||||
"os_users": flattenBSGroupOSUsers(bsgc.OSUsers),
|
"name": bsgc.Name,
|
||||||
}
|
"os_users": flattenBSGroupOSUsers(bsgc.OSUsers),
|
||||||
res = append(res, temp)
|
}
|
||||||
}
|
res = append(res, temp)
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func dataSourceBasicServiceGroupSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceBasicServiceGroupSchemaMake() map[string]*schema.Schema {
|
||||||
"service_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"service_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Required: true,
|
||||||
"compgroup_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"compgroup_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Required: true,
|
||||||
"account_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"account_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"account_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"computes": {
|
},
|
||||||
Type: schema.TypeList,
|
"computes": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"id": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"ip_addresses": {
|
},
|
||||||
Type: schema.TypeList,
|
"ip_addresses": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Schema{
|
Computed: true,
|
||||||
Type: schema.TypeString,
|
Elem: &schema.Schema{
|
||||||
},
|
Type: schema.TypeString,
|
||||||
},
|
},
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"os_users": {
|
},
|
||||||
Type: schema.TypeList,
|
"os_users": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"login": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeString,
|
"login": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"password": {
|
},
|
||||||
Type: schema.TypeString,
|
"password": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"consistency": {
|
},
|
||||||
Type: schema.TypeBool,
|
"consistency": {
|
||||||
Computed: true,
|
Type: schema.TypeBool,
|
||||||
},
|
Computed: true,
|
||||||
"cpu": {
|
},
|
||||||
Type: schema.TypeInt,
|
"cpu": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"created_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"created_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"created_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"created_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"deleted_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"deleted_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"disk": {
|
},
|
||||||
Type: schema.TypeInt,
|
"disk": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"driver": {
|
},
|
||||||
Type: schema.TypeString,
|
"driver": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"extnets": {
|
},
|
||||||
Type: schema.TypeList,
|
"extnets": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Schema{
|
Computed: true,
|
||||||
Type: schema.TypeInt,
|
Elem: &schema.Schema{
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
},
|
},
|
||||||
"gid": {
|
},
|
||||||
Type: schema.TypeInt,
|
"gid": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"guid": {
|
},
|
||||||
Type: schema.TypeInt,
|
"guid": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"image_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"image_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"milestones": {
|
},
|
||||||
Type: schema.TypeInt,
|
"milestones": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"compgroup_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"compgroup_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"parents": {
|
},
|
||||||
Type: schema.TypeList,
|
"parents": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Schema{
|
Computed: true,
|
||||||
Type: schema.TypeInt,
|
Elem: &schema.Schema{
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
},
|
},
|
||||||
"ram": {
|
},
|
||||||
Type: schema.TypeInt,
|
"ram": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"rg_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"rg_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"rg_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"rg_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"role": {
|
},
|
||||||
Type: schema.TypeString,
|
"role": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"sep_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"sep_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"seq_no": {
|
},
|
||||||
Type: schema.TypeInt,
|
"seq_no": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"tech_status": {
|
},
|
||||||
Type: schema.TypeString,
|
"tech_status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"timeout_start": {
|
},
|
||||||
Type: schema.TypeInt,
|
"timeout_start": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"updated_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"updated_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"updated_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"updated_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"vinses": {
|
},
|
||||||
Type: schema.TypeList,
|
"vinses": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Schema{
|
Computed: true,
|
||||||
Type: schema.TypeInt,
|
Elem: &schema.Schema{
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func DataSourceBasicServiceGroup() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceBasicServiceGroup() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceBasicServiceGroupRead,
|
|
||||||
|
ReadContext: dataSourceBasicServiceGroupRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceBasicServiceGroupSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceBasicServiceGroupSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,263 +1,264 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenBasicServiceList(bsl *bservice.ListBasicServices) []map[string]interface{} {
|
func flattenBasicServiceList(bsl *bservice.ListBasicServices) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, bs := range bsl.Data {
|
for _, bs := range bsl.Data {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"account_id": bs.AccountID,
|
"account_id": bs.AccountID,
|
||||||
"account_name": bs.AccountName,
|
"account_name": bs.AccountName,
|
||||||
"base_domain": bs.BaseDomain,
|
"base_domain": bs.BaseDomain,
|
||||||
"created_by": bs.CreatedBy,
|
"created_by": bs.CreatedBy,
|
||||||
"created_time": bs.CreatedTime,
|
"created_time": bs.CreatedTime,
|
||||||
"deleted_by": bs.DeletedBy,
|
"deleted_by": bs.DeletedBy,
|
||||||
"deleted_time": bs.DeletedTime,
|
"deleted_time": bs.DeletedTime,
|
||||||
"gid": bs.GID,
|
"gid": bs.GID,
|
||||||
"groups": bs.Groups,
|
"groups": bs.Groups,
|
||||||
"guid": bs.GUID,
|
"guid": bs.GUID,
|
||||||
"service_id": bs.ID,
|
"service_id": bs.ID,
|
||||||
"service_name": bs.Name,
|
"service_name": bs.Name,
|
||||||
"parent_srv_id": bs.ParentSrvID,
|
"parent_srv_id": bs.ParentSrvID,
|
||||||
"parent_srv_type": bs.ParentSrvType,
|
"parent_srv_type": bs.ParentSrvType,
|
||||||
"rg_id": bs.RGID,
|
"rg_id": bs.RGID,
|
||||||
"rg_name": bs.RGName,
|
"rg_name": bs.RGName,
|
||||||
"ssh_user": bs.SSHUser,
|
"ssh_user": bs.SSHUser,
|
||||||
"status": bs.Status,
|
"status": bs.Status,
|
||||||
"tech_status": bs.TechStatus,
|
"tech_status": bs.TechStatus,
|
||||||
"updated_by": bs.UpdatedBy,
|
"updated_by": bs.UpdatedBy,
|
||||||
"updated_time": bs.UpdatedTime,
|
"updated_time": bs.UpdatedTime,
|
||||||
"user_managed": bs.UserManaged,
|
"user_managed": bs.UserManaged,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceBasicServiceListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceBasicServiceListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
basicServiceList, err := utilityBasicServiceListCheckPresence(ctx, d, m)
|
basicServiceList, err := utilityBasicServiceListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenBasicServiceList(basicServiceList))
|
d.SetId(id.String())
|
||||||
d.Set("entry_count", basicServiceList.EntryCount)
|
d.Set("items", flattenBasicServiceList(basicServiceList))
|
||||||
|
d.Set("entry_count", basicServiceList.EntryCount)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceBasicServiceListSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceBasicServiceListSchemaMake() map[string]*schema.Schema {
|
||||||
"by_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"by_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by ID",
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by bservice name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by bservice name",
|
||||||
"rg_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"rg_name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by resource group name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by resource group name",
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by status",
|
Optional: true,
|
||||||
},
|
Description: "Filter by status",
|
||||||
"tech_status": {
|
},
|
||||||
Type: schema.TypeString,
|
"tech_status": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by tech status",
|
Optional: true,
|
||||||
},
|
Description: "Filter by tech status",
|
||||||
"account_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"account_name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by account name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by account name",
|
||||||
"account_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the account to query for BasicService instances",
|
Optional: true,
|
||||||
},
|
Description: "ID of the account to query for BasicService instances",
|
||||||
"rg_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"rg_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the resource group to query for BasicService instances",
|
Optional: true,
|
||||||
},
|
Description: "ID of the resource group to query for BasicService instances",
|
||||||
"page": {
|
},
|
||||||
Type: schema.TypeInt,
|
"page": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page number",
|
Optional: true,
|
||||||
},
|
Description: "Page number",
|
||||||
"size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"size": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page size",
|
Optional: true,
|
||||||
},
|
Description: "Page size",
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"items": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"account_id": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"account_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"account_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"base_domain": {
|
},
|
||||||
Type: schema.TypeString,
|
"base_domain": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"created_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"created_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"created_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"created_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"deleted_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"deleted_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"deleted_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"gid": {
|
},
|
||||||
Type: schema.TypeInt,
|
"gid": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"groups": {
|
},
|
||||||
Type: schema.TypeList,
|
"groups": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Schema{
|
Computed: true,
|
||||||
Type: schema.TypeInt,
|
Elem: &schema.Schema{
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
},
|
},
|
||||||
"guid": {
|
},
|
||||||
Type: schema.TypeInt,
|
"guid": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"service_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"service_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"service_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"service_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"parent_srv_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"parent_srv_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"parent_srv_type": {
|
},
|
||||||
Type: schema.TypeString,
|
"parent_srv_type": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"rg_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"rg_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"rg_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"rg_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"ssh_user": {
|
},
|
||||||
Type: schema.TypeString,
|
"ssh_user": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"tech_status": {
|
},
|
||||||
Type: schema.TypeString,
|
"tech_status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"updated_by": {
|
},
|
||||||
Type: schema.TypeString,
|
"updated_by": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"updated_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"updated_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"user_managed": {
|
},
|
||||||
Type: schema.TypeBool,
|
"user_managed": {
|
||||||
Computed: true,
|
Type: schema.TypeBool,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"entry_count": {
|
},
|
||||||
Type: schema.TypeInt,
|
"entry_count": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
}
|
},
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func DataSourceBasicServiceList() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceBasicServiceList() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceBasicServiceListRead,
|
|
||||||
|
ReadContext: dataSourceBasicServiceListRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceBasicServiceListSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceBasicServiceListSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,105 +1,110 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceBasicServiceSnapshotListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceBasicServiceSnapshotListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
basicServiceSnapshotList, err := utilityBasicServiceSnapshotListCheckPresence(ctx, d, m)
|
basicServiceSnapshotList, err := utilityBasicServiceSnapshotListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenBasicServiceSnapshots(basicServiceSnapshotList))
|
d.SetId(id.String())
|
||||||
|
d.Set("items", flattenBasicServiceSnapshotsList(basicServiceSnapshotList))
|
||||||
return nil
|
d.Set("entry_count", basicServiceSnapshotList.EntryCount)
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceBasicServiceSnapshotListSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceBasicServiceSnapshotListSchemaMake() map[string]*schema.Schema {
|
||||||
"service_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"service_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the BasicService instance",
|
Required: true,
|
||||||
},
|
Description: "ID of the BasicService instance",
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"items": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"guid": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeString,
|
"guid": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"label": {
|
},
|
||||||
Type: schema.TypeString,
|
"label": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"timestamp": {
|
},
|
||||||
Type: schema.TypeInt,
|
"timestamp": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"valid": {
|
},
|
||||||
Type: schema.TypeBool,
|
"valid": {
|
||||||
Computed: true,
|
Type: schema.TypeBool,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
return res
|
"entry_count": {
|
||||||
}
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
func DataSourceBasicServiceSnapshotList() *schema.Resource {
|
},
|
||||||
return &schema.Resource{
|
}
|
||||||
SchemaVersion: 1,
|
return res
|
||||||
|
}
|
||||||
ReadContext: dataSourceBasicServiceSnapshotListRead,
|
|
||||||
|
func DataSourceBasicServiceSnapshotList() *schema.Resource {
|
||||||
Timeouts: &schema.ResourceTimeout{
|
return &schema.Resource{
|
||||||
Read: &constants.Timeout30s,
|
SchemaVersion: 1,
|
||||||
Default: &constants.Timeout60s,
|
|
||||||
},
|
ReadContext: dataSourceBasicServiceSnapshotListRead,
|
||||||
|
|
||||||
Schema: dataSourceBasicServiceSnapshotListSchemaMake(),
|
Timeouts: &schema.ResourceTimeout{
|
||||||
}
|
Read: &constants.Timeout30s,
|
||||||
}
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceBasicServiceSnapshotListSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ func flattenResourceBasicServiceGroup(d *schema.ResourceData, bsg *bservice.Reco
|
|||||||
d.Set("rg_name", bsg.RGName)
|
d.Set("rg_name", bsg.RGName)
|
||||||
d.Set("role", bsg.Role)
|
d.Set("role", bsg.Role)
|
||||||
d.Set("sep_id", bsg.SEPID)
|
d.Set("sep_id", bsg.SEPID)
|
||||||
|
d.Set("sep_pool", bsg.PoolName)
|
||||||
d.Set("seq_no", bsg.SeqNo)
|
d.Set("seq_no", bsg.SeqNo)
|
||||||
d.Set("status", bsg.Status)
|
d.Set("status", bsg.Status)
|
||||||
d.Set("tech_status", bsg.TechStatus)
|
d.Set("tech_status", bsg.TechStatus)
|
||||||
@@ -110,7 +111,7 @@ func flattenBasicServiceComputes(bscs bservice.ListComputes) []map[string]interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenBasicServiceSnapshots(bsrvss bservice.ListSnapshots) []map[string]interface{} {
|
func flattenBasicServiceSnapshots(bsrvss bservice.ListSnapshots) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(bsrvss))
|
||||||
for _, bsrvs := range bsrvss {
|
for _, bsrvs := range bsrvss {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"guid": bsrvs.GUID,
|
"guid": bsrvs.GUID,
|
||||||
@@ -122,3 +123,17 @@ func flattenBasicServiceSnapshots(bsrvss bservice.ListSnapshots) []map[string]in
|
|||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func flattenBasicServiceSnapshotsList(bsrvss *bservice.ListInfoSnapshots) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0, len(bsrvss.Data))
|
||||||
|
for _, bsrvs := range bsrvss.Data {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"guid": bsrvs.GUID,
|
||||||
|
"label": bsrvs.Label,
|
||||||
|
"timestamp": bsrvs.Timestamp,
|
||||||
|
"valid": bsrvs.Valid,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityBasicServiceSnapshotListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (bservice.ListSnapshots, error) {
|
func utilityBasicServiceSnapshotListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*bservice.ListInfoSnapshots, error) {
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
var id uint64
|
var id uint64
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import (
|
|||||||
func dataSourceDiskRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,489 +1,500 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceDiskListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
diskList, err := utilityDiskListCheckPresence(ctx, d, m)
|
diskList, err := utilityDiskListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenDiskList(diskList))
|
d.SetId(id.String())
|
||||||
d.Set("entry_count", diskList.EntryCount)
|
d.Set("items", flattenDiskList(diskList))
|
||||||
|
d.Set("entry_count", diskList.EntryCount)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
||||||
"by_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"by_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Find by ID",
|
Optional: true,
|
||||||
},
|
Description: "Find by ID",
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Find by name",
|
Optional: true,
|
||||||
},
|
Description: "Find by name",
|
||||||
"account_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"account_name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Find by account name",
|
Optional: true,
|
||||||
},
|
Description: "Find by account name",
|
||||||
"disk_max_size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"disk_max_size": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Find by max disk size",
|
Optional: true,
|
||||||
},
|
Description: "Find by max disk size",
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Find by status",
|
Optional: true,
|
||||||
},
|
Description: "Find by status",
|
||||||
"shared": {
|
},
|
||||||
Type: schema.TypeBool,
|
"shared": {
|
||||||
Optional: true,
|
Type: schema.TypeBool,
|
||||||
Description: "Find by shared field",
|
Optional: true,
|
||||||
},
|
Description: "Find by shared field",
|
||||||
"account_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the account the disks belong to",
|
Optional: true,
|
||||||
},
|
Description: "ID of the account the disks belong to",
|
||||||
"type": {
|
},
|
||||||
Type: schema.TypeString,
|
"type": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "type of the disks",
|
Optional: true,
|
||||||
},
|
Description: "type of the disks",
|
||||||
"page": {
|
},
|
||||||
Type: schema.TypeInt,
|
"sep_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page number",
|
Optional: true,
|
||||||
},
|
Description: "find by sep ID",
|
||||||
"size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"pool_name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Page size",
|
Optional: true,
|
||||||
},
|
Description: "find by pool name",
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"page": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Elem: &schema.Resource{
|
Optional: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Description: "Page number",
|
||||||
"account_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"size": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "The unique ID of the subscriber-owner of the disk",
|
Optional: true,
|
||||||
},
|
Description: "Page size",
|
||||||
"account_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"items": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Description: "The name of the subscriber '(account') to whom this disk belongs",
|
Computed: true,
|
||||||
},
|
Elem: &schema.Resource{
|
||||||
"acl": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeString,
|
"account_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
// "boot_partition": {
|
Description: "The unique ID of the subscriber-owner of the disk",
|
||||||
// Type: schema.TypeInt,
|
},
|
||||||
// Computed: true,
|
"account_name": {
|
||||||
// Description: "Number of disk partitions",
|
Type: schema.TypeString,
|
||||||
// },
|
Computed: true,
|
||||||
"computes": {
|
Description: "The name of the subscriber '(account') to whom this disk belongs",
|
||||||
Type: schema.TypeList,
|
},
|
||||||
Computed: true,
|
"acl": {
|
||||||
Elem: &schema.Resource{
|
Type: schema.TypeString,
|
||||||
Schema: map[string]*schema.Schema{
|
Computed: true,
|
||||||
"compute_id": {
|
},
|
||||||
Type: schema.TypeString,
|
// "boot_partition": {
|
||||||
Computed: true,
|
// Type: schema.TypeInt,
|
||||||
},
|
// Computed: true,
|
||||||
"compute_name": {
|
// Description: "Number of disk partitions",
|
||||||
Type: schema.TypeString,
|
// },
|
||||||
Computed: true,
|
"computes": {
|
||||||
},
|
Type: schema.TypeList,
|
||||||
},
|
Computed: true,
|
||||||
},
|
Elem: &schema.Resource{
|
||||||
},
|
Schema: map[string]*schema.Schema{
|
||||||
"created_time": {
|
"compute_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Created time",
|
},
|
||||||
},
|
"compute_name": {
|
||||||
"deleted_time": {
|
Type: schema.TypeString,
|
||||||
Type: schema.TypeInt,
|
Computed: true,
|
||||||
Computed: true,
|
},
|
||||||
Description: "Deleted time",
|
},
|
||||||
},
|
},
|
||||||
"desc": {
|
},
|
||||||
Type: schema.TypeString,
|
"created_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Description of disk",
|
Computed: true,
|
||||||
},
|
Description: "Created time",
|
||||||
"destruction_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"deleted_time": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Time of final deletion",
|
Computed: true,
|
||||||
},
|
Description: "Deleted time",
|
||||||
"devicename": {
|
},
|
||||||
Type: schema.TypeString,
|
"desc": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "Name of the device",
|
Computed: true,
|
||||||
},
|
Description: "Description of disk",
|
||||||
// "disk_path": {
|
},
|
||||||
// Type: schema.TypeString,
|
"destruction_time": {
|
||||||
// Computed: true,
|
Type: schema.TypeInt,
|
||||||
// Description: "Disk path",
|
Computed: true,
|
||||||
// },
|
Description: "Time of final deletion",
|
||||||
"gid": {
|
},
|
||||||
Type: schema.TypeInt,
|
"devicename": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "ID of the grid (platform)",
|
Computed: true,
|
||||||
},
|
Description: "Name of the device",
|
||||||
// "guid": {
|
},
|
||||||
// Type: schema.TypeInt,
|
// "disk_path": {
|
||||||
// Computed: true,
|
// Type: schema.TypeString,
|
||||||
// Description: "Disk ID on the storage side",
|
// Computed: true,
|
||||||
// },
|
// Description: "Disk path",
|
||||||
"disk_id": {
|
// },
|
||||||
Type: schema.TypeInt,
|
"gid": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "The unique ID of the subscriber-owner of the disk",
|
Computed: true,
|
||||||
},
|
Description: "ID of the grid (platform)",
|
||||||
"image_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
// "guid": {
|
||||||
Computed: true,
|
// Type: schema.TypeInt,
|
||||||
Description: "Image ID",
|
// Computed: true,
|
||||||
},
|
// Description: "Disk ID on the storage side",
|
||||||
"images": {
|
// },
|
||||||
Type: schema.TypeList,
|
"disk_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Elem: &schema.Schema{
|
Computed: true,
|
||||||
Type: schema.TypeString,
|
Description: "The unique ID of the subscriber-owner of the disk",
|
||||||
},
|
},
|
||||||
Description: "IDs of images using the disk",
|
"image_id": {
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
"iotune": {
|
Computed: true,
|
||||||
Type: schema.TypeList,
|
Description: "Image ID",
|
||||||
Computed: true,
|
},
|
||||||
Elem: &schema.Resource{
|
"images": {
|
||||||
Schema: map[string]*schema.Schema{
|
Type: schema.TypeList,
|
||||||
"read_bytes_sec": {
|
Computed: true,
|
||||||
Type: schema.TypeInt,
|
Elem: &schema.Schema{
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "Number of bytes to read per second",
|
},
|
||||||
},
|
Description: "IDs of images using the disk",
|
||||||
"read_bytes_sec_max": {
|
},
|
||||||
Type: schema.TypeInt,
|
"iotune": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Description: "Maximum number of bytes to read",
|
Computed: true,
|
||||||
},
|
Elem: &schema.Resource{
|
||||||
"read_iops_sec": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"read_bytes_sec": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Number of io read operations per second",
|
Computed: true,
|
||||||
},
|
Description: "Number of bytes to read per second",
|
||||||
"read_iops_sec_max": {
|
},
|
||||||
Type: schema.TypeInt,
|
"read_bytes_sec_max": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Maximum number of io read operations",
|
Computed: true,
|
||||||
},
|
Description: "Maximum number of bytes to read",
|
||||||
"size_iops_sec": {
|
},
|
||||||
Type: schema.TypeInt,
|
"read_iops_sec": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Size of io operations",
|
Computed: true,
|
||||||
},
|
Description: "Number of io read operations per second",
|
||||||
"total_bytes_sec": {
|
},
|
||||||
Type: schema.TypeInt,
|
"read_iops_sec_max": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Total size bytes per second",
|
Computed: true,
|
||||||
},
|
Description: "Maximum number of io read operations",
|
||||||
"total_bytes_sec_max": {
|
},
|
||||||
Type: schema.TypeInt,
|
"size_iops_sec": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Maximum total size of bytes per second",
|
Computed: true,
|
||||||
},
|
Description: "Size of io operations",
|
||||||
"total_iops_sec": {
|
},
|
||||||
Type: schema.TypeInt,
|
"total_bytes_sec": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Total number of io operations per second",
|
Computed: true,
|
||||||
},
|
Description: "Total size bytes per second",
|
||||||
"total_iops_sec_max": {
|
},
|
||||||
Type: schema.TypeInt,
|
"total_bytes_sec_max": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Maximum total number of io operations per second",
|
Computed: true,
|
||||||
},
|
Description: "Maximum total size of bytes per second",
|
||||||
"write_bytes_sec": {
|
},
|
||||||
Type: schema.TypeInt,
|
"total_iops_sec": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Number of bytes to write per second",
|
Computed: true,
|
||||||
},
|
Description: "Total number of io operations per second",
|
||||||
"write_bytes_sec_max": {
|
},
|
||||||
Type: schema.TypeInt,
|
"total_iops_sec_max": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Maximum number of bytes to write per second",
|
Computed: true,
|
||||||
},
|
Description: "Maximum total number of io operations per second",
|
||||||
"write_iops_sec": {
|
},
|
||||||
Type: schema.TypeInt,
|
"write_bytes_sec": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Number of write operations per second",
|
Computed: true,
|
||||||
},
|
Description: "Number of bytes to write per second",
|
||||||
"write_iops_sec_max": {
|
},
|
||||||
Type: schema.TypeInt,
|
"write_bytes_sec_max": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Maximum number of write operations per second",
|
Computed: true,
|
||||||
},
|
Description: "Maximum number of bytes to write per second",
|
||||||
},
|
},
|
||||||
},
|
"write_iops_sec": {
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
// "iqn": {
|
Computed: true,
|
||||||
// Type: schema.TypeString,
|
Description: "Number of write operations per second",
|
||||||
// Computed: true,
|
},
|
||||||
// Description: "Disk IQN",
|
"write_iops_sec_max": {
|
||||||
// },
|
Type: schema.TypeInt,
|
||||||
// "login": {
|
Computed: true,
|
||||||
// Type: schema.TypeString,
|
Description: "Maximum number of write operations per second",
|
||||||
// Computed: true,
|
},
|
||||||
// Description: "Login to access the disk",
|
},
|
||||||
// },
|
},
|
||||||
"machine_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
// "iqn": {
|
||||||
Computed: true,
|
// Type: schema.TypeString,
|
||||||
Description: "Machine ID",
|
// Computed: true,
|
||||||
},
|
// Description: "Disk IQN",
|
||||||
"machine_name": {
|
// },
|
||||||
Type: schema.TypeString,
|
// "login": {
|
||||||
Computed: true,
|
// Type: schema.TypeString,
|
||||||
Description: "Machine name",
|
// Computed: true,
|
||||||
},
|
// Description: "Login to access the disk",
|
||||||
// "milestones": {
|
// },
|
||||||
// Type: schema.TypeInt,
|
"machine_id": {
|
||||||
// Computed: true,
|
Type: schema.TypeInt,
|
||||||
// Description: "Milestones",
|
Computed: true,
|
||||||
// },
|
Description: "Machine ID",
|
||||||
"disk_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"machine_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "Name of disk",
|
Computed: true,
|
||||||
},
|
Description: "Machine name",
|
||||||
"order": {
|
},
|
||||||
Type: schema.TypeInt,
|
// "milestones": {
|
||||||
Computed: true,
|
// Type: schema.TypeInt,
|
||||||
Description: "Disk order",
|
// Computed: true,
|
||||||
},
|
// Description: "Milestones",
|
||||||
"params": {
|
// },
|
||||||
Type: schema.TypeString,
|
"disk_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "Disk params",
|
Computed: true,
|
||||||
},
|
Description: "Name of disk",
|
||||||
"parent_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"order": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the parent disk",
|
Computed: true,
|
||||||
},
|
Description: "Disk order",
|
||||||
// "passwd": {
|
},
|
||||||
// Type: schema.TypeString,
|
"params": {
|
||||||
// Computed: true,
|
Type: schema.TypeString,
|
||||||
// Description: "Password to access the disk",
|
Computed: true,
|
||||||
// },
|
Description: "Disk params",
|
||||||
"pci_slot": {
|
},
|
||||||
Type: schema.TypeInt,
|
"parent_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Description: "ID of the pci slot to which the disk is connected",
|
Computed: true,
|
||||||
},
|
Description: "ID of the parent disk",
|
||||||
"pool": {
|
},
|
||||||
Type: schema.TypeString,
|
// "passwd": {
|
||||||
Computed: true,
|
// Type: schema.TypeString,
|
||||||
Description: "Pool for disk location",
|
// Computed: true,
|
||||||
},
|
// Description: "Password to access the disk",
|
||||||
"present_to": {
|
// },
|
||||||
Type: schema.TypeList,
|
"pci_slot": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Elem: &schema.Schema{
|
Computed: true,
|
||||||
Type: schema.TypeInt,
|
Description: "ID of the pci slot to which the disk is connected",
|
||||||
},
|
},
|
||||||
},
|
"pool": {
|
||||||
// "purge_attempts": {
|
Type: schema.TypeString,
|
||||||
// Type: schema.TypeInt,
|
Computed: true,
|
||||||
// Computed: true,
|
Description: "Pool for disk location",
|
||||||
// Description: "Number of deletion attempts",
|
},
|
||||||
// },
|
"present_to": {
|
||||||
"purge_time": {
|
Type: schema.TypeList,
|
||||||
Type: schema.TypeInt,
|
Computed: true,
|
||||||
Computed: true,
|
Elem: &schema.Schema{
|
||||||
Description: "Time of the last deletion attempt",
|
Type: schema.TypeInt,
|
||||||
},
|
},
|
||||||
// "reality_device_number": {
|
},
|
||||||
// Type: schema.TypeInt,
|
// "purge_attempts": {
|
||||||
// Computed: true,
|
// Type: schema.TypeInt,
|
||||||
// Description: "Reality device number",
|
// Computed: true,
|
||||||
// },
|
// Description: "Number of deletion attempts",
|
||||||
// "reference_id": {
|
// },
|
||||||
// Type: schema.TypeString,
|
"purge_time": {
|
||||||
// Computed: true,
|
Type: schema.TypeInt,
|
||||||
// Description: "ID of the reference to the disk",
|
Computed: true,
|
||||||
// },
|
Description: "Time of the last deletion attempt",
|
||||||
"res_id": {
|
},
|
||||||
Type: schema.TypeString,
|
// "reality_device_number": {
|
||||||
Computed: true,
|
// Type: schema.TypeInt,
|
||||||
Description: "Resource ID",
|
// Computed: true,
|
||||||
},
|
// Description: "Reality device number",
|
||||||
"res_name": {
|
// },
|
||||||
Type: schema.TypeString,
|
// "reference_id": {
|
||||||
Computed: true,
|
// Type: schema.TypeString,
|
||||||
Description: "Name of the resource",
|
// Computed: true,
|
||||||
},
|
// Description: "ID of the reference to the disk",
|
||||||
"role": {
|
// },
|
||||||
Type: schema.TypeString,
|
"res_id": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "Disk role",
|
Computed: true,
|
||||||
},
|
Description: "Resource ID",
|
||||||
"sep_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"res_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "Storage endpoint provider ID to create disk",
|
Computed: true,
|
||||||
},
|
Description: "Name of the resource",
|
||||||
"sep_type": {
|
},
|
||||||
Type: schema.TypeString,
|
"role": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "Type SEP. Defines the type of storage system and contains one of the values set in the cloud platform",
|
Computed: true,
|
||||||
},
|
Description: "Disk role",
|
||||||
"shareable": {
|
},
|
||||||
Type: schema.TypeBool,
|
"sep_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"size_max": {
|
Description: "Storage endpoint provider ID to create disk",
|
||||||
Type: schema.TypeInt,
|
},
|
||||||
Computed: true,
|
"sep_type": {
|
||||||
Description: "Size in GB",
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"size_used": {
|
Description: "Type SEP. Defines the type of storage system and contains one of the values set in the cloud platform",
|
||||||
Type: schema.TypeFloat,
|
},
|
||||||
Computed: true,
|
"shareable": {
|
||||||
Description: "Number of used space, in GB",
|
Type: schema.TypeBool,
|
||||||
},
|
Computed: true,
|
||||||
"snapshots": {
|
},
|
||||||
Type: schema.TypeList,
|
"size_max": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Description: "Size in GB",
|
||||||
"guid": {
|
},
|
||||||
Type: schema.TypeString,
|
"size_used": {
|
||||||
Computed: true,
|
Type: schema.TypeFloat,
|
||||||
Description: "ID of the snapshot",
|
Computed: true,
|
||||||
},
|
Description: "Number of used space, in GB",
|
||||||
"label": {
|
},
|
||||||
Type: schema.TypeString,
|
"snapshots": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Description: "Name of the snapshot",
|
Computed: true,
|
||||||
},
|
Elem: &schema.Resource{
|
||||||
"res_id": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeString,
|
"guid": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "Reference to the snapshot",
|
Computed: true,
|
||||||
},
|
Description: "ID of the snapshot",
|
||||||
"snap_set_guid": {
|
},
|
||||||
Type: schema.TypeString,
|
"label": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "The set snapshot ID",
|
Computed: true,
|
||||||
},
|
Description: "Name of the snapshot",
|
||||||
"snap_set_time": {
|
},
|
||||||
Type: schema.TypeInt,
|
"res_id": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "The set time of the snapshot",
|
Computed: true,
|
||||||
},
|
Description: "Reference to the snapshot",
|
||||||
"timestamp": {
|
},
|
||||||
Type: schema.TypeInt,
|
"snap_set_guid": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "Snapshot time",
|
Computed: true,
|
||||||
},
|
Description: "The set snapshot ID",
|
||||||
},
|
},
|
||||||
},
|
"snap_set_time": {
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
"status": {
|
Computed: true,
|
||||||
Type: schema.TypeString,
|
Description: "The set time of the snapshot",
|
||||||
Computed: true,
|
},
|
||||||
Description: "Disk status",
|
"timestamp": {
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
"tech_status": {
|
Computed: true,
|
||||||
Type: schema.TypeString,
|
Description: "Snapshot time",
|
||||||
Computed: true,
|
},
|
||||||
Description: "Technical status of the disk",
|
},
|
||||||
},
|
},
|
||||||
"type": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "The type of disk in terms of its role in compute: 'B=Boot, D=Data, T=Temp'",
|
Computed: true,
|
||||||
},
|
Description: "Disk status",
|
||||||
"vmid": {
|
},
|
||||||
Type: schema.TypeInt,
|
"tech_status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
Description: "Virtual Machine ID (Deprecated)",
|
Computed: true,
|
||||||
},
|
Description: "Technical status of the disk",
|
||||||
},
|
},
|
||||||
},
|
"type": {
|
||||||
},
|
Type: schema.TypeString,
|
||||||
"entry_count": {
|
Computed: true,
|
||||||
Type: schema.TypeInt,
|
Description: "The type of disk in terms of its role in compute: 'B=Boot, D=Data, T=Temp'",
|
||||||
Computed: true,
|
},
|
||||||
},
|
"vmid": {
|
||||||
}
|
Type: schema.TypeInt,
|
||||||
return res
|
Computed: true,
|
||||||
}
|
Description: "Virtual Machine ID (Deprecated)",
|
||||||
|
},
|
||||||
func DataSourceDiskList() *schema.Resource {
|
},
|
||||||
return &schema.Resource{
|
},
|
||||||
SchemaVersion: 1,
|
},
|
||||||
|
"entry_count": {
|
||||||
ReadContext: dataSourceDiskListRead,
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
},
|
||||||
Read: &constants.Timeout30s,
|
}
|
||||||
Default: &constants.Timeout60s,
|
return res
|
||||||
},
|
}
|
||||||
|
|
||||||
Schema: dataSourceDiskListSchemaMake(),
|
func DataSourceDiskList() *schema.Resource {
|
||||||
}
|
return &schema.Resource{
|
||||||
}
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceDiskListRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceDiskListSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -44,17 +44,29 @@ import (
|
|||||||
func dataSourceDiskListTypesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskListTypesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
listTypes, err := utilityDiskListTypesCheckPresence(ctx, d, m)
|
listTypes, err := utilityDiskListTypesCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
d.SetId(id.String())
|
d.SetId(id.String())
|
||||||
d.Set("types", listTypes)
|
d.Set("types", listTypes.Data)
|
||||||
|
d.Set("entry_count", listTypes.EntryCount)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceDiskListTypesSchemaMake() map[string]*schema.Schema {
|
func dataSourceDiskListTypesSchemaMake() map[string]*schema.Schema {
|
||||||
res := map[string]*schema.Schema{
|
res := map[string]*schema.Schema{
|
||||||
|
"page": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Page number",
|
||||||
|
},
|
||||||
|
"size": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Page size",
|
||||||
|
},
|
||||||
"types": {
|
"types": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -63,6 +75,10 @@ func dataSourceDiskListTypesSchemaMake() map[string]*schema.Schema {
|
|||||||
},
|
},
|
||||||
Description: "The types of disk in terms of its role in compute: 'B=Boot, D=Data, T=Temp'",
|
Description: "The types of disk in terms of its role in compute: 'B=Boot, D=Data, T=Temp'",
|
||||||
},
|
},
|
||||||
|
"entry_count": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,8 +47,9 @@ func flattenDiskListTypesDetailed(tld *disks.ListTypes) []map[string]interface{}
|
|||||||
for _, typeListDetailed := range tld.Data {
|
for _, typeListDetailed := range tld.Data {
|
||||||
toMap := typeListDetailed.(map[string]interface{})
|
toMap := typeListDetailed.(map[string]interface{})
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"pools": flattenListTypesDetailedPools(toMap["pools"].([]interface{})),
|
"pools": flattenListTypesDetailedPools(toMap["pools"].([]interface{})),
|
||||||
"sep_id": toMap["sepId"].(float64),
|
"sep_id": toMap["sepId"].(float64),
|
||||||
|
"sep_name": toMap["sepName"].(string),
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
@@ -60,8 +61,9 @@ func flattenListTypesDetailedPools(pools []interface{}) []interface{} {
|
|||||||
for _, pool := range pools {
|
for _, pool := range pools {
|
||||||
toMap := pool.(map[string]interface{})
|
toMap := pool.(map[string]interface{})
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"name": toMap["name"].(string),
|
"name": toMap["name"].(string),
|
||||||
"types": toMap["types"].([]interface{}),
|
"system": toMap["system"].(string),
|
||||||
|
"types": toMap["types"].([]interface{}),
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
@@ -72,17 +74,29 @@ func flattenListTypesDetailedPools(pools []interface{}) []interface{} {
|
|||||||
func dataSourceDiskListTypesDetailedRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskListTypesDetailedRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
listTypesDetailed, err := utilityDiskListTypesDetailedCheckPresence(ctx, d, m)
|
listTypesDetailed, err := utilityDiskListTypesDetailedCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
d.SetId(id.String())
|
d.SetId(id.String())
|
||||||
d.Set("items", flattenDiskListTypesDetailed(listTypesDetailed))
|
d.Set("items", flattenDiskListTypesDetailed(listTypesDetailed))
|
||||||
|
d.Set("entry_count", listTypesDetailed.EntryCount)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceDiskListTypesDetailedSchemaMake() map[string]*schema.Schema {
|
func dataSourceDiskListTypesDetailedSchemaMake() map[string]*schema.Schema {
|
||||||
res := map[string]*schema.Schema{
|
res := map[string]*schema.Schema{
|
||||||
|
"page": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Page number",
|
||||||
|
},
|
||||||
|
"size": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Page size",
|
||||||
|
},
|
||||||
"items": {
|
"items": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -98,6 +112,10 @@ func dataSourceDiskListTypesDetailedSchemaMake() map[string]*schema.Schema {
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Pool name",
|
Description: "Pool name",
|
||||||
},
|
},
|
||||||
|
"system": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"types": {
|
"types": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -114,9 +132,17 @@ func dataSourceDiskListTypesDetailedSchemaMake() map[string]*schema.Schema {
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Storage endpoint provider ID to create disk",
|
Description: "Storage endpoint provider ID to create disk",
|
||||||
},
|
},
|
||||||
|
"sep_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"entry_count": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import (
|
|||||||
func dataSourceDiskListUnattachedRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskListUnattachedRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
diskListUnattached, err := utilityDiskListUnattachedCheckPresence(ctx, d, m)
|
diskListUnattached, err := utilityDiskListUnattachedCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,6 +98,16 @@ func dataSourceDiskListUnattachedSchemaMake() map[string]*schema.Schema {
|
|||||||
Optional: true,
|
Optional: true,
|
||||||
Description: "ID of the account the disks belong to",
|
Description: "ID of the account the disks belong to",
|
||||||
},
|
},
|
||||||
|
"sep_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "find by sep ID",
|
||||||
|
},
|
||||||
|
"pool_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "find by pool name",
|
||||||
|
},
|
||||||
"type": {
|
"type": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
@@ -365,6 +376,11 @@ func dataSourceDiskListUnattachedSchemaMake() map[string]*schema.Schema {
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Storage endpoint provider ID to create disk",
|
Description: "Storage endpoint provider ID to create disk",
|
||||||
},
|
},
|
||||||
|
"shareable": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Computed: true,
|
||||||
|
Description: "shareable",
|
||||||
|
},
|
||||||
"size_max": {
|
"size_max": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import (
|
|||||||
func dataSourceDiskSnapshotRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskSnapshotRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import (
|
|||||||
func dataSourceDiskSnapshotListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskSnapshotListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import (
|
|||||||
func dataSourceDiskListDeletedRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskListDeletedRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
diskList, err := utilityDiskListDeletedCheckPresence(ctx, d, m)
|
diskList, err := utilityDiskListDeletedCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ func flattenDiskSnapshot(d *schema.ResourceData, snapshot disks.ItemSnapshot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenDiskListUnattached(ul *disks.ListDisksUnattached) []map[string]interface{} {
|
func flattenDiskListUnattached(ul *disks.ListDisksUnattached) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(ul.Data))
|
||||||
for _, unattachedDisk := range ul.Data {
|
for _, unattachedDisk := range ul.Data {
|
||||||
unattachedDiskAcl, _ := json.Marshal(unattachedDisk.ACL)
|
unattachedDiskAcl, _ := json.Marshal(unattachedDisk.ACL)
|
||||||
tmp := map[string]interface{}{
|
tmp := map[string]interface{}{
|
||||||
@@ -56,6 +56,7 @@ func flattenDiskListUnattached(ul *disks.ListDisksUnattached) []map[string]inter
|
|||||||
"res_name": unattachedDisk.ResName,
|
"res_name": unattachedDisk.ResName,
|
||||||
"role": unattachedDisk.Role,
|
"role": unattachedDisk.Role,
|
||||||
"sep_id": unattachedDisk.SEPID,
|
"sep_id": unattachedDisk.SEPID,
|
||||||
|
"shareable": unattachedDisk.Shareable,
|
||||||
"size_max": unattachedDisk.SizeMax,
|
"size_max": unattachedDisk.SizeMax,
|
||||||
"size_used": unattachedDisk.SizeUsed,
|
"size_used": unattachedDisk.SizeUsed,
|
||||||
"snapshots": flattenDiskSnapshotList(unattachedDisk.Snapshots),
|
"snapshots": flattenDiskSnapshotList(unattachedDisk.Snapshots),
|
||||||
@@ -120,7 +121,7 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenDiskSnapshotList(sl disks.ListSnapshots) []interface{} {
|
func flattenDiskSnapshotList(sl disks.ListSnapshots) []interface{} {
|
||||||
res := make([]interface{}, 0)
|
res := make([]interface{}, 0, len(sl))
|
||||||
for _, snapshot := range sl {
|
for _, snapshot := range sl {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"guid": snapshot.GUID,
|
"guid": snapshot.GUID,
|
||||||
@@ -137,7 +138,7 @@ func flattenDiskSnapshotList(sl disks.ListSnapshots) []interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenDiskList(dl *disks.ListDisks) []map[string]interface{} {
|
func flattenDiskList(dl *disks.ListDisks) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(dl.Data))
|
||||||
for _, disk := range dl.Data {
|
for _, disk := range dl.Data {
|
||||||
diskAcl, _ := json.Marshal(disk.ACL)
|
diskAcl, _ := json.Marshal(disk.ACL)
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ func resourceDiskCreate(ctx context.Context, d *schema.ResourceData, m interface
|
|||||||
|
|
||||||
diskId, err := c.CloudAPI().Disks().Create(ctx, req)
|
diskId, err := c.CloudAPI().Disks().Create(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +143,7 @@ func resourceDiskCreate(ctx context.Context, d *schema.ResourceData, m interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
func resourceDiskRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceDiskRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
c := m.(*controller.ControllerCfg)
|
// c := m.(*controller.ControllerCfg)
|
||||||
warnings := dc.Warnings{}
|
warnings := dc.Warnings{}
|
||||||
|
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
@@ -157,23 +158,24 @@ func resourceDiskRead(ctx context.Context, d *schema.ResourceData, m interface{}
|
|||||||
case status.Destroyed, status.Purged:
|
case status.Destroyed, status.Purged:
|
||||||
d.Set("disk_id", 0)
|
d.Set("disk_id", 0)
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return resourceDiskCreate(ctx, d, m)
|
return diag.Errorf("The resource cannot be updated because it has been destroyed")
|
||||||
|
// return resourceDiskCreate(ctx, d, m)
|
||||||
case status.Deleted:
|
case status.Deleted:
|
||||||
hasChangeState = true
|
// hasChangeState = true
|
||||||
req := disks.RestoreRequest{
|
// req := disks.RestoreRequest{
|
||||||
DiskID: disk.ID,
|
// DiskID: disk.ID,
|
||||||
}
|
// }
|
||||||
|
|
||||||
if reason, ok := d.GetOk("reason"); ok {
|
// if reason, ok := d.GetOk("reason"); ok {
|
||||||
req.Reason = reason.(string)
|
// req.Reason = reason.(string)
|
||||||
} else {
|
// } else {
|
||||||
req.Reason = "Terraform automatic restore"
|
// req.Reason = "Terraform automatic restore"
|
||||||
}
|
// }
|
||||||
|
|
||||||
_, err := c.CloudAPI().Disks().Restore(ctx, req)
|
// _, err := c.CloudAPI().Disks().Restore(ctx, req)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
warnings.Add(err)
|
// warnings.Add(err)
|
||||||
}
|
// }
|
||||||
case status.Assigned:
|
case status.Assigned:
|
||||||
case status.Modeled:
|
case status.Modeled:
|
||||||
return diag.Errorf("The disk is in status: %s, please, contact support for more information", disk.Status)
|
return diag.Errorf("The disk is in status: %s, please, contact support for more information", disk.Status)
|
||||||
@@ -218,6 +220,7 @@ func resourceDiskUpdate(ctx context.Context, d *schema.ResourceData, m interface
|
|||||||
|
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +230,8 @@ func resourceDiskUpdate(ctx context.Context, d *schema.ResourceData, m interface
|
|||||||
case status.Destroyed, status.Purged:
|
case status.Destroyed, status.Purged:
|
||||||
d.Set("disk_id", 0)
|
d.Set("disk_id", 0)
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return resourceDiskCreate(ctx, d, m)
|
return diag.Errorf("The resource cannot be updated because it has been destroyed")
|
||||||
|
// return resourceDiskCreate(ctx, d, m)
|
||||||
case status.Deleted:
|
case status.Deleted:
|
||||||
hasChangeState = true
|
hasChangeState = true
|
||||||
req := disks.RestoreRequest{
|
req := disks.RestoreRequest{
|
||||||
@@ -375,9 +379,9 @@ func resourceDiskDelete(ctx context.Context, d *schema.ResourceData, m interface
|
|||||||
func resourceDiskSchemaMake() map[string]*schema.Schema {
|
func resourceDiskSchemaMake() map[string]*schema.Schema {
|
||||||
rets := map[string]*schema.Schema{
|
rets := map[string]*schema.Schema{
|
||||||
"account_id": {
|
"account_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Description: "The unique ID of the subscriber-owner of the disk",
|
Description: "The unique ID of the subscriber-owner of the disk",
|
||||||
},
|
},
|
||||||
"disk_name": {
|
"disk_name": {
|
||||||
@@ -391,9 +395,9 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
|||||||
Description: "Size in GB",
|
Description: "Size in GB",
|
||||||
},
|
},
|
||||||
"gid": {
|
"gid": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Description: "ID of the grid (platform)",
|
Description: "ID of the grid (platform)",
|
||||||
},
|
},
|
||||||
"pool": {
|
"pool": {
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ func resourceDiskSnapshotCreate(ctx context.Context, d *schema.ResourceData, m i
|
|||||||
func resourceDiskSnapshotRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceDiskSnapshotRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,15 +170,15 @@ func resourceDiskSnapshotDelete(ctx context.Context, d *schema.ResourceData, m i
|
|||||||
func resourceDiskSnapshotSchemaMake() map[string]*schema.Schema {
|
func resourceDiskSnapshotSchemaMake() map[string]*schema.Schema {
|
||||||
rets := map[string]*schema.Schema{
|
rets := map[string]*schema.Schema{
|
||||||
"disk_id": {
|
"disk_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Description: "The unique ID of the subscriber-owner of the disk",
|
Description: "The unique ID of the subscriber-owner of the disk",
|
||||||
},
|
},
|
||||||
"label": {
|
"label": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Description: "Name of the snapshot",
|
Description: "Name of the snapshot",
|
||||||
},
|
},
|
||||||
"rollback": {
|
"rollback": {
|
||||||
|
|||||||
@@ -47,18 +47,6 @@ func utilityDiskListCheckPresence(ctx context.Context, d *schema.ResourceData, m
|
|||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
req := disks.ListRequest{}
|
req := disks.ListRequest{}
|
||||||
|
|
||||||
if page, ok := d.GetOk("page"); ok {
|
|
||||||
req.Page = uint64(page.(int))
|
|
||||||
}
|
|
||||||
if size, ok := d.GetOk("size"); ok {
|
|
||||||
req.Size = uint64(size.(int))
|
|
||||||
}
|
|
||||||
if diskType, ok := d.GetOk("type"); ok {
|
|
||||||
req.Type = strings.ToUpper(diskType.(string))
|
|
||||||
}
|
|
||||||
if accountId, ok := d.GetOk("accountId"); ok {
|
|
||||||
req.AccountID = uint64(accountId.(int))
|
|
||||||
}
|
|
||||||
if by_id, ok := d.GetOk("by_id"); ok {
|
if by_id, ok := d.GetOk("by_id"); ok {
|
||||||
req.ByID = uint64(by_id.(int))
|
req.ByID = uint64(by_id.(int))
|
||||||
}
|
}
|
||||||
@@ -77,6 +65,24 @@ func utilityDiskListCheckPresence(ctx context.Context, d *schema.ResourceData, m
|
|||||||
if shared, ok := d.GetOk("shared"); ok {
|
if shared, ok := d.GetOk("shared"); ok {
|
||||||
req.Shared = shared.(bool)
|
req.Shared = shared.(bool)
|
||||||
}
|
}
|
||||||
|
if accountId, ok := d.GetOk("account_id"); ok {
|
||||||
|
req.AccountID = uint64(accountId.(int))
|
||||||
|
}
|
||||||
|
if diskType, ok := d.GetOk("type"); ok {
|
||||||
|
req.Type = strings.ToUpper(diskType.(string))
|
||||||
|
}
|
||||||
|
if sepId, ok := d.GetOk("sep_id"); ok {
|
||||||
|
req.AccountID = uint64(sepId.(int))
|
||||||
|
}
|
||||||
|
if pool_name, ok := d.GetOk("pool_name"); ok {
|
||||||
|
req.Pool = pool_name.(string)
|
||||||
|
}
|
||||||
|
if page, ok := d.GetOk("page"); ok {
|
||||||
|
req.Page = uint64(page.(int))
|
||||||
|
}
|
||||||
|
if size, ok := d.GetOk("size"); ok {
|
||||||
|
req.Size = uint64(size.(int))
|
||||||
|
}
|
||||||
|
|
||||||
log.Debugf("utilityDiskListCheckPresence: load disk list")
|
log.Debugf("utilityDiskListCheckPresence: load disk list")
|
||||||
diskList, err := c.CloudAPI().Disks().List(ctx, req)
|
diskList, err := c.CloudAPI().Disks().List(ctx, req)
|
||||||
|
|||||||
@@ -13,15 +13,6 @@ func utilityDiskListUnattachedCheckPresence(ctx context.Context, d *schema.Resou
|
|||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
req := disks.ListUnattachedRequest{}
|
req := disks.ListUnattachedRequest{}
|
||||||
|
|
||||||
if page, ok := d.GetOk("page"); ok {
|
|
||||||
req.Page = uint64(page.(int))
|
|
||||||
}
|
|
||||||
if size, ok := d.GetOk("size"); ok {
|
|
||||||
req.Size = uint64(size.(int))
|
|
||||||
}
|
|
||||||
if accountId, ok := d.GetOk("accountId"); ok {
|
|
||||||
req.AccountID = uint64(accountId.(int))
|
|
||||||
}
|
|
||||||
if by_id, ok := d.GetOk("by_id"); ok {
|
if by_id, ok := d.GetOk("by_id"); ok {
|
||||||
req.ByID = uint64(by_id.(int))
|
req.ByID = uint64(by_id.(int))
|
||||||
}
|
}
|
||||||
@@ -34,6 +25,24 @@ func utilityDiskListUnattachedCheckPresence(ctx context.Context, d *schema.Resou
|
|||||||
if status, ok := d.GetOk("status"); ok {
|
if status, ok := d.GetOk("status"); ok {
|
||||||
req.Status = status.(string)
|
req.Status = status.(string)
|
||||||
}
|
}
|
||||||
|
if diskType, ok := d.GetOk("type"); ok {
|
||||||
|
req.Type = diskType.(string)
|
||||||
|
}
|
||||||
|
if accountId, ok := d.GetOk("account_id"); ok {
|
||||||
|
req.AccountID = uint64(accountId.(int))
|
||||||
|
}
|
||||||
|
if sepId, ok := d.GetOk("sep_id"); ok {
|
||||||
|
req.AccountID = uint64(sepId.(int))
|
||||||
|
}
|
||||||
|
if pool_name, ok := d.GetOk("pool_name"); ok {
|
||||||
|
req.Pool = pool_name.(string)
|
||||||
|
}
|
||||||
|
if page, ok := d.GetOk("page"); ok {
|
||||||
|
req.Page = uint64(page.(int))
|
||||||
|
}
|
||||||
|
if size, ok := d.GetOk("size"); ok {
|
||||||
|
req.Size = uint64(size.(int))
|
||||||
|
}
|
||||||
|
|
||||||
log.Debugf("utilityDiskListUnattachedCheckPresence: load disk Unattached list")
|
log.Debugf("utilityDiskListUnattachedCheckPresence: load disk Unattached list")
|
||||||
unattachedList, err := c.CloudAPI().Disks().ListUnattached(ctx, req)
|
unattachedList, err := c.CloudAPI().Disks().ListUnattached(ctx, req)
|
||||||
|
|||||||
@@ -46,6 +46,13 @@ func utilityDiskListTypesDetailedCheckPresence(ctx context.Context, d *schema.Re
|
|||||||
req := disks.ListTypesRequest{
|
req := disks.ListTypesRequest{
|
||||||
Detailed: true,
|
Detailed: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if page, ok := d.GetOk("page"); ok {
|
||||||
|
req.Page = uint64(page.(int))
|
||||||
|
}
|
||||||
|
if size, ok := d.GetOk("size"); ok {
|
||||||
|
req.Size = uint64(size.(int))
|
||||||
|
}
|
||||||
|
|
||||||
log.Debugf("utilityDiskListTypesDetailedCheckPresence: load disk list Types Detailed")
|
log.Debugf("utilityDiskListTypesDetailedCheckPresence: load disk list Types Detailed")
|
||||||
listTypesDetailed, err := c.CloudAPI().Disks().ListTypes(ctx, req)
|
listTypesDetailed, err := c.CloudAPI().Disks().ListTypes(ctx, req)
|
||||||
|
|||||||
@@ -47,6 +47,13 @@ func utilityDiskListTypesCheckPresence(ctx context.Context, d *schema.ResourceDa
|
|||||||
Detailed: false,
|
Detailed: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if page, ok := d.GetOk("page"); ok {
|
||||||
|
req.Page = uint64(page.(int))
|
||||||
|
}
|
||||||
|
if size, ok := d.GetOk("size"); ok {
|
||||||
|
req.Size = uint64(size.(int))
|
||||||
|
}
|
||||||
|
|
||||||
log.Debugf("utilityDiskListTypesCheckPresence: load disk list Types Detailed")
|
log.Debugf("utilityDiskListTypesCheckPresence: load disk list Types Detailed")
|
||||||
typesList, err := c.CloudAPI().Disks().ListTypes(ctx, req)
|
typesList, err := c.CloudAPI().Disks().ListTypes(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1,285 +1,286 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
Tim Tkachev, <tvtkachev@basistech.ru>
|
Tim Tkachev, <tvtkachev@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package extnet
|
package extnet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceExtnetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceExtnetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
e, err := utilityExtnetCheckPresence(ctx, d, m)
|
e, err := utilityExtnetCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
d.SetId(strconv.FormatUint(e.ID, 10))
|
|
||||||
flattenExtnet(d, e)
|
d.SetId(strconv.FormatUint(e.ID, 10))
|
||||||
|
flattenExtnet(d, e)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceExtnetSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceExtnetSchemaMake() map[string]*schema.Schema {
|
||||||
"net_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"net_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Required: true,
|
||||||
"ckey": {
|
},
|
||||||
Type: schema.TypeString,
|
"ckey": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"meta": {
|
},
|
||||||
Type: schema.TypeList,
|
"meta": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Schema{
|
Computed: true,
|
||||||
Type: schema.TypeString,
|
Elem: &schema.Schema{
|
||||||
},
|
Type: schema.TypeString,
|
||||||
Description: "meta",
|
},
|
||||||
},
|
Description: "meta",
|
||||||
"check_ips": {
|
},
|
||||||
Type: schema.TypeList,
|
"check_ips": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Schema{
|
Computed: true,
|
||||||
Type: schema.TypeString,
|
Elem: &schema.Schema{
|
||||||
},
|
Type: schema.TypeString,
|
||||||
},
|
},
|
||||||
"default": {
|
},
|
||||||
Type: schema.TypeBool,
|
"default": {
|
||||||
Computed: true,
|
Type: schema.TypeBool,
|
||||||
},
|
Computed: true,
|
||||||
"default_qos": {
|
},
|
||||||
Type: schema.TypeList,
|
"default_qos": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"e_rate": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"e_rate": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"e_burst": {
|
},
|
||||||
Type: schema.TypeInt,
|
"e_burst": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"guid": {
|
},
|
||||||
Type: schema.TypeString,
|
"guid": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"in_burst": {
|
},
|
||||||
Type: schema.TypeInt,
|
"in_burst": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"in_rate": {
|
},
|
||||||
Type: schema.TypeInt,
|
"in_rate": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"desc": {
|
},
|
||||||
Type: schema.TypeString,
|
"desc": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"dns": {
|
},
|
||||||
Type: schema.TypeList,
|
"dns": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Schema{
|
Computed: true,
|
||||||
Type: schema.TypeString,
|
Elem: &schema.Schema{
|
||||||
},
|
Type: schema.TypeString,
|
||||||
},
|
},
|
||||||
"excluded": {
|
},
|
||||||
Type: schema.TypeList,
|
"excluded": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"client_type": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeString,
|
"client_type": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"mac": {
|
},
|
||||||
Type: schema.TypeString,
|
"mac": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"ip": {
|
},
|
||||||
Type: schema.TypeString,
|
"ip": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"type": {
|
},
|
||||||
Type: schema.TypeString,
|
"type": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"vm_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"vm_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"free_ips": {
|
},
|
||||||
Type: schema.TypeInt,
|
"free_ips": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"gateway": {
|
},
|
||||||
Type: schema.TypeString,
|
"gateway": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"gid": {
|
},
|
||||||
Type: schema.TypeInt,
|
"gid": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"guid": {
|
},
|
||||||
Type: schema.TypeInt,
|
"guid": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"ipcidr": {
|
},
|
||||||
Type: schema.TypeString,
|
"ipcidr": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"milestones": {
|
},
|
||||||
Type: schema.TypeInt,
|
"milestones": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"net_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"net_name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"network": {
|
},
|
||||||
Type: schema.TypeString,
|
"network": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"network_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"network_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"pre_reservations_num": {
|
},
|
||||||
Type: schema.TypeInt,
|
"pre_reservations_num": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"prefix": {
|
},
|
||||||
Type: schema.TypeInt,
|
"prefix": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"pri_vnf_dev_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"pri_vnf_dev_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"reservations": {
|
},
|
||||||
Type: schema.TypeList,
|
"reservations": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"client_type": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeString,
|
"client_type": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"domainname": {
|
},
|
||||||
Type: schema.TypeString,
|
"domainname": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"hostname": {
|
},
|
||||||
Type: schema.TypeString,
|
"hostname": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"desc": {
|
},
|
||||||
Type: schema.TypeString,
|
"desc": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"ip": {
|
},
|
||||||
Type: schema.TypeString,
|
"ip": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"mac": {
|
},
|
||||||
Type: schema.TypeString,
|
"mac": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"type": {
|
},
|
||||||
Type: schema.TypeString,
|
"type": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"vm_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"vm_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"shared_with": {
|
},
|
||||||
Type: schema.TypeList,
|
"shared_with": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Schema{
|
Computed: true,
|
||||||
Type: schema.TypeInt,
|
Elem: &schema.Schema{
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
},
|
},
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"vlan_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"vlan_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"vnfs": {
|
},
|
||||||
Type: schema.TypeList,
|
"vnfs": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"dhcp": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"dhcp": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func DataSourceExtnet() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceExtnet() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceExtnetRead,
|
|
||||||
|
ReadContext: dataSourceExtnetRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceExtnetSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceExtnetSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,137 +1,162 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package extnet
|
package extnet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceExtnetComputesListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceExtnetComputesListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
extnetComputesList, err := utilityExtnetComputesListCheckPresence(ctx, d, m)
|
extnetComputesList, err := utilityExtnetComputesListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenExtnetComputesList(extnetComputesList))
|
d.SetId(id.String())
|
||||||
|
d.Set("items", flattenExtnetComputesList(extnetComputesList))
|
||||||
return nil
|
d.Set("entry_count", extnetComputesList.EntryCount)
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceExtnetComputesListSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceExtnetComputesListSchemaMake() map[string]*schema.Schema {
|
||||||
"account_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Required: true,
|
Type: schema.TypeInt,
|
||||||
Description: "filter by account ID",
|
Required: true,
|
||||||
},
|
Description: "filter by account ID",
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"rg_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Elem: &schema.Resource{
|
Optional: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Description: "Filter by RG ID",
|
||||||
"account_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"compute_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Optional: true,
|
||||||
"account_name": {
|
Description: "Filter by compute ID",
|
||||||
Type: schema.TypeString,
|
},
|
||||||
Computed: true,
|
"page": {
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
"extnets": {
|
Optional: true,
|
||||||
Type: schema.TypeList,
|
Description: "Page number",
|
||||||
Computed: true,
|
},
|
||||||
Elem: &schema.Resource{
|
"size": {
|
||||||
Schema: map[string]*schema.Schema{
|
Type: schema.TypeInt,
|
||||||
"net_id": {
|
Optional: true,
|
||||||
Type: schema.TypeInt,
|
Description: "Page size",
|
||||||
Computed: true,
|
},
|
||||||
},
|
"items": {
|
||||||
"ipaddr": {
|
Type: schema.TypeList,
|
||||||
Type: schema.TypeString,
|
Computed: true,
|
||||||
Computed: true,
|
Elem: &schema.Resource{
|
||||||
},
|
Schema: map[string]*schema.Schema{
|
||||||
"ipcidr": {
|
"account_id": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
"name": {
|
"account_name": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
"extnets": {
|
||||||
},
|
Type: schema.TypeList,
|
||||||
},
|
Computed: true,
|
||||||
"id": {
|
Elem: &schema.Resource{
|
||||||
Type: schema.TypeInt,
|
Schema: map[string]*schema.Schema{
|
||||||
Computed: true,
|
"net_id": {
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
"name": {
|
Computed: true,
|
||||||
Type: schema.TypeString,
|
},
|
||||||
Computed: true,
|
"ipaddr": {
|
||||||
},
|
Type: schema.TypeString,
|
||||||
"rg_id": {
|
Computed: true,
|
||||||
Type: schema.TypeInt,
|
},
|
||||||
Computed: true,
|
"ipcidr": {
|
||||||
},
|
Type: schema.TypeString,
|
||||||
"rg_name": {
|
Computed: true,
|
||||||
Type: schema.TypeString,
|
},
|
||||||
Computed: true,
|
"name": {
|
||||||
},
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
return res
|
},
|
||||||
}
|
"id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
func DataSourceExtnetComputesList() *schema.Resource {
|
Computed: true,
|
||||||
return &schema.Resource{
|
},
|
||||||
SchemaVersion: 1,
|
"name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
ReadContext: dataSourceExtnetComputesListRead,
|
Computed: true,
|
||||||
|
},
|
||||||
Timeouts: &schema.ResourceTimeout{
|
"rg_id": {
|
||||||
Read: &constants.Timeout30s,
|
Type: schema.TypeInt,
|
||||||
Default: &constants.Timeout60s,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"rg_name": {
|
||||||
Schema: dataSourceExtnetComputesListSchemaMake(),
|
Type: schema.TypeString,
|
||||||
}
|
Computed: true,
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"entry_count": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceExtnetComputesList() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceExtnetComputesListRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceExtnetComputesListSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,85 +1,86 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package extnet
|
package extnet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceExtnetDefaultRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceExtnetDefaultRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
extnetId, err := utilityExtnetDefaultCheckPresence(ctx, m)
|
extnetId, err := utilityExtnetDefaultCheckPresence(ctx, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
extnetIdInt, err := strconv.ParseInt(extnetId, 10, 32)
|
d.SetId(id.String())
|
||||||
if err != nil {
|
extnetIdInt, err := strconv.ParseInt(extnetId, 10, 32)
|
||||||
return diag.FromErr(err)
|
if err != nil {
|
||||||
}
|
return diag.FromErr(err)
|
||||||
d.Set("net_id", extnetIdInt)
|
}
|
||||||
|
d.Set("net_id", extnetIdInt)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceExtnetDefaultSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceExtnetDefaultSchemaMake() map[string]*schema.Schema {
|
||||||
"net_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"net_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
}
|
},
|
||||||
return res
|
}
|
||||||
}
|
return res
|
||||||
|
}
|
||||||
func DataSourceExtnetDefault() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceExtnetDefault() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceExtnetDefaultRead,
|
|
||||||
|
ReadContext: dataSourceExtnetDefaultRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceExtnetDefaultSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceExtnetDefaultSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,145 +1,150 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package extnet
|
package extnet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceExtnetListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceExtnetListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
extnetList, err := utilityExtnetListCheckPresence(ctx, d, m)
|
extnetList, err := utilityExtnetListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenExtnetList(extnetList))
|
d.SetId(id.String())
|
||||||
d.Set("entry_count", extnetList.EntryCount)
|
d.Set("items", flattenExtnetList(extnetList))
|
||||||
|
d.Set("entry_count", extnetList.EntryCount)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceExtnetListSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
func dataSourceExtnetListSchemaMake() map[string]*schema.Schema {
|
||||||
"account_id": {
|
res := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"account_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Find by account ID",
|
Optional: true,
|
||||||
},
|
Description: "Find by account ID",
|
||||||
"by_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"by_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Find by ID",
|
Optional: true,
|
||||||
},
|
Description: "Find by ID",
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Find by name",
|
Optional: true,
|
||||||
},
|
Description: "Find by name",
|
||||||
"network": {
|
},
|
||||||
Type: schema.TypeString,
|
"network": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
},
|
Optional: true,
|
||||||
"vlan_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"vlan_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Find by VLAN ID",
|
Optional: true,
|
||||||
},
|
Description: "Find by VLAN ID",
|
||||||
"vnfdev_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"vnfdev_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Find by VnfDEV ID",
|
Optional: true,
|
||||||
},
|
Description: "Find by VnfDEV ID",
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Find by status",
|
Optional: true,
|
||||||
},
|
Description: "Find by status",
|
||||||
"page": {
|
},
|
||||||
Type: schema.TypeInt,
|
"page": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page number",
|
Optional: true,
|
||||||
},
|
Description: "Page number",
|
||||||
"size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"size": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Page size",
|
Optional: true,
|
||||||
},
|
Description: "Page size",
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"items": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Elem: &schema.Resource{
|
Computed: true,
|
||||||
Schema: map[string]*schema.Schema{
|
Elem: &schema.Resource{
|
||||||
"net_id": {
|
Schema: map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"net_id": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
"ipcidr": {
|
},
|
||||||
Type: schema.TypeString,
|
"ipcidr": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Computed: true,
|
Type: schema.TypeString,
|
||||||
},
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
"status": {
|
||||||
},
|
Type: schema.TypeString,
|
||||||
"entry_count": {
|
Computed: true,
|
||||||
Type: schema.TypeInt,
|
},
|
||||||
Computed: true,
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
return res
|
"entry_count": {
|
||||||
}
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
func DataSourceExtnetList() *schema.Resource {
|
},
|
||||||
return &schema.Resource{
|
}
|
||||||
SchemaVersion: 1,
|
return res
|
||||||
|
}
|
||||||
ReadContext: dataSourceExtnetListRead,
|
|
||||||
|
func DataSourceExtnetList() *schema.Resource {
|
||||||
Timeouts: &schema.ResourceTimeout{
|
return &schema.Resource{
|
||||||
Read: &constants.Timeout30s,
|
SchemaVersion: 1,
|
||||||
Default: &constants.Timeout60s,
|
|
||||||
},
|
ReadContext: dataSourceExtnetListRead,
|
||||||
|
|
||||||
Schema: dataSourceExtnetListSchemaMake(),
|
Timeouts: &schema.ResourceTimeout{
|
||||||
}
|
Read: &constants.Timeout30s,
|
||||||
}
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceExtnetListSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ func flattenExtnet(d *schema.ResourceData, e *extnet.RecordExtNet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenExcluded(ex []extnet.Excluded) []map[string]interface{} {
|
func flattenExcluded(ex []extnet.Excluded) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(ex))
|
||||||
for _, item := range ex {
|
for _, item := range ex {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"client_type": item.ClientType,
|
"client_type": item.ClientType,
|
||||||
@@ -51,7 +51,7 @@ func flattenExcluded(ex []extnet.Excluded) []map[string]interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenExtnetReservations(ers extnet.ListReservations) []map[string]interface{} {
|
func flattenExtnetReservations(ers extnet.ListReservations) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(ers))
|
||||||
for _, er := range ers {
|
for _, er := range ers {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"client_type": er.ClientType,
|
"client_type": er.ClientType,
|
||||||
@@ -92,7 +92,7 @@ func flattenExtnetVNFS(evnfs extnet.VNFs) []map[string]interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenExtnetsComputes(ecs extnet.ListExtNetExtends) []map[string]interface{} {
|
func flattenExtnetsComputes(ecs extnet.ListExtNetExtends) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(ecs))
|
||||||
for _, ec := range ecs {
|
for _, ec := range ecs {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"net_id": ec.ID,
|
"net_id": ec.ID,
|
||||||
@@ -106,7 +106,7 @@ func flattenExtnetsComputes(ecs extnet.ListExtNetExtends) []map[string]interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenExtnetComputesList(ecl *extnet.ListExtNetComputes) []map[string]interface{} {
|
func flattenExtnetComputesList(ecl *extnet.ListExtNetComputes) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(ecl.Data))
|
||||||
for _, ec := range ecl.Data {
|
for _, ec := range ecl.Data {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"account_id": ec.AccountID,
|
"account_id": ec.AccountID,
|
||||||
@@ -123,12 +123,13 @@ func flattenExtnetComputesList(ecl *extnet.ListExtNetComputes) []map[string]inte
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenExtnetList(el *extnet.ListExtNets) []map[string]interface{} {
|
func flattenExtnetList(el *extnet.ListExtNets) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(el.Data))
|
||||||
for _, e := range el.Data {
|
for _, e := range el.Data {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"net_id": e.ID,
|
"net_id": e.ID,
|
||||||
"ipcidr": e.IPCIDR,
|
"ipcidr": e.IPCIDR,
|
||||||
"name": e.Name,
|
"name": e.Name,
|
||||||
|
"status": e.Status,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,20 @@ func utilityExtnetComputesListCheckPresence(ctx context.Context, d *schema.Resou
|
|||||||
AccountID: uint64(d.Get("account_id").(int)),
|
AccountID: uint64(d.Get("account_id").(int)),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rg_id, ok := d.GetOk("rg_id"); ok {
|
||||||
|
req.RGID = uint64(rg_id.(int))
|
||||||
|
}
|
||||||
|
if compute_id, ok := d.GetOk("compute_id"); ok {
|
||||||
|
req.ComputeID = uint64(compute_id.(int))
|
||||||
|
}
|
||||||
|
if page, ok := d.GetOk("page"); ok {
|
||||||
|
req.Page = uint64(page.(int))
|
||||||
|
}
|
||||||
|
if size, ok := d.GetOk("size"); ok {
|
||||||
|
req.Size = uint64(size.(int))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
log.Debugf("utilityExtnetComputesListCheckPresence")
|
log.Debugf("utilityExtnetComputesListCheckPresence")
|
||||||
extnetComputesList, err := c.CloudAPI().ExtNet().ListComputes(ctx, req)
|
extnetComputesList, err := c.CloudAPI().ExtNet().ListComputes(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ func dataSourceFlipgroupSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"account_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"client_ids": {
|
"client_ids": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -85,10 +89,26 @@ func dataSourceFlipgroupSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"created_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"created_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"default_gw": {
|
"default_gw": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"deleted_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"deleted_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"desc": {
|
"desc": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -121,16 +141,28 @@ func dataSourceFlipgroupSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"network": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"rg_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"rg_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"status": {
|
"status": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
"net_mask": {
|
"updated_by": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
"ckey": {
|
"updated_time": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,6 +185,13 @@ func dataSourceFlipgroupListSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"meta": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -36,15 +36,21 @@ package flipgroup
|
|||||||
import (
|
import (
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/flipgroup"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/flipgroup"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/flattens"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenFlipgroup(d *schema.ResourceData, fg *flipgroup.RecordFLIPGroup) {
|
func flattenFlipgroup(d *schema.ResourceData, fg *flipgroup.RecordFLIPGroup) {
|
||||||
d.Set("account_id", fg.AccountID)
|
d.Set("account_id", fg.AccountID)
|
||||||
|
d.Set("account_name", fg.AccountName)
|
||||||
d.Set("client_ids", fg.ClientIDs)
|
d.Set("client_ids", fg.ClientIDs)
|
||||||
d.Set("client_type", fg.ClientType)
|
d.Set("client_type", fg.ClientType)
|
||||||
d.Set("conn_id", fg.ConnID)
|
d.Set("conn_id", fg.ConnID)
|
||||||
d.Set("conn_type", fg.ConnType)
|
d.Set("conn_type", fg.ConnType)
|
||||||
|
d.Set("created_by", fg.CreatedBy)
|
||||||
|
d.Set("created_time", fg.CreatedTime)
|
||||||
d.Set("default_gw", fg.DefaultGW)
|
d.Set("default_gw", fg.DefaultGW)
|
||||||
|
d.Set("deleted_by", fg.DeletedBy)
|
||||||
|
d.Set("deleted_time", fg.DeletedTime)
|
||||||
d.Set("desc", fg.Description)
|
d.Set("desc", fg.Description)
|
||||||
d.Set("gid", fg.GID)
|
d.Set("gid", fg.GID)
|
||||||
d.Set("guid", fg.GUID)
|
d.Set("guid", fg.GUID)
|
||||||
@@ -54,13 +60,20 @@ func flattenFlipgroup(d *schema.ResourceData, fg *flipgroup.RecordFLIPGroup) {
|
|||||||
d.Set("name", fg.Name)
|
d.Set("name", fg.Name)
|
||||||
d.Set("net_id", fg.NetID)
|
d.Set("net_id", fg.NetID)
|
||||||
d.Set("net_type", fg.NetType)
|
d.Set("net_type", fg.NetType)
|
||||||
|
d.Set("network", fg.Network)
|
||||||
|
d.Set("rg_id", fg.RGID)
|
||||||
|
d.Set("rg_name", fg.RGName)
|
||||||
d.Set("status", fg.Status)
|
d.Set("status", fg.Status)
|
||||||
|
d.Set("updated_by", fg.UpdatedBy)
|
||||||
|
d.Set("updated_time", fg.UpdatedTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenFlipgroupList(fg_list *flipgroup.ListFLIPGroups) []map[string]interface{} {
|
func flattenFlipgroupList(fg_list *flipgroup.ListFLIPGroups) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, fg := range fg_list.Data {
|
for _, fg := range fg_list.Data {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
|
"ckey": fg.CKey,
|
||||||
|
"meta": flattens.FlattenMeta(fg.Meta),
|
||||||
"account_id": fg.AccountID,
|
"account_id": fg.AccountID,
|
||||||
"client_ids": fg.ClientIDs,
|
"client_ids": fg.ClientIDs,
|
||||||
"client_type": fg.ClientType,
|
"client_type": fg.ClientType,
|
||||||
@@ -76,6 +89,7 @@ func flattenFlipgroupList(fg_list *flipgroup.ListFLIPGroups) []map[string]interf
|
|||||||
"name": fg.Name,
|
"name": fg.Name,
|
||||||
"net_id": fg.NetID,
|
"net_id": fg.NetID,
|
||||||
"net_type": fg.NetType,
|
"net_type": fg.NetType,
|
||||||
|
"net_mask": fg.NetMask,
|
||||||
"status": fg.Status,
|
"status": fg.Status,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ func resourceFlipgroupCreate(ctx context.Context, d *schema.ResourceData, m inte
|
|||||||
|
|
||||||
resp, err := c.CloudAPI().FLIPGroup().Create(ctx, req)
|
resp, err := c.CloudAPI().FLIPGroup().Create(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,6 +137,7 @@ func resourceFlipgroupDelete(ctx context.Context, d *schema.ResourceData, m inte
|
|||||||
|
|
||||||
fg, err := utilityFlipgroupCheckPresence(ctx, d, m)
|
fg, err := utilityFlipgroupCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,6 +150,8 @@ func resourceFlipgroupDelete(ctx context.Context, d *schema.ResourceData, m inte
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.SetId("")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +209,10 @@ func resourceFlipgroupSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"account_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"conn_id": {
|
"conn_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -213,10 +221,26 @@ func resourceFlipgroupSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"created_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"created_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"default_gw": {
|
"default_gw": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"deleted_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"deleted_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"gid": {
|
"gid": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -233,14 +257,26 @@ func resourceFlipgroupSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
"net_mask": {
|
"network": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"rg_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
"ckey": {
|
"rg_name": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"updated_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"updated_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ package image
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
@@ -44,12 +44,11 @@ import (
|
|||||||
func dataSourceImageRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceImageRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
image, err := utilityImageCheckPresence(ctx, d, m)
|
image, err := utilityImageCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
id := uuid.New()
|
d.SetId(strconv.Itoa(int(image.ID)))
|
||||||
d.SetId(id.String())
|
|
||||||
|
|
||||||
flattenImage(d, image)
|
flattenImage(d, image)
|
||||||
|
|
||||||
|
|||||||
@@ -1,159 +1,160 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package image
|
package image
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceImageListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceImageListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
imageList, err := utilityImageListCheckPresence(ctx, d, m)
|
imageList, err := utilityImageListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
id := uuid.New()
|
}
|
||||||
d.SetId(id.String())
|
id := uuid.New()
|
||||||
d.Set("items", flattenImageList(imageList))
|
d.SetId(id.String())
|
||||||
d.Set("entry_count", imageList.EntryCount)
|
d.Set("items", flattenImageList(imageList))
|
||||||
|
d.Set("entry_count", imageList.EntryCount)
|
||||||
return nil
|
|
||||||
}
|
return nil
|
||||||
|
}
|
||||||
func dataSourceImageListSchemaMake() map[string]*schema.Schema {
|
|
||||||
rets := map[string]*schema.Schema{
|
func dataSourceImageListSchemaMake() map[string]*schema.Schema {
|
||||||
"sep_id": {
|
rets := map[string]*schema.Schema{
|
||||||
Type: schema.TypeInt,
|
"sep_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by Storage Endpoint ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by Storage Endpoint ID",
|
||||||
"by_id": {
|
},
|
||||||
Type: schema.TypeInt,
|
"by_id": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by ID",
|
Optional: true,
|
||||||
},
|
Description: "Filter by ID",
|
||||||
"name": {
|
},
|
||||||
Type: schema.TypeString,
|
"name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by name",
|
||||||
"status": {
|
},
|
||||||
Type: schema.TypeString,
|
"status": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by status",
|
Optional: true,
|
||||||
},
|
Description: "Filter by status",
|
||||||
"architecture": {
|
},
|
||||||
Type: schema.TypeString,
|
"architecture": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by architecture",
|
Optional: true,
|
||||||
},
|
Description: "Filter by architecture",
|
||||||
"type_image": {
|
},
|
||||||
Type: schema.TypeString,
|
"type_image": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by image type",
|
Optional: true,
|
||||||
},
|
Description: "Filter by image type",
|
||||||
"image_size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"image_size": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "Filter by image size",
|
Optional: true,
|
||||||
},
|
Description: "Filter by image size",
|
||||||
"sep_name": {
|
},
|
||||||
Type: schema.TypeString,
|
"sep_name": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by SEP name",
|
Optional: true,
|
||||||
},
|
Description: "Filter by SEP name",
|
||||||
"pool": {
|
},
|
||||||
Type: schema.TypeString,
|
"pool": {
|
||||||
Optional: true,
|
Type: schema.TypeString,
|
||||||
Description: "Filter by pool",
|
Optional: true,
|
||||||
},
|
Description: "Filter by pool",
|
||||||
"public": {
|
},
|
||||||
Type: schema.TypeBool,
|
"public": {
|
||||||
Optional: true,
|
Type: schema.TypeBool,
|
||||||
Description: "Find public/private images",
|
Optional: true,
|
||||||
},
|
Description: "Find public/private images",
|
||||||
"hot_resize": {
|
},
|
||||||
Type: schema.TypeBool,
|
"hot_resize": {
|
||||||
Optional: true,
|
Type: schema.TypeBool,
|
||||||
Description: "Find hot resizable images",
|
Optional: true,
|
||||||
},
|
Description: "Find hot resizable images",
|
||||||
"bootable": {
|
},
|
||||||
Type: schema.TypeBool,
|
"bootable": {
|
||||||
Optional: true,
|
Type: schema.TypeBool,
|
||||||
Description: "Find bootable images",
|
Optional: true,
|
||||||
},
|
Description: "Find bootable images",
|
||||||
"page": {
|
},
|
||||||
Type: schema.TypeInt,
|
"page": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "page number",
|
Optional: true,
|
||||||
},
|
Description: "page number",
|
||||||
"size": {
|
},
|
||||||
Type: schema.TypeInt,
|
"size": {
|
||||||
Optional: true,
|
Type: schema.TypeInt,
|
||||||
Description: "page size",
|
Optional: true,
|
||||||
},
|
Description: "page size",
|
||||||
"items": {
|
},
|
||||||
Type: schema.TypeList,
|
"items": {
|
||||||
Computed: true,
|
Type: schema.TypeList,
|
||||||
Description: "image list",
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Description: "image list",
|
||||||
Schema: dataSourceImageSchemaMake(),
|
Elem: &schema.Resource{
|
||||||
},
|
Schema: dataSourceImageSchemaMake(),
|
||||||
},
|
},
|
||||||
"entry_count": {
|
},
|
||||||
Type: schema.TypeInt,
|
"entry_count": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
},
|
Computed: true,
|
||||||
}
|
},
|
||||||
|
}
|
||||||
return rets
|
|
||||||
}
|
return rets
|
||||||
|
}
|
||||||
func DataSourceImageList() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
func DataSourceImageList() *schema.Resource {
|
||||||
SchemaVersion: 1,
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
ReadContext: dataSourceImageListRead,
|
|
||||||
|
ReadContext: dataSourceImageListRead,
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout60s,
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
Schema: dataSourceImageListSchemaMake(),
|
|
||||||
}
|
Schema: dataSourceImageListSchemaMake(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package image
|
|||||||
import (
|
import (
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/image"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/image"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenHistory(history []image.History) []map[string]interface{} {
|
func flattenHistory(history []image.History) []map[string]interface{} {
|
||||||
@@ -23,7 +24,7 @@ func flattenImage(d *schema.ResourceData, img *image.RecordImage) {
|
|||||||
d.Set("unc_path", img.UNCPath)
|
d.Set("unc_path", img.UNCPath)
|
||||||
d.Set("ckey", img.CKey)
|
d.Set("ckey", img.CKey)
|
||||||
d.Set("account_id", img.AccountID)
|
d.Set("account_id", img.AccountID)
|
||||||
d.Set("acl", img.ACL)
|
d.Set("acl", FlattenACL(img.ACL))
|
||||||
d.Set("architecture", img.Architecture)
|
d.Set("architecture", img.Architecture)
|
||||||
d.Set("boot_type", img.BootType)
|
d.Set("boot_type", img.BootType)
|
||||||
d.Set("bootable", img.Bootable)
|
d.Set("bootable", img.Bootable)
|
||||||
@@ -85,3 +86,18 @@ func flattenImageList(il *image.ListImages) []map[string]interface{} {
|
|||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FlattenACL(acl interface{}) string {
|
||||||
|
switch d := acl.(type) {
|
||||||
|
case string:
|
||||||
|
return d
|
||||||
|
case int:
|
||||||
|
return strconv.Itoa(d)
|
||||||
|
case int64:
|
||||||
|
return strconv.FormatInt(d, 10)
|
||||||
|
case float64:
|
||||||
|
return strconv.FormatInt(int64(d), 10)
|
||||||
|
default:
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,272 +1,276 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package image
|
package image
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/image"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/image"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/status"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
func resourceImageCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceImageCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
log.Debugf("resourceImageCreate: called for image %s", d.Get("name").(string))
|
log.Debugf("resourceImageCreate: called for image %s", d.Get("name").(string))
|
||||||
|
|
||||||
haveGID, err := existGID(ctx, d, m)
|
haveGID, err := existGID(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !haveGID {
|
if !haveGID {
|
||||||
return diag.Errorf("resourceImageCreate: can't create Image because GID %d is not allowed or does not exist", d.Get("gid").(int))
|
return diag.Errorf("resourceImageCreate: can't create Image because GID %d is not allowed or does not exist", d.Get("gid").(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := d.GetOk("account_id"); ok {
|
if _, ok := d.GetOk("account_id"); ok {
|
||||||
haveAccountID, err := existAccountID(ctx, d, m)
|
haveAccountID, err := existAccountID(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !haveAccountID {
|
if !haveAccountID {
|
||||||
return diag.Errorf("resourceImageCreate: can't create Image because AccountID %d is not allowed or does not exist", d.Get("account_id").(int))
|
return diag.Errorf("resourceImageCreate: can't create Image because AccountID %d is not allowed or does not exist", d.Get("account_id").(int))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
req := image.CreateRequest{}
|
req := image.CreateRequest{}
|
||||||
|
|
||||||
req.Name = d.Get("name").(string)
|
req.Name = d.Get("name").(string)
|
||||||
req.URL = d.Get("url").(string)
|
req.URL = d.Get("url").(string)
|
||||||
req.GID = uint64(d.Get("gid").(int))
|
req.GID = uint64(d.Get("gid").(int))
|
||||||
req.BootType = d.Get("boot_type").(string)
|
req.BootType = d.Get("boot_type").(string)
|
||||||
req.ImageType = d.Get("type").(string)
|
req.ImageType = d.Get("type").(string)
|
||||||
|
|
||||||
drivers := []string{}
|
drivers := []string{}
|
||||||
for _, driver := range d.Get("drivers").([]interface{}) {
|
for _, driver := range d.Get("drivers").([]interface{}) {
|
||||||
drivers = append(drivers, driver.(string))
|
drivers = append(drivers, driver.(string))
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Drivers = drivers
|
req.Drivers = drivers
|
||||||
|
|
||||||
if hotresize, ok := d.GetOk("hot_resize"); ok {
|
if hotresize, ok := d.GetOk("hot_resize"); ok {
|
||||||
req.HotResize = hotresize.(bool)
|
req.HotResize = hotresize.(bool)
|
||||||
}
|
}
|
||||||
if username, ok := d.GetOk("username"); ok {
|
if username, ok := d.GetOk("username"); ok {
|
||||||
req.Username = username.(string)
|
req.Username = username.(string)
|
||||||
}
|
}
|
||||||
if password, ok := d.GetOk("password"); ok {
|
if password, ok := d.GetOk("password"); ok {
|
||||||
req.Password = password.(string)
|
req.Password = password.(string)
|
||||||
}
|
}
|
||||||
if accountId, ok := d.GetOk("account_id"); ok {
|
if accountId, ok := d.GetOk("account_id"); ok {
|
||||||
req.AccountID = uint64(accountId.(int))
|
req.AccountID = uint64(accountId.(int))
|
||||||
}
|
}
|
||||||
if usernameDL, ok := d.GetOk("username_dl"); ok {
|
if usernameDL, ok := d.GetOk("username_dl"); ok {
|
||||||
req.UsernameDL = usernameDL.(string)
|
req.UsernameDL = usernameDL.(string)
|
||||||
}
|
}
|
||||||
if passwordDL, ok := d.GetOk("password_dl"); ok {
|
if passwordDL, ok := d.GetOk("password_dl"); ok {
|
||||||
req.PasswordDL = passwordDL.(string)
|
req.PasswordDL = passwordDL.(string)
|
||||||
}
|
}
|
||||||
if sepId, ok := d.GetOk("sep_id"); ok {
|
if sepId, ok := d.GetOk("sep_id"); ok {
|
||||||
req.SEPID = uint64(sepId.(int))
|
req.SEPID = uint64(sepId.(int))
|
||||||
}
|
}
|
||||||
if poolName, ok := d.GetOk("pool_name"); ok {
|
if poolName, ok := d.GetOk("pool_name"); ok {
|
||||||
req.Pool = poolName.(string)
|
req.Pool = poolName.(string)
|
||||||
}
|
}
|
||||||
if architecture, ok := d.GetOk("architecture"); ok {
|
if architecture, ok := d.GetOk("architecture"); ok {
|
||||||
req.Architecture = architecture.(string)
|
req.Architecture = architecture.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
imageId, err := c.CloudAPI().Image().Create(ctx, req)
|
imageId, err := c.CloudAPI().Image().Create(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
d.SetId(strconv.FormatUint(imageId, 10))
|
|
||||||
d.Set("image_id", imageId)
|
d.SetId(strconv.FormatUint(imageId, 10))
|
||||||
|
d.Set("image_id", imageId)
|
||||||
_, err = utilityImageCheckPresence(ctx, d, m)
|
|
||||||
if err != nil {
|
_, err = utilityImageCheckPresence(ctx, d, m)
|
||||||
return diag.FromErr(err)
|
if err != nil {
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
return resourceImageRead(ctx, d, m)
|
|
||||||
}
|
return resourceImageRead(ctx, d, m)
|
||||||
|
}
|
||||||
func resourceImageRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
|
||||||
log.Debugf("resourceImageRead: called for %s id: %s", d.Get("name").(string), d.Id())
|
func resourceImageRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
log.Debugf("resourceImageRead: called for %s id: %s", d.Get("name").(string), d.Id())
|
||||||
img, err := utilityImageCheckPresence(ctx, d, m)
|
|
||||||
if img == nil {
|
img, err := utilityImageCheckPresence(ctx, d, m)
|
||||||
d.SetId("")
|
if img == nil {
|
||||||
return diag.FromErr(err)
|
d.SetId("")
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
switch img.Status {
|
|
||||||
case status.Modeled:
|
switch img.Status {
|
||||||
return diag.Errorf("The image is in status: %s, please, contact support for more information", img.Status)
|
case status.Modeled:
|
||||||
case status.Creating:
|
return diag.Errorf("The image is in status: %s, please, contact support for more information", img.Status)
|
||||||
case status.Created:
|
case status.Creating:
|
||||||
case status.Destroyed, status.Purged:
|
case status.Created:
|
||||||
d.SetId("")
|
case status.Destroyed, status.Purged:
|
||||||
return resourceImageCreate(ctx, d, m)
|
d.SetId("")
|
||||||
}
|
return diag.Errorf("The resource cannot be updated because it has been destroyed")
|
||||||
|
// return resourceImageCreate(ctx, d, m)
|
||||||
flattenImage(d, img)
|
}
|
||||||
|
|
||||||
return nil
|
flattenImage(d, img)
|
||||||
}
|
|
||||||
|
return nil
|
||||||
func resourceImageDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
}
|
||||||
log.Debugf("resourceImageDelete: called for %s, id: %s", d.Get("name").(string), d.Id())
|
|
||||||
|
func resourceImageDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
_, err := utilityImageCheckPresence(ctx, d, m)
|
log.Debugf("resourceImageDelete: called for %s, id: %s", d.Get("name").(string), d.Id())
|
||||||
if err != nil {
|
|
||||||
return diag.FromErr(err)
|
_, err := utilityImageCheckPresence(ctx, d, m)
|
||||||
}
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
c := m.(*controller.ControllerCfg)
|
return diag.FromErr(err)
|
||||||
req := image.DeleteRequest{
|
}
|
||||||
ImageID: uint64(d.Get("image_id").(int)),
|
|
||||||
}
|
c := m.(*controller.ControllerCfg)
|
||||||
|
req := image.DeleteRequest{
|
||||||
if permanently, ok := d.GetOk("permanently"); ok {
|
ImageID: uint64(d.Get("image_id").(int)),
|
||||||
req.Permanently = permanently.(bool)
|
}
|
||||||
}
|
|
||||||
|
if permanently, ok := d.GetOk("permanently"); ok {
|
||||||
_, err = c.CloudAPI().Image().Delete(ctx, req)
|
req.Permanently = permanently.(bool)
|
||||||
if err != nil {
|
}
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
_, err = c.CloudAPI().Image().Delete(ctx, req)
|
||||||
|
if err != nil {
|
||||||
d.SetId("")
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
return nil
|
|
||||||
}
|
d.SetId("")
|
||||||
|
|
||||||
func resourceImageRename(ctx context.Context, d *schema.ResourceData, m interface{}) error {
|
return nil
|
||||||
log.Debugf("resourceImageEditName: called for %s, id: %s", d.Get("name").(string), d.Id())
|
}
|
||||||
c := m.(*controller.ControllerCfg)
|
|
||||||
req := image.RenameRequest{
|
func resourceImageRename(ctx context.Context, d *schema.ResourceData, m interface{}) error {
|
||||||
ImageID: uint64(d.Get("image_id").(int)),
|
log.Debugf("resourceImageEditName: called for %s, id: %s", d.Get("name").(string), d.Id())
|
||||||
Name: d.Get("name").(string),
|
c := m.(*controller.ControllerCfg)
|
||||||
}
|
req := image.RenameRequest{
|
||||||
|
ImageID: uint64(d.Get("image_id").(int)),
|
||||||
_, err := c.CloudAPI().Image().Rename(ctx, req)
|
Name: d.Get("name").(string),
|
||||||
if err != nil {
|
}
|
||||||
return err
|
|
||||||
}
|
_, err := c.CloudAPI().Image().Rename(ctx, req)
|
||||||
|
if err != nil {
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceImageUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
return nil
|
||||||
log.Debugf("resourceImageUpdate: called for %s, id: %s", d.Get("name").(string), d.Id())
|
}
|
||||||
|
|
||||||
haveGID, err := existGID(ctx, d, m)
|
func resourceImageUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
if err != nil {
|
log.Debugf("resourceImageUpdate: called for %s, id: %s", d.Get("name").(string), d.Id())
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
haveGID, err := existGID(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
if !haveGID {
|
return diag.FromErr(err)
|
||||||
return diag.Errorf("resourceImageUpdate: can't update Image because GID %d is not allowed or does not exist", d.Get("gid").(int))
|
}
|
||||||
}
|
|
||||||
|
if !haveGID {
|
||||||
if _, ok := d.GetOk("account_id"); ok {
|
return diag.Errorf("resourceImageUpdate: can't update Image because GID %d is not allowed or does not exist", d.Get("gid").(int))
|
||||||
haveAccountID, err := existAccountID(ctx, d, m)
|
}
|
||||||
if err != nil {
|
|
||||||
return diag.FromErr(err)
|
if _, ok := d.GetOk("account_id"); ok {
|
||||||
}
|
haveAccountID, err := existAccountID(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
if !haveAccountID {
|
return diag.FromErr(err)
|
||||||
return diag.Errorf("resourceImageUpdate: can't update Image because AccountID %d is not allowed or does not exist", d.Get("account_id").(int))
|
}
|
||||||
}
|
|
||||||
}
|
if !haveAccountID {
|
||||||
|
return diag.Errorf("resourceImageUpdate: can't update Image because AccountID %d is not allowed or does not exist", d.Get("account_id").(int))
|
||||||
image, err := utilityImageCheckPresence(ctx, d, m)
|
}
|
||||||
if image == nil {
|
}
|
||||||
if err != nil {
|
|
||||||
return diag.FromErr(err)
|
image, err := utilityImageCheckPresence(ctx, d, m)
|
||||||
}
|
if image == nil {
|
||||||
return nil
|
if err != nil {
|
||||||
}
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
switch image.Status {
|
return nil
|
||||||
case status.Modeled:
|
}
|
||||||
return diag.Errorf("The image is in status: %s, please, contact support for more information", image.Status)
|
|
||||||
case status.Creating:
|
switch image.Status {
|
||||||
case status.Created:
|
case status.Modeled:
|
||||||
case status.Destroyed, status.Purged:
|
return diag.Errorf("The image is in status: %s, please, contact support for more information", image.Status)
|
||||||
d.SetId("")
|
case status.Creating:
|
||||||
return resourceImageCreate(ctx, d, m)
|
case status.Created:
|
||||||
}
|
case status.Destroyed, status.Purged:
|
||||||
|
d.SetId("")
|
||||||
if d.HasChange("name") {
|
return diag.Errorf("The resource cannot be updated because it has been destroyed")
|
||||||
err := resourceImageRename(ctx, d, m)
|
// return resourceImageCreate(ctx, d, m)
|
||||||
if err != nil {
|
}
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
if d.HasChange("name") {
|
||||||
}
|
err := resourceImageRename(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
return resourceImageRead(ctx, d, m)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
func ResourceImage() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
return resourceImageRead(ctx, d, m)
|
||||||
SchemaVersion: 1,
|
}
|
||||||
|
|
||||||
CreateContext: resourceImageCreate,
|
func ResourceImage() *schema.Resource {
|
||||||
ReadContext: resourceImageRead,
|
return &schema.Resource{
|
||||||
UpdateContext: resourceImageUpdate,
|
SchemaVersion: 1,
|
||||||
DeleteContext: resourceImageDelete,
|
|
||||||
|
CreateContext: resourceImageCreate,
|
||||||
Importer: &schema.ResourceImporter{
|
ReadContext: resourceImageRead,
|
||||||
StateContext: schema.ImportStatePassthroughContext,
|
UpdateContext: resourceImageUpdate,
|
||||||
},
|
DeleteContext: resourceImageDelete,
|
||||||
|
|
||||||
Timeouts: &schema.ResourceTimeout{
|
Importer: &schema.ResourceImporter{
|
||||||
Create: &constants.Timeout600s,
|
StateContext: schema.ImportStatePassthroughContext,
|
||||||
Read: &constants.Timeout300s,
|
},
|
||||||
Update: &constants.Timeout300s,
|
|
||||||
Delete: &constants.Timeout300s,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Default: &constants.Timeout300s,
|
Create: &constants.Timeout600s,
|
||||||
},
|
Read: &constants.Timeout300s,
|
||||||
|
Update: &constants.Timeout300s,
|
||||||
Schema: resourceImageSchemaMake(dataSourceImageExtendSchemaMake()),
|
Delete: &constants.Timeout300s,
|
||||||
}
|
Default: &constants.Timeout300s,
|
||||||
}
|
},
|
||||||
|
|
||||||
|
Schema: resourceImageSchemaMake(dataSourceImageExtendSchemaMake()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ func resourceImageVirtualCreate(ctx context.Context, d *schema.ResourceData, m i
|
|||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
req := image.CreateVirtualRequest{
|
req := image.CreateVirtualRequest{
|
||||||
Name: d.Get("name").(string),
|
Name: d.Get("name").(string),
|
||||||
TargetID: uint64(d.Get("target_id").(int)),
|
TargetID: uint64(d.Get("link_to").(int)),
|
||||||
}
|
}
|
||||||
|
|
||||||
imageId, err := c.CloudAPI().Image().CreateVirtual(ctx, req)
|
imageId, err := c.CloudAPI().Image().CreateVirtual(ctx, req)
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import (
|
|||||||
func dataSourceK8sRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceK8sRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
cluster, err := utilityDataK8sCheckPresence(ctx, d, m)
|
cluster, err := utilityDataK8sCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
d.SetId(strconv.FormatUint(cluster.ID, 10))
|
d.SetId(strconv.FormatUint(cluster.ID, 10))
|
||||||
@@ -399,6 +400,10 @@ func dataSourceK8sSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"network_plugin": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"rg_id": {
|
"rg_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
|||||||
@@ -80,10 +80,6 @@ func computesSchemaMake() map[string]*schema.Schema {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func workerComputesSchemaMake() map[string]*schema.Schema {
|
|
||||||
return map[string]*schema.Schema{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func dataSourceK8sComputesSchemaMake() map[string]*schema.Schema {
|
func dataSourceK8sComputesSchemaMake() map[string]*schema.Schema {
|
||||||
return map[string]*schema.Schema{
|
return map[string]*schema.Schema{
|
||||||
"k8s_id": {
|
"k8s_id": {
|
||||||
|
|||||||
@@ -271,6 +271,10 @@ func createK8sListSchema() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"network_plugin": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"rg_id": {
|
"rg_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ func dataSourceK8sListDeletedRead(ctx context.Context, d *schema.ResourceData, m
|
|||||||
func dataSourceK8sListDeletedSchemaMake() map[string]*schema.Schema {
|
func dataSourceK8sListDeletedSchemaMake() map[string]*schema.Schema {
|
||||||
k8sListDeleted := createK8sListSchema()
|
k8sListDeleted := createK8sListSchema()
|
||||||
delete(k8sListDeleted, "includedeleted")
|
delete(k8sListDeleted, "includedeleted")
|
||||||
|
delete(k8sListDeleted, "status")
|
||||||
return k8sListDeleted
|
return k8sListDeleted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ func dataSourceK8sWgRead(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
|
|
||||||
wg, workersComputeList, err := utilityDataK8sWgCheckPresence(ctx, d, m)
|
wg, workersComputeList, err := utilityDataK8sWgCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package k8s
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
)
|
||||||
|
|
||||||
|
func dataSourceK8sWgCloudInitRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
log.Debugf("dataSourceK8sWgCloudInitRead: called with k8s id %d and wg id %d", d.Get("k8s_id").(int), d.Get("wg_id").(int))
|
||||||
|
|
||||||
|
metaData, err := utilityK8sWgCloudInitCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
id := uuid.New()
|
||||||
|
d.SetId(id.String())
|
||||||
|
d.Set("cloud_init", metaData)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceK8sWgCloudInitSchemaMake() map[string]*schema.Schema {
|
||||||
|
return map[string]*schema.Schema{
|
||||||
|
"k8s_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Required: true,
|
||||||
|
Description: "Kubernetes cluster ID",
|
||||||
|
},
|
||||||
|
"wg_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Required: true,
|
||||||
|
Description: "ID of the workers compute group",
|
||||||
|
},
|
||||||
|
"cloud_init": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Worker group Cloud init",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceK8sWgCloudInit() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceK8sWgCloudInitRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceK8sWgCloudInitSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -45,6 +45,7 @@ import (
|
|||||||
func dataSourceK8sWgListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceK8sWgListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
wgList, err := utilityK8sWgListCheckPresence(ctx, d, m)
|
wgList, err := utilityK8sWgListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func flattenK8CIItems(list *k8ci.ListK8CI) []map[string]interface{} {
|
func flattenK8CIItems(list *k8ci.ListK8CI) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(list.Data))
|
||||||
for _, item := range list.Data {
|
for _, item := range list.Data {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"k8ci_id": item.ID,
|
"k8ci_id": item.ID,
|
||||||
@@ -72,7 +72,7 @@ func flattenK8sDataComputes(d *schema.ResourceData, cluster *k8s.RecordK8S) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenMasterComputes(cluster *k8s.RecordK8S) []map[string]interface{} {
|
func flattenMasterComputes(cluster *k8s.RecordK8S) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(cluster.K8SGroups.Masters.DetailedInfo))
|
||||||
for _, comp := range cluster.K8SGroups.Masters.DetailedInfo {
|
for _, comp := range cluster.K8SGroups.Masters.DetailedInfo {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"id": comp.ID,
|
"id": comp.ID,
|
||||||
@@ -88,7 +88,7 @@ func flattenMasterComputes(cluster *k8s.RecordK8S) []map[string]interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenWorkerComputes(cluster *k8s.RecordK8S) []map[string]interface{} {
|
func flattenWorkerComputes(cluster *k8s.RecordK8S) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(cluster.K8SGroups.Workers))
|
||||||
for _, wg := range cluster.K8SGroups.Workers {
|
for _, wg := range cluster.K8SGroups.Workers {
|
||||||
for _, comp := range wg.DetailedInfo {
|
for _, comp := range wg.DetailedInfo {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
@@ -106,7 +106,7 @@ func flattenWorkerComputes(cluster *k8s.RecordK8S) []map[string]interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenAclList(aclList k8s.ListACL) []map[string]interface{} {
|
func flattenAclList(aclList k8s.ListACL) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(aclList))
|
||||||
for _, acl := range aclList {
|
for _, acl := range aclList {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"explicit": acl.Explicit,
|
"explicit": acl.Explicit,
|
||||||
@@ -134,7 +134,7 @@ func flattenAcl(acl k8s.RecordACL) []map[string]interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenInterfaces(interfaces compute.ListInterfaces) []map[string]interface{} {
|
func flattenInterfaces(interfaces compute.ListInterfaces) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(interfaces))
|
||||||
for _, interfaceCompute := range interfaces {
|
for _, interfaceCompute := range interfaces {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"def_gw": interfaceCompute.DefGW,
|
"def_gw": interfaceCompute.DefGW,
|
||||||
@@ -147,7 +147,7 @@ func flattenInterfaces(interfaces compute.ListInterfaces) []map[string]interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenDetailedInfo(detailedInfoList k8s.ListDetailedInfo, computes []compute.RecordCompute) []map[string]interface{} {
|
func flattenDetailedInfo(detailedInfoList k8s.ListDetailedInfo, computes []compute.RecordCompute) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(detailedInfoList))
|
||||||
if computes != nil {
|
if computes != nil {
|
||||||
for i, detailedInfo := range detailedInfoList {
|
for i, detailedInfo := range detailedInfoList {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
@@ -193,7 +193,7 @@ func flattenMasterGroup(mastersGroup k8s.MasterGroup, masters []compute.RecordCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenK8sGroup(k8SGroupList k8s.ListK8SGroups, workers []compute.RecordCompute) []map[string]interface{} {
|
func flattenK8sGroup(k8SGroupList k8s.ListK8SGroups, workers []compute.RecordCompute) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(k8SGroupList))
|
||||||
for _, k8sGroup := range k8SGroupList {
|
for _, k8sGroup := range k8SGroupList {
|
||||||
labels := make([]string, 0)
|
labels := make([]string, 0)
|
||||||
for _, label := range k8sGroup.Labels {
|
for _, label := range k8sGroup.Labels {
|
||||||
@@ -222,15 +222,15 @@ func flattenK8sGroup(k8SGroupList k8s.ListK8SGroups, workers []compute.RecordCom
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenK8sGroups(k8sGroups k8s.RecordK8SGroups, masters []compute.RecordCompute, workers []compute.RecordCompute) []map[string]interface{} {
|
// func flattenK8sGroups(k8sGroups k8s.RecordK8SGroups, masters []compute.RecordCompute, workers []compute.RecordCompute) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
// res := make([]map[string]interface{}, 0)
|
||||||
temp := map[string]interface{}{
|
// temp := map[string]interface{}{
|
||||||
"masters": flattenMasterGroup(k8sGroups.Masters, masters),
|
// "masters": flattenMasterGroup(k8sGroups.Masters, masters),
|
||||||
"workers": flattenK8sGroup(k8sGroups.Workers, workers),
|
// "workers": flattenK8sGroup(k8sGroups.Workers, workers),
|
||||||
}
|
// }
|
||||||
res = append(res, temp)
|
// res = append(res, temp)
|
||||||
return res
|
// return res
|
||||||
}
|
// }
|
||||||
|
|
||||||
func flattenK8sData(d *schema.ResourceData, cluster k8s.RecordK8S, masters []compute.RecordCompute, workers []compute.RecordCompute) {
|
func flattenK8sData(d *schema.ResourceData, cluster k8s.RecordK8S, masters []compute.RecordCompute, workers []compute.RecordCompute) {
|
||||||
d.Set("acl", flattenAcl(cluster.ACL))
|
d.Set("acl", flattenAcl(cluster.ACL))
|
||||||
@@ -247,6 +247,7 @@ func flattenK8sData(d *schema.ResourceData, cluster k8s.RecordK8S, masters []com
|
|||||||
d.Set("workers", flattenK8sGroup(cluster.K8SGroups.Workers, workers))
|
d.Set("workers", flattenK8sGroup(cluster.K8SGroups.Workers, workers))
|
||||||
d.Set("lb_id", cluster.LBID)
|
d.Set("lb_id", cluster.LBID)
|
||||||
d.Set("name", cluster.Name)
|
d.Set("name", cluster.Name)
|
||||||
|
d.Set("network_plugin", cluster.NetworkPlugin)
|
||||||
d.Set("rg_id", cluster.RGID)
|
d.Set("rg_id", cluster.RGID)
|
||||||
d.Set("rg_name", cluster.RGName)
|
d.Set("rg_name", cluster.RGName)
|
||||||
d.Set("status", cluster.Status)
|
d.Set("status", cluster.Status)
|
||||||
@@ -267,7 +268,7 @@ func flattenServiceAccount(serviceAccount k8s.RecordServiceAccount) []map[string
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenWorkersGroup(workersGroups k8s.ListK8SGroups) []map[string]interface{} {
|
func flattenWorkersGroup(workersGroups k8s.ListK8SGroups) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(workersGroups))
|
||||||
for _, worker := range workersGroups {
|
for _, worker := range workersGroups {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"annotations": worker.Annotations,
|
"annotations": worker.Annotations,
|
||||||
@@ -288,11 +289,11 @@ func flattenWorkersGroup(workersGroups k8s.ListK8SGroups) []map[string]interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenK8sItems(k8sItems *k8s.ListK8SClusters) []map[string]interface{} {
|
func flattenK8sItems(k8sItems *k8s.ListK8SClusters) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(k8sItems.Data))
|
||||||
for _, item := range k8sItems.Data {
|
for _, item := range k8sItems.Data {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"account_id": item.AccountID,
|
"account_id": item.AccountID,
|
||||||
"account_name": item.Name,
|
"account_name": item.AccountName,
|
||||||
"acl": item.ACL,
|
"acl": item.ACL,
|
||||||
"bservice_id": item.BServiceID,
|
"bservice_id": item.BServiceID,
|
||||||
"ci_id": item.CIID,
|
"ci_id": item.CIID,
|
||||||
@@ -308,6 +309,7 @@ func flattenK8sItems(k8sItems *k8s.ListK8SClusters) []map[string]interface{} {
|
|||||||
"lb_id": item.LBID,
|
"lb_id": item.LBID,
|
||||||
"milestones": item.Milestones,
|
"milestones": item.Milestones,
|
||||||
"k8s_name": item.Name,
|
"k8s_name": item.Name,
|
||||||
|
"network_plugin": item.NetworkPlugin,
|
||||||
"rg_id": item.RGID,
|
"rg_id": item.RGID,
|
||||||
"rg_name": item.RGName,
|
"rg_name": item.RGName,
|
||||||
"service_account": flattenServiceAccount(item.ServiceAccount),
|
"service_account": flattenServiceAccount(item.ServiceAccount),
|
||||||
@@ -396,7 +398,7 @@ func flattenResourceK8s(d *schema.ResourceData, k8s k8s.RecordK8S, masters []com
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenWg(d *schema.ResourceData, wg k8s.ItemK8SGroup, computes []compute.RecordCompute) {
|
func flattenWg(d *schema.ResourceData, wg k8s.ItemK8SGroup, computes []compute.RecordCompute) {
|
||||||
labels := make([]string, 0)
|
labels := make([]string, 0, len(wg.Labels))
|
||||||
for _, label := range wg.Labels {
|
for _, label := range wg.Labels {
|
||||||
if strings.HasPrefix(label, "workersGroupName") {
|
if strings.HasPrefix(label, "workersGroupName") {
|
||||||
continue
|
continue
|
||||||
@@ -418,7 +420,7 @@ func flattenWg(d *schema.ResourceData, wg k8s.ItemK8SGroup, computes []compute.R
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flattenWgList(wgList k8s.ListK8SGroups, computesMap map[uint64][]compute.RecordCompute) []map[string]interface{} {
|
func flattenWgList(wgList k8s.ListK8SGroups, computesMap map[uint64][]compute.RecordCompute) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0, len(wgList))
|
||||||
for _, wg := range wgList {
|
for _, wg := range wgList {
|
||||||
computes := computesMap[wg.ID]
|
computes := computesMap[wg.ID]
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ package k8s
|
|||||||
import (
|
import (
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
func nodeMasterDefault() K8sNodeRecord {
|
func nodeMasterDefault() K8sNodeRecord {
|
||||||
@@ -85,21 +87,25 @@ func mastersSchemaMake() map[string]*schema.Schema {
|
|||||||
Optional: true,
|
Optional: true,
|
||||||
}
|
}
|
||||||
masters["cpu"] = &schema.Schema{
|
masters["cpu"] = &schema.Schema{
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Description: "Node CPU count.",
|
Description: "Node CPU count.",
|
||||||
}
|
}
|
||||||
masters["ram"] = &schema.Schema{
|
masters["ram"] = &schema.Schema{
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
|
ValidateFunc: validation.All(
|
||||||
|
validation.IntAtLeast(constants.MinRamPerCompute),
|
||||||
|
validators.DivisibleBy(constants.RAMDivisibility),
|
||||||
|
),
|
||||||
Description: "Node RAM in MB.",
|
Description: "Node RAM in MB.",
|
||||||
}
|
}
|
||||||
masters["disk"] = &schema.Schema{
|
masters["disk"] = &schema.Schema{
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Description: "Node boot disk size in GB.",
|
Description: "Node boot disk size in GB.",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +123,11 @@ func workersSchemaMake() map[string]*schema.Schema {
|
|||||||
Required: true,
|
Required: true,
|
||||||
},
|
},
|
||||||
"ram": {
|
"ram": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
|
ValidateFunc: validation.All(
|
||||||
|
validation.IntAtLeast(constants.MinRamPerCompute),
|
||||||
|
validators.DivisibleBy(constants.RAMDivisibility),
|
||||||
|
),
|
||||||
Required: true,
|
Required: true,
|
||||||
},
|
},
|
||||||
"cpu": {
|
"cpu": {
|
||||||
|
|||||||
396
internal/service/cloudapi/k8s/old_schemas.go
Normal file
396
internal/service/cloudapi/k8s/old_schemas.go
Normal file
@@ -0,0 +1,396 @@
|
|||||||
|
package k8s
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
||||||
|
)
|
||||||
|
|
||||||
|
func resourceK8sCPSchemaV1() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Required: true,
|
||||||
|
Description: "Name of the cluster.",
|
||||||
|
},
|
||||||
|
"rg_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Required: true,
|
||||||
|
//ForceNew: true,
|
||||||
|
Description: "Resource group ID that this instance belongs to.",
|
||||||
|
},
|
||||||
|
"k8sci_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Required: true,
|
||||||
|
//ForceNew: true,
|
||||||
|
Description: "ID of the k8s catalog item to base this instance on.",
|
||||||
|
},
|
||||||
|
"network_plugin": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Required: true,
|
||||||
|
Description: "Network plugin to be used",
|
||||||
|
ValidateFunc: validation.StringInSlice([]string{"flannel", "weavenet", "calico"}, true),
|
||||||
|
},
|
||||||
|
"num": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
ValidateFunc: validation.IntInSlice([]int{1, 3}),
|
||||||
|
Description: "Number of VMs to create. Can be either 1 or 3",
|
||||||
|
},
|
||||||
|
"cpu": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Node CPU count.",
|
||||||
|
},
|
||||||
|
"ram": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Node RAM in MB.",
|
||||||
|
},
|
||||||
|
"disk": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Node boot disk size in GB.",
|
||||||
|
},
|
||||||
|
"sep_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Storage Endpoint ID",
|
||||||
|
},
|
||||||
|
"sep_pool": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Storage Endpoint Pool",
|
||||||
|
},
|
||||||
|
"with_lb": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Default: true,
|
||||||
|
Description: "Create k8s with load balancer if true.",
|
||||||
|
},
|
||||||
|
"extnet_only": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Default: false,
|
||||||
|
Description: "Use only selected ExtNet for infrastructure connections",
|
||||||
|
},
|
||||||
|
// /4.4.0
|
||||||
|
"cloud_init": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Meta data for working group computes, format YAML 'user_data': 1111",
|
||||||
|
},
|
||||||
|
"join_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "is used to configure the behavior and settings for joining a node to a cluster. It includes parameters such as the cluster's control plane endpoint, token, and certificate key. insert a valid JSON string with all levels of nesting.",
|
||||||
|
},
|
||||||
|
"kube_proxy_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "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.",
|
||||||
|
},
|
||||||
|
"kubelet_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "is used to configure the behavior and settings of the Kubelet, which is the primary node agent that runs on each node in the cluster. It includes parameters such as node IP address, resource allocation, pod eviction policies, and other Kubelet-specific configurations. insert a valid JSON string with all levels of nesting.",
|
||||||
|
},
|
||||||
|
"cluster_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "is used to define global settings and configurations for the entire cluster. It includes parameters such as cluster name, DNS settings, authentication methods, and other cluster-wide configurations. insert a valid JSON string with all levels of nesting.",
|
||||||
|
},
|
||||||
|
"init_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "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.",
|
||||||
|
},
|
||||||
|
"additional_sans": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Optional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names",
|
||||||
|
Elem: &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"ha_mode": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Use Highly Available schema for LB deploy",
|
||||||
|
},
|
||||||
|
"lb_sysctl_params": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Custom sysctl values for Load Balancer instance. Applied on boot.",
|
||||||
|
},
|
||||||
|
"oidc_cert": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "insert ssl certificate in x509 pem format",
|
||||||
|
},
|
||||||
|
////
|
||||||
|
"extnet_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
//ForceNew: true,
|
||||||
|
Description: "ID of the external network to connect workers to. If omitted network will be chosen by the platfom.",
|
||||||
|
},
|
||||||
|
"desc": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Text description of this instance.",
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Default: true,
|
||||||
|
Description: "Start k8s cluster.",
|
||||||
|
},
|
||||||
|
"detailed_info": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"compute_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"tech_status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"interfaces": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"def_gw": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"ip_address": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"natable_vins_ip": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"natable_vins_network": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"master_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Master group ID.",
|
||||||
|
},
|
||||||
|
"master_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Master group name.",
|
||||||
|
},
|
||||||
|
"acl": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"account_acl": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"explicit": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"guid": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"user_group_id": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"k8s_acl": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"explicit": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"guid": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"user_group_id": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"rg_acl": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"explicit": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"guid": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"user_group_id": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"account_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"account_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"bservice_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"created_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"created_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"deleted_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"deleted_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"k8s_ci_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"lb_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"k8s_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"lb_ip": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
Description: "IP address of default load balancer.",
|
||||||
|
},
|
||||||
|
"rg_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"tech_status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"updated_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"updated_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"kubeconfig": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Kubeconfig for cluster access.",
|
||||||
|
},
|
||||||
|
"vins_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
Description: "ID of default vins for this instace.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -145,18 +145,72 @@ func resourceK8sCreate(ctx context.Context, d *schema.ResourceData, m interface{
|
|||||||
|
|
||||||
createReq.WithLB = d.Get("with_lb").(bool)
|
createReq.WithLB = d.Get("with_lb").(bool)
|
||||||
|
|
||||||
|
///4.4.0
|
||||||
|
createReq.HighlyAvailable = d.Get("ha_mode").(bool)
|
||||||
|
|
||||||
|
if additionalSans, ok := d.GetOk("additional_sans"); ok {
|
||||||
|
addSans := additionalSans.([]interface{})
|
||||||
|
resSans := make([]string, 0)
|
||||||
|
for _, san := range addSans {
|
||||||
|
resSans = append(resSans, san.(string))
|
||||||
|
}
|
||||||
|
|
||||||
|
createReq.AdditionalSANs = resSans
|
||||||
|
}
|
||||||
|
|
||||||
|
if clusterConfig, ok := d.GetOk("cluster_config"); ok {
|
||||||
|
createReq.ClusterConfiguration = clusterConfig.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
if kubeletConfig, ok := d.GetOk("kubelet_config"); ok {
|
||||||
|
createReq.KubeletConfiguration = kubeletConfig.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
if kubeProxyConfig, ok := d.GetOk("kube_proxy_config"); ok {
|
||||||
|
createReq.KubeProxyConfiguration = kubeProxyConfig.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
if joinConfig, ok := d.GetOk("join_config"); ok {
|
||||||
|
createReq.JoinConfiguration = joinConfig.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
if cloudInit, ok := d.GetOk("cloud_init"); ok {
|
||||||
|
createReq.UserData = cloudInit.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
if initConfig, ok := d.GetOk("init_config"); ok {
|
||||||
|
createReq.InitConfiguration = initConfig.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
if lbSysctlParams, ok := d.GetOk("lb_sysctl_params"); ok {
|
||||||
|
createReq.LbSysctlParams = lbSysctlParams.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
if oidcCertificate, ok := d.GetOk("oidc_cert"); ok {
|
||||||
|
createReq.OidcCertificate = oidcCertificate.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
createReq.ExtNetOnly = d.Get("extnet_only").(bool)
|
||||||
|
|
||||||
if extNet, ok := d.GetOk("extnet_id"); ok {
|
if extNet, ok := d.GetOk("extnet_id"); ok {
|
||||||
createReq.ExtNetID = uint64(extNet.(int))
|
createReq.ExtNetID = uint64(extNet.(int))
|
||||||
} else {
|
} else {
|
||||||
createReq.ExtNetID = 0
|
createReq.ExtNetID = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if vins, ok := d.GetOk("vins_id"); ok {
|
||||||
|
createReq.VinsId = uint64(vins.(int))
|
||||||
|
} else {
|
||||||
|
createReq.VinsId = 0
|
||||||
|
}
|
||||||
|
|
||||||
if desc, ok := d.GetOk("desc"); ok {
|
if desc, ok := d.GetOk("desc"); ok {
|
||||||
createReq.Description = desc.(string)
|
createReq.Description = desc.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := c.CloudAPI().K8S().Create(ctx, createReq)
|
resp, err := c.CloudAPI().K8S().Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +235,7 @@ func resourceK8sCreate(ctx context.Context, d *schema.ResourceData, m interface{
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
time.Sleep(time.Second * 10)
|
time.Sleep(time.Second * 20)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resourceK8sRead(ctx, d, m)
|
return resourceK8sRead(ctx, d, m)
|
||||||
@@ -205,31 +259,32 @@ func resourceK8sRead(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
case status.Created:
|
case status.Created:
|
||||||
case status.Deleting:
|
case status.Deleting:
|
||||||
case status.Deleted:
|
case status.Deleted:
|
||||||
id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
// id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||||
restoreReq := k8s.RestoreRequest{
|
// restoreReq := k8s.RestoreRequest{
|
||||||
K8SID: id,
|
// K8SID: id,
|
||||||
}
|
// }
|
||||||
|
|
||||||
_, err := c.CloudAPI().K8S().Restore(ctx, restoreReq)
|
// _, err := c.CloudAPI().K8S().Restore(ctx, restoreReq)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return diag.FromErr(err)
|
// return diag.FromErr(err)
|
||||||
}
|
// }
|
||||||
|
|
||||||
enableReq := k8s.DisableEnableRequest{
|
// enableReq := k8s.DisableEnableRequest{
|
||||||
K8SID: id,
|
// K8SID: id,
|
||||||
}
|
// }
|
||||||
|
|
||||||
_, err = c.CloudAPI().K8S().Enable(ctx, enableReq)
|
// _, err = c.CloudAPI().K8S().Enable(ctx, enableReq)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return diag.FromErr(err)
|
// return diag.FromErr(err)
|
||||||
}
|
// }
|
||||||
|
|
||||||
hasChanged = true
|
// hasChanged = true
|
||||||
case status.Destroying:
|
case status.Destroying:
|
||||||
return diag.Errorf("The k8s cluster is in progress with status: %s", cluster.Status)
|
return diag.Errorf("The k8s cluster is in progress with status: %s", cluster.Status)
|
||||||
case status.Destroyed:
|
case status.Destroyed:
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return resourceK8sCreate(ctx, d, m)
|
return diag.Errorf("The resource cannot be updated because it has been destroyed")
|
||||||
|
// return resourceK8sCreate(ctx, d, m)
|
||||||
case status.Enabling:
|
case status.Enabling:
|
||||||
case status.Enabled:
|
case status.Enabled:
|
||||||
case status.Disabling:
|
case status.Disabling:
|
||||||
@@ -261,7 +316,7 @@ func resourceK8sRead(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
k8sList, err := utilityK8sListCheckPresence(ctx, d, m)
|
k8sList, err := utilityK8sListForResourceCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@@ -388,7 +443,8 @@ func resourceK8sUpdate(ctx context.Context, d *schema.ResourceData, m interface{
|
|||||||
return diag.Errorf("The k8s cluster is in progress with status: %s", cluster.Status)
|
return diag.Errorf("The k8s cluster is in progress with status: %s", cluster.Status)
|
||||||
case status.Destroyed:
|
case status.Destroyed:
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return resourceK8sCreate(ctx, d, m)
|
return diag.Errorf("The resource cannot be updated because it has been destroyed")
|
||||||
|
// return resourceK8sCreate(ctx, d, m)
|
||||||
case status.Enabling:
|
case status.Enabling:
|
||||||
case status.Enabled:
|
case status.Enabled:
|
||||||
case status.Disabling:
|
case status.Disabling:
|
||||||
@@ -459,10 +515,11 @@ func resourceK8sUpdate(ctx context.Context, d *schema.ResourceData, m interface{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return resourceK8sRead(ctx, d, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceK8sDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceK8sDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
|
||||||
log.Debugf("resourceK8sDelete: called with id %s, rg %d", d.Id(), d.Get("rg_id").(int))
|
log.Debugf("resourceK8sDelete: called with id %s, rg %d", d.Id(), d.Get("rg_id").(int))
|
||||||
|
|
||||||
cluster, err := utilityK8sCheckPresence(ctx, d, m)
|
cluster, err := utilityK8sCheckPresence(ctx, d, m)
|
||||||
@@ -470,12 +527,14 @@ func resourceK8sDelete(ctx context.Context, d *schema.ResourceData, m interface{
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
c := m.(*controller.ControllerCfg)
|
req := k8s.DeleteRequest{K8SID: cluster.ID}
|
||||||
req := k8s.DeleteRequest{
|
|
||||||
K8SID: cluster.ID,
|
if val, ok := d.GetOk("permanently"); ok {
|
||||||
Permanently: true,
|
req.Permanently = val.(bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
|
||||||
_, err = c.CloudAPI().K8S().Delete(ctx, req)
|
_, err = c.CloudAPI().K8S().Delete(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@@ -492,15 +551,15 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
|
|||||||
Description: "Name of the cluster.",
|
Description: "Name of the cluster.",
|
||||||
},
|
},
|
||||||
"rg_id": {
|
"rg_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Description: "Resource group ID that this instance belongs to.",
|
Description: "Resource group ID that this instance belongs to.",
|
||||||
},
|
},
|
||||||
"k8sci_id": {
|
"k8sci_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Description: "ID of the k8s catalog item to base this instance on.",
|
Description: "ID of the k8s catalog item to base this instance on.",
|
||||||
},
|
},
|
||||||
"wg_name": {
|
"wg_name": {
|
||||||
@@ -539,7 +598,7 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
MaxItems: 1,
|
MaxItems: 1,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: mastersSchemaMake(),
|
Schema: mastersSchemaMake(),
|
||||||
@@ -561,13 +620,80 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
|
|||||||
Default: true,
|
Default: true,
|
||||||
Description: "Create k8s with load balancer if true.",
|
Description: "Create k8s with load balancer if true.",
|
||||||
},
|
},
|
||||||
"extnet_id": {
|
"extnet_only": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeBool,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Default: false,
|
||||||
ForceNew: true,
|
Description: "Use only selected ExtNet for infrastructure connections",
|
||||||
|
},
|
||||||
|
"extnet_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
//ForceNew: true,
|
||||||
Description: "ID of the external network to connect workers to. If omitted network will be chosen by the platfom.",
|
Description: "ID of the external network to connect workers to. If omitted network will be chosen by the platfom.",
|
||||||
},
|
},
|
||||||
|
"permanently": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Default: false,
|
||||||
|
Description: "Determines if cluster should be destroyed",
|
||||||
|
},
|
||||||
|
|
||||||
|
///4.4.0
|
||||||
|
"cloud_init": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Meta data for working group computes, format YAML 'user_data': 1111",
|
||||||
|
},
|
||||||
|
"join_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "is used to configure the behavior and settings for joining a node to a cluster. It includes parameters such as the cluster's control plane endpoint, token, and certificate key. insert a valid JSON string with all levels of nesting.",
|
||||||
|
},
|
||||||
|
"kube_proxy_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "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.",
|
||||||
|
},
|
||||||
|
"kubelet_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "is used to configure the behavior and settings of the Kubelet, which is the primary node agent that runs on each node in the cluster. It includes parameters such as node IP address, resource allocation, pod eviction policies, and other Kubelet-specific configurations. insert a valid JSON string with all levels of nesting.",
|
||||||
|
},
|
||||||
|
"cluster_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "is used to define global settings and configurations for the entire cluster. It includes parameters such as cluster name, DNS settings, authentication methods, and other cluster-wide configurations. insert a valid JSON string with all levels of nesting.",
|
||||||
|
},
|
||||||
|
"init_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "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.",
|
||||||
|
},
|
||||||
|
"additional_sans": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Optional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names",
|
||||||
|
Elem: &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"ha_mode": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Use Highly Available schema for LB deploy",
|
||||||
|
},
|
||||||
|
"lb_sysctl_params": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Custom sysctl values for Load Balancer instance. Applied on boot.",
|
||||||
|
},
|
||||||
|
"oidc_cert": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "insert ssl certificate in x509 pem format",
|
||||||
|
},
|
||||||
"desc": {
|
"desc": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
@@ -579,7 +705,6 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
|
|||||||
Default: true,
|
Default: true,
|
||||||
Description: "Start k8s cluster",
|
Description: "Start k8s cluster",
|
||||||
},
|
},
|
||||||
|
|
||||||
"acl": {
|
"acl": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -660,6 +785,7 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
|
|||||||
},
|
},
|
||||||
"vins_id": {
|
"vins_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "ID of default vins for this instace.",
|
Description: "ID of default vins for this instace.",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import (
|
|||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/dc"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/dc"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/status"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/status"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
func resourceK8sCPCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceK8sCPCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
@@ -129,18 +130,73 @@ func resourceK8sCPCreate(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
|
|
||||||
createReq.WithLB = d.Get("with_lb").(bool)
|
createReq.WithLB = d.Get("with_lb").(bool)
|
||||||
|
|
||||||
|
///4.4.0
|
||||||
|
createReq.HighlyAvailable = d.Get("ha_mode").(bool)
|
||||||
|
|
||||||
|
if additionalSans, ok := d.GetOk("additional_sans"); ok {
|
||||||
|
addSans := additionalSans.([]interface{})
|
||||||
|
resSans := make([]string, 0)
|
||||||
|
for _, san := range addSans {
|
||||||
|
resSans = append(resSans, san.(string))
|
||||||
|
}
|
||||||
|
|
||||||
|
createReq.AdditionalSANs = resSans
|
||||||
|
}
|
||||||
|
|
||||||
|
if clusterConfig, ok := d.GetOk("cluster_config"); ok {
|
||||||
|
createReq.ClusterConfiguration = clusterConfig.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
if kubeletConfig, ok := d.GetOk("kubelet_config"); ok {
|
||||||
|
createReq.KubeletConfiguration = kubeletConfig.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
if kubeProxyConfig, ok := d.GetOk("kube_proxy_config"); ok {
|
||||||
|
createReq.KubeProxyConfiguration = kubeProxyConfig.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
if joinConfig, ok := d.GetOk("join_config"); ok {
|
||||||
|
createReq.JoinConfiguration = joinConfig.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
// if cloudInit, ok := d.GetOk("cloud_init"); ok {
|
||||||
|
// createReq.UserData = cloudInit.(string)
|
||||||
|
// }
|
||||||
|
|
||||||
|
if initConfig, ok := d.GetOk("init_config"); ok {
|
||||||
|
createReq.InitConfiguration = initConfig.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
if lbSysctlParams, ok := d.GetOk("lb_sysctl_params"); ok {
|
||||||
|
createReq.LbSysctlParams = lbSysctlParams.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
if oidcCertificate, ok := d.GetOk("oidc_cert"); ok {
|
||||||
|
createReq.OidcCertificate = oidcCertificate.(string)
|
||||||
|
log.Debug(createReq.OidcCertificate)
|
||||||
|
}
|
||||||
|
|
||||||
|
createReq.ExtNetOnly = d.Get("extnet_only").(bool)
|
||||||
|
|
||||||
if extNet, ok := d.GetOk("extnet_id"); ok {
|
if extNet, ok := d.GetOk("extnet_id"); ok {
|
||||||
createReq.ExtNetID = uint64(extNet.(int))
|
createReq.ExtNetID = uint64(extNet.(int))
|
||||||
} else {
|
} else {
|
||||||
createReq.ExtNetID = 0
|
createReq.ExtNetID = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if vins, ok := d.GetOk("vins_id"); ok {
|
||||||
|
createReq.VinsId = uint64(vins.(int))
|
||||||
|
} else {
|
||||||
|
createReq.VinsId = 0
|
||||||
|
}
|
||||||
|
|
||||||
if desc, ok := d.GetOk("desc"); ok {
|
if desc, ok := d.GetOk("desc"); ok {
|
||||||
createReq.Description = desc.(string)
|
createReq.Description = desc.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := c.CloudAPI().K8S().Create(ctx, createReq)
|
resp, err := c.CloudAPI().K8S().Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +221,7 @@ func resourceK8sCPCreate(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
time.Sleep(time.Second * 10)
|
time.Sleep(time.Second * 20)
|
||||||
}
|
}
|
||||||
|
|
||||||
cluster, err := utilityK8sCheckPresence(ctx, d, m)
|
cluster, err := utilityK8sCheckPresence(ctx, d, m)
|
||||||
@@ -204,31 +260,32 @@ func resourceK8sCPRead(ctx context.Context, d *schema.ResourceData, m interface{
|
|||||||
case status.Created:
|
case status.Created:
|
||||||
case status.Deleting:
|
case status.Deleting:
|
||||||
case status.Deleted:
|
case status.Deleted:
|
||||||
id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
// id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||||
restoreReq := k8s.RestoreRequest{
|
// restoreReq := k8s.RestoreRequest{
|
||||||
K8SID: id,
|
// K8SID: id,
|
||||||
}
|
// }
|
||||||
|
|
||||||
_, err := c.CloudAPI().K8S().Restore(ctx, restoreReq)
|
// _, err := c.CloudAPI().K8S().Restore(ctx, restoreReq)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return diag.FromErr(err)
|
// return diag.FromErr(err)
|
||||||
}
|
// }
|
||||||
|
|
||||||
enableReq := k8s.DisableEnableRequest{
|
// enableReq := k8s.DisableEnableRequest{
|
||||||
K8SID: id,
|
// K8SID: id,
|
||||||
}
|
// }
|
||||||
|
|
||||||
_, err = c.CloudAPI().K8S().Enable(ctx, enableReq)
|
// _, err = c.CloudAPI().K8S().Enable(ctx, enableReq)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return diag.FromErr(err)
|
// return diag.FromErr(err)
|
||||||
}
|
// }
|
||||||
|
|
||||||
hasChanged = true
|
// hasChanged = true
|
||||||
case status.Destroying:
|
case status.Destroying:
|
||||||
return diag.Errorf("The k8s cluster is in progress with status: %s", cluster.Status)
|
return diag.Errorf("The k8s cluster is in progress with status: %s", cluster.Status)
|
||||||
case status.Destroyed:
|
case status.Destroyed:
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return resourceK8sCreate(ctx, d, m)
|
return diag.Errorf("The resource cannot be updated because it has been destroyed")
|
||||||
|
// return resourceK8sCreate(ctx, d, m)
|
||||||
case status.Enabling:
|
case status.Enabling:
|
||||||
case status.Enabled:
|
case status.Enabled:
|
||||||
case status.Disabling:
|
case status.Disabling:
|
||||||
@@ -260,7 +317,7 @@ func resourceK8sCPRead(ctx context.Context, d *schema.ResourceData, m interface{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
k8sList, err := utilityK8sListCheckPresence(ctx, d, m)
|
k8sList, err := utilityK8sListForResourceCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
@@ -291,7 +348,7 @@ func resourceK8sCPRead(ctx context.Context, d *schema.ResourceData, m interface{
|
|||||||
|
|
||||||
if _, ok := d.GetOk("k8s_id"); !ok {
|
if _, ok := d.GetOk("k8s_id"); !ok {
|
||||||
for _, worker := range cluster.K8SGroups.Workers {
|
for _, worker := range cluster.K8SGroups.Workers {
|
||||||
err := fmt.Errorf("Found worker-group with ID %d. Make sure to import it to decort_k8s_wg resource if you wish to manage it", worker.ID)
|
err := fmt.Errorf("found worker-group with ID %d. Make sure to import it to decort_k8s_wg resource if you wish to manage it", worker.ID)
|
||||||
warnings.Add(err)
|
warnings.Add(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -387,7 +444,8 @@ func resourceK8sCPUpdate(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
return diag.Errorf("The k8s cluster is in progress with status: %s", cluster.Status)
|
return diag.Errorf("The k8s cluster is in progress with status: %s", cluster.Status)
|
||||||
case status.Destroyed:
|
case status.Destroyed:
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return resourceK8sCreate(ctx, d, m)
|
return diag.Errorf("The resource cannot be updated because it has been destroyed")
|
||||||
|
// return resourceK8sCreate(ctx, d, m)
|
||||||
case status.Enabling:
|
case status.Enabling:
|
||||||
case status.Enabled:
|
case status.Enabled:
|
||||||
case status.Disabling:
|
case status.Disabling:
|
||||||
@@ -474,28 +532,34 @@ func resourceK8sCPUpdate(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return resourceK8sCPRead(ctx, d, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceK8sCPDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceK8sCPDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
|
||||||
log.Debugf("resourceK8sControlPlaneDelete: called with id %s, rg %d", d.Id(), d.Get("rg_id").(int))
|
log.Debugf("resourceK8sControlPlaneDelete: called with id %s, rg %d", d.Id(), d.Get("rg_id").(int))
|
||||||
|
|
||||||
cluster, err := utilityK8sCheckPresence(ctx, d, m)
|
cluster, err := utilityK8sCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
c := m.(*controller.ControllerCfg)
|
req := k8s.DeleteRequest{K8SID: cluster.ID}
|
||||||
req := k8s.DeleteRequest{
|
|
||||||
K8SID: cluster.ID,
|
if val, ok := d.GetOk("permanently"); ok {
|
||||||
Permanently: true,
|
req.Permanently = val.(bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
|
||||||
_, err = c.CloudAPI().K8S().Delete(ctx, req)
|
_, err = c.CloudAPI().K8S().Delete(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.SetId("")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,15 +571,15 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
|
|||||||
Description: "Name of the cluster.",
|
Description: "Name of the cluster.",
|
||||||
},
|
},
|
||||||
"rg_id": {
|
"rg_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Description: "Resource group ID that this instance belongs to.",
|
Description: "Resource group ID that this instance belongs to.",
|
||||||
},
|
},
|
||||||
"k8sci_id": {
|
"k8sci_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Description: "ID of the k8s catalog item to base this instance on.",
|
Description: "ID of the k8s catalog item to base this instance on.",
|
||||||
},
|
},
|
||||||
"network_plugin": {
|
"network_plugin": {
|
||||||
@@ -538,9 +602,13 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
|
|||||||
Description: "Node CPU count.",
|
Description: "Node CPU count.",
|
||||||
},
|
},
|
||||||
"ram": {
|
"ram": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
ValidateFunc: validation.All(
|
||||||
|
validation.IntAtLeast(constants.MinRamPerCompute),
|
||||||
|
validators.DivisibleBy(constants.RAMDivisibility),
|
||||||
|
),
|
||||||
Description: "Node RAM in MB.",
|
Description: "Node RAM in MB.",
|
||||||
},
|
},
|
||||||
"disk": {
|
"disk": {
|
||||||
@@ -567,11 +635,65 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
|
|||||||
Default: true,
|
Default: true,
|
||||||
Description: "Create k8s with load balancer if true.",
|
Description: "Create k8s with load balancer if true.",
|
||||||
},
|
},
|
||||||
"extnet_id": {
|
"extnet_only": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeBool,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Default: false,
|
||||||
ForceNew: true,
|
Description: "Use only selected ExtNet for infrastructure connections",
|
||||||
|
},
|
||||||
|
"join_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "is used to configure the behavior and settings for joining a node to a cluster. It includes parameters such as the cluster's control plane endpoint, token, and certificate key. insert a valid JSON string with all levels of nesting.",
|
||||||
|
},
|
||||||
|
"kube_proxy_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "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.",
|
||||||
|
},
|
||||||
|
"kubelet_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "is used to configure the behavior and settings of the Kubelet, which is the primary node agent that runs on each node in the cluster. It includes parameters such as node IP address, resource allocation, pod eviction policies, and other Kubelet-specific configurations. insert a valid JSON string with all levels of nesting.",
|
||||||
|
},
|
||||||
|
"cluster_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "is used to define global settings and configurations for the entire cluster. It includes parameters such as cluster name, DNS settings, authentication methods, and other cluster-wide configurations. insert a valid JSON string with all levels of nesting.",
|
||||||
|
},
|
||||||
|
"init_config": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "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.",
|
||||||
|
},
|
||||||
|
"additional_sans": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Optional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names",
|
||||||
|
Elem: &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"ha_mode": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Use Highly Available schema for LB deploy",
|
||||||
|
},
|
||||||
|
"lb_sysctl_params": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Custom sysctl values for Load Balancer instance. Applied on boot.",
|
||||||
|
},
|
||||||
|
"oidc_cert": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "insert ssl certificate in x509 pem format",
|
||||||
|
},
|
||||||
|
"extnet_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
//ForceNew: true,
|
||||||
Description: "ID of the external network to connect workers to. If omitted network will be chosen by the platfom.",
|
Description: "ID of the external network to connect workers to. If omitted network will be chosen by the platfom.",
|
||||||
},
|
},
|
||||||
"desc": {
|
"desc": {
|
||||||
@@ -654,6 +776,12 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "IP address of default load balancer.",
|
Description: "IP address of default load balancer.",
|
||||||
},
|
},
|
||||||
|
"permanently": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Default: false,
|
||||||
|
Description: "Determines if cluster should be destroyed",
|
||||||
|
},
|
||||||
"rg_name": {
|
"rg_name": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -681,6 +809,7 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
|
|||||||
},
|
},
|
||||||
"vins_id": {
|
"vins_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "ID of default vins for this instace.",
|
Description: "ID of default vins for this instace.",
|
||||||
},
|
},
|
||||||
@@ -689,7 +818,7 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
|
|||||||
|
|
||||||
func ResourceK8sCP() *schema.Resource {
|
func ResourceK8sCP() *schema.Resource {
|
||||||
return &schema.Resource{
|
return &schema.Resource{
|
||||||
SchemaVersion: 1,
|
SchemaVersion: 2,
|
||||||
|
|
||||||
CreateContext: resourceK8sCPCreate,
|
CreateContext: resourceK8sCPCreate,
|
||||||
ReadContext: resourceK8sCPRead,
|
ReadContext: resourceK8sCPRead,
|
||||||
@@ -709,5 +838,12 @@ func ResourceK8sCP() *schema.Resource {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Schema: resourceK8sCPSchemaMake(),
|
Schema: resourceK8sCPSchemaMake(),
|
||||||
|
StateUpgraders: []schema.StateUpgrader{
|
||||||
|
{
|
||||||
|
Type: resourceK8sCPSchemaV1().CoreConfigSchema().ImpliedType(),
|
||||||
|
Upgrade: resourceK8sCPStateUpgradeV1,
|
||||||
|
Version: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,16 +34,19 @@ package k8s
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8s"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8s"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
func resourceK8sWgCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceK8sWgCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
@@ -92,12 +95,16 @@ func resourceK8sWgCreate(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
req.WorkerDisk = uint64(d.Get("disk").(int))
|
req.WorkerDisk = uint64(d.Get("disk").(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cloudInit, ok := d.GetOk("cloud_init"); ok {
|
||||||
|
req.UserData = cloudInit.(string)
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := c.CloudAPI().K8S().WorkersGroupAdd(ctx, req)
|
resp, err := c.CloudAPI().K8S().WorkersGroupAdd(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.SetId(strconv.FormatUint(resp, 10))
|
d.SetId(fmt.Sprintf("%d#%d", d.Get("k8s_id").(int), resp))
|
||||||
|
|
||||||
return resourceK8sWgRead(ctx, d, m)
|
return resourceK8sWgRead(ctx, d, m)
|
||||||
}
|
}
|
||||||
@@ -110,7 +117,7 @@ func resourceK8sWgRead(ctx context.Context, d *schema.ResourceData, m interface{
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
workersComputeList := make([]compute.RecordCompute, 0, 0)
|
workersComputeList := make([]compute.RecordCompute, 0)
|
||||||
for _, info := range wg.DetailedInfo {
|
for _, info := range wg.DetailedInfo {
|
||||||
compute, err := utilityComputeCheckPresence(ctx, d, m, info.ID)
|
compute, err := utilityComputeCheckPresence(ctx, d, m, info.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -121,7 +128,7 @@ func resourceK8sWgRead(ctx context.Context, d *schema.ResourceData, m interface{
|
|||||||
|
|
||||||
d.Set("wg_id", wg.ID)
|
d.Set("wg_id", wg.ID)
|
||||||
if strings.Contains(d.Id(), "#") {
|
if strings.Contains(d.Id(), "#") {
|
||||||
k8sId, err := strconv.Atoi(strings.Split(d.Id(), "#")[1])
|
k8sId, err := strconv.Atoi(strings.Split(d.Id(), "#")[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
@@ -130,8 +137,7 @@ func resourceK8sWgRead(ctx context.Context, d *schema.ResourceData, m interface{
|
|||||||
} else {
|
} else {
|
||||||
d.Set("k8s_id", d.Get("k8s_id"))
|
d.Set("k8s_id", d.Get("k8s_id"))
|
||||||
}
|
}
|
||||||
|
d.SetId(fmt.Sprintf("%d#%d", d.Get("k8s_id").(int), wg.ID))
|
||||||
d.SetId(strings.Split(d.Id(), "#")[0])
|
|
||||||
|
|
||||||
flattenWg(d, *wg, workersComputeList)
|
flattenWg(d, *wg, workersComputeList)
|
||||||
|
|
||||||
@@ -157,11 +163,10 @@ func resourceK8sWgUpdate(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
wgId, _ := strconv.ParseUint(d.Id(), 10, 64)
|
|
||||||
if newNum := d.Get("num").(int); uint64(newNum) > wg.Num {
|
if newNum := d.Get("num").(int); uint64(newNum) > wg.Num {
|
||||||
req := k8s.WorkerAddRequest{
|
req := k8s.WorkerAddRequest{
|
||||||
K8SID: uint64(d.Get("k8s_id").(int)),
|
K8SID: uint64(d.Get("k8s_id").(int)),
|
||||||
WorkersGroupID: wgId,
|
WorkersGroupID: wg.ID,
|
||||||
Num: uint64(newNum) - wg.Num,
|
Num: uint64(newNum) - wg.Num,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +178,7 @@ func resourceK8sWgUpdate(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
for i := int(wg.Num) - 1; i >= newNum; i-- {
|
for i := int(wg.Num) - 1; i >= newNum; i-- {
|
||||||
req := k8s.DeleteWorkerFromGroupRequest{
|
req := k8s.DeleteWorkerFromGroupRequest{
|
||||||
K8SID: uint64(d.Get("k8s_id").(int)),
|
K8SID: uint64(d.Get("k8s_id").(int)),
|
||||||
WorkersGroupID: wgId,
|
WorkersGroupID: wg.ID,
|
||||||
WorkerID: wg.DetailedInfo[i].ID,
|
WorkerID: wg.DetailedInfo[i].ID,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +189,20 @@ func resourceK8sWgUpdate(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
if d.HasChange("cloud_init") {
|
||||||
|
req := k8s.UpdateWorkerNodesMetaDataRequest{
|
||||||
|
K8SID: uint64(d.Get("k8s_id").(int)),
|
||||||
|
WorkersGroupID: wg.ID,
|
||||||
|
UserData: d.Get("cloud_init").(string),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().K8S().UpdateWorkerNodesMetaData(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resourceK8sWgRead(ctx, d, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceK8sWgDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceK8sWgDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
@@ -192,6 +210,7 @@ func resourceK8sWgDelete(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
|
|
||||||
wg, err := utilityK8sWgCheckPresence(ctx, d, m)
|
wg, err := utilityK8sWgCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,22 +225,24 @@ func resourceK8sWgDelete(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.SetId("")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceK8sWgSchemaMake() map[string]*schema.Schema {
|
func resourceK8sWgSchemaMake() map[string]*schema.Schema {
|
||||||
return map[string]*schema.Schema{
|
return map[string]*schema.Schema{
|
||||||
"k8s_id": {
|
"k8s_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Description: "ID of k8s instance.",
|
Description: "ID of k8s instance.",
|
||||||
},
|
},
|
||||||
|
|
||||||
"name": {
|
"name": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Description: "Name of the worker group.",
|
Description: "Name of the worker group.",
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -233,18 +254,22 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
|
|||||||
},
|
},
|
||||||
|
|
||||||
"cpu": {
|
"cpu": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Default: 1,
|
Default: 1,
|
||||||
Description: "Worker node CPU count.",
|
Description: "Worker node CPU count.",
|
||||||
},
|
},
|
||||||
|
|
||||||
"ram": {
|
"ram": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
ForceNew: true,
|
//ForceNew: true,
|
||||||
Default: 1024,
|
Default: 1024,
|
||||||
|
ValidateFunc: validation.All(
|
||||||
|
validation.IntAtLeast(constants.MinRamPerCompute),
|
||||||
|
validators.DivisibleBy(constants.RAMDivisibility),
|
||||||
|
),
|
||||||
Description: "Worker node RAM in MB.",
|
Description: "Worker node RAM in MB.",
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -286,6 +311,11 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
|
"cloud_init": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
DiffSuppressFunc: cloudInitDiffSupperss,
|
||||||
|
},
|
||||||
"wg_id": {
|
"wg_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
|||||||
15
internal/service/cloudapi/k8s/state_upgraders.go
Normal file
15
internal/service/cloudapi/k8s/state_upgraders.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package k8s
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
func resourceK8sCPStateUpgradeV1(ctx context.Context, rawState map[string]interface{}, meta any) (map[string]interface{}, error) {
|
||||||
|
log.Debug("resourceK8sCPStateUpgradeV1: upgrading state")
|
||||||
|
|
||||||
|
delete(rawState, "cloud_init")
|
||||||
|
|
||||||
|
return rawState, nil
|
||||||
|
}
|
||||||
@@ -261,6 +261,34 @@ func utilityK8sListCheckPresence(ctx context.Context, d *schema.ResourceData, m
|
|||||||
req.TechStatus = tech_status.(string)
|
req.TechStatus = tech_status.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if includedeleted, ok := d.GetOk("includedeleted"); ok {
|
||||||
|
req.IncludeDeleted = includedeleted.(bool)
|
||||||
|
}
|
||||||
|
|
||||||
|
if page, ok := d.GetOk("page"); ok {
|
||||||
|
req.Page = uint64(page.(int))
|
||||||
|
}
|
||||||
|
|
||||||
|
if size, ok := d.GetOk("size"); ok {
|
||||||
|
req.Size = uint64(size.(int))
|
||||||
|
}
|
||||||
|
|
||||||
|
k8sList, err := c.CloudAPI().K8S().List(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return k8sList, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func utilityK8sListForResourceCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*k8s.ListK8SClusters, error) {
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
req := k8s.ListRequest{
|
||||||
|
IncludeDeleted: false,
|
||||||
|
}
|
||||||
|
if name, ok := d.GetOk("name"); ok {
|
||||||
|
req.Name = name.(string)
|
||||||
|
}
|
||||||
k8sList, err := c.CloudAPI().K8S().List(ctx, req)
|
k8sList, err := c.CloudAPI().K8S().List(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -297,14 +325,18 @@ func utilityK8sListDeletedCheckPresence(ctx context.Context, d *schema.ResourceD
|
|||||||
req.BasicServiceID = uint64(bservice_id.(int))
|
req.BasicServiceID = uint64(bservice_id.(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
if status, ok := d.GetOk("status"); ok {
|
|
||||||
req.Status = status.(string)
|
|
||||||
}
|
|
||||||
|
|
||||||
if tech_status, ok := d.GetOk("tech_status"); ok {
|
if tech_status, ok := d.GetOk("tech_status"); ok {
|
||||||
req.TechStatus = tech_status.(string)
|
req.TechStatus = tech_status.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if page, ok := d.GetOk("page"); ok {
|
||||||
|
req.Page = uint64(page.(int))
|
||||||
|
}
|
||||||
|
|
||||||
|
if size, ok := d.GetOk("size"); ok {
|
||||||
|
req.Size = uint64(size.(int))
|
||||||
|
}
|
||||||
|
|
||||||
k8sList, err := c.CloudAPI().K8S().ListDeleted(ctx, req)
|
k8sList, err := c.CloudAPI().K8S().ListDeleted(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8s"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8s"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
@@ -70,7 +71,7 @@ func utilityDataK8sWgCheckPresence(ctx context.Context, d *schema.ResourceData,
|
|||||||
return nil, nil, fmt.Errorf("WG with id %v in k8s cluster %v not found", wgId, k8sId)
|
return nil, nil, fmt.Errorf("WG with id %v in k8s cluster %v not found", wgId, k8sId)
|
||||||
}
|
}
|
||||||
|
|
||||||
workersComputeList := make([]compute.RecordCompute, 0, 0)
|
workersComputeList := make([]compute.RecordCompute, 0)
|
||||||
for _, info := range curWg.DetailedInfo {
|
for _, info := range curWg.DetailedInfo {
|
||||||
compute, err := utilityComputeCheckPresence(ctx, d, m, info.ID)
|
compute, err := utilityComputeCheckPresence(ctx, d, m, info.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -90,11 +91,11 @@ func utilityK8sWgCheckPresence(ctx context.Context, d *schema.ResourceData, m in
|
|||||||
var err error
|
var err error
|
||||||
|
|
||||||
if strings.Contains(d.Id(), "#") {
|
if strings.Contains(d.Id(), "#") {
|
||||||
wgId, err = strconv.Atoi(strings.Split(d.Id(), "#")[0])
|
wgId, err = strconv.Atoi(strings.Split(d.Id(), "#")[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
k8sId, err = strconv.Atoi(strings.Split(d.Id(), "#")[1])
|
k8sId, err = strconv.Atoi(strings.Split(d.Id(), "#")[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -121,10 +122,10 @@ func utilityK8sWgCheckPresence(ctx context.Context, d *schema.ResourceData, m in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, fmt.Errorf("Not found wg with id: %v in k8s cluster: %v", wgId, cluster.ID)
|
return nil, fmt.Errorf("not found wg with id: %v in k8s cluster: %v", wgId, cluster.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func utilityK8sWgListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (k8s.ListK8SGroups, error) {
|
func utilityK8sWgListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (k8s.ListK8SGroups, error) {
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
req := k8s.GetRequest{
|
req := k8s.GetRequest{
|
||||||
K8SID: uint64(d.Get("k8s_id").(int)),
|
K8SID: uint64(d.Get("k8s_id").(int)),
|
||||||
@@ -137,3 +138,27 @@ func utilityK8sWgListCheckPresence(ctx context.Context, d *schema.ResourceData,
|
|||||||
|
|
||||||
return cluster.K8SGroups.Workers, nil
|
return cluster.K8SGroups.Workers, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func utilityK8sWgCloudInitCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (string, error) {
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
req := k8s.GetWorkerNodesMetaDataRequest{
|
||||||
|
K8SID: uint64(d.Get("k8s_id").(int)),
|
||||||
|
WorkersGroupID: uint64(d.Get("wg_id").(int)),
|
||||||
|
}
|
||||||
|
|
||||||
|
cloudInit, err := c.CloudAPI().K8S().GetWorkerNodesMetaData(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return cloudInit, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func cloudInitDiffSupperss(key, oldVal, newVal string, d *schema.ResourceData) bool {
|
||||||
|
if newVal != "" && newVal != oldVal {
|
||||||
|
log.Debugf("networkSubresIPAddreDiffSupperss: key=%s, oldVal=%q, newVal=%q -> suppress=FALSE", key, oldVal, newVal)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
log.Debugf("networkSubresIPAddreDiffSupperss: key=%s, oldVal=%q, newVal=%q -> suppress=TRUE", key, oldVal, newVal)
|
||||||
|
return true // suppress difference
|
||||||
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ func findInExtraDisks(DiskId uint, ExtraDisks []interface{}) bool {
|
|||||||
func dataSourceComputeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceComputeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
compute, err := utilityDataComputeCheckPresence(ctx, d, m)
|
compute, err := utilityDataComputeCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
d.SetId(strconv.Itoa(int(compute.ID)))
|
d.SetId(strconv.Itoa(int(compute.ID)))
|
||||||
@@ -290,6 +291,10 @@ func computeListDisksSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"image_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"images": {
|
"images": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -444,6 +449,10 @@ func computeInterfacesSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"enabled": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"flip_group_id": {
|
"flip_group_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -606,7 +615,7 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"bootdisk_size": {
|
"boot_disk_size": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
@@ -711,6 +720,10 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"need_reboot" : {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"natable_vins_id": {
|
"natable_vins_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import (
|
|||||||
func dataSourceComputeAuditsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceComputeAuditsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
computeAudits, err := utilityComputeAuditsCheckPresence(ctx, d, m)
|
computeAudits, err := utilityComputeAuditsCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import (
|
|||||||
func dataSourceComputeGetAuditsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceComputeGetAuditsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
computeAudits, err := utilityComputeGetAuditsCheckPresence(ctx, d, m)
|
computeAudits, err := utilityComputeGetAuditsCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
|
|||||||
@@ -45,12 +45,13 @@ import (
|
|||||||
func dataSourceComputeGetConsoleUrlRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceComputeGetConsoleUrlRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
computeConsoleUrl, err := utilityComputeGetConsoleUrlCheckPresence(ctx, d, m)
|
computeConsoleUrl, err := utilityComputeGetConsoleUrlCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
d.SetId(id.String())
|
d.SetId(id.String())
|
||||||
result := strings.ReplaceAll(string(computeConsoleUrl), "\"", "")
|
result := strings.ReplaceAll(computeConsoleUrl, "\"", "")
|
||||||
result = strings.ReplaceAll(string(result), "\\", "")
|
result = strings.ReplaceAll(result, "\\", "")
|
||||||
d.Set("console_url", result)
|
d.Set("console_url", result)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import (
|
|||||||
func dataSourceComputeGetLogRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceComputeGetLogRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
computeGetLog, err := utilityComputeGetLogCheckPresence(ctx, d, m)
|
computeGetLog, err := utilityComputeGetLogCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import (
|
|||||||
func dataSourceComputeListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceComputeListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
computeList, err := utilityDataComputeListCheckPresence(ctx, d, m)
|
computeList, err := utilityDataComputeListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +124,7 @@ func itemComputeSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"bootdisk_size": {
|
"boot_disk_size": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
@@ -232,6 +233,10 @@ func itemComputeSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"need_reboot": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"pinned": {
|
"pinned": {
|
||||||
Type: schema.TypeBool,
|
Type: schema.TypeBool,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
|||||||
@@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package kvmvm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
)
|
||||||
|
|
||||||
|
func dataSourceComputeListDeletedRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
computeList, err := utilityDataComputeListDeletedCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
result := computeList
|
||||||
|
if d.Get("ignore_k8s").(bool) {
|
||||||
|
// matches automatically generated names like "s234-g2134-c1" etc
|
||||||
|
result = matchComputes(computeList)
|
||||||
|
}
|
||||||
|
|
||||||
|
id := uuid.New()
|
||||||
|
d.SetId(id.String())
|
||||||
|
d.Set("items", flattenComputeList(result))
|
||||||
|
d.Set("entry_count", computeList.EntryCount)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceComputeListDeletedSchemaMake() map[string]*schema.Schema {
|
||||||
|
res := map[string]*schema.Schema{
|
||||||
|
"by_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Find by ID",
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Find by name",
|
||||||
|
},
|
||||||
|
"account_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Find by AccountID",
|
||||||
|
},
|
||||||
|
"rg_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Find by resgroup name",
|
||||||
|
},
|
||||||
|
"rg_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Find by RGID",
|
||||||
|
},
|
||||||
|
"tech_status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Find by tech status",
|
||||||
|
},
|
||||||
|
"ip_address": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Find by IP address",
|
||||||
|
},
|
||||||
|
"extnet_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Find by Extnet name",
|
||||||
|
},
|
||||||
|
"extnet_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Find by Extnet ID",
|
||||||
|
},
|
||||||
|
"page": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
},
|
||||||
|
"size": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
},
|
||||||
|
"ignore_k8s": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Default: false,
|
||||||
|
Description: "If set to true, ignores any VMs associated with any k8s cluster",
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: itemComputeSchemaMake(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"entry_count": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceComputeListDeleted() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceComputeListDeletedRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceComputeListDeletedSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,132 +1,120 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
You may obtain a copy of the License at
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
Unless required by applicable law or agreed to in writing, software
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
See the License for the specific language governing permissions and
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
limitations under the License.
|
See the License for the specific language governing permissions and
|
||||||
*/
|
limitations under the License.
|
||||||
|
*/
|
||||||
/*
|
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
/*
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
|
||||||
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
Please see README.md to learn where to place source code so that it
|
|
||||||
builds seamlessly.
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
|
||||||
*/
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
package snapshot
|
|
||||||
|
package kvmvm
|
||||||
import (
|
|
||||||
"context"
|
import (
|
||||||
|
"context"
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/compute"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenSnapshotList(gl compute.ListSnapshots) []map[string]interface{} {
|
func dataSourceComputePCIDeviceListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
res := make([]map[string]interface{}, 0)
|
computePCIDeviceList, err := utilityComputePCIDeviceListCheckPresence(ctx, d, m)
|
||||||
for _, item := range gl {
|
if err != nil {
|
||||||
temp := map[string]interface{}{
|
d.SetId("")
|
||||||
"label": item.Label,
|
return diag.FromErr(err)
|
||||||
"guid": item.GUID,
|
}
|
||||||
"disks": item.Disks,
|
id := uuid.New()
|
||||||
"timestamp": item.Timestamp,
|
d.SetId(id.String())
|
||||||
}
|
d.Set("items", flattenPCIDevice(computePCIDeviceList.Data))
|
||||||
|
d.Set("entry_count", computePCIDeviceList.EntryCount)
|
||||||
res = append(res, temp)
|
return nil
|
||||||
}
|
}
|
||||||
return res
|
|
||||||
}
|
func dataSourceComputePCIDeviceListSchemaMake() map[string]*schema.Schema {
|
||||||
|
return map[string]*schema.Schema{
|
||||||
func dataSourceSnapshotListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
"compute_id": {
|
||||||
snapshotList, err := utilitySnapshotListCheckPresence(ctx, d, m)
|
Type: schema.TypeInt,
|
||||||
if err != nil {
|
Required: true,
|
||||||
return diag.FromErr(err)
|
},
|
||||||
}
|
"rg_id": {
|
||||||
id := uuid.New()
|
Type: schema.TypeInt,
|
||||||
d.SetId(id.String())
|
Optional: true,
|
||||||
d.Set("items", flattenSnapshotList(snapshotList))
|
Description: "Find by RG id",
|
||||||
|
},
|
||||||
return nil
|
"device_id": {
|
||||||
}
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
func dataSourceSnapshotListSchemaMake() map[string]*schema.Schema {
|
Description: "Find by device id",
|
||||||
rets := map[string]*schema.Schema{
|
},
|
||||||
"compute_id": {
|
"name": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Computed: true,
|
||||||
ForceNew: true,
|
Description: "Find by name",
|
||||||
Description: "ID of the compute instance to create snapshot for.",
|
},
|
||||||
},
|
"status": {
|
||||||
"items": {
|
Type: schema.TypeString,
|
||||||
Type: schema.TypeList,
|
Computed: true,
|
||||||
Computed: true,
|
Description: "Find by status",
|
||||||
Description: "snapshot list",
|
},
|
||||||
Elem: &schema.Resource{
|
"page": {
|
||||||
Schema: dataSourceSnapshotSchemaMake(),
|
Type: schema.TypeInt,
|
||||||
},
|
Optional: true,
|
||||||
},
|
Description: "Page number",
|
||||||
}
|
},
|
||||||
|
"size": {
|
||||||
return rets
|
Type: schema.TypeInt,
|
||||||
}
|
Optional: true,
|
||||||
|
Description: "Page size",
|
||||||
func dataSourceSnapshotSchemaMake() map[string]*schema.Schema {
|
},
|
||||||
return map[string]*schema.Schema{
|
"items": {
|
||||||
"label": {
|
Type: schema.TypeList,
|
||||||
Type: schema.TypeString,
|
Computed: true,
|
||||||
Computed: true,
|
Elem: &schema.Schema{
|
||||||
Description: "text label for snapshot. Must be unique among this compute snapshots.",
|
Type: schema.TypeString,
|
||||||
},
|
},
|
||||||
"disks": {
|
},
|
||||||
Type: schema.TypeList,
|
"entry_count": {
|
||||||
Computed: true,
|
Type: schema.TypeInt,
|
||||||
Elem: &schema.Schema{
|
Computed: true,
|
||||||
Type: schema.TypeInt,
|
},
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
"guid": {
|
|
||||||
Type: schema.TypeString,
|
func DataSourceComputePCIDeviceList() *schema.Resource {
|
||||||
Computed: true,
|
return &schema.Resource{
|
||||||
Description: "guid of the snapshot",
|
SchemaVersion: 1,
|
||||||
},
|
|
||||||
"timestamp": {
|
ReadContext: dataSourceComputePCIDeviceListRead,
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
Timeouts: &schema.ResourceTimeout{
|
||||||
Description: "timestamp",
|
Read: &constants.Timeout30s,
|
||||||
},
|
Default: &constants.Timeout60s,
|
||||||
}
|
},
|
||||||
}
|
|
||||||
|
Schema: dataSourceComputePCIDeviceListSchemaMake(),
|
||||||
func DataSourceSnapshotList() *schema.Resource {
|
}
|
||||||
return &schema.Resource{
|
}
|
||||||
SchemaVersion: 1,
|
|
||||||
|
|
||||||
ReadContext: dataSourceSnapshotListRead,
|
|
||||||
|
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
|
||||||
Default: &constants.Timeout60s,
|
|
||||||
},
|
|
||||||
|
|
||||||
Schema: dataSourceSnapshotListSchemaMake(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -44,11 +44,13 @@ import (
|
|||||||
func dataSourceComputePfwListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceComputePfwListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
computePfwList, err := utilityComputePfwListCheckPresence(ctx, d, m)
|
computePfwList, err := utilityComputePfwListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
d.SetId(id.String())
|
d.SetId(id.String())
|
||||||
d.Set("items", flattenPfwList(computePfwList))
|
d.Set("items", flattenPfwList(computePfwList))
|
||||||
|
d.Set("entry_count", computePfwList.EntryCount)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +96,10 @@ func dataSourceComputePfwListSchemaMake() map[string]*schema.Schema {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"entry_count": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
func dataSourceComputeSnapshotUsageRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceComputeSnapshotUsageRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
computeSnapshotUsage, err := utilityComputeSnapshotUsageCheckPresence(ctx, d, m)
|
computeSnapshotUsage, err := utilityComputeSnapshotUsageCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import (
|
|||||||
func dataSourceComputeUserListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceComputeUserListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
computeUserList, err := utilityComputeUserListCheckPresence(ctx, d, m)
|
computeUserList, err := utilityComputeUserListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
|
|||||||
120
internal/service/cloudapi/kvmvm/data_source_compute_vgpu_list.go
Normal file
120
internal/service/cloudapi/kvmvm/data_source_compute_vgpu_list.go
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package kvmvm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
)
|
||||||
|
|
||||||
|
func dataSourceComputeVGPUListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
computeVGPUList, err := utilityComputeVGPUListCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
id := uuid.New()
|
||||||
|
d.SetId(id.String())
|
||||||
|
d.Set("items", flattenVGPU(computeVGPUList.Data))
|
||||||
|
d.Set("entry_count", computeVGPUList.EntryCount)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceComputeVGPUListSchemaMake() map[string]*schema.Schema {
|
||||||
|
return map[string]*schema.Schema{
|
||||||
|
"compute_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
|
"gpu_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Find by GPU id",
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Find by type",
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Find by status",
|
||||||
|
},
|
||||||
|
"includedeleted": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Include deleted computes. If using field 'status', then includedeleted will be ignored",
|
||||||
|
},
|
||||||
|
"page": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Page number",
|
||||||
|
},
|
||||||
|
"size": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Page size",
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"entry_count": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceComputeVGPUList() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceComputeVGPUListRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceComputeVGPUListSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user