Compare commits
222 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 67830db3eb | |||
| e42fbcef39 | |||
| 4b3f21d9be | |||
|
|
bae25296bb | ||
|
|
1b81a71504 | ||
|
|
e04dab77cb | ||
| 9e68edb2b9 | |||
| 2c70109d2d | |||
|
|
efe0c88556 | ||
| 5496073a0c | |||
| dc39a6412e | |||
|
|
de8857b1d5 | ||
| 782afe70da | |||
|
|
d6b4752cc7 | ||
| 36879efd58 | |||
|
|
040af43607 | ||
| a59ec3611b | |||
| 6eb6546722 | |||
| 8ad6811e88 | |||
| 6876b25f0e | |||
| db1760cb72 | |||
| 84b7a80e1b | |||
| 8857ed17be | |||
| 91ba361af9 | |||
| f49d9f8860 | |||
| 20050bc169 | |||
| e2ee45ee14 | |||
|
|
294680282e | ||
|
|
2bc0fbae9a | ||
|
|
2453a32d01 | ||
|
|
0602a4b693 | ||
|
|
28b60de115 | ||
|
|
b705ce4aab | ||
|
|
83ca627cea | ||
|
|
739289fbb8 | ||
|
|
c89574c3e6 | ||
|
|
a1e61674c8 | ||
|
|
cb9ff26bb0 | ||
|
|
6932f9d305 | ||
|
|
712f8edf9e | ||
|
|
805ffe1f29 | ||
|
|
bf8d3fb437 | ||
| d7a7eb9cb3 | |||
|
|
b60f32c570 | ||
| 272e385318 | |||
| f731cf246f | |||
| 6365f63fc1 | |||
| 85ce76564f | |||
| 928481d26f | |||
| 0e64974821 | |||
| 371bb0d90f | |||
| caf7213bca | |||
| 9cf150437d | |||
| 523d96189f | |||
|
|
8ca233dd32 | ||
|
|
9bad8a6947 | ||
|
|
e3e7e7bd89 | ||
|
|
b112c5ee22 | ||
|
|
f2f31b939e | ||
|
|
c781ffafaa | ||
|
|
3715db2923 | ||
|
|
f83c8e8a9a | ||
|
|
af82decadd | ||
|
|
f5e0a53364 | ||
|
|
9d1c8eeaa7 | ||
|
|
8516e0419a | ||
|
|
e12afbe1ad | ||
|
|
c0c9dc8131 | ||
|
|
c3bc6ef5da | ||
|
|
4d865ae921 | ||
|
|
a355247845 | ||
|
|
be86069155 | ||
|
|
0adf28daf6 | ||
|
|
9402d6f291 | ||
|
|
cb7e573d26 | ||
|
|
6ef0ad2f93 | ||
|
|
31be0a0b54 | ||
|
|
71ddaa3345 | ||
|
|
775a0b5adb | ||
|
|
1a983e945b | ||
|
|
b152359706 | ||
| a844f6cc30 | |||
|
|
8e6b5a9bab | ||
|
|
cd4695ee68 | ||
|
|
5bd7958f09 | ||
| 8fc9170c9c | |||
|
|
294550f5ce | ||
|
|
ddc6640a32 | ||
|
|
4bc11c5f07 | ||
|
|
2287177302 | ||
|
|
6433bc2954 | ||
|
|
965b6013a6 | ||
|
|
8d530c45ea | ||
|
|
bdcb1ab532 | ||
|
|
818875976c | ||
|
|
e9de5a2840 | ||
|
|
fae22aa484 | ||
| abd1a439eb | |||
|
|
4c4a007a58 | ||
|
|
3275424089 | ||
|
|
f06aa41b96 | ||
|
|
1245dd17f2 | ||
|
|
28ceebecf8 | ||
|
|
2b7f3d45f3 | ||
|
|
0bdd7c3c32 | ||
|
|
44ad5e4fe2 | ||
|
|
628ce3b75c | ||
|
|
020845b48f | ||
|
|
5b4c1f4324 | ||
|
|
fc32db30b6 | ||
|
|
81443a3d02 | ||
|
|
c422910bbe | ||
|
|
e45695e07f | ||
|
|
48cada2cf3 | ||
|
|
7cc359ec59 | ||
|
|
a1d716d566 | ||
|
|
aac56e22b8 | ||
|
|
e4be812c68 | ||
|
|
9a7642cf33 | ||
|
|
3613bbea28 | ||
|
|
3c2eb0407c | ||
|
|
d776a86303 | ||
|
|
b49cbe3d55 | ||
|
|
71aff5fa32 | ||
|
|
407e45cd5c | ||
|
|
40b8f93fa2 | ||
|
|
b599e244e8 | ||
|
|
42c4f2e505 | ||
|
|
d398dd3699 | ||
|
|
5db1aa5ddb | ||
|
|
4b4efec196 | ||
|
|
945e6e08b0 | ||
|
|
efe2b577b0 | ||
|
|
545eac90df | ||
|
|
4e35273d6d | ||
|
|
6f1f18fd0a | ||
|
|
5aa436cfb8 | ||
|
|
4a98b99f1c | ||
|
|
c7b54717a1 | ||
|
|
0609b158c1 | ||
|
|
8d1b13f7b7 | ||
|
|
0be6da1ae1 | ||
|
|
c73a6e0d71 | ||
|
|
95ab4e37c4 | ||
|
|
b70cdcabf6 | ||
|
|
eb22dee25b | ||
|
|
61b8765c82 | ||
|
|
96c4175e74 | ||
|
|
a685a91f86 | ||
|
|
839841aee4 | ||
|
|
9f5b4ab771 | ||
|
|
4a326e9ceb | ||
|
|
a0fbc8dd4f | ||
|
|
9912b04c2a | ||
|
|
d527d9b474 | ||
|
|
5e515daafa | ||
|
|
fa748f6e5d | ||
|
|
c5e35b19f9 | ||
|
|
b5a9987b74 | ||
|
|
103038c0a3 | ||
|
|
f5a606153f | ||
|
|
9a806a8e2c | ||
|
|
56e71c8981 | ||
|
|
424cdcd2b3 | ||
|
|
165bd89fbf | ||
|
|
7fb4223f85 | ||
|
|
8112f328a2 | ||
|
|
5e867706c0 | ||
|
|
2e355d2ede | ||
|
|
b849521780 | ||
|
|
2797a10fcb | ||
|
|
d35fa26eb8 | ||
|
|
83dad0d6b3 | ||
|
|
ffbcce9897 | ||
|
|
efe79ee85a | ||
|
|
42c91e1549 | ||
|
|
6bc61fb856 | ||
|
|
dbf61d4da1 | ||
|
|
c5953387ae | ||
|
|
bc6789f755 | ||
|
|
0aee28ed2e | ||
|
|
98c4dfe0af | ||
|
|
0fd620eeff | ||
|
|
2f2fa2a544 | ||
|
|
9af980964a | ||
|
|
c110239225 | ||
|
|
413fb4b82b | ||
|
|
b2e1004dbe | ||
|
|
594c876364 | ||
|
|
8a716edac3 | ||
|
|
cda317f4db | ||
|
|
299d606df0 | ||
|
|
3cd8c2e618 | ||
|
|
efea1af92a | ||
|
|
77d8d2e921 | ||
|
|
f1ec6d776a | ||
|
|
ff64840b13 | ||
|
|
13e6849328 | ||
|
|
964e85c34a | ||
|
|
92d96b13c6 | ||
|
|
94f222fe19 | ||
|
|
a3da44f2ad | ||
|
|
ef7fa62e79 | ||
|
|
4bb75fe0d7 | ||
|
|
8cf4680ce1 | ||
|
|
bf1afc66dd | ||
|
|
d9c10c0d9c | ||
|
|
f28588fea5 | ||
|
|
3e72f72d15 | ||
|
|
bf179b9d12 | ||
|
|
9379289e58 | ||
|
|
edf7728cb5 | ||
|
|
95cd7cb820 | ||
|
|
06c0578fa6 | ||
|
|
1bf17c23c8 | ||
|
|
668d57cd3b | ||
|
|
fef6040cc6 | ||
|
|
d0165918c3 | ||
|
|
dfeb9a9165 | ||
|
|
e0dcd053c5 | ||
|
|
ab070b73cb | ||
|
|
80a4b70db8 |
37
.github/workflows/release.yml
vendored
Normal file
37
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Fetch all tags
|
||||
run: git fetch --force --tags
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18
|
||||
|
||||
- name: Import GPG key
|
||||
id: import_gpg
|
||||
uses: crazy-max/ghaction-import-gpg@v4
|
||||
with:
|
||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.PASSPHRASE }}
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v3
|
||||
with:
|
||||
args: release --rm-dist --release-notes CHANGELOG.md
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,2 +1,8 @@
|
||||
decort/vendor/
|
||||
examples/
|
||||
url_scrapping/
|
||||
terraform-provider-decort*
|
||||
.vscode/
|
||||
.DS_Store
|
||||
vendor/
|
||||
.idea/
|
||||
35
.golangci.yml
Normal file
35
.golangci.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
linters:
|
||||
enable:
|
||||
- bodyclose
|
||||
- decorder
|
||||
- dogsled
|
||||
- errorlint
|
||||
- exportloopref
|
||||
#- gocognit - disabled till better times
|
||||
- goconst
|
||||
- gocyclo
|
||||
- gosec
|
||||
- ifshort
|
||||
- makezero
|
||||
#- nestif - disabled till better times
|
||||
- nilerr
|
||||
- prealloc
|
||||
- unconvert
|
||||
- unparam
|
||||
|
||||
linters-settings:
|
||||
errcheck:
|
||||
exclude-functions:
|
||||
- (*github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.ResourceData).Set
|
||||
staticcheck:
|
||||
go: "1.18"
|
||||
checks:
|
||||
- all
|
||||
- -SA1019
|
||||
nestif:
|
||||
min-complexity: 7
|
||||
gocyclo:
|
||||
min-complexity: 40
|
||||
|
||||
issues:
|
||||
max-same-issues: 0
|
||||
@@ -1,15 +1,10 @@
|
||||
# Visit https://goreleaser.com for documentation on how to customize this
|
||||
# behavior.
|
||||
before:
|
||||
hooks:
|
||||
# this is just an example and not a requirement for provider building/publishing
|
||||
- go mod tidy
|
||||
builds:
|
||||
- env:
|
||||
# goreleaser does not work with CGO, it could also complicate
|
||||
# usage by users in CI/CD systems like Terraform Cloud where
|
||||
# they are unable to install libraries.
|
||||
- CGO_ENABLED=0
|
||||
main: ./cmd/decort
|
||||
mod_timestamp: '{{ .CommitTimestamp }}'
|
||||
flags:
|
||||
- -trimpath
|
||||
@@ -21,9 +16,12 @@ builds:
|
||||
goarch:
|
||||
- amd64
|
||||
- '386'
|
||||
- arm64
|
||||
ignore:
|
||||
- goos: darwin
|
||||
goarch: '386'
|
||||
- goos: windows
|
||||
goarch: arm64
|
||||
binary: '{{ .ProjectName }}_v{{ .Version }}'
|
||||
archives:
|
||||
- format: zip
|
||||
@@ -37,11 +35,9 @@ checksum:
|
||||
signs:
|
||||
- artifacts: checksum
|
||||
args:
|
||||
# if you are using this in a GitHub action or some other automated pipeline, you
|
||||
# need to pass the batch flag to indicate its not interactive.
|
||||
- "--batch"
|
||||
- "--local-user"
|
||||
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
|
||||
- "{{ .Env.GPG_FINGERPRINT }}"
|
||||
- "--output"
|
||||
- "${signature}"
|
||||
- "--detach-sign"
|
||||
@@ -50,7 +46,5 @@ release:
|
||||
extra_files:
|
||||
- glob: 'terraform-registry-manifest.json'
|
||||
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
|
||||
# If you want to manually examine the release before its live, uncomment this line:
|
||||
# draft: true
|
||||
changelog:
|
||||
skip: true
|
||||
skip: false
|
||||
|
||||
30
CHANGELOG.md
Normal file
30
CHANGELOG.md
Normal file
@@ -0,0 +1,30 @@
|
||||
## Version 4.10.2
|
||||
|
||||
### Добавлено
|
||||
|
||||
#### storage policy
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-1090 | Отображение вычисляемых полей `sep_name` в блоке `access_seps_pools` datasource `decort_storage_policy_list` в cloudapi/stpolicy и в datasource `decort_cb_storage_policy_list` в cloudbroker/stpolicy |
|
||||
|
||||
### Исправлено
|
||||
|
||||
#### account
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-1061 | Исправлен sample resource `decort_cb_account` в cloudbroker/account |
|
||||
| BATF-1061 | Вывод значения поле `storage_policy_ids` в data_sourse`decort_cb_account` в cloudbroker/account |
|
||||
|
||||
#### kvmvm
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-1079 | Отображение поля `disks` в resource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm` в cloudbroker/kvmvm при импорте |
|
||||
| BATF-1083 | Отображение поля `boot_disk` в resource `decort_kvmvm` в cloudapi/kvmvm при обновлении поля `image_id` |
|
||||
| BATF-1088 | Исправлена логика работы поля `pin_to_stack` в resources `decort_kvmvm` в cloudapi/kvmvm и `decort_cb_kvmvm` в cloudbroker/kvmvm |
|
||||
| BATF-1092 | Отображение вычисляемых полей `devicename`,`created_by`, `deleted_by`, `updated_time` в блоке `disks` и блока `loader_meta_iso` в resource `decort_kvmvm`, datasource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm`, datasource `decort_cb_kvmvm` в cloudbroker/kvmvm |
|
||||
| BATF-1144 | Остановка виртуальной машины перед удалением в resources `decort_kvmvm` и `decort_cb_kvmvm` в cloudapi/kvmvm и в cloudbroker/kvmvm |
|
||||
|
||||
#### rg
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BATF-1062 | Отображение datasourses `decort_rg_list_deleted` в cloudapi/rg и `decort_cb_rg_list_deleted` в cloudbroker/rg |
|
||||
2
LICENSE
2
LICENSE
@@ -186,7 +186,7 @@
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
Copyright 2022 Basis LTD
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
85
Makefile
Normal file
85
Makefile
Normal file
@@ -0,0 +1,85 @@
|
||||
TEST?=$$(go list ./... | grep -v 'vendor')
|
||||
HOSTNAME=basis
|
||||
NAMESPACE=decort
|
||||
NAME=terraform-provider-decort
|
||||
BINDIR = ./bin
|
||||
ZIPDIR = ./zip
|
||||
BINARY=${NAME}
|
||||
WORKPATH= ./examples/terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAMESPACE}/${VERSION}/${OS_ARCH}
|
||||
MAINPATH = ./cmd/decort/
|
||||
VERSION=4.10.2
|
||||
OS_ARCH=$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)
|
||||
|
||||
FILES = ${BINARY}_${VERSION}_darwin_amd64\
|
||||
${BINARY}_${VERSION}_darwin_arm64\
|
||||
${BINARY}_${VERSION}_freebsd_386\
|
||||
${BINARY}_${VERSION}_freebsd_amd64\
|
||||
${BINARY}_${VERSION}_freebsd_arm\
|
||||
${BINARY}_${VERSION}_linux_386\
|
||||
${BINARY}_${VERSION}_linux_amd64\
|
||||
${BINARY}_${VERSION}_linux_arm\
|
||||
${BINARY}_${VERSION}_linux_arm64\
|
||||
${BINARY}_${VERSION}_openbsd_386\
|
||||
${BINARY}_${VERSION}_openbsd_amd64\
|
||||
${BINARY}_${VERSION}_solaris_amd64\
|
||||
${BINARY}_${VERSION}_windows_386.exe\
|
||||
${BINARY}_${VERSION}_windows_amd64.exe\
|
||||
|
||||
BINS = $(addprefix bin/, $(FILES))
|
||||
|
||||
default: install
|
||||
|
||||
image:
|
||||
GOOS=linux GOARCH=amd64 go build -o terraform-provider-decort ./cmd/decort/
|
||||
docker build . -t rudecs/tf:3.2.2
|
||||
rm terraform-provider-decort
|
||||
|
||||
lint:
|
||||
golangci-lint run --timeout 600s
|
||||
|
||||
st:
|
||||
go build -o ${BINARY} ${MAINPATH}
|
||||
cp ${BINARY} ${WORKPATH}
|
||||
rm ${BINARY}
|
||||
|
||||
build:
|
||||
go build -o ${BINARY} ${MAINPATH}
|
||||
|
||||
release: $(FILES)
|
||||
|
||||
$(FILES) : $(BINDIR) $(ZIPDIR) $(BINS)
|
||||
zip -r $(ZIPDIR)/$@.zip $(BINDIR)/$@
|
||||
zip -rj $(ZIPDIR)/$@.zip scripts/install.bat scripts/install.sh
|
||||
|
||||
$(BINDIR):
|
||||
mkdir $@
|
||||
|
||||
$(ZIPDIR):
|
||||
mkdir $@
|
||||
|
||||
$(BINS):
|
||||
GOOS=darwin GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_darwin_amd64 $(MAINPATH)
|
||||
GOOS=darwin GOARCH=arm64 go build -o ./bin/${BINARY}_${VERSION}_darwin_arm64 $(MAINPATH)
|
||||
GOOS=freebsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_freebsd_386 $(MAINPATH)
|
||||
GOOS=freebsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_freebsd_amd64 $(MAINPATH)
|
||||
GOOS=freebsd GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_freebsd_arm $(MAINPATH)
|
||||
GOOS=linux GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_linux_386 $(MAINPATH)
|
||||
GOOS=linux GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_linux_amd64 $(MAINPATH)
|
||||
GOOS=linux GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_linux_arm $(MAINPATH)
|
||||
GOOS=linux GOARCH=arm64 go build -o ./bin/${BINARY}_${VERSION}_linux_arm64 ${MAINPATH}
|
||||
GOOS=openbsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_openbsd_386 $(MAINPATH)
|
||||
GOOS=openbsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_openbsd_amd64 $(MAINPATH)
|
||||
GOOS=solaris GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_solaris_amd64 $(MAINPATH)
|
||||
GOOS=windows GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_windows_386.exe $(MAINPATH)
|
||||
GOOS=windows GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_windows_amd64.exe $(MAINPATH)
|
||||
|
||||
install: build
|
||||
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAMESPACE}/${VERSION}/${OS_ARCH}
|
||||
mv ${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAMESPACE}/${VERSION}/${OS_ARCH}
|
||||
|
||||
test:
|
||||
go test -i $(TEST) || exit 1
|
||||
echo $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
|
||||
|
||||
testacc:
|
||||
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m
|
||||
257
README.md
257
README.md
@@ -1,55 +1,242 @@
|
||||
# terraform-provider-decort
|
||||
Terraform provider for Digital Energy Cloud Orchestration Technology (DECORT) platform
|
||||
|
||||
NOTE: provider rc-1.25 is designed for DECORT API 3.7.x. For older API versions please use:
|
||||
- DECORT API 3.6.x versions - provider version rc-1.10
|
||||
- DECORT API versions prior to 3.6.0 - Terraform DECS provider (https://github.com/rudecs/terraform-provider-decs)
|
||||
Terraform provider для платформы Digital Energy Cloud Orchestration Technology (DECORT)
|
||||
|
||||
With this provider you can manage Compute instances, disks, virtual network segments and resource
|
||||
groups in DECORT platform, as well as query the platform for information about existing resources.
|
||||
This provider supports Import operations on pre-existing resources.
|
||||
## Соответсвие версий платформы версиям провайдера
|
||||
|
||||
See user guide at https://github.com/rudecs/terraform-provider-decort/wiki
|
||||
| Версия DECORT API | Версия провайдера Terraform |
|
||||
| ------ | ------ |
|
||||
| 4.4.0 | 4.10.x |
|
||||
| 4.3.0 | 4.9.x |
|
||||
| 4.2.0 | 4.8.x |
|
||||
| 4.1.0 | 4.7.x |
|
||||
| 4.0.0 | 4.6.x |
|
||||
| 3.8.9 | 4.5.x |
|
||||
| 3.8.8 | 4.4.x |
|
||||
| 3.8.7 | 4.3.x |
|
||||
| 3.8.6 | 4.0.x, 4.1.x, 4.2.x |
|
||||
| 3.8.5 | 3.4.x |
|
||||
| 3.8.0 - 3.8.4 | 3.3.1 |
|
||||
| 3.7.x | rc-1.25 |
|
||||
| 3.6.x | rc-1.10 |
|
||||
| до 3.6.0 | [terraform-provider-decs](https://github.com/rudecs/terraform-provider-decs) |
|
||||
|
||||
For a quick start follow these steps (assuming that your build host is running Linux; this provider builds on Windows as well, however, some paths may differ from what is mentioned below).
|
||||
## Режимы работы
|
||||
|
||||
1. Obtain the latest GO compiler. As of beginning 2021 it is recommended to use v.1.16.3 but as new Terraform versions are released newer Go compiler may be required, so check official Terraform repository regularly for more information.
|
||||
Провайдер позволяет работать в трех режимах:
|
||||
|
||||
- Режим пользователя,
|
||||
- Режим администратора. <br>
|
||||
Используйте ресурсы `decort_cb_` для администрирования. <br>
|
||||
- Режим SDN. <br>
|
||||
Используйте ресурсы `decort_sdn_` для работы с группой sdn. <br>
|
||||
Вики проекта: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
|
||||
## Возможности провайдера
|
||||
|
||||
- Режим пользователя:
|
||||
- Работа с accounts,
|
||||
- Работа с audit,
|
||||
- Работа с bservice,
|
||||
- Работа с disks,
|
||||
- Работа с dpdk,
|
||||
- Работа с extnets,
|
||||
- Работа с flipgroups,
|
||||
- Работа с image,
|
||||
- Работа с k8s,
|
||||
- Работа с Compute instances,
|
||||
- Работа с load balancer,
|
||||
- Работа с locations,
|
||||
- Работа с pfw,
|
||||
- Работа с resource groups,
|
||||
- Работа с security groups,
|
||||
- Работа с snapshots,
|
||||
- Работа с stacks,
|
||||
- Работа с trunk,
|
||||
- Работа с VINS,
|
||||
- Работа с SEPs,
|
||||
- Работа с Zone.
|
||||
|
||||
- Режим администратора:
|
||||
- Работа с accounts,
|
||||
- Работа с audit,
|
||||
- Работа с disks,
|
||||
- Работа с dpdk,
|
||||
- Работа с extnets,
|
||||
- Работа с flipgroups,
|
||||
- Работа с grids,
|
||||
- Работа с images,
|
||||
- Работа с k8ci,
|
||||
- Работа с k8s,
|
||||
- Работа с Compute instances,
|
||||
- Работа с load balancer,
|
||||
- Работа с pci device,
|
||||
- Работа с resource groups,
|
||||
- Работа с seps,
|
||||
- Работа с user,
|
||||
- Работа с security groups,
|
||||
- Работа с stacks,
|
||||
- Работа с trunk,
|
||||
- Работа с VINS,
|
||||
- Работа с Zone.
|
||||
|
||||
- Режим SDN:
|
||||
- Работа с access groups,
|
||||
- Работа с default security policies,
|
||||
- Работа с segments
|
||||
|
||||
Со списком и описанием функционала всех групп можно ознамоиться на Вики проекта: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
|
||||
## Установка
|
||||
Начиная с версии провайдера `4.3.0` в релизном архиве находятся скрипты-инсталляторы.
|
||||
Чтобы выполнить установку, необходимо:
|
||||
1. Перейти по адресу: https://repository.basistech.ru/BASIS/terraform-provider-decort/releases
|
||||
2. Выбрать необходимую версию провайдера подходящую под операционную систему.
|
||||
3. Скачать архив.
|
||||
4. Распаковать архив.
|
||||
5. Выполнить скрипт установщика, `install.sh` или `install.bat` для Windows.<br/>
|
||||
*Для запуска `install.sh` не забудьте изменить права доступа к файлу*
|
||||
```bash
|
||||
chmod u+x install.sh
|
||||
```
|
||||
cd /tmp
|
||||
wget https://golang.org/dl/go1.16.3.linux-amd64.tar.gz
|
||||
tar xvf ./go1.16.3.linux-amd64.tar.gz
|
||||
sudo mv go /usr/local
|
||||
6. Дождаться сообщения об успешной установке. Установщик выведет актуальный блок конфигурации провайдера, скопируйте его
|
||||
```bash
|
||||
DECORT provider version 4.10.0 has been successfully installed
|
||||
|
||||
Copy this provider configuration to main.tf file:
|
||||
terraform {
|
||||
required_providers {
|
||||
decort = {
|
||||
version = "4.10.0"
|
||||
source = "basis/decort/decort"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
7. После этого, создайте файл `main.tf` в рабочей директории, которая может находится в любом удобном для пользователя месте.
|
||||
В данном примере, рабочая директория с файлом main.tf находится по пути:
|
||||
```bash
|
||||
~/work/tfdir/main.tf
|
||||
```
|
||||
8. Вставьте в `main.tf` блок конфигурации провайдера, который был выведен на экран установщиком:
|
||||
```terraform
|
||||
terraform {
|
||||
required_providers {
|
||||
decort = {
|
||||
version = "4.10.0"
|
||||
source = "basis/decort/decort"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
9. Добавьте в файл блок с инициализацией провайдера.
|
||||
```terraform
|
||||
provider "decort" {
|
||||
authenticator = "decs3o"
|
||||
controller_url = "https://mr4.digitalenergy.online"
|
||||
oauth2_url = "https://sso.digitalenergy.online"
|
||||
allow_unverified_ssl = true
|
||||
}
|
||||
```
|
||||
|
||||
2. Add the following environment variables' declarations to shell startup script:
|
||||
```
|
||||
export GOPATH=/opt/gopkg:~/
|
||||
export GOROOT=/usr/local/go
|
||||
export PATH=$PATH:$GOROOT/bin
|
||||
10. В консоли выполните команду
|
||||
```bash
|
||||
terraform init
|
||||
```
|
||||
|
||||
3. Clone Terraform Plugin SDK framework repository to $GOPKG/src/github.com/hashicorp
|
||||
11. В случае успешной установки, Terraform инициализирует провайдер и будет готов к дальнейшей работе.
|
||||
|
||||
## Установка из релизов
|
||||
Terraform провайдер DECORT имеет скомпилированные релизные версии, которые расположены по адресу: [Релизы](https://repository.basistech.ru/BASIS/terraform-provider-decort/releases).
|
||||
Чтобы выполнить установку из релиза, необходимо:
|
||||
1. Перейти по адресу: https://repository.basistech.ru/BASIS/terraform-provider-decort/releases
|
||||
2. Выбрать необходимую версию провайдера подходящую под операционную систему.
|
||||
3. Скачать архив.
|
||||
4. Распаковать архив.
|
||||
5. Полученный файл (в директории `bin/`) необходимо поместить:
|
||||
Linux:
|
||||
```bash
|
||||
~/.terraform.d/plugins/${host_name}/${namespace}/${type}/${version}/${target}
|
||||
```
|
||||
mkdir -p $GOPKG/src/github.com/hashicorp
|
||||
cd $GOPKG/src/github.com/hashicorp
|
||||
git clone https://github.com/hashicorp/terraform-plugin-sdk.git
|
||||
Windows:
|
||||
```powershell
|
||||
%APPDATA%\terraform.d\plugins\${host_name}\${namespace}\${type}\${version}\${target}
|
||||
```
|
||||
Где:
|
||||
- host_name - имя хоста, держателя провайдера, например, basis
|
||||
- namespace - пространство имен хоста, например decort
|
||||
- type - тип провайдера, может совпадать с пространством имен, например, decort
|
||||
- version - версия провайдера, например 4.10.0
|
||||
- target - архитектура операционной системы, например windows_amd64
|
||||
|
||||
В примере ниже используется путь до провайдера на машине с ОС Linux:
|
||||
|
||||
```bash
|
||||
~/.terraform.d/plugins/basis/decort/decort/4.10.0/linux_amd64/tf-provider
|
||||
^ ^ ^ ^ ^ ^
|
||||
host_name | | | | | |
|
||||
| | | | |
|
||||
namespace | | | | |
|
||||
| | | |
|
||||
type | | | |
|
||||
| | |
|
||||
version | | |
|
||||
| |
|
||||
target | |
|
||||
|
|
||||
исполняемый файл |
|
||||
```
|
||||
|
||||
4. Clone jwt-go package repository to $GOPKG/src/github.com/dgrijalva/jwt-go:
|
||||
6. После этого, создайте файл `main.tf` в рабочей директории, которая может находится в любом удобном для пользователя месте.
|
||||
В данном примере, рабочая директория с файлом main.tf находится по пути:
|
||||
```bash
|
||||
~/work/tfdir/main.tf
|
||||
```
|
||||
mkdir -p $GOPKG/src/github.com/dgrijalva
|
||||
cd $GOPKG/src/github.com/dgrijalva
|
||||
git clone https://github.com/dgrijalva/jwt-go.git
|
||||
7. Добавьте в `main.tf` следующий блок
|
||||
```terraform
|
||||
terraform {
|
||||
required_providers {
|
||||
decort = {
|
||||
version = "4.10.0"
|
||||
source = "basis/decort/decort"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
В поле `version` указывается версия провайдера.
|
||||
<br/>
|
||||
**ВНИМАНИЕ: Версии в блоке и в пути к исполняемому файлу провайдера должны совпадать!**
|
||||
|
||||
В поле `source` помещается путь до репозитория с версией вида:
|
||||
|
||||
```bash
|
||||
${host_name}/${namespace}/${type}
|
||||
```
|
||||
|
||||
5. Clone Terraform DECORT provider repository to $GOPKG/src/github.com/terraform-provider-decort
|
||||
```
|
||||
cd $GOPKG/src/github.com
|
||||
git clone https://github.com/rudecs/terraform-provider-decort.git
|
||||
**ВНИМАНИЕ: Версии в блоке и в пути к исполняемому файлу провайдера должны совпадать!**
|
||||
|
||||
8. Добавьте в файл блок с инициализацией провайдера.
|
||||
```terraform
|
||||
provider "decort" {
|
||||
authenticator = "decs3o"
|
||||
controller_url = "https://mr4.digitalenergy.online"
|
||||
oauth2_url = "https://sso.digitalenergy.online"
|
||||
allow_unverified_ssl = true
|
||||
}
|
||||
```
|
||||
|
||||
6. Build Terraform DECORT provider:
|
||||
9. В консоли выполните команду
|
||||
```bash
|
||||
terraform init
|
||||
```
|
||||
cd $GOPKG/src/github.com/terraform-provider-decort
|
||||
go build -o terraform-provider-decort
|
||||
```
|
||||
|
||||
10. В случае успешной установки, Terraform инициализирует провайдер и будет готов к дальнейшей работе.
|
||||
|
||||
## Примеры работы
|
||||
|
||||
Примеры работы можно найти:
|
||||
|
||||
- На вики проекта: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
- В папке `samples`
|
||||
|
||||
Хорошей работы!
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
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>
|
||||
Tim Tkachev, <tvtkachev@basistech.ru>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -19,12 +23,12 @@ limitations under the License.
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://github.com/rudecs/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.
|
||||
|
||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package main
|
||||
@@ -32,10 +36,10 @@ package main
|
||||
import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/plugin"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/terraform"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
|
||||
|
||||
"github.com/rudecs/terraform-provider-decort/decort"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/provider"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
|
||||
@@ -45,8 +49,8 @@ func main() {
|
||||
log.Debug("Debug logging enabled")
|
||||
|
||||
plugin.Serve(&plugin.ServeOpts{
|
||||
ProviderFunc: func() terraform.ResourceProvider {
|
||||
return decort.Provider()
|
||||
ProviderFunc: func() *schema.Provider {
|
||||
return provider.Provider()
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
// LimitMaxVinsPerResgroup set maximum number of VINs instances per Resource Group
|
||||
const LimitMaxVinsPerResgroup=4
|
||||
|
||||
// MaxSshKeysPerCompute sets maximum number of user:ssh_key pairs to authorize when creating new compute
|
||||
const MaxSshKeysPerCompute=12
|
||||
|
||||
// MaxExtraDisksPerCompute sets maximum number of extra disks that can be added when creating new compute
|
||||
const MaxExtraDisksPerCompute=12
|
||||
|
||||
// MaxNetworksPerCompute sets maximum number of vNICs per compute
|
||||
const MaxNetworksPerCompute=8
|
||||
|
||||
// MaxCpusPerCompute sets maximum number of vCPUs per compute
|
||||
const MaxCpusPerCompute=128
|
||||
|
||||
// MinRamPerCompute sets minimum amount of RAM per compute in MB
|
||||
const MinRamPerCompute=128
|
||||
@@ -1,406 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
// "time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/terraform"
|
||||
)
|
||||
|
||||
// enumerated constants that define authentication modes
|
||||
const (
|
||||
MODE_UNDEF = iota // this is the invalid mode - it should never be seen
|
||||
MODE_LEGACY = iota
|
||||
MODE_OAUTH2 = iota
|
||||
MODE_JWT = iota
|
||||
)
|
||||
|
||||
type ControllerCfg struct {
|
||||
controller_url string // always required
|
||||
auth_mode_code int // always required
|
||||
auth_mode_txt string // always required, it is a text representation of auth mode
|
||||
legacy_user 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
|
||||
jwt string // obtained from Outh2 provider on successful login in oauth2 mode, required in jwt mode
|
||||
app_id string // required for oauth2 mode
|
||||
app_secret string // required for oauth2 mode
|
||||
oauth2_url string // always required
|
||||
decort_username string // assigned to either legacy_user (legacy mode) or Oauth2 user (oauth2 mode) upon successful verification
|
||||
cc_client *http.Client // assigned when all initial checks successfully passed
|
||||
}
|
||||
|
||||
func ControllerConfigure(d *schema.ResourceData) (*ControllerCfg, error) {
|
||||
// This function first will check that all required provider parameters for the
|
||||
// selected authenticator mode are set correctly and initialize ControllerCfg structure
|
||||
// based on the provided parameters.
|
||||
//
|
||||
// Next, it will check for validity of supplied credentials by initiating connection to the specified
|
||||
// DECORT controller URL and, if succeeded, completes ControllerCfg structure with the rest of computed
|
||||
// parameters (e.g. JWT, session ID and Oauth2 user name).
|
||||
//
|
||||
// The structure created by this function should be used with subsequent calls to decortAPICall() method,
|
||||
// which is a DECORT authentication mode aware wrapper around standard HTTP requests.
|
||||
|
||||
ret_config := &ControllerCfg{
|
||||
controller_url: d.Get("controller_url").(string),
|
||||
auth_mode_code: MODE_UNDEF,
|
||||
legacy_user: d.Get("user").(string),
|
||||
legacy_password: d.Get("password").(string),
|
||||
legacy_sid: "",
|
||||
jwt: d.Get("jwt").(string),
|
||||
app_id: d.Get("app_id").(string),
|
||||
app_secret: d.Get("app_secret").(string),
|
||||
oauth2_url: d.Get("oauth2_url").(string),
|
||||
decort_username: "",
|
||||
}
|
||||
|
||||
var allow_unverified_ssl bool
|
||||
allow_unverified_ssl = d.Get("allow_unverified_ssl").(bool)
|
||||
|
||||
if ret_config.controller_url == "" {
|
||||
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
|
||||
ret_config.auth_mode_txt = strings.ToLower(d.Get("authenticator").(string))
|
||||
|
||||
switch ret_config.auth_mode_txt {
|
||||
case "jwt":
|
||||
if ret_config.jwt == "" {
|
||||
return nil, fmt.Errorf("Authenticator mode 'jwt' specified but no JWT provided.")
|
||||
}
|
||||
ret_config.auth_mode_code = MODE_JWT
|
||||
case "oauth2":
|
||||
if ret_config.oauth2_url == "" {
|
||||
return nil, fmt.Errorf("Authenticator mode 'oauth2' specified but no OAuth2 URL provided.")
|
||||
}
|
||||
if ret_config.app_id == "" {
|
||||
return nil, fmt.Errorf("Authenticator mode 'oauth2' specified but no Application ID provided.")
|
||||
}
|
||||
if ret_config.app_secret == "" {
|
||||
return nil, fmt.Errorf("Authenticator mode 'oauth2' specified but no Secret ID provided.")
|
||||
}
|
||||
ret_config.auth_mode_code = MODE_OAUTH2
|
||||
case "legacy":
|
||||
//
|
||||
ret_config.legacy_user = d.Get("user").(string)
|
||||
if ret_config.legacy_user == "" {
|
||||
return nil, fmt.Errorf("Authenticator mode 'legacy' specified but no user provided.")
|
||||
}
|
||||
ret_config.legacy_password = d.Get("password").(string)
|
||||
if ret_config.legacy_password == "" {
|
||||
return nil, fmt.Errorf("Authenticator mode 'legacy' specified but no password provided.")
|
||||
}
|
||||
ret_config.auth_mode_code = MODE_LEGACY
|
||||
default:
|
||||
return nil, fmt.Errorf("Unknown authenticator mode %q provided.", ret_config.auth_mode_txt)
|
||||
}
|
||||
|
||||
if allow_unverified_ssl {
|
||||
log.Warn("ControllerConfigure: allow_unverified_ssl is set - will not check certificates!")
|
||||
transCfg := &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}
|
||||
ret_config.cc_client = &http.Client{
|
||||
Transport: transCfg,
|
||||
Timeout: Timeout180s,
|
||||
}
|
||||
} else {
|
||||
ret_config.cc_client = &http.Client{
|
||||
Timeout: Timeout180s, // time.Second * 30,
|
||||
}
|
||||
}
|
||||
|
||||
switch ret_config.auth_mode_code {
|
||||
case MODE_LEGACY:
|
||||
ok, err := ret_config.validateLegacyUser()
|
||||
if !ok {
|
||||
return nil, err
|
||||
}
|
||||
ret_config.decort_username = ret_config.legacy_user
|
||||
case MODE_JWT:
|
||||
//
|
||||
ok, err := ret_config.validateJWT("")
|
||||
if !ok {
|
||||
return nil, err
|
||||
}
|
||||
case MODE_OAUTH2:
|
||||
// on success getOAuth2JWT will set config.jwt to the obtained JWT, so there is no
|
||||
// need to set it once again here
|
||||
_, err := ret_config.getOAuth2JWT()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 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")
|
||||
// and JWT issuer name (claim "iss")
|
||||
parser := jwt.Parser{}
|
||||
token, _, err := parser.ParseUnverified(ret_config.jwt, jwt.MapClaims{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if claims, ok := token.Claims.(jwt.MapClaims); ok {
|
||||
var tbuf bytes.Buffer
|
||||
tbuf.WriteString(claims["username"].(string))
|
||||
tbuf.WriteString("@")
|
||||
tbuf.WriteString(claims["iss"].(string))
|
||||
ret_config.decort_username = tbuf.String()
|
||||
} else {
|
||||
return nil, fmt.Errorf("Failed to extract user and iss fields from JWT token in oauth2 mode.")
|
||||
}
|
||||
default:
|
||||
// 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)
|
||||
}
|
||||
|
||||
// All checks passed successfully, credentials corresponding to the selected authenticator mode
|
||||
// obtained and validated.
|
||||
return ret_config, nil
|
||||
}
|
||||
|
||||
func (config *ControllerCfg) getDecortUsername() string {
|
||||
return config.decort_username
|
||||
}
|
||||
|
||||
func (config *ControllerCfg) getOAuth2JWT() (string, error) {
|
||||
// Obtain JWT from the Oauth2 provider using application ID and application secret provided in config.
|
||||
if config.auth_mode_code == MODE_UNDEF {
|
||||
return "", fmt.Errorf("getOAuth2JWT method called for undefined authorization mode.")
|
||||
}
|
||||
if config.auth_mode_code != MODE_OAUTH2 {
|
||||
return "", fmt.Errorf("getOAuth2JWT method called for incompatible authorization mode %q.", config.auth_mode_txt)
|
||||
}
|
||||
|
||||
params := url.Values{}
|
||||
params.Add("grant_type", "client_credentials")
|
||||
params.Add("client_id", config.app_id)
|
||||
params.Add("client_secret", config.app_secret)
|
||||
params.Add("response_type", "id_token")
|
||||
params.Add("validity", "3600")
|
||||
params_str := params.Encode()
|
||||
|
||||
req, err := http.NewRequest("POST", config.oauth2_url+"/v1/oauth/access_token", strings.NewReader(params_str))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
req.Header.Set("Content-Length", strconv.Itoa(len(params_str)))
|
||||
|
||||
resp, err := config.cc_client.Do(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
// fmt.Println("response Status:", resp.Status)
|
||||
// fmt.Println("response Headers:", resp.Header)
|
||||
// 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",
|
||||
resp.StatusCode, req.URL, config.app_id, params_str)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
responseData, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// validation successful - store JWT in the corresponding field of the ControllerCfg structure
|
||||
config.jwt = strings.TrimSpace(string(responseData))
|
||||
|
||||
return config.jwt, nil
|
||||
}
|
||||
|
||||
func (config *ControllerCfg) validateJWT(jwt string) (bool, error) {
|
||||
/*
|
||||
Validate JWT against DECORT controller. JWT can be supplied as argument to this method. If empty string supplied as
|
||||
argument, JWT will be taken from config attribute.
|
||||
DECORT controller URL will always be taken from the config attribute assigned at instantiation.
|
||||
Validation is accomplished by attempting API call that lists accounts for the invoking user.
|
||||
*/
|
||||
if jwt == "" {
|
||||
if config.jwt == "" {
|
||||
return false, fmt.Errorf("validateJWT method called, but no meaningful JWT provided.")
|
||||
}
|
||||
jwt = config.jwt
|
||||
}
|
||||
|
||||
if config.oauth2_url == "" {
|
||||
return false, fmt.Errorf("validateJWT method called, but no OAuth2 URL provided.")
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("POST", config.controller_url+"/restmachine/cloudapi/accounts/list", nil)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
req.Header.Set("Authorization", fmt.Sprintf("bearer %s", jwt))
|
||||
// req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
// req.Header.Set("Content-Length", strconv.Itoa(0))
|
||||
|
||||
resp, err := config.cc_client.Do(req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return false, fmt.Errorf("validateJWT: unexpected status code %d when validating JWT against %q.",
|
||||
resp.StatusCode, req.URL)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (config *ControllerCfg) validateLegacyUser() (bool, error) {
|
||||
/*
|
||||
Validate legacy user by obtaining a session key, which will be used for authenticating subsequent API calls
|
||||
to DECORT controller.
|
||||
If successful, the session key is stored in config.legacy_sid and true is returned. If unsuccessful for any
|
||||
reason, the method will return false and error.
|
||||
*/
|
||||
if config.auth_mode_code == MODE_UNDEF {
|
||||
return false, fmt.Errorf("validateLegacyUser method called for undefined authorization mode.")
|
||||
}
|
||||
if config.auth_mode_code != MODE_LEGACY {
|
||||
return false, fmt.Errorf("validateLegacyUser method called for incompatible authorization mode %q.", config.auth_mode_txt)
|
||||
}
|
||||
|
||||
params := url.Values{}
|
||||
params.Add("username", config.legacy_user)
|
||||
params.Add("password", config.legacy_password)
|
||||
params_str := params.Encode()
|
||||
|
||||
req, err := http.NewRequest("POST", config.controller_url+"/restmachine/cloudapi/users/authenticate", strings.NewReader(params_str))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
req.Header.Set("Content-Length", strconv.Itoa(len(params_str)))
|
||||
|
||||
resp, err := config.cc_client.Do(req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return false, fmt.Errorf("validateLegacyUser: unexpected status code %d when validating legacy user %q against %q.",
|
||||
resp.StatusCode, config.legacy_user, config.controller_url)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
responseData, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// validation successful - keep session ID for future use
|
||||
config.legacy_sid = string(responseData)
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (config *ControllerCfg) decortAPICall(method string, api_name string, url_values *url.Values) (json_resp string, err error) {
|
||||
// This is a convenience wrapper around standard HTTP request methods that is aware of the
|
||||
// authorization mode for which the provider was initialized and compiles request accordingly.
|
||||
|
||||
if config.cc_client == nil {
|
||||
// this should never happen if ClientConfig was properly called prior to decortAPICall
|
||||
return "", fmt.Errorf("decortAPICall method called with unconfigured DECORT cloud controller HTTP client.")
|
||||
}
|
||||
|
||||
// Example: to create api_params, one would generally do the following:
|
||||
//
|
||||
// data := []byte(`{"machineId": "2638"}`)
|
||||
// api_params := bytes.NewBuffer(data))
|
||||
//
|
||||
// Or:
|
||||
//
|
||||
// params := url.Values{}
|
||||
// params.Add("machineId", "2638")
|
||||
// params.Add("username", "u")
|
||||
// params.Add("password", "b")
|
||||
// req, _ := http.NewRequest(method, url, strings.NewReader(params.Encode()))
|
||||
//
|
||||
|
||||
if config.auth_mode_code == MODE_UNDEF {
|
||||
return "", fmt.Errorf("decortAPICall method called for unknown authorization mode.")
|
||||
}
|
||||
|
||||
if config.auth_mode_code == MODE_LEGACY {
|
||||
url_values.Add("authkey", config.legacy_sid)
|
||||
}
|
||||
params_str := url_values.Encode()
|
||||
|
||||
req, err := http.NewRequest(method, config.controller_url+api_name, strings.NewReader(params_str))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
req.Header.Set("Content-Length", strconv.Itoa(len(params_str)))
|
||||
req.Header.Set("Accept", "application/json")
|
||||
|
||||
if config.auth_mode_code == MODE_OAUTH2 || config.auth_mode_code == MODE_JWT {
|
||||
req.Header.Set("Authorization", fmt.Sprintf("bearer %s", config.jwt))
|
||||
}
|
||||
|
||||
resp, err := config.cc_client.Do(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode == http.StatusOK {
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
log.Debugf("decortAPICall: %s %s\n %s", method, api_name, body)
|
||||
return string(body), nil
|
||||
} else {
|
||||
return "", fmt.Errorf("decortAPICall: unexpected status code %d when calling API %q with request Body %q",
|
||||
resp.StatusCode, req.URL, params_str)
|
||||
}
|
||||
|
||||
/*
|
||||
if resp.StatusCode == StatusServiceUnavailable {
|
||||
return nil, fmt.Errorf("decortAPICall method called for incompatible authorization mode %q.", config.auth_mode_txt)
|
||||
}
|
||||
*/
|
||||
|
||||
return "", err
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
// "net/url"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
func flattenAccount(d *schema.ResourceData, acc_facts string) error {
|
||||
// NOTE: this function modifies ResourceData argument - as such it should never be called
|
||||
// from resourceAccountExists(...) method
|
||||
|
||||
// log.Debugf("flattenAccount: ready to decode response body from %q", CloudspacesGetAPI)
|
||||
details := AccountRecord{}
|
||||
err := json.Unmarshal([]byte(acc_facts), &details)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debugf("flattenAccount: decoded Account name %q / ID %d, status %q", details.Name, details.ID, details.Status)
|
||||
|
||||
d.SetId(fmt.Sprintf("%d", details.ID))
|
||||
d.Set("name", details.Name)
|
||||
d.Set("status", details.Status)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dataSourceAccountRead(d *schema.ResourceData, m interface{}) error {
|
||||
acc_facts, err := utilityAccountCheckPresence(d, m)
|
||||
if acc_facts == "" {
|
||||
// if empty string is returned from utilityAccountCheckPresence then there is no
|
||||
// such account and err tells so - just return it to the calling party
|
||||
d.SetId("") // ensure ID is empty in this case
|
||||
return err
|
||||
}
|
||||
|
||||
return flattenAccount(d, acc_facts)
|
||||
}
|
||||
|
||||
func dataSourceAccount() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
Read: dataSourceAccountRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &Timeout30s,
|
||||
Default: &Timeout60s,
|
||||
},
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Name of the account. Names are case sensitive and unique.",
|
||||
},
|
||||
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Unique ID of the account. If account ID is specified, then account name is ignored.",
|
||||
},
|
||||
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Current status of the account.",
|
||||
},
|
||||
|
||||
/* We keep the following attributes commented out, as we are not implementing account
|
||||
management with Terraform plugin, so we do not need this extra info.
|
||||
|
||||
"quota": {
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
MaxItems: 1,
|
||||
Elem: &schema.Resource{
|
||||
Schema: quotaRgSubresourceSchema(), // this is a dictionary
|
||||
},
|
||||
Description: "Quotas on the resources for this account and all its resource groups.",
|
||||
},
|
||||
|
||||
"resource_groups": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "IDs of resource groups in this account."
|
||||
},
|
||||
|
||||
"vins": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "IDs of VINSes created at the account level."
|
||||
},
|
||||
*/
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,503 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
// "net/url"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
// Parse list of all disks from API compute/get into a list of "extra disks" attached to this compute
|
||||
// Extra disks are all compute disks but a boot disk.
|
||||
func parseComputeDisksToExtraDisks(disks []DiskRecord) []interface{} {
|
||||
// this return value will be used to d.Set("extra_disks",) item of dataSourceCompute schema,
|
||||
// which is a simple list of integer disk IDs excluding boot disk ID
|
||||
length := len(disks)
|
||||
log.Debugf("parseComputeDisksToExtraDisks: called for %d disks", length)
|
||||
|
||||
if length == 0 || (length == 1 && disks[0].Type == "B") {
|
||||
// the disk list is empty (which is kind of strange - diskless compute?), or
|
||||
// there is only one disk in the list and it is a boot disk;
|
||||
// as we skip boot disks, the result will be of 0 length anyway
|
||||
return make([]interface{}, 0)
|
||||
}
|
||||
|
||||
result := make([]interface{}, length-1)
|
||||
idx := 0
|
||||
for _, value := range disks {
|
||||
if value.Type == "B" {
|
||||
// skip boot disk when iterating over the list of disks
|
||||
continue
|
||||
}
|
||||
|
||||
result[idx] = value.ID
|
||||
idx++
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// NOTE: this is a legacy function, which is not used as of rc-1.10
|
||||
// Use "parseComputeDisksToExtraDisks" instead
|
||||
func parseComputeDisks(disks []DiskRecord) []interface{} {
|
||||
// Return value was designed to d.Set("disks",) item of dataSourceCompute schema
|
||||
// However, this item was excluded from the schema as it is not directly
|
||||
// managed through Terraform
|
||||
length := len(disks)
|
||||
log.Debugf("parseComputeDisks: called for %d disks", length)
|
||||
|
||||
/*
|
||||
if length == 1 && disks[0].Type == "B" {
|
||||
// there is only one disk in the list and it is a boot disk
|
||||
// as we skip boot disks, the result will be of 0 lenght
|
||||
length = 0
|
||||
}
|
||||
*/
|
||||
|
||||
result := []interface{}{}
|
||||
|
||||
if length == 0 {
|
||||
return result
|
||||
}
|
||||
|
||||
for _, value := range disks {
|
||||
/*
|
||||
if value.Type == "B" {
|
||||
// skip boot disk when parsing the list of disks
|
||||
continue
|
||||
}
|
||||
*/
|
||||
elem := make(map[string]interface{})
|
||||
// keys in this map should correspond to the Schema definition
|
||||
// as returned by dataSourceDiskSchemaMake()
|
||||
elem["name"] = value.Name
|
||||
elem["disk_id"] = value.ID
|
||||
elem["account_id"] = value.AccountID
|
||||
elem["account_name"] = value.AccountName
|
||||
elem["description"] = value.Desc
|
||||
elem["image_id"] = value.ImageID
|
||||
elem["size"] = value.SizeMax
|
||||
elem["type"] = value.Type
|
||||
elem["sep_id"] = value.SepID
|
||||
elem["sep_type"] = value.SepType
|
||||
elem["pool"] = value.Pool
|
||||
// elem["status"] = value.Status
|
||||
// elem["tech_status"] = value.TechStatus
|
||||
elem["compute_id"] = value.ComputeID
|
||||
|
||||
result = append(result, elem)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func parseBootDiskSize(disks []DiskRecord) int {
|
||||
// this return value will be used to d.Set("boot_disk_size",) item of dataSourceCompute schema
|
||||
if len(disks) == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
for _, value := range disks {
|
||||
if value.Type == "B" {
|
||||
return value.SizeMax
|
||||
}
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
func parseBootDiskId(disks []DiskRecord) uint {
|
||||
// this return value will be used to d.Set("boot_disk_id",) item of dataSourceCompute schema
|
||||
if len(disks) == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
for _, value := range disks {
|
||||
if value.Type == "B" {
|
||||
return value.ID
|
||||
}
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// Parse the list of interfaces from compute/get response into a list of networks
|
||||
// attached to this compute
|
||||
func parseComputeInterfacesToNetworks(ifaces []InterfaceRecord) []interface{} {
|
||||
// return value will be used to d.Set("network") item of dataSourceCompute schema
|
||||
length := len(ifaces)
|
||||
log.Debugf("parseComputeInterfacesToNetworks: called for %d ifaces", length)
|
||||
|
||||
result := []interface{}{}
|
||||
|
||||
for _, value := range ifaces {
|
||||
elem := make(map[string]interface{})
|
||||
// Keys in this map should correspond to the Schema definition
|
||||
// as returned by networkSubresourceSchemaMake()
|
||||
elem["net_id"] = value.NetID
|
||||
elem["net_type"] = value.NetType
|
||||
elem["ip_address"] = value.IPAddress
|
||||
elem["mac"] = value.MAC
|
||||
|
||||
// log.Debugf(" element %d: net_id=%d, net_type=%s", i, value.NetID, value.NetType)
|
||||
|
||||
result = append(result, elem)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
/*
|
||||
func parseComputeInterfacesToNetworks(ifaces []InterfaceRecord) []map[string]interface{} {
|
||||
// return value will be used to d.Set("network") item of dataSourceCompute schema
|
||||
length := len(ifaces)
|
||||
log.Debugf("parseComputeInterfacesToNetworks: called for %d ifaces", length)
|
||||
|
||||
result := make([]map[string]interface{}, length, length)
|
||||
|
||||
for i, value := range ifaces {
|
||||
elem := make(map[string]interface{})
|
||||
// Keys in this map should correspond to the Schema definition
|
||||
// as returned by networkSubresourceSchemaMake()
|
||||
elem["net_id"] = value.NetID
|
||||
elem["net_type"] = value.NetType
|
||||
elem["ip_address"] = value.IPAddress
|
||||
elem["mac"] = value.MAC
|
||||
|
||||
// log.Debugf(" element %d: net_id=%d, net_type=%s", i, value.NetID, value.NetType)
|
||||
|
||||
result[i] = elem
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
*/
|
||||
|
||||
// NOTE: this function is retained for historical purposes and actually not used as of rc-1.10
|
||||
func parseComputeInterfaces(ifaces []InterfaceRecord) []map[string]interface{} {
|
||||
// return value was designed to d.Set("interfaces",) item of dataSourceCompute schema
|
||||
// However, this item was excluded from the schema as it is not directly
|
||||
// managed through Terraform
|
||||
length := len(ifaces)
|
||||
log.Debugf("parseComputeInterfaces: called for %d ifaces", length)
|
||||
|
||||
result := make([]map[string]interface{}, length, length)
|
||||
|
||||
for i, value := range ifaces {
|
||||
// Keys in this map should correspond to the Schema definition
|
||||
// as returned by dataSourceInterfaceSchemaMake()
|
||||
elem := make(map[string]interface{})
|
||||
|
||||
elem["net_id"] = value.NetID
|
||||
elem["net_type"] = value.NetType
|
||||
elem["ip_address"] = value.IPAddress
|
||||
elem["netmask"] = value.NetMask
|
||||
elem["mac"] = value.MAC
|
||||
elem["default_gw"] = value.DefaultGW
|
||||
elem["name"] = value.Name
|
||||
elem["connection_id"] = value.ConnID
|
||||
elem["connection_type"] = value.ConnType
|
||||
|
||||
/* TODO: add code to parse QoS
|
||||
qos_schema := interfaceQosSubresourceSchemaMake()
|
||||
qos_schema.Set("egress_rate", value.QOS.ERate)
|
||||
qos_schema.Set("ingress_rate", value.QOS.InRate)
|
||||
qos_schema.Set("ingress_burst", value.QOS.InBurst)
|
||||
elem["qos"] = qos_schema
|
||||
*/
|
||||
|
||||
result[i] = elem
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func flattenCompute(d *schema.ResourceData, compFacts string) error {
|
||||
// This function expects that compFacts string contains response from API compute/get,
|
||||
// i.e. detailed information about compute instance.
|
||||
//
|
||||
// NOTE: this function modifies ResourceData argument - as such it should never be called
|
||||
// from resourceComputeExists(...) method
|
||||
model := ComputeGetResp{}
|
||||
log.Debugf("flattenCompute: ready to unmarshal string %s", compFacts)
|
||||
err := json.Unmarshal([]byte(compFacts), &model)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debugf("flattenCompute: ID %d, RG ID %d", model.ID, model.RgID)
|
||||
|
||||
d.SetId(fmt.Sprintf("%d", model.ID))
|
||||
// d.Set("compute_id", model.ID) - we should NOT set compute_id in the schema here: if it was set - it is already set, if it wasn't - we shouldn't
|
||||
d.Set("name", model.Name)
|
||||
d.Set("rg_id", model.RgID)
|
||||
d.Set("rg_name", model.RgName)
|
||||
d.Set("account_id", model.AccountID)
|
||||
d.Set("account_name", model.AccountName)
|
||||
d.Set("arch", model.Arch)
|
||||
d.Set("cpu", model.Cpu)
|
||||
d.Set("ram", model.Ram)
|
||||
// d.Set("boot_disk_size", model.BootDiskSize) - bootdiskSize key in API compute/get is always zero, so we set boot_disk_size in another way
|
||||
d.Set("boot_disk_size", parseBootDiskSize(model.Disks))
|
||||
d.Set("boot_disk_id", parseBootDiskId(model.Disks)) // we may need boot disk ID in resize operations
|
||||
d.Set("image_id", model.ImageID)
|
||||
d.Set("description", model.Desc)
|
||||
d.Set("cloud_init", "applied") // NOTE: for existing compute we hard-code this value as an indicator for DiffSuppress fucntion
|
||||
// d.Set("status", model.Status)
|
||||
// d.Set("tech_status", model.TechStatus)
|
||||
|
||||
if model.TechStatus == "STARTED" {
|
||||
d.Set("started", true)
|
||||
} else {
|
||||
d.Set("started", false)
|
||||
}
|
||||
|
||||
if len(model.Disks) > 0 {
|
||||
log.Debugf("flattenCompute: calling parseComputeDisksToExtraDisks for %d disks", len(model.Disks))
|
||||
if err = d.Set("extra_disks", parseComputeDisksToExtraDisks(model.Disks)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(model.Interfaces) > 0 {
|
||||
log.Debugf("flattenCompute: calling parseComputeInterfacesToNetworks for %d interfaces", len(model.Interfaces))
|
||||
if err = d.Set("network", parseComputeInterfacesToNetworks(model.Interfaces)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(model.OsUsers) > 0 {
|
||||
log.Debugf("flattenCompute: calling parseOsUsers for %d logins", len(model.OsUsers))
|
||||
if err = d.Set("os_users", parseOsUsers(model.OsUsers)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dataSourceComputeRead(d *schema.ResourceData, m interface{}) error {
|
||||
compFacts, err := utilityComputeCheckPresence(d, m)
|
||||
if compFacts == "" {
|
||||
// if empty string is returned from utilityComputeCheckPresence then there is no
|
||||
// such Compute and err tells so - just return it to the calling party
|
||||
d.SetId("") // ensure ID is empty
|
||||
return err
|
||||
}
|
||||
|
||||
return flattenCompute(d, compFacts)
|
||||
}
|
||||
|
||||
func dataSourceCompute() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
Read: dataSourceComputeRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &Timeout30s,
|
||||
Default: &Timeout60s,
|
||||
},
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Name of this compute instance. NOTE: this parameter is case sensitive.",
|
||||
},
|
||||
|
||||
// TODO: consider removing compute_id from the schema, as it not practical to call this data provider if
|
||||
// corresponding compute ID is already known
|
||||
"compute_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "ID of the compute instance. If ID is specified, name and resource group ID are ignored.",
|
||||
},
|
||||
|
||||
"rg_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "ID of the resource group where this compute instance is located.",
|
||||
},
|
||||
|
||||
"rg_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Name of the resource group where this compute instance is located.",
|
||||
},
|
||||
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "ID of the account this compute instance belongs to.",
|
||||
},
|
||||
|
||||
"account_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Name of the account this compute instance belongs to.",
|
||||
},
|
||||
|
||||
"arch": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Hardware architecture of this compute instance.",
|
||||
},
|
||||
|
||||
"cpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Number of CPUs allocated for this compute instance.",
|
||||
},
|
||||
|
||||
"ram": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Amount of RAM in MB allocated for this compute instance.",
|
||||
},
|
||||
|
||||
"image_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "ID of the OS image this compute instance is based on.",
|
||||
},
|
||||
|
||||
"image_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Name of the OS image this compute instance is based on.",
|
||||
},
|
||||
|
||||
"boot_disk_size": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "This compute instance boot disk size in GB.",
|
||||
},
|
||||
|
||||
"boot_disk_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "This compute instance boot disk ID.",
|
||||
},
|
||||
|
||||
"extra_disks": {
|
||||
Type: schema.TypeSet,
|
||||
Computed: true,
|
||||
MaxItems: MaxExtraDisksPerCompute,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "IDs of the extra disk(s) attached to this compute.",
|
||||
},
|
||||
|
||||
/*
|
||||
"disks": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: dataSourceDiskSchemaMake(), // ID, type, name, size, account ID, SEP ID, SEP type, pool, status, tech status, compute ID, image ID
|
||||
},
|
||||
Description: "Detailed specification for all disks attached to this compute instance (including bood disk).",
|
||||
},
|
||||
*/
|
||||
|
||||
"network": {
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
MaxItems: MaxNetworksPerCompute,
|
||||
Elem: &schema.Resource{
|
||||
Schema: networkSubresourceSchemaMake(),
|
||||
},
|
||||
Description: "Network connection(s) for this compute.",
|
||||
},
|
||||
|
||||
/*
|
||||
"interfaces": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: interfaceSubresourceSchemaMake(),
|
||||
},
|
||||
Description: "Specification for the virtual NICs configured on this compute instance.",
|
||||
},
|
||||
*/
|
||||
|
||||
"os_users": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: osUsersSubresourceSchemaMake(),
|
||||
},
|
||||
Description: "Guest OS users provisioned on this compute instance.",
|
||||
},
|
||||
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "User-defined text description of this compute instance.",
|
||||
},
|
||||
|
||||
"cloud_init": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Placeholder for cloud_init parameters.",
|
||||
},
|
||||
|
||||
"started": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: true,
|
||||
Description: "Is compute started.",
|
||||
},
|
||||
|
||||
/*
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Current model status of this compute instance.",
|
||||
},
|
||||
|
||||
"tech_status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Current technical status of this compute instance.",
|
||||
},
|
||||
|
||||
"internal_ip": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Internal IP address of this Compute.",
|
||||
},
|
||||
*/
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,201 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
// "net/url"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
func flattenDisk(d *schema.ResourceData, disk_facts string) error {
|
||||
// This function expects disk_facts string to contain a response from disks/get API
|
||||
//
|
||||
// NOTE: this function modifies ResourceData argument - as such it should never be called
|
||||
// from resourceDiskExists(...) method. Use utilityDiskCheckPresence instead.
|
||||
|
||||
log.Debugf("flattenDisk: ready to unmarshal string %s", disk_facts)
|
||||
|
||||
model := DiskRecord{}
|
||||
|
||||
err := json.Unmarshal([]byte(disk_facts), &model)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debugf("flattenDisk: disk ID %d, disk AccountID %d", model.ID, model.AccountID)
|
||||
|
||||
d.SetId(fmt.Sprintf("%d", model.ID))
|
||||
// d.Set("disk_id", model.ID) - we should NOT update disk_id in the schema. If it was set - it is already set, if it wasn't - we shouldn't
|
||||
d.Set("name", model.Name)
|
||||
d.Set("account_id", model.AccountID)
|
||||
d.Set("account_name", model.AccountName)
|
||||
d.Set("size", model.SizeMax)
|
||||
// d.Set("sizeUsed", model.SizeUsed)
|
||||
d.Set("type", model.Type)
|
||||
d.Set("image_id", model.ImageID)
|
||||
d.Set("sep_id", model.SepID)
|
||||
d.Set("sep_type", model.SepType)
|
||||
d.Set("pool", model.Pool)
|
||||
// d.Set("compute_id", model.ComputeID)
|
||||
|
||||
d.Set("description", model.Desc)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dataSourceDiskRead(d *schema.ResourceData, m interface{}) error {
|
||||
disk_facts, err := utilityDiskCheckPresence(d, m)
|
||||
if disk_facts == "" {
|
||||
// if empty string is returned from utilityDiskCheckPresence then there is no
|
||||
// such Disk and err tells so - just return it to the calling party
|
||||
d.SetId("") // ensure ID is empty
|
||||
return err
|
||||
}
|
||||
|
||||
return flattenDisk(d, disk_facts)
|
||||
}
|
||||
|
||||
func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
rets := map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Name of this disk. NOTE: disk names are NOT unique within an account. If disk ID is specified, disk name is ignored.",
|
||||
},
|
||||
|
||||
"disk_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "ID of the disk to get. If disk ID is specified, then disk name and account ID are ignored.",
|
||||
},
|
||||
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "ID of the account this disk belongs to. If disk ID is specified, then account ID is ignored.",
|
||||
},
|
||||
|
||||
// The rest of the data source Disk schema are all computed
|
||||
"sep_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Storage end-point provider serving this disk.",
|
||||
},
|
||||
|
||||
"pool": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Pool where this disk is located.",
|
||||
},
|
||||
|
||||
"size": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Size of the disk in GB.",
|
||||
},
|
||||
|
||||
"type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Type of this disk. E.g. D for data disks, B for boot.",
|
||||
},
|
||||
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "User-defined text description of this disk.",
|
||||
},
|
||||
|
||||
"account_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Name of the account this disk belongs to. If account ID is specified, account name is ignored.",
|
||||
},
|
||||
|
||||
"image_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "ID of the image, which this disk was cloned from (valid for disk clones only).",
|
||||
},
|
||||
|
||||
"sep_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Type of the storage end-point provider serving this disk.",
|
||||
},
|
||||
|
||||
/*
|
||||
"snapshots": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource {
|
||||
Schema: snapshotSubresourceSchemaMake(),
|
||||
},
|
||||
Description: "List of user-created snapshots for this disk."
|
||||
},
|
||||
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Current model status of this disk.",
|
||||
},
|
||||
|
||||
"tech_status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Current technical status of this disk.",
|
||||
},
|
||||
|
||||
"compute_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "ID of the compute instance where this disk is attached to, or 0 for unattached disk.",
|
||||
},
|
||||
*/
|
||||
}
|
||||
|
||||
return rets
|
||||
}
|
||||
|
||||
func dataSourceDisk() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
Read: dataSourceDiskRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &Timeout30s,
|
||||
Default: &Timeout60s,
|
||||
},
|
||||
|
||||
Schema: dataSourceDiskSchemaMake(),
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
func dataSourceImageRead(d *schema.ResourceData, m interface{}) error {
|
||||
name := d.Get("name").(string)
|
||||
// rg_id, rgid_set := d.GetOk("rg_id")
|
||||
accId, accSet := d.GetOk("account_id")
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
url_values := &url.Values{}
|
||||
if accSet {
|
||||
url_values.Add("accountId", fmt.Sprintf("%d", accId.(int)))
|
||||
}
|
||||
body_string, err := controller.decortAPICall("POST", ImagesListAPI, url_values)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debugf("dataSourceImageRead: ready to decode response body from %s", ImagesListAPI)
|
||||
model := ImagesListResp{}
|
||||
err = json.Unmarshal([]byte(body_string), &model)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// log.Printf("%#v", model)
|
||||
log.Debugf("dataSourceImageRead: traversing decoded JSON of length %d", len(model))
|
||||
for index, item := range model {
|
||||
// need to match Image by name
|
||||
if item.Name == name {
|
||||
log.Debugf("dataSourceImageRead: index %d, matched name %s", index, item.Name)
|
||||
d.SetId(fmt.Sprintf("%d", item.ID))
|
||||
d.Set("account_id", item.AccountID)
|
||||
d.Set("arch", item.Arch)
|
||||
d.Set("sep_id", item.SepID)
|
||||
d.Set("pool", item.Pool)
|
||||
d.Set("status", item.Status)
|
||||
d.Set("size", item.Size)
|
||||
// d.Set("field_name", value)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("Cannot find Image name %s", name)
|
||||
}
|
||||
|
||||
func dataSourceImage() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
Read: dataSourceImageRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &Timeout30s,
|
||||
Default: &Timeout60s,
|
||||
},
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Description: "Name of the image to locate. This parameter is case sensitive.",
|
||||
},
|
||||
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
ValidateFunc: validation.IntAtLeast(1),
|
||||
Description: "Optional ID of the account to limit image search to.",
|
||||
},
|
||||
|
||||
"arch": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Binary architecture of this image.",
|
||||
},
|
||||
|
||||
"sep_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Storage end-point provider serving this image.",
|
||||
},
|
||||
|
||||
/*
|
||||
"sep_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Type of the storage end-point provider serving this image.",
|
||||
},
|
||||
*/
|
||||
|
||||
"pool": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Pool where this image is located.",
|
||||
},
|
||||
|
||||
"size": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Size of the image in GB.",
|
||||
},
|
||||
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Current model status of this image.",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
// "net/url"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
func flattenResgroup(d *schema.ResourceData, rg_facts string) error {
|
||||
// NOTE: this function modifies ResourceData argument - as such it should never be called
|
||||
// from resourceRsgroupExists(...) method
|
||||
// log.Debugf("%s", rg_facts)
|
||||
log.Debugf("flattenResgroup: ready to decode response body from API")
|
||||
details := ResgroupGetResp{}
|
||||
err := json.Unmarshal([]byte(rg_facts), &details)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debugf("flattenResgroup: decoded RG name %q / ID %d, account ID %d",
|
||||
details.Name, details.ID, details.AccountID)
|
||||
|
||||
d.SetId(fmt.Sprintf("%d", details.ID))
|
||||
d.Set("rg_id", details.ID)
|
||||
d.Set("name", details.Name)
|
||||
d.Set("account_name", details.AccountName)
|
||||
d.Set("account_id", details.AccountID)
|
||||
// d.Set("grid_id", details.GridID)
|
||||
d.Set("description", details.Desc)
|
||||
d.Set("status", details.Status)
|
||||
d.Set("def_net_type", details.DefaultNetType)
|
||||
d.Set("def_net_id", details.DefaultNetID)
|
||||
/*
|
||||
d.Set("vins", details.Vins)
|
||||
d.Set("computes", details.Computes)
|
||||
*/
|
||||
|
||||
log.Debugf("flattenResgroup: calling flattenQuota()")
|
||||
if err = d.Set("quota", parseQuota(details.Quota)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dataSourceResgroupRead(d *schema.ResourceData, m interface{}) error {
|
||||
rg_facts, err := utilityResgroupCheckPresence(d, m)
|
||||
if rg_facts == "" {
|
||||
// if empty string is returned from utilityResgroupCheckPresence then there is no
|
||||
// such resource group and err tells so - just return it to the calling party
|
||||
d.SetId("") // ensure ID is empty in this case
|
||||
return err
|
||||
}
|
||||
|
||||
return flattenResgroup(d, rg_facts)
|
||||
}
|
||||
|
||||
func dataSourceResgroup() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
Read: dataSourceResgroupRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &Timeout30s,
|
||||
Default: &Timeout60s,
|
||||
},
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Name of the resource group. Names are case sensitive and unique within the context of an account.",
|
||||
},
|
||||
|
||||
"rg_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Unique ID of the resource group. If this ID is specified, then resource group name is ignored.",
|
||||
},
|
||||
|
||||
"account_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Name of the account, which this resource group belongs to.",
|
||||
},
|
||||
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
Description: "Unique ID of the account, which this resource group belongs to.",
|
||||
},
|
||||
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "User-defined text description of this resource group.",
|
||||
},
|
||||
|
||||
/* commented out, as in this version of provider we use default Grid ID
|
||||
"grid_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Unique ID of the grid, where this resource group is deployed.",
|
||||
},
|
||||
*/
|
||||
|
||||
"quota": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
MaxItems: 1,
|
||||
Elem: &schema.Resource{
|
||||
Schema: quotaRgSubresourceSchemaMake(), // this is a dictionary
|
||||
},
|
||||
Description: "Quota settings for this resource group.",
|
||||
},
|
||||
|
||||
"def_net_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Type of the default network for this resource group.",
|
||||
},
|
||||
|
||||
"def_net_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "ID of the default network for this resource group (if any).",
|
||||
},
|
||||
|
||||
/*
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Current status of this resource group.",
|
||||
},
|
||||
|
||||
"vins": {
|
||||
Type: schema.TypeList, // this is a list of ints
|
||||
Computed: true,
|
||||
MaxItems: LimitMaxVinsPerResgroup,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "List of VINs deployed in this resource group.",
|
||||
},
|
||||
|
||||
"computes": {
|
||||
Type: schema.TypeList, //t his is a list of ints
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "List of computes deployed in this resource group.",
|
||||
},
|
||||
*/
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2020-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
// "net/url"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
// vins_facts is a response string from API vins/get
|
||||
func flattenVins(d *schema.ResourceData, vins_facts string) error {
|
||||
// NOTE: this function modifies ResourceData argument - as such it should never be called
|
||||
// from resourceVinsExists(...) method
|
||||
// log.Debugf("flattenVins: ready to decode response body from API %s", vins_facts)
|
||||
vinsRecord := VinsRecord{}
|
||||
err := json.Unmarshal([]byte(vins_facts), &vinsRecord)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debugf("flattenVins: decoded ViNS name:ID %s:%d, account ID %d, RG ID %d",
|
||||
vinsRecord.Name, vinsRecord.ID, vinsRecord.AccountID, vinsRecord.RgID)
|
||||
|
||||
d.SetId(fmt.Sprintf("%d", vinsRecord.ID))
|
||||
d.Set("name", vinsRecord.Name)
|
||||
d.Set("account_id", vinsRecord.AccountID)
|
||||
d.Set("account_name", vinsRecord.AccountName)
|
||||
err = d.Set("rg_id", vinsRecord.RgID)
|
||||
d.Set("description", vinsRecord.Desc)
|
||||
d.Set("ipcidr", vinsRecord.IPCidr)
|
||||
|
||||
noExtNetConnection := true
|
||||
for _, value := range vinsRecord.VNFs {
|
||||
if value.Type == "GW" {
|
||||
log.Debugf("flattenVins: discovered GW VNF ID %d in ViNS ID %d", value.ID, vinsRecord.ID)
|
||||
extNetID, idOk := value.Config["ext_net_id"] // NOTE: unknown numbers are unmarshalled to float64. This is by design!
|
||||
extNetIP, ipOk := value.Config["ext_net_ip"]
|
||||
if idOk && ipOk {
|
||||
log.Debugf("flattenVins: ViNS ext_net_id=%d, ext_net_ip=%s", int(extNetID.(float64)), extNetIP.(string))
|
||||
d.Set("ext_ip_addr", extNetIP.(string))
|
||||
d.Set("ext_net_id", int(extNetID.(float64)))
|
||||
} else {
|
||||
return fmt.Errorf("Failed to unmarshal VNF GW Config - structure is invalid.")
|
||||
}
|
||||
noExtNetConnection = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if noExtNetConnection {
|
||||
d.Set("ext_ip_addr", "")
|
||||
d.Set("ext_net_id", 0)
|
||||
}
|
||||
|
||||
log.Debugf("flattenVins: EXTRA CHECK - schema rg_id=%d, ext_net_id=%d", d.Get("rg_id").(int), d.Get("ext_net_id").(int))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dataSourceVinsRead(d *schema.ResourceData, m interface{}) error {
|
||||
vinsFacts, err := utilityVinsCheckPresence(d, m)
|
||||
if vinsFacts == "" {
|
||||
// if empty string is returned from utilityVinsCheckPresence then there is no
|
||||
// such ViNS and err tells so - just return it to the calling party
|
||||
d.SetId("") // ensure ID is empty in this case
|
||||
return err
|
||||
}
|
||||
|
||||
return flattenVins(d, vinsFacts)
|
||||
}
|
||||
|
||||
func dataSourceVins() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
Read: dataSourceVinsRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &Timeout30s,
|
||||
Default: &Timeout60s,
|
||||
},
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Description: "Name of the ViNS. Names are case sensitive and unique within the context of an account or resource group.",
|
||||
},
|
||||
|
||||
/*
|
||||
"vins_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Unique ID of the ViNS. If ViNS ID is specified, then ViNS name, rg_id and account_id are ignored.",
|
||||
},
|
||||
*/
|
||||
|
||||
"rg_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Unique ID of the resource group, where this ViNS is belongs to (for ViNS created at resource group level, 0 otherwise).",
|
||||
},
|
||||
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Unique ID of the account, which this ViNS belongs to.",
|
||||
},
|
||||
|
||||
// the rest of attributes are computed
|
||||
"account_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Name of the account, which this ViNS belongs to.",
|
||||
},
|
||||
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "User-defined text description of this ViNS.",
|
||||
},
|
||||
|
||||
"ext_ip_addr": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "IP address of the external connection (valid for ViNS connected to external network, empty string otherwise).",
|
||||
},
|
||||
|
||||
"ext_net_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "ID of the external network this ViNS is connected to (-1 means no external connection).",
|
||||
},
|
||||
|
||||
"ipcidr": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Network address used by this ViNS.",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
// log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
|
||||
// ID, type, name, size, account ID, SEP ID, SEP type, pool, status, tech status, compute ID, image ID
|
||||
func diskSubresourceSchemaMake() map[string]*schema.Schema {
|
||||
rets := map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Description: "Name of this disk.",
|
||||
},
|
||||
|
||||
"size": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
ValidateFunc: validation.IntAtLeast(1),
|
||||
Description: "Size of the disk in GB.",
|
||||
},
|
||||
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
ValidateFunc: validation.IntAtLeast(1),
|
||||
Description: "ID of the account this disk belongs to.",
|
||||
},
|
||||
|
||||
"type": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Type of this disk.",
|
||||
},
|
||||
|
||||
"sep_id": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Default: "default",
|
||||
Description: "ID of the storage end-point provider serving this disk.",
|
||||
},
|
||||
|
||||
"sep_type": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Default: "default",
|
||||
Description: "Type of the storage provider serving this disk.",
|
||||
},
|
||||
|
||||
"pool": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Default: "default",
|
||||
Description: "Pool on the storage where this disk is located.",
|
||||
},
|
||||
|
||||
"image_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "ID of the binary Image this disk resource is cloned from (if any).",
|
||||
},
|
||||
}
|
||||
|
||||
return rets
|
||||
}
|
||||
@@ -1,331 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file contains definitions and code for handling Interface component of Compute schema
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
/*
|
||||
"log"
|
||||
"strconv"
|
||||
"strings"
|
||||
*/
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
func interfaceSubresourceSchemaMake() map[string]*schema.Schema {
|
||||
rets := map[string]*schema.Schema{
|
||||
"net_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "ID of the network entity this interface is connected to.",
|
||||
},
|
||||
|
||||
"net_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Type of the network entity this interface is connected to.",
|
||||
},
|
||||
|
||||
"ip_address": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "IP addresses assigned to this interface.",
|
||||
},
|
||||
|
||||
"netmask": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Network mask to be used with this interface.",
|
||||
},
|
||||
|
||||
"mac": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "MAC address of this interface.",
|
||||
},
|
||||
|
||||
"default_gw": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Default gateway associated with this interface.",
|
||||
},
|
||||
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Interface name.",
|
||||
},
|
||||
|
||||
"connection_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "VxLAN or VLAN ID this interface is connected to.",
|
||||
},
|
||||
|
||||
"connection_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Type of the segment (VLAN or VxLAN) this interface is connected to.",
|
||||
},
|
||||
|
||||
"qos": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: interfaceQosSubresourceSchemaMake(),
|
||||
},
|
||||
Description: "QoS settings for this interface.",
|
||||
},
|
||||
}
|
||||
|
||||
return rets
|
||||
}
|
||||
|
||||
func interfaceQosSubresourceSchemaMake() map[string]*schema.Schema {
|
||||
rets := map[string]*schema.Schema{
|
||||
"egress_rate": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Egress rate limit on this interface.",
|
||||
},
|
||||
|
||||
"ingress_burst": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Ingress burst limit on this interface.",
|
||||
},
|
||||
|
||||
"ingress_rate": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Ingress rate limit on this interface.",
|
||||
},
|
||||
|
||||
"guid": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "GUID of this QoS record.",
|
||||
},
|
||||
}
|
||||
|
||||
return rets
|
||||
}
|
||||
|
||||
/*
|
||||
func flattenNetworks(nets []NicRecord) []interface{} {
|
||||
// this function expects an array of NicRecord as returned by machines/get API call
|
||||
// NOTE: it does NOT expect a strucutre as returned by externalnetwork/list
|
||||
var length = 0
|
||||
var strarray []string
|
||||
|
||||
for _, value := range nets {
|
||||
if value.NicType == "PUBLIC" {
|
||||
length += 1
|
||||
}
|
||||
}
|
||||
log.Debugf("flattenNetworks: found %d NICs with PUBLIC type", length)
|
||||
|
||||
result := make([]interface{}, length)
|
||||
if length == 0 {
|
||||
return result
|
||||
}
|
||||
|
||||
elem := make(map[string]interface{})
|
||||
|
||||
var subindex = 0
|
||||
for index, value := range nets {
|
||||
if value.NicType == "PUBLIC" {
|
||||
// this will be changed as network segments entity
|
||||
// value.Params for ext net comes in a form "gateway:176.118.165.1 externalnetworkId:6"
|
||||
// for network_id we need to extract from this string
|
||||
strarray = strings.Split(value.Params, " ")
|
||||
substr := strings.Split(strarray[1], ":")
|
||||
elem["network_id"], _ = strconv.Atoi(substr[1])
|
||||
elem["ip_range"] = value.IPAddress
|
||||
// elem["label"] = ... - should be uncommented for the future release
|
||||
log.Debugf("flattenNetworks: parsed element %d - network_id %d, ip_range %s",
|
||||
index, elem["network_id"].(int), value.IPAddress)
|
||||
result[subindex] = elem
|
||||
subindex += 1
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func makePortforwardsConfig(arg_list []interface{}) (pfws []PortforwardConfig, count int) {
|
||||
count = len(arg_list)
|
||||
if count < 1 {
|
||||
return nil, 0
|
||||
}
|
||||
|
||||
pfws = make([]PortforwardConfig, count)
|
||||
var subres_data map[string]interface{}
|
||||
for index, value := range arg_list {
|
||||
subres_data = value.(map[string]interface{})
|
||||
// pfws[index].Label = subres_data["label"].(string) - should be uncommented for future release
|
||||
pfws[index].ExtPort = subres_data["ext_port"].(int)
|
||||
pfws[index].IntPort = subres_data["int_port"].(int)
|
||||
pfws[index].Proto = subres_data["proto"].(string)
|
||||
}
|
||||
|
||||
return pfws, count
|
||||
}
|
||||
|
||||
func flattenPortforwards(pfws []PortforwardRecord) []interface{} {
|
||||
result := make([]interface{}, len(pfws))
|
||||
elem := make(map[string]interface{})
|
||||
var port_num int
|
||||
|
||||
for index, value := range pfws {
|
||||
// elem["label"] = ... - should be uncommented for the future release
|
||||
|
||||
// external port field is of TypeInt in the portforwardSubresourceSchema, but string is returned
|
||||
// by portforwards/list API, so we need conversion here
|
||||
port_num, _ = strconv.Atoi(value.ExtPort)
|
||||
elem["ext_port"] = port_num
|
||||
// internal port field is of TypeInt in the portforwardSubresourceSchema, but string is returned
|
||||
// by portforwards/list API, so we need conversion here
|
||||
port_num, _ = strconv.Atoi(value.IntPort)
|
||||
elem["int_port"] = port_num
|
||||
elem["proto"] = value.Proto
|
||||
elem["ext_ip"] = value.ExtIP
|
||||
elem["int_ip"] = value.IntIP
|
||||
result[index] = elem
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func portforwardSubresourceSchema() map[string]*schema.Schema {
|
||||
rets := map[string]*schema.Schema{
|
||||
"label": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Description: "Unique label of this network connection to identify it amnong other connections for this VM.",
|
||||
},
|
||||
|
||||
"ext_port": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
ValidateFunc: validation.IntBetween(1, 65535),
|
||||
Description: "External port number for this port forwarding rule.",
|
||||
},
|
||||
|
||||
"int_port": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
ValidateFunc: validation.IntBetween(1, 65535),
|
||||
Description: "Internal port number for this port forwarding rule.",
|
||||
},
|
||||
|
||||
"proto": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
// ValidateFunc: validation.IntBetween(1, ),
|
||||
Description: "Protocol type for this port forwarding rule. Should be either 'tcp' or 'udp'.",
|
||||
},
|
||||
|
||||
"ext_ip": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: ".",
|
||||
},
|
||||
|
||||
"int_ip": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: ".",
|
||||
},
|
||||
}
|
||||
|
||||
return rets
|
||||
}
|
||||
|
||||
func flattenNICs(nics []NicRecord) []interface{} {
|
||||
var result = make([]interface{}, len(nics))
|
||||
elem := make(map[string]interface{})
|
||||
|
||||
for index, value := range nics {
|
||||
elem["status"] = value.Status
|
||||
elem["type"] = value.NicType
|
||||
elem["mac"] = value.MacAddress
|
||||
elem["ip_address"] = value.IPAddress
|
||||
elem["parameters"] = value.Params
|
||||
elem["reference_id"] = value.ReferenceID
|
||||
elem["network_id"] = value.NetworkID
|
||||
result[index] = elem
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func nicSubresourceSchema() map[string]*schema.Schema {
|
||||
rets := map[string]*schema.Schema{
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Current status of this NIC.",
|
||||
},
|
||||
|
||||
"type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Type of this NIC.",
|
||||
},
|
||||
|
||||
"mac": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "MAC address assigned to this NIC.",
|
||||
},
|
||||
|
||||
"ip_address": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "IP address assigned to this NIC.",
|
||||
},
|
||||
|
||||
"parameters": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Additional NIC parameters.",
|
||||
},
|
||||
|
||||
"reference_id": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Reference ID of this NIC.",
|
||||
},
|
||||
|
||||
"network_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Network ID which this NIC is connected to.",
|
||||
},
|
||||
}
|
||||
|
||||
return rets
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -1,596 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
//
|
||||
// timeouts for API calls from CRUD functions of Terraform plugin
|
||||
var Timeout30s = time.Second * 30
|
||||
var Timeout60s = time.Second * 60
|
||||
var Timeout180s = time.Second * 180
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/rg/list API
|
||||
//
|
||||
type UserAclRecord struct {
|
||||
IsExplicit bool `json:"explicit"`
|
||||
Rights string `json:"right"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
UgroupID string `json:"userGroupId"`
|
||||
// CanBeDeleted bool `json:"canBeDeleted"`
|
||||
}
|
||||
|
||||
type AccountAclRecord struct {
|
||||
IsExplicit bool `json:"explicit"`
|
||||
Guid string `json:"guid"`
|
||||
Rights string `json:"right"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
UgroupID string `json:"userGroupId"`
|
||||
}
|
||||
|
||||
type ResgroupRecord struct {
|
||||
ACLs []UserAclRecord `json:"acl"`
|
||||
Owner AccountAclRecord `json:"accountAcl"`
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
DefaultNetID int `json:"def_net_id"`
|
||||
DefaultNetType string `json:"def_net_type"`
|
||||
Decsription string `json:"desc"`
|
||||
GridID int `json:"gid"`
|
||||
ID uint `json:"id"`
|
||||
LockStatus string `json:"lockStatus"`
|
||||
Name string `json:"name"`
|
||||
Status string `json:"status"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
Vins []int `json:"vins"`
|
||||
Computes []int `json:"vms"`
|
||||
}
|
||||
|
||||
const ResgroupListAPI = "/restmachine/cloudapi/rg/list"
|
||||
|
||||
type ResgroupListResp []ResgroupRecord
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/rg/create API call
|
||||
//
|
||||
const ResgroupCreateAPI = "/restmachine/cloudapi/rg/create"
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/rg/update API call
|
||||
//
|
||||
const ResgroupUpdateAPI = "/restmachine/cloudapi/rg/update"
|
||||
|
||||
type ResgroupUpdateParam struct {
|
||||
RgId int `json:"rgId"`
|
||||
Name string `json:"name"`
|
||||
Desc string `json:"decs"`
|
||||
Ram int `json:"maxMemoryCapacity"`
|
||||
Disk int `json:"maxVDiskCapacity"`
|
||||
Cpu int `json:"maxCPUCapacity"`
|
||||
NetTraffic int `json:"maxNetworkPeerTransfer"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/rg/get API call
|
||||
//
|
||||
type QuotaRecord struct { // this is how quota is reported by /api/.../rg/get
|
||||
Cpu int `json:"CU_C"` // CPU count in pcs
|
||||
Ram float64 `json:"CU_M"` // RAM volume in MB, it is STILL reported as FLOAT
|
||||
Disk int `json:"CU_D"` // Disk capacity in GB
|
||||
ExtIPs int `json:"CU_I"` // Ext IPs count
|
||||
ExtTraffic int `json:"CU_NP"` // Ext network traffic
|
||||
GpuUnits int `json:"gpu_units"` // GPU count
|
||||
}
|
||||
|
||||
type ResourceRecord struct { // this is how actual usage is reported by /api/.../rg/get
|
||||
Cpu int `json:"cpu"`
|
||||
Disk int `json:"disksize"`
|
||||
ExtIPs int `json:"extips"`
|
||||
ExtTraffic int `json:"exttraffic"`
|
||||
Gpu int `json:"gpu"`
|
||||
Ram int `json:"ram"`
|
||||
}
|
||||
|
||||
type UsageRecord struct {
|
||||
Current ResourceRecord `json:"Current"`
|
||||
Reserved ResourceRecord `json:"Reserved"`
|
||||
}
|
||||
|
||||
const ResgroupGetAPI = "/restmachine/cloudapi/rg/get"
|
||||
|
||||
type ResgroupGetResp struct {
|
||||
ACLs []UserAclRecord `json:"ACLs"`
|
||||
Usage UsageRecord `json:"Resources"`
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
GridID int `json:"gid"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
DefaultNetID int `json:"def_net_id"`
|
||||
DefaultNetType string `json:"def_net_type"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
Desc string `json:"desc"`
|
||||
ID uint `json:"id"`
|
||||
LockStatus string `json:"lockStatus"`
|
||||
Name string `json:"name"`
|
||||
Quota QuotaRecord `json:"resourceLimits"`
|
||||
Status string `json:"status"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
Vins []int `json:"vins"`
|
||||
Computes []int `json:"vms"`
|
||||
|
||||
Ignored map[string]interface{} `json:"-"`
|
||||
}
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/rg/delete API
|
||||
//
|
||||
const ResgroupDeleteAPI = "/restmachine/cloudapi/rg/delete"
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/rg/listComputes API
|
||||
//
|
||||
type ComputeBriefRecord struct { // this is a brief compute specifiaction as returned by API rg/listComputes
|
||||
// we do not even include here all fields as returned by this API, but only the most important that
|
||||
// are really necessary to identify and distinguish computes
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
Name string `json:"name"`
|
||||
ID uint `json:"id"`
|
||||
RgID int `json:"rgId"`
|
||||
RgName string `json:"rgName"`
|
||||
Status string `json:"status"`
|
||||
TechStatus string `json:"techStatus"`
|
||||
}
|
||||
|
||||
const RgListComputesAPI = "/restmachine/cloudapi/rg/listComputes"
|
||||
|
||||
type RgListComputesResp []ComputeBriefRecord
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/kvmXXX/create APIs
|
||||
//
|
||||
const KvmX86CreateAPI = "/restmachine/cloudapi/kvmx86/create"
|
||||
const KvmPPCCreateAPI = "/restmachine/cloudapi/kvmppc/create"
|
||||
|
||||
type KvmVmCreateParam struct { // this is unified structure for both x86 and PPC based KVM VMs creation
|
||||
RgID uint `json:"rgId"`
|
||||
Name string `json:"name"`
|
||||
Cpu int `json:"cpu"`
|
||||
Ram int `json:"ram"`
|
||||
ImageID int `json:"imageId"`
|
||||
BootDisk int `json:"bootDisk"`
|
||||
NetType string `json:"netType"`
|
||||
NetId int `json:"netId"`
|
||||
IPAddr string `json:"ipAddr"`
|
||||
UserData string `json:"userdata"`
|
||||
Desc string `json:"desc"`
|
||||
Start bool `json:"start"`
|
||||
}
|
||||
|
||||
// structures related to cloudapi/compute/start API
|
||||
const ComputeStartAPI = "/restmachine/cloudapi/compute/start"
|
||||
const ComputeStopAPI = "/restmachine/cloudapi/compute/stop"
|
||||
|
||||
// structures related to cloudapi/compute/delete API
|
||||
const ComputeDeleteAPI = "/restmachine/cloudapi/compute/delete"
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/compute/list API
|
||||
//
|
||||
|
||||
type InterfaceQosRecord struct {
|
||||
ERate int `json:"eRate"`
|
||||
Guid string `json:"guid"`
|
||||
InBurst int `json:"inBurst"`
|
||||
InRate int `json:"inRate"`
|
||||
}
|
||||
|
||||
type InterfaceRecord struct {
|
||||
ConnID int `json:"connId"` // This is VLAN ID or VxLAN ID, depending on ConnType
|
||||
ConnType string `json:"connType"` // Either "VLAN" or "VXLAN" tag
|
||||
DefaultGW string `json:"defGw"`
|
||||
Guid string `json:"guid"`
|
||||
IPAddress string `json:"ipAddress"` // without trailing network mask, i.e. "192.168.1.3"
|
||||
MAC string `json:"mac"`
|
||||
Name string `json:"name"`
|
||||
NetID int `json:"netId"` // This is either ExtNet ID or ViNS ID, depending on NetType
|
||||
NetMask int `json:"netMask"`
|
||||
NetType string `json:"netType"` // Either "EXTNET" or "VINS" tag
|
||||
PciSlot int `json:"pciSlot"`
|
||||
Target string `json:"target"`
|
||||
Type string `json:"type"`
|
||||
VNFs []int `json:"vnfs"`
|
||||
QOS InterfaceQosRecord `json:"qos"`
|
||||
}
|
||||
|
||||
type SnapSetRecord struct {
|
||||
Disks []int `json:"disks"`
|
||||
Guid string `json:"guid"`
|
||||
Label string `json:"label"`
|
||||
TimeStamp uint64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type ComputeRecord struct {
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
ACLs []UserAclRecord `json:"acl"`
|
||||
Arch string `json:"arch"`
|
||||
BootDiskSize int `json:"bootdiskSize"`
|
||||
CloneReference int `json:"cloneReference"`
|
||||
Clones []int `json:"clones"`
|
||||
Cpus int `json:"cpus"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
Desc string `json:"desc"`
|
||||
Disks []int `json:"disks"`
|
||||
GridID int `json:"gid"`
|
||||
ID uint `json:"id"`
|
||||
ImageID int `json:"imageId"`
|
||||
Interfaces []InterfaceRecord `json:"interfaces"`
|
||||
LockStatus string `json:"lockStatus"`
|
||||
ManagerID int `json:"managerId"`
|
||||
Name string `json:"name"`
|
||||
Ram int `json:"ram"`
|
||||
RgID int `json:"rgId"`
|
||||
RgName string `json:"rgName"`
|
||||
SnapSets []SnapSetRecord `json:"snapSets"`
|
||||
Status string `json:"status"`
|
||||
// Tags []string `json:"tags"` // Tags were reworked since DECORT 3.7.1
|
||||
TechStatus string `json:"techStatus"`
|
||||
TotalDiskSize int `json:"totalDiskSize"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdateTime uint64 `json:"updateTime"`
|
||||
UserManaged bool `json:"userManaged"`
|
||||
Vgpus []int `json:"vgpus"`
|
||||
VinsConnected int `json:"vinsConnected"`
|
||||
VirtualImageID int `json:"virtualImageId"`
|
||||
}
|
||||
|
||||
const ComputeListAPI = "/restmachine/cloudapi/compute/list"
|
||||
|
||||
type ComputeListResp []ComputeRecord
|
||||
|
||||
const ComputeResizeAPI = "/restmachine/cloudapi/compute/resize"
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/compute/get
|
||||
//
|
||||
type SnapshotRecord struct {
|
||||
Guid string `json:"guid"`
|
||||
Label string `json:"label"`
|
||||
SnapSetGuid string `json:"snapSetGuid"`
|
||||
SnapSetTime uint64 `json:"snapSetTime"`
|
||||
TimeStamp uint64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type DiskRecord struct {
|
||||
// ACLs `json:"ACL"` - it is a dictionary, special parsing required
|
||||
// was - Acl map[string]string `json:"acl"`
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"` // NOTE: absent from compute/get output
|
||||
BootPartition int `json:"bootPartition"`
|
||||
CreatedTime uint64 `json:"creationTime"`
|
||||
DeletedTime uint64 `json:"deletionTime"`
|
||||
Desc string `json:"desc"`
|
||||
DestructionTime uint64 `json:"destructionTime"`
|
||||
DiskPath string `json:"diskPath"`
|
||||
GridID int `json:"gid"`
|
||||
ID uint `json:"id"`
|
||||
ImageID int `json:"imageId"`
|
||||
Images []int `json:"images"`
|
||||
// IOTune 'json:"iotune" - it is a dictionary
|
||||
Name string `json:"name"`
|
||||
// Order `json:"order"`
|
||||
ParentId int `json:"parentId"`
|
||||
PciSlot int `json:"pciSlot"`
|
||||
// ResID string `json:"resId"`
|
||||
// ResName string `json:"resName"`
|
||||
// Params string `json:"params"`
|
||||
Pool string `json:"pool"`
|
||||
PurgeTime uint64 `json:"purgeTime"`
|
||||
// Role string `json:"role"`
|
||||
SepType string `json:"sepType"`
|
||||
SepID int `json:"sepId"` // NOTE: absent from compute/get output
|
||||
SizeMax int `json:"sizeMax"`
|
||||
SizeUsed int `json:"sizeUsed"` // sum over all snapshots of this disk to report total consumed space
|
||||
Snapshots []SnapshotRecord `json:"snapshots"`
|
||||
Status string `json:"status"`
|
||||
TechStatus string `json:"techStatus"`
|
||||
Type string `json:"type"`
|
||||
ComputeID int `json:"vmid"`
|
||||
}
|
||||
|
||||
type OsUserRecord struct {
|
||||
Guid string `json:"guid"`
|
||||
Login string `json:"login"`
|
||||
Password string `json:"password"`
|
||||
PubKey string `json:"pubkey"`
|
||||
}
|
||||
|
||||
const ComputeGetAPI = "/restmachine/cloudapi/compute/get"
|
||||
|
||||
type ComputeGetResp struct {
|
||||
// ACLs `json:"ACL"` - it is a dictionary, special parsing required
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
Arch string `json:"arch"`
|
||||
BootDiskSize int `json:"bootdiskSize"`
|
||||
CloneReference int `json:"cloneReference"`
|
||||
Clones []int `json:"clones"`
|
||||
Cpu int `json:"cpus"`
|
||||
Desc string `json:"desc"`
|
||||
Disks []DiskRecord `json:"disks"`
|
||||
GridID int `json:"gid"`
|
||||
ID uint `json:"id"`
|
||||
ImageID int `json:"imageId"`
|
||||
ImageName string `json:"imageName"`
|
||||
Interfaces []InterfaceRecord `json:"interfaces"`
|
||||
LockStatus string `json:"lockStatus"`
|
||||
ManagerID int `json:"managerId"`
|
||||
ManagerType string `json:"manageType"`
|
||||
Name string `json:"name"`
|
||||
NatableVinsID int `json:"natableVinsId"`
|
||||
NatableVinsIP string `json:"natableVinsIp"`
|
||||
NatableVinsName string `json:"natableVinsName"`
|
||||
NatableVinsNet string `json:"natableVinsNetwork"`
|
||||
NatableVinsNetName string `json:"natableVinsNetworkName"`
|
||||
OsUsers []OsUserRecord `json:"osUsers"`
|
||||
Ram int `json:"ram"`
|
||||
RgID int `json:"rgId"`
|
||||
RgName string `json:"rgName"`
|
||||
SnapSets []SnapSetRecord `json:"snapSets"`
|
||||
Status string `json:"status"`
|
||||
// Tags []string `json:"tags"` // Tags were reworked since DECORT 3.7.1
|
||||
TechStatus string `json:"techStatus"`
|
||||
TotalDiskSize int `json:"totalDiskSize"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdateTime uint64 `json:"updateTime"`
|
||||
UserManaged bool `json:"userManaged"`
|
||||
Vgpus []int `json:"vgpus"`
|
||||
VinsConnected int `json:"vinsConnected"`
|
||||
VirtualImageID int `json:"virtualImageId"`
|
||||
}
|
||||
|
||||
//
|
||||
// structures related to /restmachine/cloudapi/image/list API
|
||||
//
|
||||
type ImageRecord struct {
|
||||
AccountID uint `json:"accountId"`
|
||||
Arch string `json:"architecture"`
|
||||
BootType string `json:"bootType"`
|
||||
IsBootable bool `json:"bootable"`
|
||||
IsCdrom bool `json:"cdrom"`
|
||||
Desc string `json:"desc"`
|
||||
IsHotResize bool `json:"hotResize"`
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Pool string `json:"pool"`
|
||||
SepID int `json:"sepId"`
|
||||
Size int `json:"size"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
Username string `json:"username"`
|
||||
IsVirtual bool `json:"virtual"`
|
||||
}
|
||||
|
||||
const ImagesListAPI = "/restmachine/cloudapi/image/list"
|
||||
|
||||
type ImagesListResp []ImageRecord
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/extnet/list API
|
||||
//
|
||||
type ExtNetRecord struct {
|
||||
Name string `json:"name"`
|
||||
ID uint `json:"id"`
|
||||
IPCIDR string `json:"ipcidr"`
|
||||
}
|
||||
|
||||
const ExtNetListAPI = "/restmachine/cloudapi/extnet/list"
|
||||
|
||||
type ExtNetListResp []ExtNetRecord
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/account/list API
|
||||
//
|
||||
type AccountRecord struct {
|
||||
// ACLs []UserAclRecord `json:"acl"`
|
||||
// CreatedTime uint64 `json:"creationTime"`
|
||||
// DeletedTime uint64 `json:"deletionTime"`
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Status string `json:"status"`
|
||||
// UpdatedTime uint64 `json:"updateTime"`
|
||||
}
|
||||
|
||||
const AccountsGetAPI = "/restmachine/cloudapi/account/get" // returns AccountRecord superset
|
||||
|
||||
const AccountsListAPI = "/restmachine/cloudapi/account/list" // returns list of abdridged info about accounts
|
||||
type AccountsListResp []AccountRecord
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/portforwarding/list API
|
||||
//
|
||||
type PfwRecord struct {
|
||||
ID int `json:"id"`
|
||||
LocalIP string `json:"localIp"`
|
||||
LocalPort int `json:"localPort"`
|
||||
Protocol string `json:"protocol"`
|
||||
PublicPortEnd int `json:"publicPortEnd"`
|
||||
PublicPortStart int `json:"publicPortStart"`
|
||||
ComputeID int `json:"vmId"`
|
||||
}
|
||||
|
||||
const ComputePfwListAPI = "/restmachine/cloudapi/compute/pfwList"
|
||||
|
||||
type ComputePfwListResp []PfwRecord
|
||||
|
||||
const ComputePfwAddAPI = "/restmachine/cloudapi/compute/pfwAdd"
|
||||
|
||||
const ComputePfwDelAPI = "/restmachine/cloudapi/compute/pfwDel"
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/compute/net Attach/Detach API
|
||||
//
|
||||
type ComputeNetMgmtRecord struct { // used to "cache" network specs when preparing to manage compute networks
|
||||
ID int
|
||||
Type string
|
||||
IPAddress string
|
||||
MAC string
|
||||
}
|
||||
|
||||
const ComputeNetAttachAPI = "/restmachine/cloudapi/compute/netAttach"
|
||||
|
||||
const ComputeNetDetachAPI = "/restmachine/cloudapi/compute/netDetach"
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/compute/disk Attach/Detach API
|
||||
//
|
||||
const ComputeDiskAttachAPI = "/restmachine/cloudapi/compute/diskAttach"
|
||||
|
||||
const ComputeDiskDetachAPI = "/restmachine/cloudapi/compute/diskDetach"
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/disks/create
|
||||
//
|
||||
const DisksCreateAPI = "/restmachine/cloudapi/disks/create"
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/disks/get
|
||||
//
|
||||
const DisksGetAPI = "/restmachine/cloudapi/disks/get" // Returns single DiskRecord on success
|
||||
|
||||
const DisksListAPI = "/restmachine/cloudapi/disks/list" // Returns list of DiskRecord on success
|
||||
type DisksListResp []DiskRecord
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/disks/resize
|
||||
//
|
||||
const DisksResizeAPI = "/restmachine/cloudapi/disks/resize2"
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/disks/resize
|
||||
//
|
||||
const DisksRenameAPI = "/restmachine/cloudapi/disks/rename"
|
||||
|
||||
//
|
||||
// structures related to /cloudapi/disks/delete
|
||||
//
|
||||
const DisksDeleteAPI = "/restmachine/cloudapi/disks/delete"
|
||||
|
||||
//
|
||||
// ViNS structures
|
||||
//
|
||||
|
||||
// this is the structure of the element in the list returned by vins/search API
|
||||
type VinsSearchRecord struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
IPCidr string `json:"network"`
|
||||
VxLanID int `json:"vxlanId"`
|
||||
ExternalIP string `json:"externalIP"`
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
RgID int `json:"rgId"`
|
||||
RgName string `json:"rgName"`
|
||||
}
|
||||
|
||||
const VinsSearchAPI = "/restmachine/cloudapi/vins/search"
|
||||
|
||||
type VinsSearchResp []VinsSearchRecord
|
||||
|
||||
type VnfRecord struct {
|
||||
ID int `json:"id"`
|
||||
AccountID int `json:"accountId"`
|
||||
Type string `json:"type"` // "DHCP", "NAT", "GW" etc
|
||||
Config map[string]interface{} `json:"config"` // NOTE: VNF specs vary by VNF type
|
||||
}
|
||||
|
||||
type VnfGwConfigRecord struct { // describes GW VNF config structure inside ViNS, as returned by API vins/get
|
||||
ExtNetID int `json:"ext_net_id"`
|
||||
ExtNetIP string `json:"ext_net_ip"`
|
||||
ExtNetMask int `json:"ext_net_mask"`
|
||||
DefaultGW string `json:"default_gw"`
|
||||
}
|
||||
type VinsRecord struct { // represents part of the response from API vins/get
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
IPCidr string `json:"network"`
|
||||
VxLanID int `json:"vxlanId"`
|
||||
ExternalIP string `json:"externalIP"`
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
RgID int `json:"rgid"`
|
||||
RgName string `json:"rgName"`
|
||||
VNFs map[string]VnfRecord `json:"vnfs"`
|
||||
Desc string `json:"desc"`
|
||||
}
|
||||
|
||||
const VinsGetAPI = "/restmachine/cloudapi/vins/get"
|
||||
|
||||
const VinsCreateInAccountAPI = "/restmachine/cloudapi/vins/createInAccount"
|
||||
const VinsCreateInRgAPI = "/restmachine/cloudapi/vins/createInRG"
|
||||
|
||||
const VinsExtNetConnectAPI = "/restmachine/cloudapi/vins/extNetConnect"
|
||||
const VinsExtNetDisconnectAPI = "/restmachine/cloudapi/vins/extNetDisconnect"
|
||||
|
||||
const VinsDeleteAPI = "/restmachine/cloudapi/vins/delete"
|
||||
|
||||
//
|
||||
// Grid ID structures
|
||||
//
|
||||
type LocationRecord struct {
|
||||
GridID int `json:"gid"`
|
||||
Id int `json:"id"`
|
||||
LocationCode string `json:"locationCode"`
|
||||
Name string `json:"name"`
|
||||
Flag string `json:"flag"`
|
||||
}
|
||||
|
||||
const LocationsListAPI = "/restmachine/cloudapi/locations/list" // Returns list of GridRecord on success
|
||||
type LocationsListResp []LocationRecord
|
||||
|
||||
//
|
||||
// Auxiliary structures
|
||||
//
|
||||
type SshKeyConfig struct {
|
||||
User string
|
||||
SshKey string
|
||||
UserShell string
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/terraform"
|
||||
)
|
||||
|
||||
var decsController *ControllerCfg
|
||||
|
||||
func Provider() *schema.Provider {
|
||||
return &schema.Provider{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"authenticator": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
StateFunc: stateFuncToLower,
|
||||
ValidateFunc: validation.StringInSlice([]string{"oauth2", "legacy", "jwt"}, true), // ignore case while validating
|
||||
Description: "Authentication mode to use when connecting to DECORT cloud API. Should be one of 'oauth2', 'legacy' or 'jwt'.",
|
||||
},
|
||||
|
||||
"oauth2_url": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
StateFunc: stateFuncToLower,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_OAUTH2_URL", nil),
|
||||
Description: "OAuth2 application URL in 'oauth2' authentication mode.",
|
||||
},
|
||||
|
||||
"controller_url": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
StateFunc: stateFuncToLower,
|
||||
Description: "URL of DECORT Cloud controller to use. API calls will be directed to this URL.",
|
||||
},
|
||||
|
||||
"user": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_USER", nil),
|
||||
Description: "User name for DECORT cloud API operations in 'legacy' authentication mode.",
|
||||
},
|
||||
|
||||
"password": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_PASSWORD", nil),
|
||||
Description: "User password for DECORT cloud API operations in 'legacy' authentication mode.",
|
||||
},
|
||||
|
||||
"app_id": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_APP_ID", nil),
|
||||
Description: "Application ID to access DECORT cloud API in 'oauth2' authentication mode.",
|
||||
},
|
||||
|
||||
"app_secret": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_APP_SECRET", nil),
|
||||
Description: "Application secret to access DECORT cloud API in 'oauth2' authentication mode.",
|
||||
},
|
||||
|
||||
"jwt": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_JWT", nil),
|
||||
Description: "JWT to access DECORT cloud API in 'jwt' authentication mode.",
|
||||
},
|
||||
|
||||
"allow_unverified_ssl": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: false,
|
||||
Description: "If true, DECORT API will not verify SSL certificates. Use this with caution and in trusted environments only!",
|
||||
},
|
||||
},
|
||||
|
||||
ResourcesMap: map[string]*schema.Resource{
|
||||
"decort_resgroup": resourceResgroup(),
|
||||
"decort_kvmvm": resourceCompute(),
|
||||
"decort_disk": resourceDisk(),
|
||||
"decort_vins": resourceVins(),
|
||||
// "decort_pfw": resourcePfw(),
|
||||
},
|
||||
|
||||
DataSourcesMap: map[string]*schema.Resource{
|
||||
"decort_account": dataSourceAccount(),
|
||||
"decort_resgroup": dataSourceResgroup(),
|
||||
"decort_kvmvm": dataSourceCompute(),
|
||||
"decort_image": dataSourceImage(),
|
||||
"decort_disk": dataSourceDisk(),
|
||||
"decort_vins": dataSourceVins(),
|
||||
// "decort_pfw": dataSourcePfw(),
|
||||
},
|
||||
|
||||
ConfigureFunc: providerConfigure,
|
||||
}
|
||||
}
|
||||
|
||||
func stateFuncToLower(argval interface{}) string {
|
||||
return strings.ToLower(argval.(string))
|
||||
}
|
||||
|
||||
func stateFuncToUpper(argval interface{}) string {
|
||||
return strings.ToUpper(argval.(string))
|
||||
}
|
||||
|
||||
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
||||
decsController, err := ControllerConfigure(d)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// initialize global default Grid ID - it will be needed to create some resource types, e.g. disks
|
||||
gridId, err := decsController.utilityLocationGetDefaultGridID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if gridId == 0 {
|
||||
return nil, fmt.Errorf("providerConfigure: invalid default Grid ID = 0")
|
||||
}
|
||||
|
||||
return decsController, nil
|
||||
}
|
||||
@@ -1,577 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
func cloudInitDiffSupperss(key, oldVal, newVal string, d *schema.ResourceData) bool {
|
||||
if oldVal == "" && newVal != "applied" {
|
||||
// if old value for "cloud_init" resource is empty string, it means that we are creating new compute
|
||||
// and there is a chance that the user will want custom cloud init parameters - so we check if
|
||||
// cloud_init is explicitly set in TF file by making sure that its new value is different from "applied",
|
||||
// which is a reserved key word.
|
||||
log.Debugf("cloudInitDiffSupperss: key=%s, oldVal=%q, newVal=%q -> suppress=FALSE", key, oldVal, newVal)
|
||||
return false // there is a difference between stored and new value
|
||||
}
|
||||
log.Debugf("cloudInitDiffSupperss: key=%s, oldVal=%q, newVal=%q -> suppress=TRUE", key, oldVal, newVal)
|
||||
return true // suppress difference
|
||||
}
|
||||
|
||||
func resourceComputeCreate(d *schema.ResourceData, m interface{}) error {
|
||||
// we assume all mandatory parameters it takes to create a comptue instance are properly
|
||||
// specified - we rely on schema "Required" attributes to let Terraform validate them for us
|
||||
|
||||
log.Debugf("resourceComputeCreate: called for Compute name %q, RG ID %d", d.Get("name").(string), d.Get("rg_id").(int))
|
||||
|
||||
// create basic Compute (i.e. without extra disks and network connections - those will be attached
|
||||
// by subsequent individual API calls).
|
||||
// creating Compute is a multi-step workflow, which may fail at some step, so we use "partial" feature of Terraform
|
||||
d.Partial(true)
|
||||
controller := m.(*ControllerCfg)
|
||||
urlValues := &url.Values{}
|
||||
urlValues.Add("rgId", fmt.Sprintf("%d", d.Get("rg_id").(int)))
|
||||
urlValues.Add("name", d.Get("name").(string))
|
||||
urlValues.Add("cpu", fmt.Sprintf("%d", d.Get("cpu").(int)))
|
||||
urlValues.Add("ram", fmt.Sprintf("%d", d.Get("ram").(int)))
|
||||
urlValues.Add("imageId", fmt.Sprintf("%d", d.Get("image_id").(int)))
|
||||
urlValues.Add("bootDisk", fmt.Sprintf("%d", d.Get("boot_disk_size").(int)))
|
||||
urlValues.Add("netType", "NONE") // at the 1st step create isolated compute
|
||||
urlValues.Add("start", "0") // at the 1st step create compute in a stopped state
|
||||
|
||||
argVal, argSet := d.GetOk("description")
|
||||
if argSet {
|
||||
urlValues.Add("desc", argVal.(string))
|
||||
}
|
||||
|
||||
/*
|
||||
sshKeysVal, sshKeysSet := d.GetOk("ssh_keys")
|
||||
if sshKeysSet {
|
||||
// process SSH Key settings and set API values accordingly
|
||||
log.Debugf("resourceComputeCreate: calling makeSshKeysArgString to setup SSH keys for guest login(s)")
|
||||
urlValues.Add("userdata", makeSshKeysArgString(sshKeysVal.([]interface{})))
|
||||
}
|
||||
*/
|
||||
|
||||
computeCreateAPI := KvmX86CreateAPI
|
||||
driver := d.Get("driver").(string)
|
||||
if driver == "KVM_PPC" {
|
||||
computeCreateAPI = KvmPPCCreateAPI
|
||||
log.Debugf("resourceComputeCreate: creating Compute of type KVM VM PowerPC")
|
||||
} else { // note that we do not validate arch value for explicit "KVM_X86" here
|
||||
log.Debugf("resourceComputeCreate: creating Compute of type KVM VM x86")
|
||||
}
|
||||
|
||||
argVal, argSet = d.GetOk("cloud_init")
|
||||
if argSet {
|
||||
// userdata must not be empty string and must not be a reserved keyword "applied"
|
||||
userdata := argVal.(string)
|
||||
if userdata != "" && userdata != "applied" {
|
||||
urlValues.Add("userdata", userdata)
|
||||
}
|
||||
}
|
||||
|
||||
apiResp, err := controller.decortAPICall("POST", computeCreateAPI, urlValues)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Compute create API returns ID of the new Compute instance on success
|
||||
|
||||
d.SetId(apiResp) // update ID of the resource to tell Terraform that the resource exists, albeit partially
|
||||
compId, _ := strconv.Atoi(apiResp)
|
||||
d.SetPartial("name")
|
||||
d.SetPartial("description")
|
||||
d.SetPartial("cpu")
|
||||
d.SetPartial("ram")
|
||||
d.SetPartial("image_id")
|
||||
d.SetPartial("boot_disk_size")
|
||||
/*
|
||||
if sshKeysSet {
|
||||
d.SetPartial("ssh_keys")
|
||||
}
|
||||
*/
|
||||
|
||||
log.Debugf("resourceComputeCreate: new simple Compute ID %d, name %s created", compId, d.Get("name").(string))
|
||||
|
||||
// Configure data disks if any
|
||||
extraDisksOk := true
|
||||
argVal, argSet = d.GetOk("extra_disks")
|
||||
if argSet && argVal.(*schema.Set).Len() > 0 {
|
||||
// urlValues.Add("desc", argVal.(string))
|
||||
log.Debugf("resourceComputeCreate: calling utilityComputeExtraDisksConfigure to attach %d extra disk(s)", argVal.(*schema.Set).Len())
|
||||
err = controller.utilityComputeExtraDisksConfigure(d, false) // do_delta=false, as we are working on a new compute
|
||||
if err != nil {
|
||||
log.Errorf("resourceComputeCreate: error when attaching extra disk(s) to a new Compute ID %s: %s", compId, err)
|
||||
extraDisksOk = false
|
||||
}
|
||||
}
|
||||
if extraDisksOk {
|
||||
d.SetPartial("extra_disks")
|
||||
}
|
||||
|
||||
// Configure external networks if any
|
||||
netsOk := true
|
||||
argVal, argSet = d.GetOk("network")
|
||||
if argSet && argVal.(*schema.Set).Len() > 0 {
|
||||
log.Debugf("resourceComputeCreate: calling utilityComputeNetworksConfigure to attach %d network(s)", argVal.(*schema.Set).Len())
|
||||
err = controller.utilityComputeNetworksConfigure(d, false) // do_delta=false, as we are working on a new compute
|
||||
if err != nil {
|
||||
log.Errorf("resourceComputeCreate: error when attaching networks to a new Compute ID %d: %s", compId, err)
|
||||
netsOk = false
|
||||
}
|
||||
}
|
||||
if netsOk {
|
||||
// there were no errors reported when configuring networks
|
||||
d.SetPartial("network")
|
||||
}
|
||||
|
||||
if extraDisksOk && netsOk {
|
||||
// if there were no errors in setting any of the subresources, we may leave Partial mode
|
||||
d.Partial(false)
|
||||
}
|
||||
|
||||
// Note bene: we created compute in a STOPPED state (this is required to properly attach 1st network interface),
|
||||
// now we need to start it before we report the sequence complete
|
||||
if d.Get("started").(bool) {
|
||||
reqValues := &url.Values{}
|
||||
reqValues.Add("computeId", fmt.Sprintf("%d", compId))
|
||||
log.Debugf("resourceComputeCreate: starting Compute ID %d after completing its resource configuration", compId)
|
||||
apiResp, err = controller.decortAPICall("POST", ComputeStartAPI, reqValues)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("resourceComputeCreate: new Compute ID %d, name %s creation sequence complete", compId, d.Get("name").(string))
|
||||
|
||||
// We may reuse dataSourceComputeRead here as we maintain similarity
|
||||
// between Compute resource and Compute data source schemas
|
||||
// Compute read function will also update resource ID on success, so that Terraform
|
||||
// will know the resource exists
|
||||
return dataSourceComputeRead(d, m)
|
||||
}
|
||||
|
||||
func resourceComputeRead(d *schema.ResourceData, m interface{}) error {
|
||||
log.Debugf("resourceComputeRead: called for Compute name %s, RG ID %d",
|
||||
d.Get("name").(string), d.Get("rg_id").(int))
|
||||
|
||||
compFacts, err := utilityComputeCheckPresence(d, m)
|
||||
if compFacts == "" {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Compute with such name and RG ID was not found
|
||||
return nil
|
||||
}
|
||||
|
||||
if err = flattenCompute(d, compFacts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debugf("resourceComputeRead: after flattenCompute: Compute ID %s, name %q, RG ID %d",
|
||||
d.Id(), d.Get("name").(string), d.Get("rg_id").(int))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceComputeUpdate(d *schema.ResourceData, m interface{}) error {
|
||||
log.Debugf("resourceComputeUpdate: called for Compute ID %s / name %s, RGID %d",
|
||||
d.Id(), d.Get("name").(string), d.Get("rg_id").(int))
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
|
||||
/*
|
||||
1. Resize CPU/RAM
|
||||
2. Resize (grow) boot disk
|
||||
3. Update extra disks
|
||||
4. Update networks
|
||||
5. Start/stop
|
||||
*/
|
||||
|
||||
// 1. Resize CPU/RAM
|
||||
params := &url.Values{}
|
||||
doUpdate := false
|
||||
params.Add("computeId", d.Id())
|
||||
|
||||
d.Partial(true)
|
||||
|
||||
oldCpu, newCpu := d.GetChange("cpu")
|
||||
if oldCpu.(int) != newCpu.(int) {
|
||||
params.Add("cpu", fmt.Sprintf("%d", newCpu.(int)))
|
||||
doUpdate = true
|
||||
} else {
|
||||
params.Add("cpu", "0") // no change to CPU allocation
|
||||
}
|
||||
|
||||
oldRam, newRam := d.GetChange("ram")
|
||||
if oldRam.(int) != newRam.(int) {
|
||||
params.Add("ram", fmt.Sprintf("%d", newRam.(int)))
|
||||
doUpdate = true
|
||||
} else {
|
||||
params.Add("ram", "0")
|
||||
}
|
||||
|
||||
if doUpdate {
|
||||
log.Debugf("resourceComputeUpdate: changing CPU %d -> %d and/or RAM %d -> %d",
|
||||
oldCpu.(int), newCpu.(int),
|
||||
oldRam.(int), newRam.(int))
|
||||
_, err := controller.decortAPICall("POST", ComputeResizeAPI, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d.SetPartial("cpu")
|
||||
d.SetPartial("ram")
|
||||
}
|
||||
|
||||
// 2. Resize (grow) Boot disk
|
||||
oldSize, newSize := d.GetChange("boot_disk_size")
|
||||
if oldSize.(int) < newSize.(int) {
|
||||
bdsParams := &url.Values{}
|
||||
bdsParams.Add("diskId", fmt.Sprintf("%d", d.Get("boot_disk_id").(int)))
|
||||
bdsParams.Add("size", fmt.Sprintf("%d", newSize.(int)))
|
||||
log.Debugf("resourceComputeUpdate: compute ID %s, boot disk ID %d resize %d -> %d",
|
||||
d.Id(), d.Get("boot_disk_id").(int), oldSize.(int), newSize.(int))
|
||||
_, err := controller.decortAPICall("POST", DisksResizeAPI, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d.SetPartial("boot_disk_size")
|
||||
} else if oldSize.(int) > newSize.(int) {
|
||||
log.Warnf("resourceComputeUpdate: compute ID %d - shrinking boot disk is not allowed", d.Id())
|
||||
}
|
||||
|
||||
// 3. Calculate and apply changes to data disks
|
||||
err := controller.utilityComputeExtraDisksConfigure(d, true) // pass do_delta = true to apply changes, if any
|
||||
if err != nil {
|
||||
return err
|
||||
} else {
|
||||
d.SetPartial("extra_disks")
|
||||
}
|
||||
|
||||
// 4. Calculate and apply changes to network connections
|
||||
err = controller.utilityComputeNetworksConfigure(d, true) // pass do_delta = true to apply changes, if any
|
||||
if err != nil {
|
||||
return err
|
||||
} else {
|
||||
d.SetPartial("network")
|
||||
}
|
||||
|
||||
if d.HasChange("started") {
|
||||
params := &url.Values{}
|
||||
params.Add("computeId", d.Id())
|
||||
if d.Get("started").(bool) {
|
||||
if _, err := controller.decortAPICall("POST", ComputeStartAPI, params); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if _, err := controller.decortAPICall("POST", ComputeStopAPI, params); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
d.SetPartial("started")
|
||||
}
|
||||
|
||||
d.Partial(false)
|
||||
|
||||
// we may reuse dataSourceComputeRead here as we maintain similarity
|
||||
// between Compute resource and Compute data source schemas
|
||||
return dataSourceComputeRead(d, m)
|
||||
}
|
||||
|
||||
func resourceComputeDelete(d *schema.ResourceData, m interface{}) error {
|
||||
// NOTE: this function destroys target Compute instance "permanently", so
|
||||
// there is no way to restore it.
|
||||
// If compute being destroyed has some extra disks attached, they are
|
||||
// detached from the compute
|
||||
log.Debugf("resourceComputeDelete: called for Compute name %s, RG ID %d",
|
||||
d.Get("name").(string), d.Get("rg_id").(int))
|
||||
|
||||
compFacts, err := utilityComputeCheckPresence(d, m)
|
||||
if compFacts == "" {
|
||||
// the target Compute does not exist - in this case according to Terraform best practice
|
||||
// we exit from Destroy method without error
|
||||
return nil
|
||||
}
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
|
||||
model := ComputeGetResp{}
|
||||
log.Debugf("resourceComputeDelete: ready to unmarshal string %s", compFacts)
|
||||
err = json.Unmarshal([]byte(compFacts), &model)
|
||||
if err == nil && len(model.Disks) > 0 {
|
||||
// prepare to detach data disks from compute - do it only if compFacts unmarshalled
|
||||
// properly and the resulting model contains non-empty Disks list
|
||||
for _, diskFacts := range model.Disks {
|
||||
if diskFacts.Type == "B" {
|
||||
// boot disk is never detached on compute delete
|
||||
continue
|
||||
}
|
||||
|
||||
log.Debugf("resourceComputeDelete: ready to detach data disk ID %d from compute ID %s", diskFacts.ID, d.Id())
|
||||
|
||||
detachParams := &url.Values{}
|
||||
detachParams.Add("computeId", d.Id())
|
||||
detachParams.Add("diskId", fmt.Sprintf("%d", diskFacts.ID))
|
||||
|
||||
_, err = controller.decortAPICall("POST", ComputeDiskDetachAPI, detachParams)
|
||||
if err != nil {
|
||||
// We do not fail compute deletion on data disk detach errors
|
||||
log.Errorf("resourceComputeDelete: error when detaching Disk ID %d: %s", diskFacts.ID, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
params := &url.Values{}
|
||||
params.Add("computeId", d.Id())
|
||||
params.Add("permanently", "1")
|
||||
// TODO: this is for the upcoming API update - params.Add("detachdisks", "1")
|
||||
|
||||
_, err = controller.decortAPICall("POST", ComputeDeleteAPI, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceComputeExists(d *schema.ResourceData, m interface{}) (bool, error) {
|
||||
// Reminder: according to Terraform rules, this function should not modify its ResourceData argument
|
||||
log.Debugf("resourceComputeExist: called for Compute name %s, RG ID %d",
|
||||
d.Get("name").(string), d.Get("rg_id").(int))
|
||||
|
||||
compFacts, err := utilityComputeCheckPresence(d, m)
|
||||
if compFacts == "" {
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func resourceCompute() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
Create: resourceComputeCreate,
|
||||
Read: resourceComputeRead,
|
||||
Update: resourceComputeUpdate,
|
||||
Delete: resourceComputeDelete,
|
||||
Exists: resourceComputeExists,
|
||||
|
||||
Importer: &schema.ResourceImporter{
|
||||
State: schema.ImportStatePassthrough,
|
||||
},
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Create: &Timeout180s,
|
||||
Read: &Timeout30s,
|
||||
Update: &Timeout180s,
|
||||
Delete: &Timeout60s,
|
||||
Default: &Timeout60s,
|
||||
},
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Description: "Name of this compute. Compute names are case sensitive and must be unique in the resource group.",
|
||||
},
|
||||
|
||||
"rg_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
ValidateFunc: validation.IntAtLeast(1),
|
||||
Description: "ID of the resource group where this compute should be deployed.",
|
||||
},
|
||||
|
||||
"driver": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
StateFunc: stateFuncToUpper,
|
||||
ValidateFunc: validation.StringInSlice([]string{"KVM_X86", "KVM_PPC"}, false), // observe case while validating
|
||||
Description: "Hardware architecture of this compute instance.",
|
||||
},
|
||||
|
||||
"cpu": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
ValidateFunc: validation.IntBetween(1, MaxCpusPerCompute),
|
||||
Description: "Number of CPUs to allocate to this compute instance.",
|
||||
},
|
||||
|
||||
"ram": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
ValidateFunc: validation.IntAtLeast(MinRamPerCompute),
|
||||
Description: "Amount of RAM in MB to allocate to this compute instance.",
|
||||
},
|
||||
|
||||
"image_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
ValidateFunc: validation.IntAtLeast(1),
|
||||
Description: "ID of the OS image to base this compute instance on.",
|
||||
},
|
||||
|
||||
"boot_disk_size": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
Description: "This compute instance boot disk size in GB. Make sure it is large enough to accomodate selected OS image.",
|
||||
},
|
||||
|
||||
"extra_disks": {
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
MaxItems: MaxExtraDisksPerCompute,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "Optional list of IDs of extra disks to attach to this compute. You may specify several extra disks.",
|
||||
},
|
||||
|
||||
"network": {
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
MaxItems: MaxNetworksPerCompute,
|
||||
Elem: &schema.Resource{
|
||||
Schema: networkSubresourceSchemaMake(),
|
||||
},
|
||||
Description: "Optional network connection(s) for this compute. You may specify several network blocks, one for each connection.",
|
||||
},
|
||||
|
||||
/*
|
||||
"ssh_keys": {
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
MaxItems: MaxSshKeysPerCompute,
|
||||
Elem: &schema.Resource{
|
||||
Schema: sshSubresourceSchemaMake(),
|
||||
},
|
||||
Description: "SSH keys to authorize on this compute instance.",
|
||||
},
|
||||
*/
|
||||
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Optional text description of this compute instance.",
|
||||
},
|
||||
|
||||
"cloud_init": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Default: "applied",
|
||||
DiffSuppressFunc: cloudInitDiffSupperss,
|
||||
Description: "Optional cloud_init parameters. Applied when creating new compute instance only, ignored in all other cases.",
|
||||
},
|
||||
|
||||
// The rest are Compute properties, which are "computed" once it is created
|
||||
"rg_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Name of the resource group where this compute instance is located.",
|
||||
},
|
||||
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "ID of the account this compute instance belongs to.",
|
||||
},
|
||||
|
||||
"account_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Name of the account this compute instance belongs to.",
|
||||
},
|
||||
|
||||
"boot_disk_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "This compute instance boot disk ID.",
|
||||
},
|
||||
|
||||
"os_users": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: osUsersSubresourceSchemaMake(),
|
||||
},
|
||||
Description: "Guest OS users provisioned on this compute instance.",
|
||||
},
|
||||
|
||||
"started": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: true,
|
||||
Description: "Is compute started.",
|
||||
},
|
||||
|
||||
/*
|
||||
"disks": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: dataSourceDiskSchemaMake(), // ID, type, name, size, account ID, SEP ID, SEP type, pool, status, tech status, compute ID, image ID
|
||||
},
|
||||
Description: "Detailed specification for all disks attached to this compute instance (including bood disk).",
|
||||
},
|
||||
|
||||
"interfaces": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: interfaceSubresourceSchemaMake(),
|
||||
},
|
||||
Description: "Specification for the virtual NICs configured on this compute instance.",
|
||||
},
|
||||
|
||||
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Current model status of this compute instance.",
|
||||
},
|
||||
|
||||
"tech_status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Current technical status of this compute instance.",
|
||||
},
|
||||
*/
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,323 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
// "encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
func resourceDiskCreate(d *schema.ResourceData, m interface{}) error {
|
||||
log.Debugf("resourceDiskCreate: called for Disk name %q, Account ID %d", d.Get("name").(string), d.Get("account_id").(int))
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
urlValues := &url.Values{}
|
||||
// accountId, gid, name, description, size, type, sep_id, pool
|
||||
urlValues.Add("accountId", fmt.Sprintf("%d", d.Get("account_id").(int)))
|
||||
urlValues.Add("gid", fmt.Sprintf("%d", DefaultGridID)) // we use default Grid ID, which was obtained along with DECORT Controller init
|
||||
urlValues.Add("name", d.Get("name").(string))
|
||||
urlValues.Add("size", fmt.Sprintf("%d", d.Get("size").(int)))
|
||||
urlValues.Add("type", "D") // NOTE: only disks of Data type are managed via plugin
|
||||
urlValues.Add("sep_id", fmt.Sprintf("%d", d.Get("sep_id").(int)))
|
||||
urlValues.Add("pool", d.Get("pool").(string))
|
||||
|
||||
argVal, argSet := d.GetOk("description")
|
||||
if argSet {
|
||||
urlValues.Add("description", argVal.(string))
|
||||
}
|
||||
|
||||
apiResp, err := controller.decortAPICall("POST", DisksCreateAPI, urlValues)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.SetId(apiResp) // update ID of the resource to tell Terraform that the disk resource exists
|
||||
diskId, _ := strconv.Atoi(apiResp)
|
||||
|
||||
log.Debugf("resourceDiskCreate: new Disk ID / name %d / %s creation sequence complete", diskId, d.Get("name").(string))
|
||||
|
||||
// We may reuse dataSourceDiskRead here as we maintain similarity
|
||||
// between Disk resource and Disk data source schemas
|
||||
// Disk resource read function will also update resource ID on success, so that Terraform
|
||||
// will know the resource exists (however, we already did it a few lines before)
|
||||
return dataSourceDiskRead(d, m)
|
||||
}
|
||||
|
||||
func resourceDiskRead(d *schema.ResourceData, m interface{}) error {
|
||||
diskFacts, err := utilityDiskCheckPresence(d, m)
|
||||
if diskFacts == "" {
|
||||
// if empty string is returned from utilityDiskCheckPresence then there is no
|
||||
// such Disk and err tells so - just return it to the calling party
|
||||
d.SetId("") // ensure ID is empty
|
||||
return err
|
||||
}
|
||||
|
||||
return flattenDisk(d, diskFacts)
|
||||
}
|
||||
|
||||
func resourceDiskUpdate(d *schema.ResourceData, m interface{}) error {
|
||||
// Update will only change the following attributes of the disk:
|
||||
// - Size; to keep data safe, shrinking disk is not allowed.
|
||||
// - Name
|
||||
//
|
||||
// Attempt to change disk type will throw an error and mark disk
|
||||
// resource as partially updated
|
||||
log.Debugf("resourceDiskUpdate: called for Disk ID / name %s / %s, Account ID %d",
|
||||
d.Id(), d.Get("name").(string), d.Get("account_id").(int))
|
||||
|
||||
d.Partial(true)
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
|
||||
oldSize, newSize := d.GetChange("size")
|
||||
if oldSize.(int) < newSize.(int) {
|
||||
log.Debugf("resourceDiskUpdate: resizing disk ID %s - %d GB -> %d GB",
|
||||
d.Id(), oldSize.(int), newSize.(int))
|
||||
sizeParams := &url.Values{}
|
||||
sizeParams.Add("diskId", d.Id())
|
||||
sizeParams.Add("size", fmt.Sprintf("%d", newSize.(int)))
|
||||
_, err := controller.decortAPICall("POST", DisksResizeAPI, sizeParams)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d.SetPartial("size")
|
||||
} else if oldSize.(int) > newSize.(int) {
|
||||
return fmt.Errorf("resourceDiskUpdate: Disk ID %s - reducing disk size is not allowed", d.Id())
|
||||
}
|
||||
|
||||
oldName, newName := d.GetChange("name")
|
||||
if oldName.(string) != newName.(string) {
|
||||
log.Debugf("resourceDiskUpdate: renaming disk ID %d - %s -> %s",
|
||||
d.Get("disk_id").(int), oldName.(string), newName.(string))
|
||||
renameParams := &url.Values{}
|
||||
renameParams.Add("diskId", d.Id())
|
||||
renameParams.Add("name", newName.(string))
|
||||
_, err := controller.decortAPICall("POST", DisksRenameAPI, renameParams)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d.SetPartial("name")
|
||||
}
|
||||
|
||||
/*
|
||||
NOTE: plugin will manage disks of type "Data" only, and type cannot be changed once disk is created
|
||||
|
||||
oldType, newType := d.GetChange("type")
|
||||
if oldType.(string) != newType.(string) {
|
||||
return fmt.Errorf("resourceDiskUpdate: Disk ID %s - changing type of existing disk not allowed", d.Id())
|
||||
}
|
||||
*/
|
||||
|
||||
d.Partial(false)
|
||||
|
||||
// we may reuse dataSourceDiskRead here as we maintain similarity
|
||||
// between Compute resource and Compute data source schemas
|
||||
return dataSourceDiskRead(d, m)
|
||||
}
|
||||
|
||||
func resourceDiskDelete(d *schema.ResourceData, m interface{}) error {
|
||||
// NOTE: this function tries to detach and destroy target Disk "permanently", so
|
||||
// there is no way to restore it.
|
||||
// If, however, the disk is attached to a compute, the method will
|
||||
// fail (by failing the underpinning DECORt API call, which is issued with detach=false)
|
||||
log.Debugf("resourceDiskDelete: called for Disk ID / name %d / %s, Account ID %d",
|
||||
d.Get("disk_id").(int), d.Get("name").(string), d.Get("account_id").(int))
|
||||
|
||||
diskFacts, err := utilityDiskCheckPresence(d, m)
|
||||
if diskFacts == "" {
|
||||
// the specified Disk does not exist - in this case according to Terraform best practice
|
||||
// we exit from Destroy method without error
|
||||
return nil
|
||||
}
|
||||
|
||||
params := &url.Values{}
|
||||
params.Add("diskId", d.Id())
|
||||
// NOTE: we are not force-detaching disk from a compute (if attached) thus protecting
|
||||
// data that may be on that disk from destruction.
|
||||
// However, this may change in the future, as TF state management logic may want
|
||||
// to delete disk resource BEFORE it is detached from compute instance, and, while
|
||||
// perfectly OK from data preservation viewpoint, this is breaking expected TF workflow
|
||||
// in the eyes of an experienced TF user
|
||||
params.Add("detach", "0")
|
||||
params.Add("permanently", "1")
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
_, err = controller.decortAPICall("POST", DisksDeleteAPI, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceDiskExists(d *schema.ResourceData, m interface{}) (bool, error) {
|
||||
// Reminder: according to Terraform rules, this function should not modify its ResourceData argument
|
||||
log.Debugf("resourceDiskExists: called for Disk ID / name %d / %s, Account ID %d",
|
||||
d.Get("disk_id").(int), d.Get("name").(string), d.Get("account_id").(int))
|
||||
|
||||
diskFacts, err := utilityDiskCheckPresence(d, m)
|
||||
if diskFacts == "" {
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func resourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
rets := map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Name of this disk. NOTE: disk names are NOT unique within an account. If disk ID is specified, disk name is ignored.",
|
||||
},
|
||||
|
||||
"disk_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "ID of the disk to get. If disk ID is specified, then disk name and account ID are ignored.",
|
||||
},
|
||||
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "ID of the account this disk belongs to.",
|
||||
},
|
||||
|
||||
"sep_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
ValidateFunc: validation.IntAtLeast(1),
|
||||
Description: "Storage end-point provider serving this disk. Cannot be changed for existing disk.",
|
||||
},
|
||||
|
||||
"pool": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
ValidateFunc: validation.StringIsNotEmpty,
|
||||
Description: "Pool where this disk is located. Cannot be changed for existing disk.",
|
||||
},
|
||||
|
||||
"size": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
ValidateFunc: validation.IntAtLeast(1),
|
||||
Description: "Size of the disk in GB. Note, that existing disks can only be grown in size.",
|
||||
},
|
||||
|
||||
/* We moved "type" attribute to computed attributes section, as plugin manages disks of only
|
||||
one type - "D", e.g. data disks.
|
||||
"type": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Default: "D",
|
||||
StateFunc: stateFuncToUpper,
|
||||
ValidateFunc: validation.StringInSlice([]string{"B", "D"}, false),
|
||||
Description: "Optional type of this disk. Defaults to D, i.e. data disk. Cannot be changed for existing disks.",
|
||||
},
|
||||
*/
|
||||
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Default: "Disk resource managed by Terraform",
|
||||
Description: "Optional user-defined text description of this disk.",
|
||||
},
|
||||
|
||||
// The rest of the attributes are all computed
|
||||
"account_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Name of the account this disk belongs to.",
|
||||
},
|
||||
|
||||
"image_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "ID of the image, which this disk was cloned from (if ever cloned).",
|
||||
},
|
||||
|
||||
"type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Type of this disk.",
|
||||
},
|
||||
|
||||
"sep_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Type of the storage end-point provider serving this disk.",
|
||||
},
|
||||
|
||||
/*
|
||||
"snapshots": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource {
|
||||
Schema: snapshotSubresourceSchemaMake(),
|
||||
},
|
||||
Description: "List of user-created snapshots for this disk."
|
||||
},
|
||||
*/
|
||||
}
|
||||
|
||||
return rets
|
||||
}
|
||||
|
||||
func resourceDisk() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
Create: resourceDiskCreate,
|
||||
Read: resourceDiskRead,
|
||||
Update: resourceDiskUpdate,
|
||||
Delete: resourceDiskDelete,
|
||||
Exists: resourceDiskExists,
|
||||
|
||||
Importer: &schema.ResourceImporter{
|
||||
State: schema.ImportStatePassthrough,
|
||||
},
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Create: &Timeout180s,
|
||||
Read: &Timeout30s,
|
||||
Update: &Timeout180s,
|
||||
Delete: &Timeout60s,
|
||||
Default: &Timeout60s,
|
||||
},
|
||||
|
||||
Schema: resourceDiskSchemaMake(),
|
||||
}
|
||||
}
|
||||
@@ -1,417 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions. All Rights Reserved.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
func resourceResgroupCreate(d *schema.ResourceData, m interface{}) error {
|
||||
// First validate that we have all parameters required to create the new Resource Group
|
||||
|
||||
// Valid account ID is required to create new resource group
|
||||
// obtain Account ID by account name - it should not be zero on success
|
||||
validated_account_id, err := utilityGetAccountIdBySchema(d, m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rg_name, arg_set := d.GetOk("name")
|
||||
if !arg_set {
|
||||
return fmt.Errorf("Cannot create new RG: missing name.")
|
||||
}
|
||||
|
||||
/* Current version of provider works with default grid id (same is true for disk resources)
|
||||
grid_id, arg_set := d.GetOk("grid_id")
|
||||
if !arg_set {
|
||||
return fmt.Errorf("Cannot create new RG %q in account ID %d: missing Grid ID.",
|
||||
rg_name.(string), validated_account_id)
|
||||
}
|
||||
if grid_id.(int) < 1 {
|
||||
grid_id = DefaultGridID
|
||||
}
|
||||
*/
|
||||
|
||||
// all required parameters are set in the schema - we can continue with RG creation
|
||||
log.Debugf("resourceResgroupCreate: called for RG name %s, account ID %d",
|
||||
rg_name.(string), validated_account_id)
|
||||
|
||||
// quota settings are optional
|
||||
set_quota := false
|
||||
var quota_record QuotaRecord
|
||||
arg_value, arg_set := d.GetOk("quota")
|
||||
if arg_set {
|
||||
log.Debugf("resourceResgroupCreate: setting Quota on RG requested")
|
||||
quota_record, _ = makeQuotaRecord(arg_value.([]interface{}))
|
||||
set_quota = true
|
||||
}
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
log.Debugf("resourceResgroupCreate: called by user %q for RG name %s, account ID %d",
|
||||
controller.getDecortUsername(),
|
||||
rg_name.(string), validated_account_id)
|
||||
|
||||
url_values := &url.Values{}
|
||||
url_values.Add("accountId", fmt.Sprintf("%d", validated_account_id))
|
||||
url_values.Add("name", rg_name.(string))
|
||||
url_values.Add("gid", fmt.Sprintf("%d", DefaultGridID)) // use default Grid ID, similar to disk resource mgmt convention
|
||||
url_values.Add("owner", controller.getDecortUsername())
|
||||
|
||||
// pass quota values as set
|
||||
if set_quota {
|
||||
url_values.Add("maxCPUCapacity", fmt.Sprintf("%d", quota_record.Cpu))
|
||||
url_values.Add("maxVDiskCapacity", fmt.Sprintf("%d", quota_record.Disk))
|
||||
url_values.Add("maxMemoryCapacity", fmt.Sprintf("%f", quota_record.Ram)) // RAM quota is float; this may change in the future
|
||||
url_values.Add("maxNetworkPeerTransfer", fmt.Sprintf("%d", quota_record.ExtTraffic))
|
||||
url_values.Add("maxNumPublicIP", fmt.Sprintf("%d", quota_record.ExtIPs))
|
||||
// url_values.Add("???", fmt.Sprintf("%d", quota_record.GpuUnits))
|
||||
}
|
||||
|
||||
// parse and handle network settings
|
||||
def_net_type, arg_set := d.GetOk("def_net_type")
|
||||
if arg_set {
|
||||
url_values.Add("def_net", def_net_type.(string)) // NOTE: in API default network type is set by "def_net" parameter
|
||||
}
|
||||
|
||||
ipcidr, arg_set := d.GetOk("ipcidr")
|
||||
if arg_set {
|
||||
url_values.Add("ipcidr", ipcidr.(string))
|
||||
}
|
||||
|
||||
ext_net_id, arg_set := d.GetOk("ext_net_id")
|
||||
if arg_set {
|
||||
url_values.Add("extNetId", fmt.Sprintf("%d", ext_net_id.(int)))
|
||||
}
|
||||
|
||||
ext_ip, arg_set := d.GetOk("ext_ip")
|
||||
if arg_set {
|
||||
url_values.Add("extIp", ext_ip.(string))
|
||||
}
|
||||
|
||||
api_resp, err := controller.decortAPICall("POST", ResgroupCreateAPI, url_values)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.SetId(api_resp) // rg/create API returns ID of the newly creted resource group on success
|
||||
// rg.ID, _ = strconv.Atoi(api_resp)
|
||||
|
||||
// re-read newly created RG to make sure schema contains complete and up to date set of specifications
|
||||
return resourceResgroupRead(d, m)
|
||||
}
|
||||
|
||||
func resourceResgroupRead(d *schema.ResourceData, m interface{}) error {
|
||||
log.Debugf("resourceResgroupRead: called for RG name %s, account ID %s",
|
||||
d.Get("name").(string), d.Get("account_id").(int))
|
||||
|
||||
rg_facts, err := utilityResgroupCheckPresence(d, m)
|
||||
if rg_facts == "" {
|
||||
// if empty string is returned from utilityResgroupCheckPresence then there is no
|
||||
// such resource group and err tells so - just return it to the calling party
|
||||
d.SetId("") // ensure ID is empty
|
||||
return err
|
||||
}
|
||||
|
||||
return flattenResgroup(d, rg_facts)
|
||||
}
|
||||
|
||||
func resourceResgroupUpdate(d *schema.ResourceData, m interface{}) error {
|
||||
log.Debugf("resourceResgroupUpdate: called for RG name %s, account ID %d",
|
||||
d.Get("name").(string), d.Get("account_id").(int))
|
||||
|
||||
/* NOTE: we do not allow changing the following attributes of an existing RG via terraform:
|
||||
- def_net_type
|
||||
- ipcidr
|
||||
- ext_net_id
|
||||
- ext_ip
|
||||
|
||||
The following code fragment checks if any of these have been changed and generates error.
|
||||
*/
|
||||
for _, attr := range []string{"def_net_type", "ipcidr", "ext_ip"} {
|
||||
attr_new, attr_old := d.GetChange("def_net_type")
|
||||
if attr_new.(string) != attr_old.(string) {
|
||||
return fmt.Errorf("resourceResgroupUpdate: RG ID %s: changing %s for existing RG is not allowed", d.Id(), attr)
|
||||
}
|
||||
}
|
||||
|
||||
attr_new, attr_old := d.GetChange("ext_net_id")
|
||||
if attr_new.(int) != attr_old.(int) {
|
||||
return fmt.Errorf("resourceResgroupUpdate: RG ID %s: changing ext_net_id for existing RG is not allowed", d.Id())
|
||||
}
|
||||
|
||||
|
||||
do_general_update := false // will be true if general RG update is necessary (API rg/update)
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
url_values := &url.Values{}
|
||||
url_values.Add("rgId", d.Id())
|
||||
|
||||
name_new, name_set := d.GetOk("name")
|
||||
if name_set {
|
||||
log.Debugf("resourceResgroupUpdate: name specified - looking for deltas from the old settings.")
|
||||
name_old, _ := d.GetChange("name")
|
||||
if name_old.(string) != name_new.(string) {
|
||||
do_general_update = true
|
||||
url_values.Add("name", name_new.(string))
|
||||
}
|
||||
}
|
||||
|
||||
quota_value, quota_set := d.GetOk("quota")
|
||||
if quota_set {
|
||||
log.Debugf("resourceResgroupUpdate: quota specified - looking for deltas from the old quota.")
|
||||
quotarecord_new, _ := makeQuotaRecord(quota_value.([]interface{}))
|
||||
quota_value_old, _ := d.GetChange("quota") // returns old as 1st, new as 2nd return value
|
||||
quotarecord_old, _ := makeQuotaRecord(quota_value_old.([]interface{}))
|
||||
|
||||
if quotarecord_new.Cpu != quotarecord_old.Cpu {
|
||||
do_general_update = true
|
||||
log.Debugf("resourceResgroupUpdate: Cpu diff %d <- %d", quotarecord_new.Cpu, quotarecord_old.Cpu)
|
||||
url_values.Add("maxCPUCapacity", fmt.Sprintf("%d", quotarecord_new.Cpu))
|
||||
}
|
||||
|
||||
if quotarecord_new.Disk != quotarecord_old.Disk {
|
||||
do_general_update = true
|
||||
log.Debugf("resourceResgroupUpdate: Disk diff %d <- %d", quotarecord_new.Disk, quotarecord_old.Disk)
|
||||
url_values.Add("maxVDiskCapacity", fmt.Sprintf("%d", quotarecord_new.Disk))
|
||||
}
|
||||
|
||||
if quotarecord_new.Ram != quotarecord_old.Ram { // NB: quota on RAM is stored as float32, in units of MB
|
||||
do_general_update = true
|
||||
log.Debugf("resourceResgroupUpdate: Ram diff %f <- %f", quotarecord_new.Ram, quotarecord_old.Ram)
|
||||
url_values.Add("maxMemoryCapacity", fmt.Sprintf("%f", quotarecord_new.Ram))
|
||||
}
|
||||
|
||||
if quotarecord_new.ExtTraffic != quotarecord_old.ExtTraffic {
|
||||
do_general_update = true
|
||||
log.Debugf("resourceResgroupUpdate: ExtTraffic diff %d <- %d", quotarecord_new.ExtTraffic, quotarecord_old.ExtTraffic)
|
||||
url_values.Add("maxNetworkPeerTransfer", fmt.Sprintf("%d", quotarecord_new.ExtTraffic))
|
||||
}
|
||||
|
||||
if quotarecord_new.ExtIPs != quotarecord_old.ExtIPs {
|
||||
do_general_update = true
|
||||
log.Debugf("resourceResgroupUpdate: ExtIPs diff %d <- %d", quotarecord_new.ExtIPs, quotarecord_old.ExtIPs)
|
||||
url_values.Add("maxNumPublicIP", fmt.Sprintf("%d", quotarecord_new.ExtIPs))
|
||||
}
|
||||
}
|
||||
|
||||
desc_new, desc_set := d.GetOk("description")
|
||||
if desc_set {
|
||||
log.Debugf("resourceResgroupUpdate: description specified - looking for deltas from the old settings.")
|
||||
desc_old, _ := d.GetChange("description")
|
||||
if desc_old.(string) != desc_new.(string) {
|
||||
do_general_update = true
|
||||
url_values.Add("desc", desc_new.(string))
|
||||
}
|
||||
}
|
||||
|
||||
if do_general_update {
|
||||
log.Debugf("resourceResgroupUpdate: detected delta between new and old RG specs - updating the RG")
|
||||
_, err := controller.decortAPICall("POST", ResgroupUpdateAPI, url_values)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
log.Debugf("resourceResgroupUpdate: no difference between old and new state - no update on the RG will be done")
|
||||
}
|
||||
|
||||
return resourceResgroupRead(d, m)
|
||||
}
|
||||
|
||||
func resourceResgroupDelete(d *schema.ResourceData, m interface{}) error {
|
||||
// NOTE: this method forcibly destroys target resource group with flag "permanently", so there is no way to
|
||||
// restore the destroyed resource group as well all Computes & VINSes that existed in it
|
||||
log.Debugf("resourceResgroupDelete: called for RG name %s, account ID %s",
|
||||
d.Get("name").(string), d.Get("account_id").(int))
|
||||
|
||||
rg_facts, err := utilityResgroupCheckPresence(d, m)
|
||||
if rg_facts == "" {
|
||||
// the target RG does not exist - in this case according to Terraform best practice
|
||||
// we exit from Destroy method without error
|
||||
return nil
|
||||
}
|
||||
|
||||
url_values := &url.Values{}
|
||||
url_values.Add("rgId", d.Id())
|
||||
url_values.Add("force", "1")
|
||||
url_values.Add("permanently", "1")
|
||||
url_values.Add("reason", "Destroyed by DECORT Terraform provider")
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
_, err = controller.decortAPICall("POST", ResgroupDeleteAPI, url_values)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceResgroupExists(d *schema.ResourceData, m interface{}) (bool, error) {
|
||||
// Reminder: according to Terraform rules, this function should NOT modify ResourceData argument
|
||||
rg_facts, err := utilityResgroupCheckPresence(d, m)
|
||||
if rg_facts == "" {
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func resourceResgroup() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
Create: resourceResgroupCreate,
|
||||
Read: resourceResgroupRead,
|
||||
Update: resourceResgroupUpdate,
|
||||
Delete: resourceResgroupDelete,
|
||||
Exists: resourceResgroupExists,
|
||||
|
||||
Importer: &schema.ResourceImporter{
|
||||
State: schema.ImportStatePassthrough,
|
||||
},
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Create: &Timeout180s,
|
||||
Read: &Timeout30s,
|
||||
Update: &Timeout180s,
|
||||
Delete: &Timeout60s,
|
||||
Default: &Timeout60s,
|
||||
},
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Description: "Name of this resource group. Names are case sensitive and unique within the context of a account.",
|
||||
},
|
||||
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
ValidateFunc: validation.IntAtLeast(1),
|
||||
Description: "Unique ID of the account, which this resource group belongs to.",
|
||||
},
|
||||
|
||||
"def_net_type": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Default: "PRIVATE",
|
||||
ValidateFunc: validation.StringInSlice([]string{"PRIVATE", "PUBLIC", "NONE"}, false),
|
||||
Description: "Type of the network, which this resource group will use as default for its computes - PRIVATE or PUBLIC or NONE.",
|
||||
},
|
||||
|
||||
"def_net_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "ID of the default network for this resource group (if any).",
|
||||
},
|
||||
|
||||
"ipcidr": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Address of the netowrk inside the private network segment (aka ViNS) if def_net_type=PRIVATE",
|
||||
},
|
||||
|
||||
"ext_net_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Default: 0,
|
||||
Description: "ID of the external network for default ViNS. Pass 0 if def_net_type=PUBLIC or no external connection required for the defult ViNS when def_net_type=PRIVATE",
|
||||
},
|
||||
|
||||
"ext_ip": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "IP address on the external netowrk to request when def_net_type=PRIVATE and ext_net_id is not 0",
|
||||
},
|
||||
|
||||
/* commented out, as in this version of provider we use default Grid ID
|
||||
"grid_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Default: 0, // if 0 is passed, default Grid ID will be used
|
||||
// DefaultFunc: utilityResgroupGetDefaultGridID,
|
||||
ForceNew: true, // change of Grid ID will require new RG
|
||||
Description: "Unique ID of the grid, where this resource group is deployed.",
|
||||
},
|
||||
*/
|
||||
|
||||
"quota": {
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
MaxItems: 1,
|
||||
Elem: &schema.Resource{
|
||||
Schema: quotaRgSubresourceSchemaMake(),
|
||||
},
|
||||
Description: "Quota settings for this resource group.",
|
||||
},
|
||||
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "User-defined text description of this resource group.",
|
||||
},
|
||||
|
||||
"account_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Name of the account, which this resource group belongs to.",
|
||||
},
|
||||
|
||||
/*
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Current status of this resource group.",
|
||||
},
|
||||
|
||||
"vins": {
|
||||
Type: schema.TypeList, // this is a list of ints
|
||||
Computed: true,
|
||||
MaxItems: LimitMaxVinsPerResgroup,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "List of VINs deployed in this resource group.",
|
||||
},
|
||||
|
||||
"computes": {
|
||||
Type: schema.TypeList, // this is a list of ints
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "List of computes deployed in this resource group.",
|
||||
},
|
||||
*/
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,318 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
// "encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
func ipcidrDiffSupperss(key, oldVal, newVal string, d *schema.ResourceData) bool {
|
||||
if oldVal == "" && newVal != "" {
|
||||
// if old value for "ipcidr" resource is empty string, it means that we are creating new ViNS
|
||||
// and there is a chance that the user will want specific IP address range for this ViNS -
|
||||
// check if "ipcidr" is explicitly set in TF file to a non-empty string.
|
||||
log.Debugf("ipcidrDiffSupperss: key=%s, oldVal=%q, newVal=%q -> suppress=FALSE", key, oldVal, newVal)
|
||||
return false // there is a difference between stored and new value
|
||||
}
|
||||
log.Debugf("ipcidrDiffSupperss: key=%s, oldVal=%q, newVal=%q -> suppress=TRUE", key, oldVal, newVal)
|
||||
return true // suppress difference
|
||||
}
|
||||
|
||||
func resourceVinsCreate(d *schema.ResourceData, m interface{}) error {
|
||||
log.Debugf("resourceVinsCreate: called for ViNS name %s, Account ID %d, RG ID %d",
|
||||
d.Get("name").(string), d.Get("account_id").(int), d.Get("rg_id").(int))
|
||||
|
||||
apiToCall := VinsCreateInAccountAPI
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
urlValues := &url.Values{}
|
||||
|
||||
urlValues.Add("name", d.Get("name").(string))
|
||||
|
||||
argVal, argSet := d.GetOk("rg_id")
|
||||
if argSet && argVal.(int) > 0 {
|
||||
apiToCall = VinsCreateInRgAPI
|
||||
urlValues.Add("rgId", fmt.Sprintf("%d", argVal.(int)))
|
||||
} else {
|
||||
// RG ID either not set at all or set to 0 - user may want ViNS at account level
|
||||
argVal, argSet = d.GetOk("account_id")
|
||||
if !argSet || argVal.(int) <= 0 {
|
||||
// No valid Account ID (and no RG ID either) - cannot create ViNS
|
||||
return fmt.Errorf("resourceVinsCreate: ViNS name %s - no valid account and/or resource group ID specified", d.Id())
|
||||
}
|
||||
urlValues.Add("accountId", fmt.Sprintf("%d", argVal.(int)))
|
||||
}
|
||||
|
||||
argVal, argSet = d.GetOk("ext_net_id") // NB: even if ext_net_id value is explicitly set to 0, argSet = false anyway
|
||||
if argSet {
|
||||
if argVal.(int) > 0 {
|
||||
// connect to specific external network
|
||||
urlValues.Add("extNetId", fmt.Sprintf("%d", argVal.(int)))
|
||||
/*
|
||||
Commented out, as we've made "ext_net_ip" parameter non-configurable via Terraform!
|
||||
|
||||
// in case of specific ext net connection user may also want a particular IP address
|
||||
argVal, argSet = d.GetOk("ext_net_ip")
|
||||
if argSet && argVal.(string) != "" {
|
||||
urlValues.Add("extIp", argVal.(string))
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
// ext_net_id is set to a negative value - connect to default external network
|
||||
// no particular IP address selection in this case
|
||||
urlValues.Add("extNetId", "0")
|
||||
}
|
||||
}
|
||||
|
||||
argVal, argSet = d.GetOk("ipcidr")
|
||||
if argSet && argVal.(string) != "" {
|
||||
log.Debugf("resourceVinsCreate: ipcidr is set to %s", argVal.(string))
|
||||
urlValues.Add("ipcidr", argVal.(string))
|
||||
}
|
||||
|
||||
argVal, argSet = d.GetOk("description")
|
||||
if argSet {
|
||||
urlValues.Add("desc", argVal.(string))
|
||||
}
|
||||
|
||||
apiResp, err := controller.decortAPICall("POST", apiToCall, urlValues)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.SetId(apiResp) // update ID of the resource to tell Terraform that the ViNS resource exists
|
||||
vinsId, _ := strconv.Atoi(apiResp)
|
||||
|
||||
log.Debugf("resourceVinsCreate: new ViNS ID / name %d / %s creation sequence complete", vinsId, d.Get("name").(string))
|
||||
|
||||
// We may reuse dataSourceVinsRead here as we maintain similarity
|
||||
// between ViNS resource and ViNS data source schemas
|
||||
// ViNS resource read function will also update resource ID on success, so that Terraform
|
||||
// will know the resource exists (however, we already did it a few lines before)
|
||||
return dataSourceVinsRead(d, m)
|
||||
}
|
||||
|
||||
func resourceVinsRead(d *schema.ResourceData, m interface{}) error {
|
||||
vinsFacts, err := utilityVinsCheckPresence(d, m)
|
||||
if vinsFacts == "" {
|
||||
// if empty string is returned from utilityVinsCheckPresence then there is no
|
||||
// such ViNS and err tells so - just return it to the calling party
|
||||
d.SetId("") // ensure ID is empty
|
||||
return err
|
||||
}
|
||||
|
||||
return flattenVins(d, vinsFacts)
|
||||
}
|
||||
|
||||
func resourceVinsUpdate(d *schema.ResourceData, m interface{}) error {
|
||||
|
||||
log.Debugf("resourceVinsUpdate: called for ViNS ID / name %s / %s, Account ID %d, RG ID %d",
|
||||
d.Id(), d.Get("name").(string), d.Get("account_id").(int), d.Get("rg_id").(int))
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
|
||||
d.Partial(true)
|
||||
|
||||
// 1. Handle external network connection change
|
||||
oldExtNetId, newExtNedId := d.GetChange("ext_net_id")
|
||||
if oldExtNetId.(int) != newExtNedId.(int) {
|
||||
log.Debugf("resourceVinsUpdate: changing ViNS ID %s - ext_net_id %d -> %d", d.Id(), oldExtNetId.(int), newExtNedId.(int))
|
||||
|
||||
extnetParams := &url.Values{}
|
||||
extnetParams.Add("vinsId", d.Id())
|
||||
|
||||
if oldExtNetId.(int) > 0 {
|
||||
// there was preexisting external net connection - disconnect ViNS
|
||||
_, err := controller.decortAPICall("POST", VinsExtNetDisconnectAPI, extnetParams)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if newExtNedId.(int) > 0 {
|
||||
// new external network connection requested - connect ViNS
|
||||
extnetParams.Add("netId", fmt.Sprintf("%d", newExtNedId.(int)))
|
||||
_, err := controller.decortAPICall("POST", VinsExtNetConnectAPI, extnetParams)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
d.SetPartial("ext_net_id")
|
||||
}
|
||||
|
||||
d.Partial(false)
|
||||
|
||||
// we may reuse dataSourceVinsRead here as we maintain similarity
|
||||
// between Compute resource and Compute data source schemas
|
||||
return dataSourceVinsRead(d, m)
|
||||
}
|
||||
|
||||
func resourceVinsDelete(d *schema.ResourceData, m interface{}) error {
|
||||
log.Debugf("resourceVinsDelete: called for ViNS ID / name %s / %s, Account ID %d, RG ID %d",
|
||||
d.Id(), d.Get("name").(string), d.Get("account_id").(int), d.Get("rg_id").(int))
|
||||
|
||||
vinsFacts, err := utilityVinsCheckPresence(d, m)
|
||||
if vinsFacts == "" {
|
||||
// the specified ViNS does not exist - in this case according to Terraform best practice
|
||||
// we exit from Destroy method without error
|
||||
return nil
|
||||
}
|
||||
|
||||
params := &url.Values{}
|
||||
params.Add("vinsId", d.Id())
|
||||
params.Add("force", "1") // disconnect all computes before deleting ViNS
|
||||
params.Add("permanently", "1") // delete ViNS immediately bypassing recycle bin
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
_, err = controller.decortAPICall("POST", VinsDeleteAPI, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceVinsExists(d *schema.ResourceData, m interface{}) (bool, error) {
|
||||
// Reminder: according to Terraform rules, this function should not modify its ResourceData argument
|
||||
log.Debugf("resourceVinsExists: called for ViNS name %s, Account ID %d, RG ID %d",
|
||||
d.Get("name").(string), d.Get("account_id").(int), d.Get("rg_id").(int))
|
||||
|
||||
vinsFacts, err := utilityVinsCheckPresence(d, m)
|
||||
if vinsFacts == "" {
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func resourceVinsSchemaMake() map[string]*schema.Schema {
|
||||
rets := map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validation.StringIsNotEmpty,
|
||||
Description: "Name of the ViNS. Names are case sensitive and unique within the context of an account or resource group.",
|
||||
},
|
||||
|
||||
/* we do not need ViNS ID as an argument because if we already know this ID, it is not practical to call resource provider.
|
||||
Resource Import will work anyway, as it obtains the ID of ViNS to be imported through another mechanism.
|
||||
"vins_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Unique ID of the ViNS. If ViNS ID is specified, then ViNS name, rg_id and account_id are ignored.",
|
||||
},
|
||||
*/
|
||||
|
||||
"rg_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
Default: 0,
|
||||
Description: "ID of the resource group, where this ViNS belongs to. Non-zero for ViNS created at resource group level, 0 otherwise.",
|
||||
},
|
||||
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
ValidateFunc: validation.IntAtLeast(1),
|
||||
Description: "ID of the account, which this ViNS belongs to. For ViNS created at account level, resource group ID is 0.",
|
||||
},
|
||||
|
||||
"ext_net_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
ValidateFunc: validation.IntAtLeast(0),
|
||||
Description: "ID of the external network this ViNS is connected to. Pass 0 if no external connection required.",
|
||||
},
|
||||
|
||||
"ipcidr": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DiffSuppressFunc: ipcidrDiffSupperss,
|
||||
Description: "Network address to use by this ViNS. This parameter is only valid when creating new ViNS.",
|
||||
},
|
||||
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Default: "",
|
||||
Description: "Optional user-defined text description of this ViNS.",
|
||||
},
|
||||
|
||||
// the rest of attributes are computed
|
||||
"account_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Name of the account, which this ViNS belongs to.",
|
||||
},
|
||||
|
||||
"ext_ip_addr": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "IP address of the external connection (valid for ViNS connected to external network, ignored otherwise).",
|
||||
},
|
||||
}
|
||||
|
||||
return rets
|
||||
}
|
||||
|
||||
func resourceVins() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
Create: resourceVinsCreate,
|
||||
Read: resourceVinsRead,
|
||||
Update: resourceVinsUpdate,
|
||||
Delete: resourceVinsDelete,
|
||||
Exists: resourceVinsExists,
|
||||
|
||||
Importer: &schema.ResourceImporter{
|
||||
State: schema.ImportStatePassthrough,
|
||||
},
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Create: &Timeout180s,
|
||||
Read: &Timeout30s,
|
||||
Update: &Timeout180s,
|
||||
Delete: &Timeout60s,
|
||||
Default: &Timeout60s,
|
||||
},
|
||||
|
||||
Schema: resourceVinsSchemaMake(),
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
/*
|
||||
func makeSshKeysConfig(arg_list []interface{}) (sshkeys []SshKeyConfig, count int) {
|
||||
count = len(arg_list)
|
||||
if count < 1 {
|
||||
return nil, 0
|
||||
}
|
||||
|
||||
sshkeys = make([]SshKeyConfig, count)
|
||||
var subres_data map[string]interface{}
|
||||
for index, value := range arg_list {
|
||||
subres_data = value.(map[string]interface{})
|
||||
sshkeys[index].User = subres_data["user"].(string)
|
||||
sshkeys[index].SshKey = subres_data["public_key"].(string)
|
||||
sshkeys[index].UserShell = subres_data["shell"].(string)
|
||||
}
|
||||
|
||||
return sshkeys, count
|
||||
}
|
||||
*/
|
||||
|
||||
func makeSshKeysArgString(arg_list []interface{}) string {
|
||||
// This function expects arg_list = data.Get("ssh_keys"), where "data" is a populated schema for Compute
|
||||
// Resource (see func resourceCompute() definition) or Compute Data Source (see func dataSourceCompute())
|
||||
|
||||
// Prepare a string with username and public ssh key value in a format recognized by cloud-init utility.
|
||||
// It is designed to be passed as "userdata" argument of virtual machine create API call.
|
||||
// The following format is expected:
|
||||
// '{"users": [{"ssh-authorized-keys": ["SSH_PUBCIC_KEY_VALUE"], "shell": "SHELL_VALUE", "name": "USERNAME_VALUE"}, {...}, ]}'
|
||||
|
||||
/*
|
||||
`%s\n
|
||||
- name: %s\n
|
||||
ssh-authorized-keys:
|
||||
- %s\n
|
||||
shell: /bin/bash`
|
||||
*/
|
||||
|
||||
if len(arg_list) < 1 {
|
||||
return ""
|
||||
}
|
||||
|
||||
out := `{"users": [`
|
||||
const UserdataTemplate = `%s{"ssh-authorized-keys": ["%s"], "shell": "%s", "name": "%s"}, `
|
||||
const out_suffix = `]}`
|
||||
|
||||
for _, value := range arg_list {
|
||||
subres_data := value.(map[string]interface{})
|
||||
|
||||
out = fmt.Sprintf(UserdataTemplate, out, subres_data["public_key"].(string), subres_data["shell"].(string), subres_data["user"].(string))
|
||||
}
|
||||
out = fmt.Sprintf("%s %s", out, out_suffix)
|
||||
return out
|
||||
}
|
||||
|
||||
func sshSubresourceSchemaMake() map[string]*schema.Schema {
|
||||
rets := map[string]*schema.Schema{
|
||||
"user": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Description: "Name of the guest OS user of a new compute, for which the following SSH key will be authorized.",
|
||||
},
|
||||
|
||||
"public_key": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Description: "Public SSH key to authorize to the specified guest OS user on the compute being created.",
|
||||
},
|
||||
|
||||
"shell": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Default: "/bin/bash",
|
||||
Description: "Guest user shell. This parameter is optional, default is /bin/bash.",
|
||||
},
|
||||
}
|
||||
|
||||
return rets
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
func utilityAccountCheckPresence(d *schema.ResourceData, m interface{}) (string, error) {
|
||||
controller := m.(*ControllerCfg)
|
||||
urlValues := &url.Values{}
|
||||
|
||||
accId, argSet := d.GetOk("account_id")
|
||||
if argSet {
|
||||
// get Account right away by its ID
|
||||
log.Debugf("utilityAccountCheckPresence: locating Account by its ID %d", accId.(int))
|
||||
urlValues.Add("accountId", fmt.Sprintf("%d", accId.(int)))
|
||||
apiResp, err := controller.decortAPICall("POST", AccountsGetAPI, urlValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return apiResp, nil
|
||||
}
|
||||
|
||||
accName, argSet := d.GetOk("name")
|
||||
if !argSet {
|
||||
// neither ID nor name - no account for you!
|
||||
return "", fmt.Errorf("Cannot check account presence if name is empty and no account ID specified")
|
||||
}
|
||||
|
||||
apiResp, err := controller.decortAPICall("POST", AccountsListAPI, urlValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
// log.Debugf("%s", apiResp)
|
||||
// log.Debugf("utilityAccountCheckPresence: ready to decode response body from %q", AccountsListAPI)
|
||||
accList := AccountsListResp{}
|
||||
err = json.Unmarshal([]byte(apiResp), &accList)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
log.Debugf("utilityAccountCheckPresence: traversing decoded Json of length %d", len(accList))
|
||||
for index, item := range accList {
|
||||
// match by account name
|
||||
if item.Name == accName.(string) {
|
||||
log.Debugf("utilityAccountCheckPresence: match account name %q / ID %d at index %d",
|
||||
item.Name, item.ID, index)
|
||||
|
||||
// NB: unlike accounts/get API, accounts/list API returns abridged set of account info,
|
||||
// for instance it does not return quotas
|
||||
|
||||
reencodedItem, err := json.Marshal(item)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(reencodedItem[:]), nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("Cannot find account name %q", accName.(string))
|
||||
}
|
||||
|
||||
func utilityGetAccountIdBySchema(d *schema.ResourceData, m interface{}) (int, error) {
|
||||
/*
|
||||
This function expects schema that contains the following two elements:
|
||||
|
||||
"account_name": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: Optional,
|
||||
Description: "Name of the account, ....",
|
||||
},
|
||||
|
||||
"account_id": &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Unique ID of the account, ....",
|
||||
},
|
||||
|
||||
Then it will check, which argument is set, and if account name is present, it will
|
||||
initiate API calls to the DECORT cloud controller and try to match relevant account
|
||||
by the name.
|
||||
|
||||
NOTE that for some resources (most notably, Resource Group) "account_name" attribute is
|
||||
marked as "Computed: true", so the only way to fully identify Resource Group is to specify
|
||||
"account_id", which is marked as "Required: true"
|
||||
|
||||
*/
|
||||
|
||||
accId, argSet := d.GetOk("account_id")
|
||||
if argSet {
|
||||
if accId.(int) > 0 {
|
||||
return accId.(int), nil
|
||||
}
|
||||
return 0, fmt.Errorf("Account ID must be positive")
|
||||
}
|
||||
|
||||
accName, argSet := d.GetOk("account_name")
|
||||
if !argSet {
|
||||
return 0, fmt.Errorf("Either non-empty account name or valid account ID must be specified")
|
||||
}
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
urlValues := &url.Values{}
|
||||
apiResp, err := controller.decortAPICall("POST", AccountsListAPI, urlValues)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
model := AccountsListResp{}
|
||||
err = json.Unmarshal([]byte(apiResp), &model)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
log.Debugf("utilityGetAccountIdBySchema: traversing decoded Json of length %d", len(model))
|
||||
for index, item := range model {
|
||||
// need to match Account by name
|
||||
if item.Name == accName.(string) {
|
||||
log.Debugf("utilityGetAccountIdBySchema: match Account name %q / ID %d at index %d",
|
||||
item.Name, item.ID, index)
|
||||
return item.ID, nil
|
||||
}
|
||||
}
|
||||
|
||||
return 0, fmt.Errorf("Cannot find account %q for the current user. Check account name and your access rights", accName.(string))
|
||||
}
|
||||
@@ -1,298 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
func (ctrl *ControllerCfg) utilityComputeExtraDisksConfigure(d *schema.ResourceData, do_delta bool) error {
|
||||
// d is filled with data according to computeResource schema, so extra disks config is retrieved via "extra_disks" key
|
||||
// If do_delta is true, this function will identify changes between new and existing specs for extra disks and try to
|
||||
// update compute configuration accordingly
|
||||
// Otherwise it will apply whatever is found in the new set of "extra_disks" right away.
|
||||
// Primary use of do_delta=false is when calling this function from compute Create handler.
|
||||
|
||||
// Note that this function will not abort on API errors, but will continue to configure (attach / detach) other individual
|
||||
// disks via atomic API calls. However, it will not retry failed manipulation on the same disk.
|
||||
log.Debugf("utilityComputeExtraDisksConfigure: called for Compute ID %s with do_delta = %b", d.Id(), do_delta)
|
||||
|
||||
// NB: as of rc-1.25 "extra_disks" are TypeSet with the elem of TypeInt
|
||||
old_set, new_set := d.GetChange("extra_disks")
|
||||
|
||||
apiErrCount := 0
|
||||
var lastSavedError error
|
||||
|
||||
if !do_delta {
|
||||
if new_set.(*schema.Set).Len() < 1 {
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, disk := range new_set.(*schema.Set).List() {
|
||||
urlValues := &url.Values{}
|
||||
urlValues.Add("computeId", d.Id())
|
||||
urlValues.Add("diskId", fmt.Sprintf("%d", disk.(int)))
|
||||
_, err := ctrl.decortAPICall("POST", ComputeDiskAttachAPI, urlValues)
|
||||
if err != nil {
|
||||
// failed to attach extra disk - partial resource update
|
||||
apiErrCount++
|
||||
lastSavedError = err
|
||||
}
|
||||
}
|
||||
|
||||
if apiErrCount > 0 {
|
||||
log.Errorf("utilityComputeExtraDisksConfigure: there were %d error(s) when attaching disks to Compute ID %s. Last error was: %s",
|
||||
apiErrCount, d.Id(), lastSavedError)
|
||||
return lastSavedError
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
detach_set := old_set.(*schema.Set).Difference(new_set.(*schema.Set))
|
||||
log.Debugf("utilityComputeExtraDisksConfigure: detach set has %d items for Compute ID %s", detach_set.Len(), d.Id())
|
||||
for _, diskId := range detach_set.List() {
|
||||
urlValues := &url.Values{}
|
||||
urlValues.Add("computeId", d.Id())
|
||||
urlValues.Add("diskId", fmt.Sprintf("%d", diskId.(int)))
|
||||
_, err := ctrl.decortAPICall("POST", ComputeDiskDetachAPI, urlValues)
|
||||
if err != nil {
|
||||
// failed to detach disk - there will be partial resource update
|
||||
log.Errorf("utilityComputeExtraDisksConfigure: failed to detach disk ID %d from Compute ID %s: %s", diskId.(int), d.Id(), err)
|
||||
apiErrCount++
|
||||
lastSavedError = err
|
||||
}
|
||||
}
|
||||
|
||||
attach_set := new_set.(*schema.Set).Difference(old_set.(*schema.Set))
|
||||
log.Debugf("utilityComputeExtraDisksConfigure: attach set has %d items for Compute ID %s", attach_set.Len(), d.Id())
|
||||
for _, diskId := range attach_set.List() {
|
||||
urlValues := &url.Values{}
|
||||
urlValues.Add("computeId", d.Id())
|
||||
urlValues.Add("diskId", fmt.Sprintf("%d", diskId.(int)))
|
||||
_, err := ctrl.decortAPICall("POST", ComputeDiskAttachAPI, urlValues)
|
||||
if err != nil {
|
||||
// failed to attach disk - there will be partial resource update
|
||||
log.Errorf("utilityComputeExtraDisksConfigure: failed to attach disk ID %d to Compute ID %s: %s", diskId.(int), d.Id(), err)
|
||||
apiErrCount++
|
||||
lastSavedError = err
|
||||
}
|
||||
}
|
||||
|
||||
if apiErrCount > 0 {
|
||||
log.Errorf("utilityComputeExtraDisksConfigure: there were %d error(s) when managing disks of Compute ID %s. Last error was: %s",
|
||||
apiErrCount, d.Id(), lastSavedError)
|
||||
return lastSavedError
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ctrl *ControllerCfg) utilityComputeNetworksConfigure(d *schema.ResourceData, do_delta bool) error {
|
||||
// "d" is filled with data according to computeResource schema, so extra networks config is retrieved via "network" key
|
||||
// If do_delta is true, this function will identify changes between new and existing specs for network and try to
|
||||
// update compute configuration accordingly
|
||||
// Otherwise it will apply whatever is found in the new set of "network" right away.
|
||||
// Primary use of do_delta=false is when calling this function from compute Create handler.
|
||||
|
||||
old_set, new_set := d.GetChange("network")
|
||||
|
||||
apiErrCount := 0
|
||||
var lastSavedError error
|
||||
|
||||
if !do_delta {
|
||||
if new_set.(*schema.Set).Len() < 1 {
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, runner := range new_set.(*schema.Set).List() {
|
||||
urlValues := &url.Values{}
|
||||
net_data := runner.(map[string]interface{})
|
||||
urlValues.Add("computeId", d.Id())
|
||||
urlValues.Add("netType", net_data["net_type"].(string))
|
||||
urlValues.Add("netId", fmt.Sprintf("%d", net_data["net_id"].(int)))
|
||||
ipaddr, ipSet := net_data["ip_address"] // "ip_address" key is optional
|
||||
if ipSet {
|
||||
urlValues.Add("ipAddr", ipaddr.(string))
|
||||
}
|
||||
_, err := ctrl.decortAPICall("POST", ComputeNetAttachAPI, urlValues)
|
||||
if err != nil {
|
||||
// failed to attach network - partial resource update
|
||||
apiErrCount++
|
||||
lastSavedError = err
|
||||
}
|
||||
}
|
||||
|
||||
if apiErrCount > 0 {
|
||||
log.Errorf("utilityComputeNetworksConfigure: there were %d error(s) when managing networks of Compute ID %s. Last error was: %s",
|
||||
apiErrCount, d.Id(), lastSavedError)
|
||||
return lastSavedError
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
detach_set := old_set.(*schema.Set).Difference(new_set.(*schema.Set))
|
||||
log.Debugf("utilityComputeNetworksConfigure: detach set has %d items for Compute ID %s", detach_set.Len(), d.Id())
|
||||
for _, runner := range detach_set.List() {
|
||||
urlValues := &url.Values{}
|
||||
net_data := runner.(map[string]interface{})
|
||||
urlValues.Add("computeId", d.Id())
|
||||
urlValues.Add("ipAddr", net_data["ip_address"].(string))
|
||||
urlValues.Add("mac", net_data["mac"].(string))
|
||||
_, err := ctrl.decortAPICall("POST", ComputeNetDetachAPI, urlValues)
|
||||
if err != nil {
|
||||
// failed to detach this network - there will be partial resource update
|
||||
log.Errorf("utilityComputeNetworksConfigure: failed to detach net ID %d of type %s from Compute ID %s: %s",
|
||||
net_data["net_id"].(int), net_data["net_type"].(string), d.Id(), err)
|
||||
apiErrCount++
|
||||
lastSavedError = err
|
||||
}
|
||||
}
|
||||
|
||||
attach_set := new_set.(*schema.Set).Difference(old_set.(*schema.Set))
|
||||
log.Debugf("utilityComputeNetworksConfigure: attach set has %d items for Compute ID %s", attach_set.Len(), d.Id())
|
||||
for _, runner := range attach_set.List() {
|
||||
urlValues := &url.Values{}
|
||||
net_data := runner.(map[string]interface{})
|
||||
urlValues.Add("computeId", d.Id())
|
||||
urlValues.Add("netId", fmt.Sprintf("%d",net_data["net_id"].(int)))
|
||||
urlValues.Add("netType", net_data["net_type"].(string))
|
||||
if net_data["ip_address"].(string) != "" {
|
||||
urlValues.Add("ipAddr", net_data["ip_address"].(string))
|
||||
}
|
||||
_, err := ctrl.decortAPICall("POST", ComputeNetAttachAPI, urlValues)
|
||||
if err != nil {
|
||||
// failed to attach this network - there will be partial resource update
|
||||
log.Errorf("utilityComputeNetworksConfigure: failed to attach net ID %d of type %s to Compute ID %s: %s",
|
||||
net_data["net_id"].(int), net_data["net_type"].(string), d.Id(), err)
|
||||
apiErrCount++
|
||||
lastSavedError = err
|
||||
}
|
||||
}
|
||||
|
||||
if apiErrCount > 0 {
|
||||
log.Errorf("utilityComputeNetworksConfigure: there were %d error(s) when managing networks of Compute ID %s. Last error was: %s",
|
||||
apiErrCount, d.Id(), lastSavedError)
|
||||
return lastSavedError
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func utilityComputeCheckPresence(d *schema.ResourceData, m interface{}) (string, error) {
|
||||
// This function tries to locate Compute by one of the following approaches:
|
||||
// - if compute_id is specified - locate by compute ID
|
||||
// - if compute_name is specified - locate by a combination of compute name and resource
|
||||
// group ID
|
||||
//
|
||||
// If succeeded, it returns non-empty string that contains JSON formatted facts about the
|
||||
// Compute as returned by compute/get API call.
|
||||
// Otherwise it returns empty string and meaningful error.
|
||||
//
|
||||
// This function does not modify its ResourceData argument, so it is safe to use it as core
|
||||
// method for resource's Exists method.
|
||||
//
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
urlValues := &url.Values{}
|
||||
|
||||
// make it possible to use "read" & "check presence" functions with compute ID set so
|
||||
// that Import of Compute resource is possible
|
||||
idSet := false
|
||||
theId, err := strconv.Atoi(d.Id())
|
||||
if err != nil || theId <= 0 {
|
||||
computeId, argSet := d.GetOk("compute_id") // NB: compute_id is NOT present in computeResource schema!
|
||||
if argSet {
|
||||
theId = computeId.(int)
|
||||
idSet = true
|
||||
}
|
||||
} else {
|
||||
idSet = true
|
||||
}
|
||||
|
||||
if idSet {
|
||||
// compute ID is specified, try to get compute instance straight by this ID
|
||||
log.Debugf("utilityComputeCheckPresence: locating compute by its ID %d", theId)
|
||||
urlValues.Add("computeId", fmt.Sprintf("%d", theId))
|
||||
computeFacts, err := controller.decortAPICall("POST", ComputeGetAPI, urlValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return computeFacts, nil
|
||||
}
|
||||
|
||||
// ID was not set in the schema upon entering this function - work through Compute name
|
||||
// and RG ID
|
||||
computeName, argSet := d.GetOk("name")
|
||||
if !argSet {
|
||||
return "", fmt.Errorf("Cannot locate compute instance if name is empty and no compute ID specified")
|
||||
}
|
||||
|
||||
rgId, argSet := d.GetOk("rg_id")
|
||||
if !argSet {
|
||||
return "", fmt.Errorf("Cannot locate compute by name %s if no resource group ID is set", computeName.(string))
|
||||
}
|
||||
|
||||
urlValues.Add("rgId", fmt.Sprintf("%d", rgId))
|
||||
apiResp, err := controller.decortAPICall("POST", RgListComputesAPI, urlValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
log.Debugf("utilityComputeCheckPresence: ready to unmarshal string %s", apiResp)
|
||||
|
||||
computeList := RgListComputesResp{}
|
||||
err = json.Unmarshal([]byte(apiResp), &computeList)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// log.Printf("%#v", computeList)
|
||||
log.Debugf("utilityComputeCheckPresence: traversing decoded JSON of length %d", len(computeList))
|
||||
for index, item := range computeList {
|
||||
// need to match Compute by name, skip Computes with the same name in DESTROYED satus
|
||||
if item.Name == computeName.(string) && item.Status != "DESTROYED" {
|
||||
log.Debugf("utilityComputeCheckPresence: index %d, matched name %s", index, item.Name)
|
||||
// we found the Compute we need - now get detailed information via compute/get API
|
||||
cgetValues := &url.Values{}
|
||||
cgetValues.Add("computeId", fmt.Sprintf("%d", item.ID))
|
||||
apiResp, err = controller.decortAPICall("POST", ComputeGetAPI, cgetValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return apiResp, nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", nil // there should be no error if Compute does not exist
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
|
||||
func utilityDiskCheckPresence(d *schema.ResourceData, m interface{}) (string, error) {
|
||||
// This function tries to locate Disk by one of the following algorithms depending on
|
||||
// the parameters passed:
|
||||
// - if disk ID is specified -> by disk ID
|
||||
// - if disk name is specifeid -> by disk name and either account ID or account name
|
||||
//
|
||||
// NOTE: disk names are not unique, so the first occurence of this name in the account will
|
||||
// be returned. There is no such ambiguity when locating disk by its ID.
|
||||
//
|
||||
// If succeeded, it returns non empty string that contains JSON formatted facts about the disk
|
||||
// as returned by disks/get API call.
|
||||
// Otherwise it returns empty string and meaningful error.
|
||||
//
|
||||
// This function does not modify its ResourceData argument, so it is safe to use it as core
|
||||
// method for resource's Exists method.
|
||||
//
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
urlValues := &url.Values{}
|
||||
|
||||
// make it possible to use "read" & "check presence" functions with disk ID set so
|
||||
// that Import of preexisting Disk resource is possible
|
||||
idSet := false
|
||||
theId, err := strconv.Atoi(d.Id())
|
||||
if err != nil || theId <= 0 {
|
||||
diskId, argSet := d.GetOk("disk_id")
|
||||
if argSet {
|
||||
theId =diskId.(int)
|
||||
idSet = true
|
||||
}
|
||||
} else {
|
||||
idSet = true
|
||||
}
|
||||
|
||||
if idSet {
|
||||
// disk ID is specified, try to get disk instance straight by this ID
|
||||
log.Debugf("utilityDiskCheckPresence: locating disk by its ID %d", theId)
|
||||
urlValues.Add("diskId", fmt.Sprintf("%d", theId))
|
||||
diskFacts, err := controller.decortAPICall("POST", DisksGetAPI, urlValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return diskFacts, nil
|
||||
}
|
||||
|
||||
// ID or disk_di was not set in the schema upon entering this function - rely on Disk name
|
||||
// and Account ID to find the disk
|
||||
diskName, argSet := d.GetOk("name")
|
||||
if !argSet {
|
||||
// no disk ID and no disk name - we cannot locate disk in this case
|
||||
return "", fmt.Errorf("Cannot locate disk if name is empty and no disk ID specified")
|
||||
}
|
||||
|
||||
// Valid account ID is required to locate disks
|
||||
// obtain Account ID by account name - it should not be zero on success
|
||||
validatedAccountId, err := utilityGetAccountIdBySchema(d, m)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
urlValues.Add("accountId", fmt.Sprintf("%d", validatedAccountId))
|
||||
diskFacts, err := controller.decortAPICall("POST", DisksListAPI, urlValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
log.Debugf("utilityDiskCheckPresence: ready to unmarshal string %s", diskFacts)
|
||||
|
||||
disksList := DisksListResp{}
|
||||
err = json.Unmarshal([]byte(diskFacts), &disksList)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// log.Printf("%#v", vm_list)
|
||||
log.Debugf("utilityDiskCheckPresence: traversing decoded JSON of length %d", len(disksList))
|
||||
for index, item := range disksList {
|
||||
// need to match disk by name, return the first match
|
||||
if item.Name == diskName.(string) && item.Status != "DESTROYED" {
|
||||
log.Debugf("utilityDiskCheckPresence: index %d, matched disk name %q", index, item.Name)
|
||||
// we found the disk we need - not get detailed information via API call to disks/get
|
||||
/*
|
||||
// TODO: this may not be optimal as it initiates one extra call to the DECORT controller
|
||||
// in spite of the fact that we already have all required information about the disk in
|
||||
// item variable
|
||||
//
|
||||
get_urlValues := &url.Values{}
|
||||
get_urlValues.Add("diskId", fmt.Sprintf("%d", item.ID))
|
||||
diskFacts, err = controller.decortAPICall("POST", DisksGetAPI, get_urlValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return diskFacts, nil
|
||||
*/
|
||||
reencodedItem, err := json.Marshal(item)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(reencodedItem[:]), nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", nil // there should be no error if disk does not exist
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
|
||||
"strings"
|
||||
|
||||
)
|
||||
|
||||
func Jo2JSON(arg_str string) string {
|
||||
// DECORT API historically returns response in the form of Python dictionary, which generally
|
||||
// looks like JSON, but does not comply with JSON syntax.
|
||||
// For Golang JSON Unmarshal to work properly we need to pre-process API response as follows:
|
||||
ret_string := strings.Replace(string(arg_str), "u'", "\"", -1)
|
||||
ret_string = strings.Replace(ret_string, "'", "\"", -1)
|
||||
ret_string = strings.Replace(ret_string, ": False", ": false", -1)
|
||||
ret_string = strings.Replace(ret_string, ": True", ": true", -1)
|
||||
ret_string = strings.Replace(ret_string, "null", "\"\"", -1)
|
||||
ret_string = strings.Replace(ret_string, "None", "\"\"", -1)
|
||||
|
||||
// fix for incorrect handling of usage info
|
||||
// ret_string = strings.Replace(ret_string, "<", "\"", -1)
|
||||
// ret_string = strings.Replace(ret_string, ">", "\"", -1)
|
||||
return ret_string
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
var DefaultGridID int
|
||||
|
||||
func (controller *ControllerCfg) utilityLocationGetDefaultGridID() (int, error) {
|
||||
urlValues := &url.Values{}
|
||||
|
||||
log.Debug("utilityLocationGetDefaultGridID: retrieving locations list")
|
||||
apiResp, err := controller.decortAPICall("POST", LocationsListAPI, urlValues)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
locList := LocationsListResp{}
|
||||
err = json.Unmarshal([]byte(apiResp), &locList)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
if len(locList) == 0 {
|
||||
DefaultGridID = 0
|
||||
return 0, fmt.Errorf("utilityLocationGetDefaultGridID: retrieved 0 length locations list")
|
||||
}
|
||||
|
||||
DefaultGridID = locList[0].GridID
|
||||
log.Debugf("utilityLocationGetDefaultGridID: default location GridID %d, name %s", DefaultGridID, locList[0].Name)
|
||||
|
||||
return DefaultGridID, nil
|
||||
}
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
)
|
||||
|
||||
func (ctrl *ControllerCfg) utilityResgroupConfigGet(rgid int) (*ResgroupGetResp, error) {
|
||||
urlValues := &url.Values{}
|
||||
urlValues.Add("rgId", fmt.Sprintf("%d", rgid))
|
||||
rgFacts, err := ctrl.decortAPICall("POST", ResgroupGetAPI, urlValues)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Debugf("utilityResgroupConfigGet: ready to unmarshal string %s", rgFacts)
|
||||
model := &ResgroupGetResp{}
|
||||
err = json.Unmarshal([]byte(rgFacts), model)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
/*
|
||||
ret := &ResgroupConfig{}
|
||||
ret.AccountID = model.AccountID
|
||||
ret.Location = model.Location
|
||||
ret.Name = model.Name
|
||||
ret.ID = rgid
|
||||
ret.GridID = model.GridID
|
||||
ret.ExtIP = model.ExtIP // legacy field for VDC - this will eventually become obsoleted by true Resource Groups
|
||||
// Quota ResgroupQuotaConfig
|
||||
// Network NetworkConfig
|
||||
*/
|
||||
log.Debugf("utilityResgroupConfigGet: account ID %d, GridID %d, Name %s",
|
||||
model.AccountID, model.GridID, model.Name)
|
||||
|
||||
return model, nil
|
||||
}
|
||||
|
||||
// On success this function returns a string, as returned by API rg/get, which could be unmarshalled
|
||||
// into ResgroupGetResp structure
|
||||
func utilityResgroupCheckPresence(d *schema.ResourceData, m interface{}) (string, error) {
|
||||
// This function tries to locate resource group by one of the following algorithms depending
|
||||
// on the parameters passed:
|
||||
// - if resource group ID is specified -> by RG ID
|
||||
// - if resource group name is specifeid -> by RG name and either account ID or account name
|
||||
//
|
||||
// If succeeded, it returns non empty string that contains JSON formatted facts about the
|
||||
// resource group as returned by rg/get API call.
|
||||
// Otherwise it returns empty string and a meaningful error.
|
||||
//
|
||||
// NOTE: As our provider always deletes RGs permanently, there is no "restore" method and
|
||||
// consequently we are not interested in matching RGs in DELETED state. Hence, we call
|
||||
// .../rg/list API with includedeleted=false
|
||||
//
|
||||
// This function does not modify its ResourceData argument, so it is safe to use it as core
|
||||
// method for the Terraform resource Exists method.
|
||||
//
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
urlValues := &url.Values{}
|
||||
|
||||
// make it possible to use "read" & "check presence" functions with RG ID set so
|
||||
// that Import of RG resource is possible
|
||||
idSet := false
|
||||
theId, err := strconv.Atoi(d.Id())
|
||||
if err != nil || theId <= 0 {
|
||||
rgId, argSet := d.GetOk("rg_id")
|
||||
if argSet {
|
||||
theId = rgId.(int)
|
||||
idSet = true
|
||||
}
|
||||
} else {
|
||||
idSet = true
|
||||
}
|
||||
|
||||
if idSet {
|
||||
// go straight for the RG by its ID
|
||||
log.Debugf("utilityResgroupCheckPresence: locating RG by its ID %d", theId)
|
||||
urlValues.Add("rgId", fmt.Sprintf("%d", theId))
|
||||
rgFacts, err := controller.decortAPICall("POST", ResgroupGetAPI, urlValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return rgFacts, nil
|
||||
}
|
||||
|
||||
rgName, argSet := d.GetOk("name")
|
||||
if !argSet {
|
||||
// no RG ID and no RG name - we cannot locate resource group in this case
|
||||
return "", fmt.Errorf("Cannot check resource group presence if name is empty and no resource group ID specified")
|
||||
}
|
||||
|
||||
// Valid account ID is required to locate a resource group
|
||||
// obtain Account ID by account name - it should not be zero on success
|
||||
validatedAccountId, err := utilityGetAccountIdBySchema(d, m)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
urlValues.Add("includedeleted", "false")
|
||||
apiResp, err := controller.decortAPICall("POST", ResgroupListAPI, urlValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
// log.Debugf("%s", apiResp)
|
||||
log.Debugf("utilityResgroupCheckPresence: ready to decode response body from %s", ResgroupListAPI)
|
||||
model := ResgroupListResp{}
|
||||
err = json.Unmarshal([]byte(apiResp), &model)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
log.Debugf("utilityResgroupCheckPresence: traversing decoded Json of length %d", len(model))
|
||||
for index, item := range model {
|
||||
// match by RG name & account ID
|
||||
if item.Name == rgName.(string) && item.AccountID == validatedAccountId {
|
||||
log.Debugf("utilityResgroupCheckPresence: match RG name %s / ID %d, account ID %d at index %d",
|
||||
item.Name, item.ID, item.AccountID, index)
|
||||
|
||||
// not all required information is returned by rg/list API, so we need to initiate one more
|
||||
// call to rg/get to obtain extra data to complete Resource population.
|
||||
// Namely, we need resource quota settings
|
||||
reqValues := &url.Values{}
|
||||
reqValues.Add("rgId", fmt.Sprintf("%d", item.ID))
|
||||
apiResp, err := controller.decortAPICall("POST", ResgroupGetAPI, reqValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return apiResp, nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("Cannot find RG name %s owned by account ID %d", rgName, validatedAccountId)
|
||||
}
|
||||
|
||||
func utilityResgroupGetDefaultGridID() (interface{}, error) {
|
||||
if DefaultGridID > 0 {
|
||||
return fmt.Sprintf("%d", DefaultGridID), nil
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("utilityResgroupGetDefaultGridID: invalid default Grid ID %d", DefaultGridID)
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2020-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
func (ctrl *ControllerCfg) utilityVinsConfigGet(vinsid int) (*VinsRecord, error) {
|
||||
urlValues := &url.Values{}
|
||||
urlValues.Add("vinsId", fmt.Sprintf("%d", vinsid))
|
||||
vinsFacts, err := ctrl.decortAPICall("POST", VinsGetAPI, urlValues)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Debugf("utilityVinsConfigGet: ready to unmarshal string %q", vinsFacts)
|
||||
model := &VinsRecord{}
|
||||
err = json.Unmarshal([]byte(vinsFacts), model)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Debugf("utilityVinsConfigGet: Name %d, account name:ID %s:%d, RG Name:ID %s:%d",
|
||||
model.Name, model.AccountName, model.AccountID,
|
||||
model.RgName, model.RgID)
|
||||
|
||||
return model, nil
|
||||
}
|
||||
|
||||
// On success this function returns a string, as returned by API vins/get, which could be unmarshalled
|
||||
// into VinsGetResp structure
|
||||
func utilityVinsCheckPresence(d *schema.ResourceData, m interface{}) (string, error) {
|
||||
// This function tries to locate ViNS by one of the following algorithms depending
|
||||
// on the parameters passed:
|
||||
// - if resource group ID is specified -> it looks for a ViNS at the RG level
|
||||
// - if account ID is specifeid -> it looks for a ViNS at the account level
|
||||
//
|
||||
// If succeeded, it returns non empty string that contains JSON formatted facts about the
|
||||
// ViNS as returned by vins/get API call.
|
||||
// Otherwise it returns empty string and a meaningful error.
|
||||
//
|
||||
// This function does not modify its ResourceData argument, so it is safe to use it as core
|
||||
// method for the Terraform resource Exists method.
|
||||
//
|
||||
|
||||
controller := m.(*ControllerCfg)
|
||||
urlValues := &url.Values{}
|
||||
|
||||
// make it possible to use "read" & "check presence" functions with ViNS ID set so
|
||||
// that Import of ViNS resource is possible
|
||||
idSet := false
|
||||
theId, err := strconv.Atoi(d.Id())
|
||||
if err != nil || theId <= 0 {
|
||||
vinsId, argSet := d.GetOk("vins_id") // NB: vins_id is NOT present in vinsResource schema!
|
||||
if argSet {
|
||||
theId = vinsId.(int)
|
||||
idSet = true
|
||||
}
|
||||
} else {
|
||||
idSet = true
|
||||
}
|
||||
|
||||
if idSet {
|
||||
// ViNS ID is specified, try to get compute instance straight by this ID
|
||||
log.Debugf("utilityVinsCheckPresence: locating ViNS by its ID %d", theId)
|
||||
urlValues.Add("vinsId", fmt.Sprintf("%d", theId))
|
||||
vinsFacts, err := controller.decortAPICall("POST", VinsGetAPI, urlValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return vinsFacts, nil
|
||||
}
|
||||
|
||||
// ID was not set in the schema upon entering this function - work through ViNS name
|
||||
// and Account / RG ID
|
||||
|
||||
vinsName, argSet := d.GetOk("name")
|
||||
if !argSet {
|
||||
// if ViNS name is not set. then we cannot locate ViNS
|
||||
return "", fmt.Errorf("Cannot check ViNS presence if ViNS name is empty")
|
||||
}
|
||||
urlValues.Add("name", vinsName.(string))
|
||||
urlValues.Add("show_all", "false")
|
||||
log.Debugf("utilityVinsCheckPresence: preparing to locate ViNS name %s", vinsName.(string))
|
||||
|
||||
rgId, rgSet := d.GetOk("rg_id")
|
||||
if rgSet {
|
||||
log.Debugf("utilityVinsCheckPresence: limiting ViNS search to RG ID %d", rgId.(int))
|
||||
urlValues.Add("rgId", fmt.Sprintf("%d", rgId.(int)))
|
||||
}
|
||||
|
||||
accountId, accountSet := d.GetOk("account_id")
|
||||
if accountSet {
|
||||
log.Debugf("utilityVinsCheckPresence: limiting ViNS search to Account ID %d", accountId.(int))
|
||||
urlValues.Add("accountId", fmt.Sprintf("%d", accountId.(int)))
|
||||
}
|
||||
|
||||
apiResp, err := controller.decortAPICall("POST", VinsSearchAPI, urlValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// log.Debugf("%s", apiResp)
|
||||
// log.Debugf("utilityResgroupCheckPresence: ready to decode response body from %s", VinsSearchAPI)
|
||||
model := VinsSearchResp{}
|
||||
err = json.Unmarshal([]byte(apiResp), &model)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
log.Debugf("utilityVinsCheckPresence: traversing decoded Json of length %d", len(model))
|
||||
for index, item := range model {
|
||||
if item.Name == vinsName.(string) {
|
||||
if ( accountSet && item.AccountID != accountId.(int) ) ||
|
||||
( rgSet && item.RgID != rgId.(int) ) {
|
||||
// double check that account ID and Rg ID match, if set in the schema
|
||||
continue
|
||||
}
|
||||
|
||||
log.Debugf("utilityVinsCheckPresence: match ViNS name %s / ID %d, account ID %d, RG ID %d at index %d",
|
||||
item.Name, item.ID, item.AccountID, item.RgID, index)
|
||||
|
||||
// element returned by API vins/search does not contain all information we may need to
|
||||
// manage ViNS, so we have to get detailed info by calling API vins/get
|
||||
rqValues := &url.Values{}
|
||||
rqValues.Add("vinsId", fmt.Sprintf("%d",item.ID))
|
||||
vinsGetResp, err := controller.decortAPICall("POST", VinsGetAPI, rqValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return vinsGetResp, nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("Cannot find ViNS name %s. Check name and/or RG ID & Account ID and your access rights", vinsName.(string))
|
||||
}
|
||||
@@ -15,23 +15,116 @@ description: |-
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- **account_id** (Number) Unique ID of the account. If account ID is specified, then account name is ignored.
|
||||
- **id** (String) The ID of this resource.
|
||||
- **name** (String) Name of the account. Names are case sensitive and unique.
|
||||
- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- **status** (String) Current status of the account.
|
||||
- `account_name` (String)
|
||||
- `acl` (List of Object) (see [below for nested schema](#nestedatt--acl))
|
||||
- `company` (String)
|
||||
- `companyurl` (String)
|
||||
- `compute_features` (List of String)
|
||||
- `computes` (List of Object) (see [below for nested schema](#nestedatt--computes))
|
||||
- `cpu_allocation_parameter` (String)
|
||||
- `cpu_allocation_ratio` (Number)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `dc_location` (String)
|
||||
- `deactivation_time` (Number)
|
||||
- `default_zone_id` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `displayname` (String)
|
||||
- `guid` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `machines` (List of Object) (see [below for nested schema](#nestedatt--machines))
|
||||
- `resource_limits` (List of Object) (see [below for nested schema](#nestedatt--resource_limits))
|
||||
- `send_access_emails` (Boolean)
|
||||
- `status` (String)
|
||||
- `storage_policy_ids` (List of Number)
|
||||
- `updated_time` (Number)
|
||||
- `version` (Number)
|
||||
- `vins` (List of Number)
|
||||
- `vinses` (Number)
|
||||
- `zone_ids` (List of Object) (see [below for nested schema](#nestedatt--zone_ids))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- **default** (String)
|
||||
- **read** (String)
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--acl"></a>
|
||||
### Nested Schema for `acl`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `can_be_deleted` (Boolean)
|
||||
- `emails` (List of String)
|
||||
- `explicit` (Boolean)
|
||||
- `guid` (String)
|
||||
- `right` (String)
|
||||
- `status` (String)
|
||||
- `type` (String)
|
||||
- `user_group_id` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--computes"></a>
|
||||
### Nested Schema for `computes`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `started` (Number)
|
||||
- `stopped` (Number)
|
||||
|
||||
|
||||
<a id="nestedatt--machines"></a>
|
||||
### Nested Schema for `machines`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `halted` (Number)
|
||||
- `running` (Number)
|
||||
|
||||
|
||||
<a id="nestedatt--resource_limits"></a>
|
||||
### Nested Schema for `resource_limits`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cu_c` (Number)
|
||||
- `cu_d` (Number)
|
||||
- `cu_dm` (Number)
|
||||
- `cu_i` (Number)
|
||||
- `cu_m` (Number)
|
||||
- `cu_np` (Number)
|
||||
- `gpu_units` (Number)
|
||||
- `storage_policy` (List of Object) (see [below for nested schema](#nestedobjatt--resource_limits--storage_policy))
|
||||
|
||||
<a id="nestedobjatt--resource_limits--storage_policy"></a>
|
||||
### Nested Schema for `resource_limits.storage_policy`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `id` (Number)
|
||||
- `limit` (Number)
|
||||
|
||||
|
||||
|
||||
<a id="nestedatt--zone_ids"></a>
|
||||
### Nested Schema for `zone_ids`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `id` (Number)
|
||||
- `name` (String)
|
||||
|
||||
49
docs/data-sources/account_audits_list.md
Normal file
49
docs/data-sources/account_audits_list.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_audits_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_audits_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) Search Result (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `call` (String)
|
||||
- `responsetime` (Number)
|
||||
- `statuscode` (Number)
|
||||
- `timestamp` (Number)
|
||||
- `user` (String)
|
||||
76
docs/data-sources/account_computes_list.md
Normal file
76
docs/data-sources/account_computes_list.md
Normal file
@@ -0,0 +1,76 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_computes_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_computes_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `compute_id` (Number) Filter by compute ID
|
||||
- `extnet_id` (Number) Filter by extnet ID
|
||||
- `extnet_name` (String) Filter by extnet name
|
||||
- `ip_address` (String) Filter by IP address
|
||||
- `name` (String) Filter by compute name
|
||||
- `page` (Number) Page number
|
||||
- `rg_id` (Number) Filter by RG ID
|
||||
- `rg_name` (String) Filter by RG name
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `tech_status` (String) Filter by tech. status
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) Search Result (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `compute_id` (Number)
|
||||
- `compute_name` (String)
|
||||
- `cpus` (Number)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `ram` (Number)
|
||||
- `registered` (Boolean)
|
||||
- `rg_id` (Number)
|
||||
- `rg_name` (String)
|
||||
- `status` (String)
|
||||
- `tech_status` (String)
|
||||
- `total_disks_size` (Number)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `user_managed` (Boolean)
|
||||
- `vins_connected` (Number)
|
||||
43
docs/data-sources/account_consumed_units.md
Normal file
43
docs/data-sources/account_consumed_units.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_consumed_units Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_consumed_units (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `cu_c` (Number)
|
||||
- `cu_d` (Number)
|
||||
- `cu_dm` (Number)
|
||||
- `cu_i` (Number)
|
||||
- `cu_m` (Number)
|
||||
- `cu_np` (Number)
|
||||
- `gpu_units` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
38
docs/data-sources/account_consumed_units_by_type.md
Normal file
38
docs/data-sources/account_consumed_units_by_type.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_consumed_units_by_type Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_consumed_units_by_type (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
- `cu_type` (String) cloud unit resource type
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `cu_result` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
70
docs/data-sources/account_deleted_list.md
Normal file
70
docs/data-sources/account_deleted_list.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_deleted_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_deleted_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `acl` (String) Filter by ACL
|
||||
- `by_id` (Number) Filter by ID
|
||||
- `name` (String) Filter by name
|
||||
- `page` (Number) Page number
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `zone_id` (Number) Zone ID
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `acl` (List of Object) (see [below for nested schema](#nestedobjatt--items--acl))
|
||||
- `compute_features` (List of String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `status` (String)
|
||||
- `updated_time` (Number)
|
||||
- `zone_ids` (List of Number)
|
||||
|
||||
<a id="nestedobjatt--items--acl"></a>
|
||||
### Nested Schema for `items.acl`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `explicit` (Boolean)
|
||||
- `guid` (String)
|
||||
- `right` (String)
|
||||
- `status` (String)
|
||||
- `type` (String)
|
||||
- `user_group_id` (String)
|
||||
59
docs/data-sources/account_disks_list.md
Normal file
59
docs/data-sources/account_disks_list.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_disks_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_disks_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `disk_id` (Number) Filter by disk ID
|
||||
- `disk_max_size` (Number) Filter by disk max size
|
||||
- `name` (String) Filter by disk name
|
||||
- `page` (Number) Page number
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `type` (String) Filter by disk type
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) Search Result (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_id` (Number)
|
||||
- `disk_name` (String)
|
||||
- `pool` (String)
|
||||
- `sep_id` (Number)
|
||||
- `shareable` (Boolean)
|
||||
- `size_max` (Number)
|
||||
- `type` (String)
|
||||
75
docs/data-sources/account_flipgroups_list.md
Normal file
75
docs/data-sources/account_flipgroups_list.md
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_flipgroups_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_flipgroups_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `by_ip` (String) Filter by IP
|
||||
- `extnet_id` (Number) Filter by extnet ID
|
||||
- `flipgroup_id` (Number) Filter by flipgroup ID
|
||||
- `name` (String) Filter by name
|
||||
- `page` (Number) Page number
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `vins_id` (Number) Filter by ViNS ID
|
||||
- `vins_name` (String) Filter by ViNS name
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) Search Result (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `client_type` (String)
|
||||
- `conn_type` (String)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `default_gw` (String)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `fg_id` (Number)
|
||||
- `fg_name` (String)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `ip` (String)
|
||||
- `milestones` (Number)
|
||||
- `net_id` (Number)
|
||||
- `net_type` (String)
|
||||
- `netmask` (Number)
|
||||
- `status` (String)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
71
docs/data-sources/account_list.md
Normal file
71
docs/data-sources/account_list.md
Normal file
@@ -0,0 +1,71 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `acl` (String) Filter by ACL
|
||||
- `by_id` (Number) Filter by ID
|
||||
- `name` (String) Filter by name
|
||||
- `page` (Number) Page number
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `status` (String) Filter by status
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `zone_id` (Number) Zone ID
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `acl` (List of Object) (see [below for nested schema](#nestedobjatt--items--acl))
|
||||
- `compute_features` (List of String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `status` (String)
|
||||
- `updated_time` (Number)
|
||||
- `zone_ids` (List of Number)
|
||||
|
||||
<a id="nestedobjatt--items--acl"></a>
|
||||
### Nested Schema for `items.acl`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `explicit` (Boolean)
|
||||
- `guid` (String)
|
||||
- `right` (String)
|
||||
- `status` (String)
|
||||
- `type` (String)
|
||||
- `user_group_id` (String)
|
||||
43
docs/data-sources/account_reserved_units.md
Normal file
43
docs/data-sources/account_reserved_units.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_reserved_units Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_reserved_units (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `cu_c` (Number)
|
||||
- `cu_d` (Number)
|
||||
- `cu_dm` (Number)
|
||||
- `cu_i` (Number)
|
||||
- `cu_m` (Number)
|
||||
- `cu_np` (Number)
|
||||
- `gpu_units` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
160
docs/data-sources/account_resource_consumption_get.md
Normal file
160
docs/data-sources/account_resource_consumption_get.md
Normal file
@@ -0,0 +1,160 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_resource_consumption_get Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_resource_consumption_get (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `consumed` (List of Object) (see [below for nested schema](#nestedatt--consumed))
|
||||
- `id` (String) The ID of this resource.
|
||||
- `reserved` (List of Object) (see [below for nested schema](#nestedatt--reserved))
|
||||
- `resource_limits` (List of Object) (see [below for nested schema](#nestedatt--resource_limits))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--consumed"></a>
|
||||
### Nested Schema for `consumed`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `ext_ips` (Number)
|
||||
- `ext_traffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `policies` (List of Object) (see [below for nested schema](#nestedobjatt--consumed--policies))
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--consumed--seps))
|
||||
|
||||
<a id="nestedobjatt--consumed--policies"></a>
|
||||
### Nested Schema for `consumed.policies`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `id` (String)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--consumed--policies--seps))
|
||||
|
||||
<a id="nestedobjatt--consumed--policies--seps"></a>
|
||||
### Nested Schema for `consumed.policies.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedobjatt--consumed--seps"></a>
|
||||
### Nested Schema for `consumed.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedatt--reserved"></a>
|
||||
### Nested Schema for `reserved`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `ext_ips` (Number)
|
||||
- `ext_traffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `policies` (List of Object) (see [below for nested schema](#nestedobjatt--reserved--policies))
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--reserved--seps))
|
||||
|
||||
<a id="nestedobjatt--reserved--policies"></a>
|
||||
### Nested Schema for `reserved.policies`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `id` (String)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--reserved--policies--seps))
|
||||
|
||||
<a id="nestedobjatt--reserved--policies--seps"></a>
|
||||
### Nested Schema for `reserved.policies.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedobjatt--reserved--seps"></a>
|
||||
### Nested Schema for `reserved.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedatt--resource_limits"></a>
|
||||
### Nested Schema for `resource_limits`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cu_c` (Number)
|
||||
- `cu_d` (Number)
|
||||
- `cu_dm` (Number)
|
||||
- `cu_i` (Number)
|
||||
- `cu_m` (Number)
|
||||
- `cu_np` (Number)
|
||||
- `gpu_units` (Number)
|
||||
- `storage_policy` (List of Object) (see [below for nested schema](#nestedobjatt--resource_limits--storage_policy))
|
||||
|
||||
<a id="nestedobjatt--resource_limits--storage_policy"></a>
|
||||
### Nested Schema for `resource_limits.storage_policy`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `id` (Number)
|
||||
- `limit` (Number)
|
||||
140
docs/data-sources/account_resource_consumption_list.md
Normal file
140
docs/data-sources/account_resource_consumption_list.md
Normal file
@@ -0,0 +1,140 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_resource_consumption_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_resource_consumption_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `consumed` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed))
|
||||
- `reserved` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved))
|
||||
|
||||
<a id="nestedobjatt--items--consumed"></a>
|
||||
### Nested Schema for `items.consumed`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `ext_ips` (Number)
|
||||
- `ext_traffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `policies` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed--policies))
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed--seps))
|
||||
|
||||
<a id="nestedobjatt--items--consumed--policies"></a>
|
||||
### Nested Schema for `items.consumed.policies`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `id` (String)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed--policies--seps))
|
||||
|
||||
<a id="nestedobjatt--items--consumed--policies--seps"></a>
|
||||
### Nested Schema for `items.consumed.policies.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--consumed--seps"></a>
|
||||
### Nested Schema for `items.consumed.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--reserved"></a>
|
||||
### Nested Schema for `items.reserved`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `ext_ips` (Number)
|
||||
- `ext_traffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `policies` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved--policies))
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved--seps))
|
||||
|
||||
<a id="nestedobjatt--items--reserved--policies"></a>
|
||||
### Nested Schema for `items.reserved.policies`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `id` (String)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved--policies--seps))
|
||||
|
||||
<a id="nestedobjatt--items--reserved--policies--seps"></a>
|
||||
### Nested Schema for `items.reserved.policies.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--reserved--seps"></a>
|
||||
### Nested Schema for `items.reserved.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
123
docs/data-sources/account_rg_list.md
Normal file
123
docs/data-sources/account_rg_list.md
Normal file
@@ -0,0 +1,123 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_rg_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_rg_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `name` (String) Filter by name
|
||||
- `page` (Number) Page number
|
||||
- `rg_id` (Number) Filter by RG ID
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `status` (String) Filter by status
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `vins_id` (Number) Filter by ViNS ID
|
||||
- `vm_id` (Number) Filter by VM ID
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) Search Result (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `computes` (List of Object) (see [below for nested schema](#nestedobjatt--items--computes))
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `milestones` (Number)
|
||||
- `resources` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources))
|
||||
- `rg_id` (Number)
|
||||
- `rg_name` (String)
|
||||
- `status` (String)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `vinses` (Number)
|
||||
|
||||
<a id="nestedobjatt--items--computes"></a>
|
||||
### Nested Schema for `items.computes`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `started` (Number)
|
||||
- `stopped` (Number)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--resources"></a>
|
||||
### Nested Schema for `items.resources`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `consumed` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--consumed))
|
||||
- `limits` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--limits))
|
||||
- `reserved` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--reserved))
|
||||
|
||||
<a id="nestedobjatt--items--resources--consumed"></a>
|
||||
### Nested Schema for `items.resources.consumed`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disksize` (Number)
|
||||
- `extips` (Number)
|
||||
- `exttraffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `ram` (Number)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--resources--limits"></a>
|
||||
### Nested Schema for `items.resources.limits`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disksize` (Number)
|
||||
- `extips` (Number)
|
||||
- `exttraffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `ram` (Number)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--resources--reserved"></a>
|
||||
### Nested Schema for `items.resources.reserved`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disksize` (Number)
|
||||
- `extips` (Number)
|
||||
- `exttraffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `ram` (Number)
|
||||
62
docs/data-sources/account_templates_list.md
Normal file
62
docs/data-sources/account_templates_list.md
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_templates_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_templates_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `image_id` (Number) Find by image id
|
||||
- `include_deleted` (Boolean)
|
||||
- `name` (String) Filter by name
|
||||
- `page` (Number) Page number
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `type` (String) Filter by type
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) Search Result (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `desc` (String)
|
||||
- `public` (Boolean)
|
||||
- `size` (Number)
|
||||
- `status` (String)
|
||||
- `template_id` (Number)
|
||||
- `template_name` (String)
|
||||
- `type` (String)
|
||||
- `unc_path` (String)
|
||||
- `username` (String)
|
||||
71
docs/data-sources/account_vins_list.md
Normal file
71
docs/data-sources/account_vins_list.md
Normal file
@@ -0,0 +1,71 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_account_vins_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_account_vins_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `ext_ip` (String) Filter by external IP
|
||||
- `name` (String) Filter by name
|
||||
- `page` (Number) Page number
|
||||
- `rg_id` (Number) Filter by RG ID
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `vins_id` (Number) Filter by ViNS ID
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) Search Result (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `computes` (Number)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `external_ip` (String)
|
||||
- `extnet_id` (Number)
|
||||
- `free_ips` (Number)
|
||||
- `network` (String)
|
||||
- `pri_vnf_dev_id` (Number)
|
||||
- `rg_id` (Number)
|
||||
- `rg_name` (String)
|
||||
- `status` (String)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `vin_id` (Number)
|
||||
- `vin_name` (String)
|
||||
49
docs/data-sources/audit.md
Normal file
49
docs/data-sources/audit.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_audit Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_audit (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `audit_guid` (String) audit guid
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `args` (String)
|
||||
- `call` (String)
|
||||
- `correlation_id` (String)
|
||||
- `guid` (String)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `kwargs` (String)
|
||||
- `remote_addr` (String)
|
||||
- `responsetime` (Number)
|
||||
- `result` (String)
|
||||
- `status_code` (Number)
|
||||
- `tags` (String)
|
||||
- `timestamp` (Number)
|
||||
- `timestamp_end` (Number)
|
||||
- `user` (String)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
77
docs/data-sources/audit_list.md
Normal file
77
docs/data-sources/audit_list.md
Normal file
@@ -0,0 +1,77 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_audit_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_audit_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `account_id` (Number)
|
||||
- `call` (String) find by api endpoint (Mongo RegExp supported)
|
||||
- `compute_id` (Number)
|
||||
- `exclude_audit_lines` (Boolean)
|
||||
- `flipgroup_id` (Number)
|
||||
- `k8s_id` (Number)
|
||||
- `lb_id` (Number)
|
||||
- `max_status_code` (Number) find by HTTP max status code
|
||||
- `min_status_code` (Number) find by HTTP min status code
|
||||
- `page` (Number) page number
|
||||
- `request_id` (String) request id
|
||||
- `resgroup_id` (Number)
|
||||
- `sep_id` (Number)
|
||||
- `service_id` (Number)
|
||||
- `size` (Number) page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `timestamp_at` (Number) find all audits after point in time (unixtime)
|
||||
- `timestamp_to` (Number) find all audits before point in time (unixtime)
|
||||
- `user` (String) find by user (Mongo RegExp supported)
|
||||
- `vins_id` (Number)
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number) entry count
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `args` (String)
|
||||
- `call` (String)
|
||||
- `compute_id` (Number)
|
||||
- `correlation_id` (String)
|
||||
- `guid` (String)
|
||||
- `kwargs` (String)
|
||||
- `remote_addr` (String)
|
||||
- `resgroup_id` (Number)
|
||||
- `responsetime` (Number)
|
||||
- `result` (String)
|
||||
- `status_code` (Number)
|
||||
- `timestamp` (Number)
|
||||
- `timestamp_end` (Number)
|
||||
- `ttl` (String)
|
||||
- `user` (String)
|
||||
107
docs/data-sources/bservice.md
Normal file
107
docs/data-sources/bservice.md
Normal file
@@ -0,0 +1,107 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_bservice Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_bservice (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `service_id` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `base_domain` (String)
|
||||
- `computes` (List of Object) (see [below for nested schema](#nestedatt--computes))
|
||||
- `cpu_total` (Number)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `disk_total` (Number)
|
||||
- `gid` (Number)
|
||||
- `groups` (List of Object) (see [below for nested schema](#nestedatt--groups))
|
||||
- `guid` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `milestones` (Number)
|
||||
- `parent_srv_id` (Number)
|
||||
- `parent_srv_type` (String)
|
||||
- `ram_total` (Number)
|
||||
- `rg_id` (Number)
|
||||
- `rg_name` (String)
|
||||
- `service_name` (String)
|
||||
- `snapshots` (List of Object) (see [below for nested schema](#nestedatt--snapshots))
|
||||
- `ssh_key` (String)
|
||||
- `ssh_user` (String)
|
||||
- `status` (String)
|
||||
- `tech_status` (String)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `user_managed` (Boolean)
|
||||
- `zone_id` (Number)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--computes"></a>
|
||||
### Nested Schema for `computes`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `architecture` (String)
|
||||
- `compgroup_id` (Number)
|
||||
- `compgroup_name` (String)
|
||||
- `compgroup_role` (String)
|
||||
- `id` (Number)
|
||||
- `name` (String)
|
||||
- `rg_id` (Number)
|
||||
- `stack_id` (Number)
|
||||
- `status` (String)
|
||||
- `tech_status` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--groups"></a>
|
||||
### Nested Schema for `groups`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `computes` (Number)
|
||||
- `consistency` (Boolean)
|
||||
- `id` (Number)
|
||||
- `name` (String)
|
||||
- `status` (String)
|
||||
- `tech_status` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--snapshots"></a>
|
||||
### Nested Schema for `snapshots`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `guid` (String)
|
||||
- `label` (String)
|
||||
- `timestamp` (Number)
|
||||
- `valid` (Boolean)
|
||||
70
docs/data-sources/bservice_deleted_list.md
Normal file
70
docs/data-sources/bservice_deleted_list.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_bservice_deleted_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_bservice_deleted_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `account_id` (Number) ID of the account to query for BasicService instances
|
||||
- `page` (Number) Page number
|
||||
- `rg_id` (Number) ID of the resource group to query for BasicService instances
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `zone_id` (Number) Zone ID
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `base_domain` (String)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `gid` (Number)
|
||||
- `groups` (List of Number)
|
||||
- `guid` (Number)
|
||||
- `parent_srv_id` (Number)
|
||||
- `parent_srv_type` (String)
|
||||
- `rg_id` (Number)
|
||||
- `rg_name` (String)
|
||||
- `service_id` (Number)
|
||||
- `service_name` (String)
|
||||
- `ssh_user` (String)
|
||||
- `status` (String)
|
||||
- `tech_status` (String)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `user_managed` (Boolean)
|
||||
- `zone_id` (Number)
|
||||
87
docs/data-sources/bservice_group.md
Normal file
87
docs/data-sources/bservice_group.md
Normal file
@@ -0,0 +1,87 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_bservice_group Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_bservice_group (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `compgroup_id` (Number)
|
||||
- `service_id` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `compgroup_name` (String)
|
||||
- `computes` (List of Object) (see [below for nested schema](#nestedatt--computes))
|
||||
- `consistency` (Boolean)
|
||||
- `cpu` (Number)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `disk` (Number)
|
||||
- `driver` (String)
|
||||
- `extnets` (List of Number)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `image_id` (Number)
|
||||
- `milestones` (Number)
|
||||
- `parents` (List of Number)
|
||||
- `ram` (Number)
|
||||
- `rg_id` (Number)
|
||||
- `rg_name` (String)
|
||||
- `role` (String)
|
||||
- `sep_id` (Number)
|
||||
- `seq_no` (Number)
|
||||
- `status` (String)
|
||||
- `tech_status` (String)
|
||||
- `timeout_start` (Number)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `vinses` (List of Number)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--computes"></a>
|
||||
### Nested Schema for `computes`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `chipset` (String)
|
||||
- `id` (Number)
|
||||
- `ip_addresses` (List of String)
|
||||
- `name` (String)
|
||||
- `os_users` (List of Object) (see [below for nested schema](#nestedobjatt--computes--os_users))
|
||||
|
||||
<a id="nestedobjatt--computes--os_users"></a>
|
||||
### Nested Schema for `computes.os_users`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `login` (String)
|
||||
- `password` (String)
|
||||
76
docs/data-sources/bservice_list.md
Normal file
76
docs/data-sources/bservice_list.md
Normal file
@@ -0,0 +1,76 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_bservice_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_bservice_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `account_id` (Number) ID of the account to query for BasicService instances
|
||||
- `account_name` (String) Filter by account name
|
||||
- `by_id` (Number) Filter by ID
|
||||
- `name` (String) Filter by bservice name
|
||||
- `page` (Number) Page number
|
||||
- `rg_id` (Number) ID of the resource group to query for BasicService instances
|
||||
- `rg_name` (String) Filter by resource group name
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `status` (String) Filter by status
|
||||
- `tech_status` (String) Filter by tech status
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `zone_id` (Number) Zone ID
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `base_domain` (String)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `gid` (Number)
|
||||
- `groups` (List of Number)
|
||||
- `guid` (Number)
|
||||
- `parent_srv_id` (Number)
|
||||
- `parent_srv_type` (String)
|
||||
- `rg_id` (Number)
|
||||
- `rg_name` (String)
|
||||
- `service_id` (Number)
|
||||
- `service_name` (String)
|
||||
- `ssh_user` (String)
|
||||
- `status` (String)
|
||||
- `tech_status` (String)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `user_managed` (Boolean)
|
||||
- `zone_id` (Number)
|
||||
49
docs/data-sources/bservice_snapshot_list.md
Normal file
49
docs/data-sources/bservice_snapshot_list.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_bservice_snapshot_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_bservice_snapshot_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `service_id` (Number) ID of the BasicService instance
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `guid` (String)
|
||||
- `label` (String)
|
||||
- `timestamp` (Number)
|
||||
- `valid` (Boolean)
|
||||
110
docs/data-sources/cb_account.md
Normal file
110
docs/data-sources/cb_account.md
Normal file
@@ -0,0 +1,110 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_account Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_account (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `account_name` (String)
|
||||
- `acl` (List of Object) (see [below for nested schema](#nestedatt--acl))
|
||||
- `company` (String)
|
||||
- `companyurl` (String)
|
||||
- `compute_features` (List of String)
|
||||
- `cpu_allocation_parameter` (String)
|
||||
- `cpu_allocation_ratio` (Number)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `dc_location` (String)
|
||||
- `deactivation_time` (Number)
|
||||
- `default_zone_id` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `displayname` (String)
|
||||
- `guid` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `resource_limits` (List of Object) (see [below for nested schema](#nestedatt--resource_limits))
|
||||
- `resource_types` (List of String)
|
||||
- `send_access_emails` (Boolean)
|
||||
- `status` (String)
|
||||
- `storage_policy_ids` (List of Number)
|
||||
- `uniq_pools` (List of String)
|
||||
- `updated_time` (Number)
|
||||
- `version` (Number)
|
||||
- `vins` (List of Number)
|
||||
- `zone_ids` (Set of Object) (see [below for nested schema](#nestedatt--zone_ids))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--acl"></a>
|
||||
### Nested Schema for `acl`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `emails` (List of String)
|
||||
- `explicit` (Boolean)
|
||||
- `guid` (String)
|
||||
- `right` (String)
|
||||
- `status` (String)
|
||||
- `type` (String)
|
||||
- `user_group_id` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--resource_limits"></a>
|
||||
### Nested Schema for `resource_limits`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cu_c` (Number)
|
||||
- `cu_d` (Number)
|
||||
- `cu_dm` (Number)
|
||||
- `cu_i` (Number)
|
||||
- `cu_m` (Number)
|
||||
- `cu_np` (Number)
|
||||
- `gpu_units` (Number)
|
||||
- `storage_policy` (List of Object) (see [below for nested schema](#nestedobjatt--resource_limits--storage_policy))
|
||||
|
||||
<a id="nestedobjatt--resource_limits--storage_policy"></a>
|
||||
### Nested Schema for `resource_limits.storage_policy`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `id` (Number)
|
||||
- `limit` (Number)
|
||||
|
||||
|
||||
|
||||
<a id="nestedatt--zone_ids"></a>
|
||||
### Nested Schema for `zone_ids`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `id` (Number)
|
||||
- `name` (String)
|
||||
49
docs/data-sources/cb_account_audits_list.md
Normal file
49
docs/data-sources/cb_account_audits_list.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_account_audits_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_account_audits_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) Search Result (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `call` (String)
|
||||
- `responsetime` (Number)
|
||||
- `statuscode` (Number)
|
||||
- `timestamp` (Number)
|
||||
- `user` (String)
|
||||
37
docs/data-sources/cb_account_available_templates_list.md
Normal file
37
docs/data-sources/cb_account_available_templates_list.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_account_available_templates_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_account_available_templates_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Number)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
76
docs/data-sources/cb_account_computes_list.md
Normal file
76
docs/data-sources/cb_account_computes_list.md
Normal file
@@ -0,0 +1,76 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_account_computes_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_account_computes_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `compute_id` (Number) Filter by compute ID
|
||||
- `extnet_id` (Number) Filter by extnet ID
|
||||
- `extnet_name` (String) Filter by extnet name
|
||||
- `ip_address` (String) Filter by IP address
|
||||
- `name` (String) Filter by compute name
|
||||
- `page` (Number) Page number
|
||||
- `rg_id` (Number) Filter by RG ID
|
||||
- `rg_name` (String) Filter by RG name
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `tech_status` (String) Filter by tech. status
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) Search Result (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `compute_id` (Number)
|
||||
- `compute_name` (String)
|
||||
- `cpus` (Number)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `ram` (Number)
|
||||
- `registered` (Boolean)
|
||||
- `rg_id` (Number)
|
||||
- `rg_name` (String)
|
||||
- `status` (String)
|
||||
- `tech_status` (String)
|
||||
- `total_disks_size` (Number)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `user_managed` (Boolean)
|
||||
- `vins_connected` (Number)
|
||||
59
docs/data-sources/cb_account_disks_list.md
Normal file
59
docs/data-sources/cb_account_disks_list.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_account_disks_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_account_disks_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `disk_id` (Number) Filter by disk ID
|
||||
- `disk_max_size` (Number) Filter by disk max size
|
||||
- `name` (String) Filter by disk name
|
||||
- `page` (Number) Page number
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `type` (String) Filter by disk type
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) Search Result (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_id` (Number)
|
||||
- `disk_name` (String)
|
||||
- `pool_name` (String)
|
||||
- `sep_id` (Number)
|
||||
- `shareable` (Boolean)
|
||||
- `size_max` (Number)
|
||||
- `type` (String)
|
||||
75
docs/data-sources/cb_account_flipgroups_list.md
Normal file
75
docs/data-sources/cb_account_flipgroups_list.md
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_account_flipgroups_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_account_flipgroups_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `by_ip` (String) Filter by IP
|
||||
- `extnet_id` (Number) Filter by extnet ID
|
||||
- `flipgroup_id` (Number) Filter by flipgroup ID
|
||||
- `name` (String) Filter by name
|
||||
- `page` (Number) Page number
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `vins_id` (Number) Filter by ViNS ID
|
||||
- `vins_name` (String) Filter by ViNS name
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) Search Result (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `client_type` (String)
|
||||
- `conn_type` (String)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `default_gw` (String)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `fg_id` (Number)
|
||||
- `fg_name` (String)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `ip` (String)
|
||||
- `milestones` (Number)
|
||||
- `net_id` (Number)
|
||||
- `net_type` (String)
|
||||
- `netmask` (Number)
|
||||
- `status` (String)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
112
docs/data-sources/cb_account_list.md
Normal file
112
docs/data-sources/cb_account_list.md
Normal file
@@ -0,0 +1,112 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_account_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_account_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `acl` (String) Filter by ACL
|
||||
- `by_id` (Number) Filter by ID
|
||||
- `name` (String) Filter by name
|
||||
- `page` (Number) Page number
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `status` (String) Filter by status
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `zone_id` (Number) Zone ID
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `acl` (List of Object) (see [below for nested schema](#nestedobjatt--items--acl))
|
||||
- `company` (String)
|
||||
- `companyurl` (String)
|
||||
- `compute_features` (List of String)
|
||||
- `cpu_allocation_parameter` (String)
|
||||
- `cpu_allocation_ratio` (Number)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `dc_location` (String)
|
||||
- `deactivation_time` (Number)
|
||||
- `default_zone_id` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `displayname` (String)
|
||||
- `guid` (Number)
|
||||
- `resource_limits` (List of Object) (see [below for nested schema](#nestedobjatt--items--resource_limits))
|
||||
- `resource_types` (List of String)
|
||||
- `send_access_emails` (Boolean)
|
||||
- `status` (String)
|
||||
- `storage_policy_ids` (List of Number)
|
||||
- `uniq_pools` (List of String)
|
||||
- `updated_time` (Number)
|
||||
- `version` (Number)
|
||||
- `vins` (List of Number)
|
||||
- `zone_ids` (List of Number)
|
||||
|
||||
<a id="nestedobjatt--items--acl"></a>
|
||||
### Nested Schema for `items.acl`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `explicit` (Boolean)
|
||||
- `guid` (String)
|
||||
- `right` (String)
|
||||
- `status` (String)
|
||||
- `type` (String)
|
||||
- `user_group_id` (String)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--resource_limits"></a>
|
||||
### Nested Schema for `items.resource_limits`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cu_c` (Number)
|
||||
- `cu_d` (Number)
|
||||
- `cu_dm` (Number)
|
||||
- `cu_i` (Number)
|
||||
- `cu_m` (Number)
|
||||
- `cu_np` (Number)
|
||||
- `gpu_units` (Number)
|
||||
- `storage_policy` (List of Object) (see [below for nested schema](#nestedobjatt--items--resource_limits--storage_policy))
|
||||
|
||||
<a id="nestedobjatt--items--resource_limits--storage_policy"></a>
|
||||
### Nested Schema for `items.resource_limits.storage_policy`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `id` (Number)
|
||||
- `limit` (Number)
|
||||
110
docs/data-sources/cb_account_list_deleted.md
Normal file
110
docs/data-sources/cb_account_list_deleted.md
Normal file
@@ -0,0 +1,110 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_account_list_deleted Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_account_list_deleted (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `acl` (String) Filter by ACL
|
||||
- `by_id` (Number) Filter by ID
|
||||
- `name` (String) Filter by name
|
||||
- `page` (Number) Page number
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `acl` (List of Object) (see [below for nested schema](#nestedobjatt--items--acl))
|
||||
- `company` (String)
|
||||
- `companyurl` (String)
|
||||
- `compute_features` (List of String)
|
||||
- `cpu_allocation_parameter` (String)
|
||||
- `cpu_allocation_ratio` (Number)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `dc_location` (String)
|
||||
- `deactivation_time` (Number)
|
||||
- `default_zone_id` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `displayname` (String)
|
||||
- `guid` (Number)
|
||||
- `resource_limits` (List of Object) (see [below for nested schema](#nestedobjatt--items--resource_limits))
|
||||
- `resource_types` (List of String)
|
||||
- `send_access_emails` (Boolean)
|
||||
- `status` (String)
|
||||
- `storage_policy_ids` (List of Number)
|
||||
- `uniq_pools` (List of String)
|
||||
- `updated_time` (Number)
|
||||
- `version` (Number)
|
||||
- `vins` (List of Number)
|
||||
- `zone_ids` (List of Number)
|
||||
|
||||
<a id="nestedobjatt--items--acl"></a>
|
||||
### Nested Schema for `items.acl`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `explicit` (Boolean)
|
||||
- `guid` (String)
|
||||
- `right` (String)
|
||||
- `status` (String)
|
||||
- `type` (String)
|
||||
- `user_group_id` (String)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--resource_limits"></a>
|
||||
### Nested Schema for `items.resource_limits`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cu_c` (Number)
|
||||
- `cu_d` (Number)
|
||||
- `cu_dm` (Number)
|
||||
- `cu_i` (Number)
|
||||
- `cu_m` (Number)
|
||||
- `cu_np` (Number)
|
||||
- `gpu_units` (Number)
|
||||
- `storage_policy` (List of Object) (see [below for nested schema](#nestedobjatt--items--resource_limits--storage_policy))
|
||||
|
||||
<a id="nestedobjatt--items--resource_limits--storage_policy"></a>
|
||||
### Nested Schema for `items.resource_limits.storage_policy`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `id` (Number)
|
||||
- `limit` (Number)
|
||||
151
docs/data-sources/cb_account_resource_consumption_get.md
Normal file
151
docs/data-sources/cb_account_resource_consumption_get.md
Normal file
@@ -0,0 +1,151 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_account_resource_consumption_get Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_account_resource_consumption_get (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `consumed` (List of Object) (see [below for nested schema](#nestedatt--consumed))
|
||||
- `id` (String) The ID of this resource.
|
||||
- `reserved` (List of Object) (see [below for nested schema](#nestedatt--reserved))
|
||||
- `resource_limits` (List of Object) (see [below for nested schema](#nestedatt--resource_limits))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--consumed"></a>
|
||||
### Nested Schema for `consumed`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disksize` (Number)
|
||||
- `disksizemax` (Number)
|
||||
- `extips` (Number)
|
||||
- `exttraffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `policies` (List of Object) (see [below for nested schema](#nestedobjatt--consumed--policies))
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--consumed--seps))
|
||||
|
||||
<a id="nestedobjatt--consumed--policies"></a>
|
||||
### Nested Schema for `consumed.policies`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `id` (String)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--consumed--policies--seps))
|
||||
|
||||
<a id="nestedobjatt--consumed--policies--seps"></a>
|
||||
### Nested Schema for `consumed.policies.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedobjatt--consumed--seps"></a>
|
||||
### Nested Schema for `consumed.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedatt--reserved"></a>
|
||||
### Nested Schema for `reserved`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disksize` (Number)
|
||||
- `disksizemax` (Number)
|
||||
- `extips` (Number)
|
||||
- `exttraffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `policies` (List of Object) (see [below for nested schema](#nestedobjatt--reserved--policies))
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--reserved--seps))
|
||||
|
||||
<a id="nestedobjatt--reserved--policies"></a>
|
||||
### Nested Schema for `reserved.policies`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `id` (String)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--reserved--policies--seps))
|
||||
|
||||
<a id="nestedobjatt--reserved--policies--seps"></a>
|
||||
### Nested Schema for `reserved.policies.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedobjatt--reserved--seps"></a>
|
||||
### Nested Schema for `reserved.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedatt--resource_limits"></a>
|
||||
### Nested Schema for `resource_limits`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cu_c` (Number)
|
||||
- `cu_d` (Number)
|
||||
- `cu_dm` (Number)
|
||||
- `cu_i` (Number)
|
||||
- `cu_m` (Number)
|
||||
- `cu_np` (Number)
|
||||
- `gpu_units` (Number)
|
||||
140
docs/data-sources/cb_account_resource_consumption_list.md
Normal file
140
docs/data-sources/cb_account_resource_consumption_list.md
Normal file
@@ -0,0 +1,140 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_account_resource_consumption_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_account_resource_consumption_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `consumed` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed))
|
||||
- `reserved` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved))
|
||||
|
||||
<a id="nestedobjatt--items--consumed"></a>
|
||||
### Nested Schema for `items.consumed`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disksize` (Number)
|
||||
- `disksizemax` (Number)
|
||||
- `extips` (Number)
|
||||
- `exttraffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `policies` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed--policies))
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed--seps))
|
||||
|
||||
<a id="nestedobjatt--items--consumed--policies"></a>
|
||||
### Nested Schema for `items.consumed.policies`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `id` (String)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed--policies--seps))
|
||||
|
||||
<a id="nestedobjatt--items--consumed--policies--seps"></a>
|
||||
### Nested Schema for `items.consumed.policies.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--consumed--seps"></a>
|
||||
### Nested Schema for `items.consumed.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--reserved"></a>
|
||||
### Nested Schema for `items.reserved`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disksize` (Number)
|
||||
- `disksizemax` (Number)
|
||||
- `extips` (Number)
|
||||
- `exttraffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `policies` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved--policies))
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved--seps))
|
||||
|
||||
<a id="nestedobjatt--items--reserved--policies"></a>
|
||||
### Nested Schema for `items.reserved.policies`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `id` (String)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved--policies--seps))
|
||||
|
||||
<a id="nestedobjatt--items--reserved--policies--seps"></a>
|
||||
### Nested Schema for `items.reserved.policies.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--reserved--seps"></a>
|
||||
### Nested Schema for `items.reserved.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
150
docs/data-sources/cb_account_rg_list.md
Normal file
150
docs/data-sources/cb_account_rg_list.md
Normal file
@@ -0,0 +1,150 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_account_rg_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_account_rg_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `name` (String) Filter by name
|
||||
- `page` (Number) Page number
|
||||
- `rg_id` (Number) Filter by RG ID
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `status` (String) Filter by status
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `vins_id` (Number) Filter by ViNS ID
|
||||
- `vm_id` (Number) Filter by VM ID
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) Search Result (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `computes` (List of Object) (see [below for nested schema](#nestedobjatt--items--computes))
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `milestones` (Number)
|
||||
- `resources` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources))
|
||||
- `rg_id` (Number)
|
||||
- `rg_name` (String)
|
||||
- `status` (String)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `vinses` (Number)
|
||||
|
||||
<a id="nestedobjatt--items--computes"></a>
|
||||
### Nested Schema for `items.computes`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `started` (Number)
|
||||
- `stopped` (Number)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--resources"></a>
|
||||
### Nested Schema for `items.resources`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `consumed` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--consumed))
|
||||
- `limits` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--limits))
|
||||
- `reserved` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--reserved))
|
||||
|
||||
<a id="nestedobjatt--items--resources--consumed"></a>
|
||||
### Nested Schema for `items.resources.consumed`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disksize` (Number)
|
||||
- `disksizemax` (Number)
|
||||
- `extips` (Number)
|
||||
- `exttraffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--consumed--seps))
|
||||
|
||||
<a id="nestedobjatt--items--resources--consumed--seps"></a>
|
||||
### Nested Schema for `items.resources.consumed.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--resources--limits"></a>
|
||||
### Nested Schema for `items.resources.limits`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disksize` (Number)
|
||||
- `disksizemax` (Number)
|
||||
- `extips` (Number)
|
||||
- `exttraffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `ram` (Number)
|
||||
- `seps` (Number)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--resources--reserved"></a>
|
||||
### Nested Schema for `items.resources.reserved`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disksize` (Number)
|
||||
- `disksizemax` (Number)
|
||||
- `extips` (Number)
|
||||
- `exttraffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--reserved--seps))
|
||||
|
||||
<a id="nestedobjatt--items--resources--reserved--seps"></a>
|
||||
### Nested Schema for `items.resources.reserved.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
71
docs/data-sources/cb_account_vins_list.md
Normal file
71
docs/data-sources/cb_account_vins_list.md
Normal file
@@ -0,0 +1,71 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_account_vins_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_account_vins_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number) ID of the account
|
||||
|
||||
### Optional
|
||||
|
||||
- `ext_ip` (String) Filter by external IP
|
||||
- `name` (String) Filter by name
|
||||
- `page` (Number) Page number
|
||||
- `rg_id` (Number) Filter by RG ID
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `vins_id` (Number) Filter by ViNS ID
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) Search Result (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `computes` (Number)
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `external_ip` (String)
|
||||
- `extnet_id` (Number)
|
||||
- `free_ips` (Number)
|
||||
- `network` (String)
|
||||
- `pri_vnf_dev_id` (Number)
|
||||
- `rg_id` (Number)
|
||||
- `rg_name` (String)
|
||||
- `status` (String)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `vin_id` (Number)
|
||||
- `vin_name` (String)
|
||||
49
docs/data-sources/cb_audit.md
Normal file
49
docs/data-sources/cb_audit.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_audit Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_audit (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `audit_guid` (String) audit guid
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `args` (String)
|
||||
- `call` (String)
|
||||
- `correlation_id` (String)
|
||||
- `guid` (String)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `kwargs` (String)
|
||||
- `remote_addr` (String)
|
||||
- `responsetime` (Number)
|
||||
- `result` (String)
|
||||
- `status_code` (Number)
|
||||
- `timestamp` (Number)
|
||||
- `timestamp_end` (Number)
|
||||
- `ttl` (String)
|
||||
- `user` (String)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
53
docs/data-sources/cb_audit_linked_jobs.md
Normal file
53
docs/data-sources/cb_audit_linked_jobs.md
Normal file
@@ -0,0 +1,53 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_audit_linked_jobs Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_audit_linked_jobs (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `audit_guid` (String) audit guid
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cmd` (String)
|
||||
- `guid` (String)
|
||||
- `nid` (Number)
|
||||
- `physical_node` (Boolean)
|
||||
- `state` (String)
|
||||
- `time_create` (Number)
|
||||
- `time_start` (Number)
|
||||
- `time_stop` (Number)
|
||||
- `timeout` (Number)
|
||||
75
docs/data-sources/cb_audit_list.md
Normal file
75
docs/data-sources/cb_audit_list.md
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_audit_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_audit_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `account_id` (Number)
|
||||
- `call` (String) find by api endpoint (Mongo RegExp supported)
|
||||
- `compute_id` (Number)
|
||||
- `exclude_audit_lines` (Boolean)
|
||||
- `flipgroup_id` (Number)
|
||||
- `k8s_id` (Number)
|
||||
- `lb_id` (Number)
|
||||
- `max_status_code` (Number) find by HTTP max status code
|
||||
- `min_status_code` (Number) find by HTTP min status code
|
||||
- `node_id` (Number)
|
||||
- `page` (Number) page number
|
||||
- `request_id` (String) request id
|
||||
- `resgroup_id` (Number)
|
||||
- `sep_id` (Number)
|
||||
- `service_id` (Number)
|
||||
- `size` (Number) page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `timestamp_at` (Number) find all audits after point in time (unixtime)
|
||||
- `timestamp_to` (Number) find all audits before point in time (unixtime)
|
||||
- `user` (String) find by user (Mongo RegExp supported)
|
||||
- `vins_id` (Number)
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number) entry count
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `args` (String)
|
||||
- `call` (String)
|
||||
- `correlation_id` (String)
|
||||
- `guid` (String)
|
||||
- `kwargs` (String)
|
||||
- `remote_addr` (String)
|
||||
- `responsetime` (Number)
|
||||
- `result` (String)
|
||||
- `status_code` (Number)
|
||||
- `timestamp` (Number)
|
||||
- `timestamp_end` (Number)
|
||||
- `ttl` (String)
|
||||
- `user` (String)
|
||||
33
docs/data-sources/cb_audits_export_to_file.md
Normal file
33
docs/data-sources/cb_audits_export_to_file.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_audits_export_to_file Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_audits_export_to_file (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `file_path` (String) file path
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `id` (String) The ID of this resource.
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
146
docs/data-sources/cb_disk.md
Normal file
146
docs/data-sources/cb_disk.md
Normal file
@@ -0,0 +1,146 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_disk Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_disk (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `disk_id` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `acl` (String)
|
||||
- `boot_partition` (Number)
|
||||
- `computes` (List of Object) (see [below for nested schema](#nestedatt--computes))
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `destruction_time` (Number)
|
||||
- `devicename` (String)
|
||||
- `disk_name` (String)
|
||||
- `disk_path` (String)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `image_id` (Number)
|
||||
- `images` (List of Number)
|
||||
- `iotune` (List of Object) (see [below for nested schema](#nestedatt--iotune))
|
||||
- `iqn` (String)
|
||||
- `login` (String)
|
||||
- `machine_id` (Number)
|
||||
- `machine_name` (String)
|
||||
- `milestones` (Number)
|
||||
- `order` (Number)
|
||||
- `params` (String)
|
||||
- `parent_id` (Number)
|
||||
- `passwd` (String)
|
||||
- `pci_slot` (Number)
|
||||
- `pool` (String)
|
||||
- `present_to` (Map of Number)
|
||||
- `purge_attempts` (Number)
|
||||
- `purge_time` (Number)
|
||||
- `reality_device_number` (Number)
|
||||
- `reference_id` (String)
|
||||
- `replication` (List of Object) Replication status (see [below for nested schema](#nestedatt--replication))
|
||||
- `res_id` (String)
|
||||
- `res_name` (String)
|
||||
- `role` (String)
|
||||
- `sep_id` (Number)
|
||||
- `sep_type` (String)
|
||||
- `shareable` (Boolean)
|
||||
- `size_available` (Number)
|
||||
- `size_max` (Number)
|
||||
- `size_used` (Number)
|
||||
- `snapshots` (List of Object) (see [below for nested schema](#nestedatt--snapshots))
|
||||
- `status` (String)
|
||||
- `storage_policy_id` (Number) Storage policy ID
|
||||
- `tech_status` (String)
|
||||
- `to_clean` (Boolean)
|
||||
- `type` (String)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `vmid` (Number)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--computes"></a>
|
||||
### Nested Schema for `computes`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `compute_id` (String)
|
||||
- `compute_name` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--iotune"></a>
|
||||
### Nested Schema for `iotune`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `read_bytes_sec` (Number)
|
||||
- `read_bytes_sec_max` (Number)
|
||||
- `read_iops_sec` (Number)
|
||||
- `read_iops_sec_max` (Number)
|
||||
- `size_iops_sec` (Number)
|
||||
- `total_bytes_sec` (Number)
|
||||
- `total_bytes_sec_max` (Number)
|
||||
- `total_iops_sec` (Number)
|
||||
- `total_iops_sec_max` (Number)
|
||||
- `write_bytes_sec` (Number)
|
||||
- `write_bytes_sec_max` (Number)
|
||||
- `write_iops_sec` (Number)
|
||||
- `write_iops_sec_max` (Number)
|
||||
|
||||
|
||||
<a id="nestedatt--replication"></a>
|
||||
### Nested Schema for `replication`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_id` (Number)
|
||||
- `pool_id` (String)
|
||||
- `role` (String)
|
||||
- `self_volume_id` (String)
|
||||
- `storage_id` (String)
|
||||
- `volume_id` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--snapshots"></a>
|
||||
### Nested Schema for `snapshots`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `guid` (String)
|
||||
- `label` (String)
|
||||
- `reference_id` (String)
|
||||
- `res_id` (String)
|
||||
- `snap_set_guid` (String)
|
||||
- `snap_set_time` (Number)
|
||||
- `timestamp` (Number)
|
||||
165
docs/data-sources/cb_disk_list.md
Normal file
165
docs/data-sources/cb_disk_list.md
Normal file
@@ -0,0 +1,165 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_disk_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_disk_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `account_id` (Number) ID of the account the disks belong to
|
||||
- `account_name` (String) Find by account name
|
||||
- `by_id` (Number) Find by ID
|
||||
- `disk_max_size` (Number) Find by max disk size
|
||||
- `name` (String) Find by name
|
||||
- `page` (Number) Page number
|
||||
- `pool` (String) Find by pool name
|
||||
- `sep_id` (Number) Find by sep id
|
||||
- `shared` (Boolean) Find by shared field
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `status` (String) Find by status
|
||||
- `storage_policy_id` (Number) storage policy ID
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `type` (String) type of the disks
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `acl` (String)
|
||||
- `boot_partition` (Number)
|
||||
- `computes` (List of Object) (see [below for nested schema](#nestedobjatt--items--computes))
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `destruction_time` (Number)
|
||||
- `devicename` (String)
|
||||
- `disk_id` (Number)
|
||||
- `disk_name` (String)
|
||||
- `disk_path` (String)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `image_id` (Number)
|
||||
- `images` (List of Number)
|
||||
- `iotune` (List of Object) (see [below for nested schema](#nestedobjatt--items--iotune))
|
||||
- `iqn` (String)
|
||||
- `login` (String)
|
||||
- `machine_id` (Number)
|
||||
- `machine_name` (String)
|
||||
- `milestones` (Number)
|
||||
- `order` (Number)
|
||||
- `params` (String)
|
||||
- `parent_id` (Number)
|
||||
- `passwd` (String)
|
||||
- `pci_slot` (Number)
|
||||
- `pool` (String)
|
||||
- `present_to` (Map of Number)
|
||||
- `purge_attempts` (Number)
|
||||
- `purge_time` (Number)
|
||||
- `reality_device_number` (Number)
|
||||
- `reference_id` (String)
|
||||
- `replication` (List of Object) (see [below for nested schema](#nestedobjatt--items--replication))
|
||||
- `res_id` (String)
|
||||
- `res_name` (String)
|
||||
- `role` (String)
|
||||
- `sep_id` (Number)
|
||||
- `sep_type` (String)
|
||||
- `shareable` (Boolean)
|
||||
- `size_available` (Number)
|
||||
- `size_max` (Number)
|
||||
- `size_used` (Number)
|
||||
- `snapshots` (List of Object) (see [below for nested schema](#nestedobjatt--items--snapshots))
|
||||
- `status` (String)
|
||||
- `storage_policy_id` (Number)
|
||||
- `tech_status` (String)
|
||||
- `to_clean` (Boolean)
|
||||
- `type` (String)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `vmid` (Number)
|
||||
|
||||
<a id="nestedobjatt--items--computes"></a>
|
||||
### Nested Schema for `items.computes`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `compute_id` (String)
|
||||
- `compute_name` (String)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--iotune"></a>
|
||||
### Nested Schema for `items.iotune`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `read_bytes_sec` (Number)
|
||||
- `read_bytes_sec_max` (Number)
|
||||
- `read_iops_sec` (Number)
|
||||
- `read_iops_sec_max` (Number)
|
||||
- `size_iops_sec` (Number)
|
||||
- `total_bytes_sec` (Number)
|
||||
- `total_bytes_sec_max` (Number)
|
||||
- `total_iops_sec` (Number)
|
||||
- `total_iops_sec_max` (Number)
|
||||
- `write_bytes_sec` (Number)
|
||||
- `write_bytes_sec_max` (Number)
|
||||
- `write_iops_sec` (Number)
|
||||
- `write_iops_sec_max` (Number)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--replication"></a>
|
||||
### Nested Schema for `items.replication`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_id` (Number)
|
||||
- `pool_id` (String)
|
||||
- `role` (String)
|
||||
- `self_volume_id` (String)
|
||||
- `storage_id` (String)
|
||||
- `volume_id` (String)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--snapshots"></a>
|
||||
### Nested Schema for `items.snapshots`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `guid` (String)
|
||||
- `label` (String)
|
||||
- `reference_id` (String)
|
||||
- `res_id` (String)
|
||||
- `snap_set_guid` (String)
|
||||
- `snap_set_time` (Number)
|
||||
- `timestamp` (Number)
|
||||
161
docs/data-sources/cb_disk_list_deleted.md
Normal file
161
docs/data-sources/cb_disk_list_deleted.md
Normal file
@@ -0,0 +1,161 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_disk_list_deleted Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_disk_list_deleted (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `account_id` (Number) ID of the account the disks belong to
|
||||
- `account_name` (String) Find by account name
|
||||
- `by_id` (Number) Find by ID
|
||||
- `disk_max_size` (Number) Find by max disk size
|
||||
- `name` (String) Find by name
|
||||
- `page` (Number) Page number
|
||||
- `shared` (Boolean) Find by shared field
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `type` (String) type of the disks
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `acl` (String)
|
||||
- `boot_partition` (Number)
|
||||
- `computes` (List of Object) (see [below for nested schema](#nestedobjatt--items--computes))
|
||||
- `created_by` (String)
|
||||
- `created_time` (Number)
|
||||
- `deleted_by` (String)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `destruction_time` (Number)
|
||||
- `devicename` (String)
|
||||
- `disk_id` (Number)
|
||||
- `disk_name` (String)
|
||||
- `disk_path` (String)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `image_id` (Number)
|
||||
- `images` (List of Number)
|
||||
- `iotune` (List of Object) (see [below for nested schema](#nestedobjatt--items--iotune))
|
||||
- `iqn` (String)
|
||||
- `login` (String)
|
||||
- `machine_id` (Number)
|
||||
- `machine_name` (String)
|
||||
- `milestones` (Number)
|
||||
- `order` (Number)
|
||||
- `params` (String)
|
||||
- `parent_id` (Number)
|
||||
- `passwd` (String)
|
||||
- `pci_slot` (Number)
|
||||
- `pool` (String)
|
||||
- `present_to` (Map of Number)
|
||||
- `purge_attempts` (Number)
|
||||
- `purge_time` (Number)
|
||||
- `reality_device_number` (Number)
|
||||
- `reference_id` (String)
|
||||
- `replication` (List of Object) (see [below for nested schema](#nestedobjatt--items--replication))
|
||||
- `res_id` (String)
|
||||
- `res_name` (String)
|
||||
- `role` (String)
|
||||
- `sep_id` (Number)
|
||||
- `sep_type` (String)
|
||||
- `shareable` (Boolean)
|
||||
- `size_available` (Number)
|
||||
- `size_max` (Number)
|
||||
- `size_used` (Number)
|
||||
- `snapshots` (List of Object) (see [below for nested schema](#nestedobjatt--items--snapshots))
|
||||
- `status` (String)
|
||||
- `storage_policy_id` (Number)
|
||||
- `tech_status` (String)
|
||||
- `to_clean` (Boolean)
|
||||
- `type` (String)
|
||||
- `updated_by` (String)
|
||||
- `updated_time` (Number)
|
||||
- `vmid` (Number)
|
||||
|
||||
<a id="nestedobjatt--items--computes"></a>
|
||||
### Nested Schema for `items.computes`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `compute_id` (String)
|
||||
- `compute_name` (String)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--iotune"></a>
|
||||
### Nested Schema for `items.iotune`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `read_bytes_sec` (Number)
|
||||
- `read_bytes_sec_max` (Number)
|
||||
- `read_iops_sec` (Number)
|
||||
- `read_iops_sec_max` (Number)
|
||||
- `size_iops_sec` (Number)
|
||||
- `total_bytes_sec` (Number)
|
||||
- `total_bytes_sec_max` (Number)
|
||||
- `total_iops_sec` (Number)
|
||||
- `total_iops_sec_max` (Number)
|
||||
- `write_bytes_sec` (Number)
|
||||
- `write_bytes_sec_max` (Number)
|
||||
- `write_iops_sec` (Number)
|
||||
- `write_iops_sec_max` (Number)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--replication"></a>
|
||||
### Nested Schema for `items.replication`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_id` (Number)
|
||||
- `pool_id` (String)
|
||||
- `role` (String)
|
||||
- `self_volume_id` (String)
|
||||
- `storage_id` (String)
|
||||
- `volume_id` (String)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--snapshots"></a>
|
||||
### Nested Schema for `items.snapshots`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `guid` (String)
|
||||
- `label` (String)
|
||||
- `reference_id` (String)
|
||||
- `res_id` (String)
|
||||
- `snap_set_guid` (String)
|
||||
- `snap_set_time` (Number)
|
||||
- `timestamp` (Number)
|
||||
37
docs/data-sources/cb_disk_list_types.md
Normal file
37
docs/data-sources/cb_disk_list_types.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_disk_list_types Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_disk_list_types (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `page` (Number) page number
|
||||
- `size` (Number) page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of String) The types of disk in terms of its role in compute: 'B=Boot, D=Data, T=Temp'
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
56
docs/data-sources/cb_disk_list_types_detailed.md
Normal file
56
docs/data-sources/cb_disk_list_types_detailed.md
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_disk_list_types_detailed Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_disk_list_types_detailed (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `page` (Number) page number
|
||||
- `size` (Number) page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `pools` (List of Object) (see [below for nested schema](#nestedobjatt--items--pools))
|
||||
- `sep_id` (Number)
|
||||
- `sep_name` (String)
|
||||
|
||||
<a id="nestedobjatt--items--pools"></a>
|
||||
### Nested Schema for `items.pools`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `name` (String)
|
||||
- `system` (String)
|
||||
- `types` (List of String)
|
||||
130
docs/data-sources/cb_disk_list_unattached.md
Normal file
130
docs/data-sources/cb_disk_list_unattached.md
Normal file
@@ -0,0 +1,130 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_disk_list_unattached Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_disk_list_unattached (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `account_id` (Number) ID of the account the disks belong to
|
||||
- `account_name` (String) Find by account name
|
||||
- `by_id` (Number) Find by ID
|
||||
- `disk_max_size` (Number) Find by max disk size
|
||||
- `page` (Number) Page number
|
||||
- `pool` (String)
|
||||
- `sep_id` (Number) ID of SEP
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `status` (String) Find by status
|
||||
- `storage_policy_id` (Number) storage policy ID
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `type` (String) type of the disks
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `_ckey` (String)
|
||||
- `_meta` (List of String)
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `acl` (String)
|
||||
- `boot_partition` (Number)
|
||||
- `created_time` (Number)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `destruction_time` (Number)
|
||||
- `disk_id` (Number)
|
||||
- `disk_name` (String)
|
||||
- `disk_path` (String)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `image_id` (Number)
|
||||
- `images` (List of Number)
|
||||
- `iotune` (List of Object) (see [below for nested schema](#nestedobjatt--items--iotune))
|
||||
- `iqn` (String)
|
||||
- `login` (String)
|
||||
- `milestones` (Number)
|
||||
- `order` (Number)
|
||||
- `params` (String)
|
||||
- `parent_id` (Number)
|
||||
- `passwd` (String)
|
||||
- `pci_slot` (Number)
|
||||
- `pool` (String)
|
||||
- `present_to` (Map of Number)
|
||||
- `purge_attempts` (Number)
|
||||
- `purge_time` (Number)
|
||||
- `reality_device_number` (Number)
|
||||
- `reference_id` (String)
|
||||
- `res_id` (String)
|
||||
- `res_name` (String)
|
||||
- `role` (String)
|
||||
- `sep_id` (Number)
|
||||
- `shareable` (Boolean)
|
||||
- `size_max` (Number)
|
||||
- `size_used` (Number)
|
||||
- `snapshots` (List of Object) (see [below for nested schema](#nestedobjatt--items--snapshots))
|
||||
- `status` (String)
|
||||
- `tech_status` (String)
|
||||
- `type` (String)
|
||||
- `vmid` (Number)
|
||||
|
||||
<a id="nestedobjatt--items--iotune"></a>
|
||||
### Nested Schema for `items.iotune`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `read_bytes_sec` (Number)
|
||||
- `read_bytes_sec_max` (Number)
|
||||
- `read_iops_sec` (Number)
|
||||
- `read_iops_sec_max` (Number)
|
||||
- `size_iops_sec` (Number)
|
||||
- `total_bytes_sec` (Number)
|
||||
- `total_bytes_sec_max` (Number)
|
||||
- `total_iops_sec` (Number)
|
||||
- `total_iops_sec_max` (Number)
|
||||
- `write_bytes_sec` (Number)
|
||||
- `write_bytes_sec_max` (Number)
|
||||
- `write_iops_sec` (Number)
|
||||
- `write_iops_sec_max` (Number)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--snapshots"></a>
|
||||
### Nested Schema for `items.snapshots`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `guid` (String)
|
||||
- `label` (String)
|
||||
- `reference_id` (String)
|
||||
- `res_id` (String)
|
||||
- `snap_set_guid` (String)
|
||||
- `snap_set_time` (Number)
|
||||
- `timestamp` (Number)
|
||||
139
docs/data-sources/cb_disk_replication.md
Normal file
139
docs/data-sources/cb_disk_replication.md
Normal file
@@ -0,0 +1,139 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_disk_replication Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_disk_replication (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `disk_id` (Number) Id of primary disk
|
||||
- `replica_disk_id` (Number) Id of secondary disk
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `account_id` (Number)
|
||||
- `account_name` (String)
|
||||
- `acl` (String)
|
||||
- `boot_partition` (Number)
|
||||
- `computes` (List of Object) (see [below for nested schema](#nestedatt--computes))
|
||||
- `created_time` (Number)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `destruction_time` (Number)
|
||||
- `devicename` (String)
|
||||
- `disk_name` (String)
|
||||
- `disk_path` (String)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `image_id` (Number)
|
||||
- `images` (List of Number)
|
||||
- `iotune` (List of Object) (see [below for nested schema](#nestedatt--iotune))
|
||||
- `iqn` (String)
|
||||
- `login` (String)
|
||||
- `milestones` (Number)
|
||||
- `order` (Number)
|
||||
- `params` (String)
|
||||
- `parent_id` (Number)
|
||||
- `passwd` (String)
|
||||
- `pci_slot` (Number)
|
||||
- `pool` (String)
|
||||
- `present_to` (Map of Number)
|
||||
- `purge_attempts` (Number)
|
||||
- `purge_time` (Number)
|
||||
- `reality_device_number` (Number)
|
||||
- `reference_id` (String)
|
||||
- `replication` (List of Object) Replication status (see [below for nested schema](#nestedatt--replication))
|
||||
- `res_id` (String)
|
||||
- `res_name` (String)
|
||||
- `role` (String)
|
||||
- `sep_id` (Number)
|
||||
- `sep_type` (String)
|
||||
- `shareable` (Boolean)
|
||||
- `size_max` (Number)
|
||||
- `size_used` (Number)
|
||||
- `snapshots` (List of Object) (see [below for nested schema](#nestedatt--snapshots))
|
||||
- `status` (String)
|
||||
- `status_replication` (String) Status of replication
|
||||
- `tech_status` (String)
|
||||
- `type` (String)
|
||||
- `vmid` (Number)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--computes"></a>
|
||||
### Nested Schema for `computes`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `compute_id` (String)
|
||||
- `compute_name` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--iotune"></a>
|
||||
### Nested Schema for `iotune`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `read_bytes_sec` (Number)
|
||||
- `read_bytes_sec_max` (Number)
|
||||
- `read_iops_sec` (Number)
|
||||
- `read_iops_sec_max` (Number)
|
||||
- `size_iops_sec` (Number)
|
||||
- `total_bytes_sec` (Number)
|
||||
- `total_bytes_sec_max` (Number)
|
||||
- `total_iops_sec` (Number)
|
||||
- `total_iops_sec_max` (Number)
|
||||
- `write_bytes_sec` (Number)
|
||||
- `write_bytes_sec_max` (Number)
|
||||
- `write_iops_sec` (Number)
|
||||
- `write_iops_sec_max` (Number)
|
||||
|
||||
|
||||
<a id="nestedatt--replication"></a>
|
||||
### Nested Schema for `replication`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `disk_id` (Number)
|
||||
- `pool_id` (String)
|
||||
- `role` (String)
|
||||
- `self_volume_id` (String)
|
||||
- `storage_id` (String)
|
||||
- `volume_id` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--snapshots"></a>
|
||||
### Nested Schema for `snapshots`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `guid` (String)
|
||||
- `label` (String)
|
||||
- `reference_id` (String)
|
||||
- `res_id` (String)
|
||||
- `snap_set_guid` (String)
|
||||
- `snap_set_time` (Number)
|
||||
- `timestamp` (Number)
|
||||
43
docs/data-sources/cb_disk_snapshot.md
Normal file
43
docs/data-sources/cb_disk_snapshot.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_disk_snapshot Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_disk_snapshot (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `disk_id` (Number) The unique ID of the subscriber-owner of the disk
|
||||
- `label` (String) Name of the snapshot
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `guid` (String) ID of the snapshot
|
||||
- `id` (String) The ID of this resource.
|
||||
- `reference_id` (String)
|
||||
- `res_id` (String) Reference to the snapshot
|
||||
- `snap_set_guid` (String) The set snapshot ID
|
||||
- `snap_set_time` (Number) The set time of the snapshot
|
||||
- `timestamp` (Number) Snapshot time
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
51
docs/data-sources/cb_disk_snapshot_list.md
Normal file
51
docs/data-sources/cb_disk_snapshot_list.md
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_disk_snapshot_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_disk_snapshot_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `disk_id` (Number) The unique ID of the subscriber-owner of the disk
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `guid` (String)
|
||||
- `label` (String)
|
||||
- `reference_id` (String)
|
||||
- `res_id` (String)
|
||||
- `snap_set_guid` (String)
|
||||
- `snap_set_time` (Number)
|
||||
- `timestamp` (Number)
|
||||
48
docs/data-sources/cb_dpdknet.md
Normal file
48
docs/data-sources/cb_dpdknet.md
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_dpdknet Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_dpdknet (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `dpdk_id` (Number) The unique ID of the subscriber-owner of the DPDK network
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `account_access` (List of Number) List of accounts with access
|
||||
- `compute_ids` (List of Number) Compute IDs which uses this DPDK network
|
||||
- `created_time` (Number) Created time
|
||||
- `desc` (String) Description of DPDK network
|
||||
- `gid` (Number) ID of the grid (platform)
|
||||
- `guid` (Number) DPDK network ID on the storage side
|
||||
- `id` (String) The ID of this resource.
|
||||
- `name` (String) Name of network
|
||||
- `ovs_bridge` (String) OVS bridge in which interfaces for computers created
|
||||
- `rg_access` (List of Number) List of resource groups with access
|
||||
- `status` (String) DPDK network status
|
||||
- `updated_time` (Number) Updated time
|
||||
- `vlan_id` (Number) vlan ID
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
64
docs/data-sources/cb_dpdknet_list.md
Normal file
64
docs/data-sources/cb_dpdknet_list.md
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_dpdknet_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_dpdknet_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `by_id` (Number) Find by ID
|
||||
- `compute_ids` (List of Number) Find by compute IDs
|
||||
- `desc` (String) Find by description
|
||||
- `gid` (Number) Find by GID
|
||||
- `name` (String) Find by name
|
||||
- `page` (Number) Page number
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `status` (String) Find by status
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_access` (List of Number)
|
||||
- `compute_ids` (List of Number)
|
||||
- `created_time` (Number)
|
||||
- `desc` (String)
|
||||
- `dpdk_id` (Number)
|
||||
- `enable_secgroups` (Boolean)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `name` (String)
|
||||
- `ovs_bridge` (String)
|
||||
- `rg_access` (List of Number)
|
||||
- `status` (String)
|
||||
- `updated_time` (Number)
|
||||
- `vlan_id` (Number)
|
||||
143
docs/data-sources/cb_extnet.md
Normal file
143
docs/data-sources/cb_extnet.md
Normal file
@@ -0,0 +1,143 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_extnet Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_extnet (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `extnet_id` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `check_ips` (List of String)
|
||||
- `ckey` (String)
|
||||
- `default` (Boolean)
|
||||
- `default_qos` (List of Object) (see [below for nested schema](#nestedatt--default_qos))
|
||||
- `desc` (String)
|
||||
- `dns` (List of String)
|
||||
- `excluded` (List of Object) (see [below for nested schema](#nestedatt--excluded))
|
||||
- `free_ips` (Number)
|
||||
- `gateway` (String)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `ipcidr` (String)
|
||||
- `meta` (List of String) meta
|
||||
- `milestones` (Number)
|
||||
- `mtu` (Number)
|
||||
- `name` (String)
|
||||
- `network` (String)
|
||||
- `network_ids` (List of Object) (see [below for nested schema](#nestedatt--network_ids))
|
||||
- `ntp` (List of String)
|
||||
- `ovs_bridge` (String)
|
||||
- `pre_reservations` (List of Object) (see [below for nested schema](#nestedatt--pre_reservations))
|
||||
- `pre_reservations_num` (Number)
|
||||
- `prefix` (Number)
|
||||
- `pri_vnfdev_id` (Number)
|
||||
- `redundant` (Boolean)
|
||||
- `reservations` (List of Object) (see [below for nested schema](#nestedatt--reservations))
|
||||
- `sec_vnfdev_id` (Number)
|
||||
- `shared_with` (List of Number)
|
||||
- `status` (String)
|
||||
- `vlan_id` (Number)
|
||||
- `vnfs` (List of Object) (see [below for nested schema](#nestedatt--vnfs))
|
||||
- `zone_id` (Number)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--default_qos"></a>
|
||||
### Nested Schema for `default_qos`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `e_rate` (Number)
|
||||
- `guid` (String)
|
||||
- `in_burst` (Number)
|
||||
- `in_rate` (Number)
|
||||
|
||||
|
||||
<a id="nestedatt--excluded"></a>
|
||||
### Nested Schema for `excluded`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `client_type` (String)
|
||||
- `desc` (String)
|
||||
- `domain_name` (String)
|
||||
- `hostname` (String)
|
||||
- `ip` (String)
|
||||
- `mac` (String)
|
||||
- `type` (String)
|
||||
- `vm_id` (Number)
|
||||
|
||||
|
||||
<a id="nestedatt--network_ids"></a>
|
||||
### Nested Schema for `network_ids`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `primary` (Number)
|
||||
- `secondary` (Number)
|
||||
|
||||
|
||||
<a id="nestedatt--pre_reservations"></a>
|
||||
### Nested Schema for `pre_reservations`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `client_type` (String)
|
||||
- `desc` (String)
|
||||
- `domain_name` (String)
|
||||
- `hostname` (String)
|
||||
- `ip` (String)
|
||||
- `mac` (String)
|
||||
- `type` (String)
|
||||
- `vm_id` (Number)
|
||||
|
||||
|
||||
<a id="nestedatt--reservations"></a>
|
||||
### Nested Schema for `reservations`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `client_type` (String)
|
||||
- `desc` (String)
|
||||
- `domain_name` (String)
|
||||
- `hostname` (String)
|
||||
- `ip` (String)
|
||||
- `mac` (String)
|
||||
- `type` (String)
|
||||
- `vm_id` (Number)
|
||||
|
||||
|
||||
<a id="nestedatt--vnfs"></a>
|
||||
### Nested Schema for `vnfs`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `dhcp` (Number)
|
||||
33
docs/data-sources/cb_extnet_default.md
Normal file
33
docs/data-sources/cb_extnet_default.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_extnet_default Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_extnet_default (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `extnet_id` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
105
docs/data-sources/cb_extnet_list.md
Normal file
105
docs/data-sources/cb_extnet_list.md
Normal file
@@ -0,0 +1,105 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_extnet_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_extnet_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `account_id` (Number) Find by account ID
|
||||
- `by_id` (Number) Find by ID
|
||||
- `name` (String) Find by name
|
||||
- `network` (String)
|
||||
- `page` (Number) Page number
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `status` (String) Find by status
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `vlan_id` (Number) Find by VLAN ID
|
||||
- `vnfdev_id` (Number) Find by VnfDEV ID
|
||||
- `zone_id` (Number) Zone ID
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `check_ips` (List of String)
|
||||
- `ckey` (String)
|
||||
- `default` (Boolean)
|
||||
- `default_qos` (List of Object) (see [below for nested schema](#nestedobjatt--items--default_qos))
|
||||
- `desc` (String)
|
||||
- `enable_secgroups` (Boolean)
|
||||
- `extnet_id` (Number)
|
||||
- `free_ips` (Number)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `ipcidr` (String)
|
||||
- `meta` (List of String)
|
||||
- `milestones` (Number)
|
||||
- `mtu` (Number)
|
||||
- `name` (String)
|
||||
- `network_ids` (List of Object) (see [below for nested schema](#nestedobjatt--items--network_ids))
|
||||
- `ovs_bridge` (String)
|
||||
- `pre_reservations_num` (Number)
|
||||
- `pri_vnfdev_id` (Number)
|
||||
- `redundant` (Boolean)
|
||||
- `sec_vnfdev_id` (Number)
|
||||
- `shared_with` (List of Number)
|
||||
- `status` (String)
|
||||
- `vlan_id` (Number)
|
||||
- `vnfs` (List of Object) (see [below for nested schema](#nestedobjatt--items--vnfs))
|
||||
- `zone_id` (Number)
|
||||
|
||||
<a id="nestedobjatt--items--default_qos"></a>
|
||||
### Nested Schema for `items.default_qos`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `e_rate` (Number)
|
||||
- `guid` (String)
|
||||
- `in_burst` (Number)
|
||||
- `in_rate` (Number)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--network_ids"></a>
|
||||
### Nested Schema for `items.network_ids`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `primary` (Number)
|
||||
- `secondary` (Number)
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--vnfs"></a>
|
||||
### Nested Schema for `items.vnfs`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `dhcp` (Number)
|
||||
61
docs/data-sources/cb_extnet_reserved_ip_list.md
Normal file
61
docs/data-sources/cb_extnet_reserved_ip_list.md
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_extnet_reserved_ip_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_extnet_reserved_ip_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `account_id` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- `extnet_id` (Number)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `extnet_id` (Number)
|
||||
- `reservations` (List of Object) (see [below for nested schema](#nestedobjatt--items--reservations))
|
||||
|
||||
<a id="nestedobjatt--items--reservations"></a>
|
||||
### Nested Schema for `items.reservations`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `client_type` (String)
|
||||
- `domain_name` (String)
|
||||
- `hostname` (String)
|
||||
- `ip` (String)
|
||||
- `mac` (String)
|
||||
- `type` (String)
|
||||
- `vm_id` (Number)
|
||||
42
docs/data-sources/cb_extnet_static_route.md
Normal file
42
docs/data-sources/cb_extnet_static_route.md
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_extnet_static_route Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_extnet_static_route (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `extnet_id` (Number) Unique ID of the ExtNet
|
||||
- `route_id` (Number) Unique ID of the static route
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `compute_ids` (List of Number)
|
||||
- `destination` (String)
|
||||
- `gateway` (String)
|
||||
- `guid` (String)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `netmask` (String)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
51
docs/data-sources/cb_extnet_static_route_list.md
Normal file
51
docs/data-sources/cb_extnet_static_route_list.md
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_extnet_static_route_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_extnet_static_route_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `extnet_id` (Number) ID of ExtNet
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number)
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `compute_ids` (List of Number)
|
||||
- `destination` (String)
|
||||
- `gateway` (String)
|
||||
- `guid` (String)
|
||||
- `netmask` (String)
|
||||
- `route_id` (Number)
|
||||
62
docs/data-sources/cb_flipgroup.md
Normal file
62
docs/data-sources/cb_flipgroup.md
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_flipgroup Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_flipgroup (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `flipgroup_id` (Number) flipgroup_id
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `account_id` (Number) account_id
|
||||
- `account_name` (String) account_name
|
||||
- `client_ids` (List of Number) client_ids
|
||||
- `client_names` (List of String) client_names
|
||||
- `client_type` (String) client_type
|
||||
- `conn_id` (Number) conn_id
|
||||
- `conn_type` (String) conn_type
|
||||
- `created_by` (String) created_by
|
||||
- `created_time` (Number) created_time
|
||||
- `default_gw` (String) default_gw
|
||||
- `deleted_by` (String) deleted_by
|
||||
- `deleted_time` (Number) deleted_time
|
||||
- `description` (String) description
|
||||
- `gid` (Number) gid
|
||||
- `guid` (Number) guid
|
||||
- `id` (String) The ID of this resource.
|
||||
- `ip` (String) ip
|
||||
- `milestones` (Number) milestones
|
||||
- `name` (String) name
|
||||
- `net_id` (Number) net_id
|
||||
- `net_type` (String) net_type
|
||||
- `network` (String) network
|
||||
- `rg_id` (Number) rg_id
|
||||
- `rg_name` (String) rg_name
|
||||
- `status` (String) status
|
||||
- `updated_by` (String) updated_by
|
||||
- `updated_time` (Number) updated_time
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
74
docs/data-sources/cb_flipgroup_list.md
Normal file
74
docs/data-sources/cb_flipgroup_list.md
Normal file
@@ -0,0 +1,74 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_flipgroup_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_flipgroup_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `account_id` (Number) Account id
|
||||
- `by_id` (Number) by_id
|
||||
- `by_ip` (String) by_ip
|
||||
- `client_ids` (List of Number) client_ids
|
||||
- `conn_id` (Number) Conn id
|
||||
- `extnet_id` (Number) extnet_id
|
||||
- `name` (String) name
|
||||
- `page` (Number) Page number
|
||||
- `rg_id` (Number) rg_id
|
||||
- `size` (Number) Page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `status` (String) Status
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
- `vins_id` (Number) vins_id
|
||||
- `vins_name` (String) vins_name
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number) entry_count
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `account_id` (Number)
|
||||
- `ckey` (String)
|
||||
- `client_ids` (List of Number)
|
||||
- `client_type` (String)
|
||||
- `conn_id` (Number)
|
||||
- `conn_type` (String)
|
||||
- `default_gw` (String)
|
||||
- `description` (String)
|
||||
- `flipgroup_id` (Number)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `ip` (String)
|
||||
- `meta` (List of String)
|
||||
- `milestones` (Number)
|
||||
- `name` (String)
|
||||
- `net_id` (Number)
|
||||
- `net_mask` (Number)
|
||||
- `net_type` (String)
|
||||
- `status` (String)
|
||||
46
docs/data-sources/cb_grid.md
Normal file
46
docs/data-sources/cb_grid.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_grid Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_grid (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `grid_id` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `auth_broker` (List of String)
|
||||
- `ckey` (String)
|
||||
- `flag` (String)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `id` (Number) The ID of this resource.
|
||||
- `location_code` (String)
|
||||
- `meta` (List of String) meta
|
||||
- `name` (String)
|
||||
- `network_modes` (List of String)
|
||||
- `sdn_support` (Boolean)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
89
docs/data-sources/cb_grid_get_consumption.md
Normal file
89
docs/data-sources/cb_grid_get_consumption.md
Normal file
@@ -0,0 +1,89 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_grid_get_consumption Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_grid_get_consumption (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `grid_id` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `consumed` (List of Object) (see [below for nested schema](#nestedatt--consumed))
|
||||
- `id` (String) The ID of this resource.
|
||||
- `reserved` (List of Object) (see [below for nested schema](#nestedatt--reserved))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--consumed"></a>
|
||||
### Nested Schema for `consumed`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `ext_ips` (Number)
|
||||
- `ext_traffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--consumed--seps))
|
||||
|
||||
<a id="nestedobjatt--consumed--seps"></a>
|
||||
### Nested Schema for `consumed.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedatt--reserved"></a>
|
||||
### Nested Schema for `reserved`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `ext_ips` (Number)
|
||||
- `ext_traffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--reserved--seps))
|
||||
|
||||
<a id="nestedobjatt--reserved--seps"></a>
|
||||
### Nested Schema for `reserved.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
37
docs/data-sources/cb_grid_get_diagnosis.md
Normal file
37
docs/data-sources/cb_grid_get_diagnosis.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_grid_get_diagnosis Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_grid_get_diagnosis (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `file_path` (String)
|
||||
- `gid` (Number)
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `id` (String) The ID of this resource.
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
114
docs/data-sources/cb_grid_get_settings.md
Normal file
114
docs/data-sources/cb_grid_get_settings.md
Normal file
@@ -0,0 +1,114 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_grid_get_settings Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_grid_get_settings (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `grid_id` (Number) grid (platform) ID
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `allowed_ports` (List of Number)
|
||||
- `cleanup_retention_period` (Number)
|
||||
- `docker_registry` (List of Object) (see [below for nested schema](#nestedatt--docker_registry))
|
||||
- `enable_uptime_monitor` (Boolean)
|
||||
- `extnet_max_pre_reservations_num` (Number)
|
||||
- `healthcheck_notifications` (List of Object) (see [below for nested schema](#nestedatt--healthcheck_notifications))
|
||||
- `id` (String) The ID of this resource.
|
||||
- `k8s_cleanup_enabled` (Boolean)
|
||||
- `limits` (String)
|
||||
- `location_url` (String)
|
||||
- `net_qos` (List of Object) (see [below for nested schema](#nestedatt--net_qos))
|
||||
- `networks` (String)
|
||||
- `prometheus` (List of Object) (see [below for nested schema](#nestedatt--prometheus))
|
||||
- `vins_max_pre_reservations_num` (Number)
|
||||
- `vnfdev_mgmt_net_range` (String)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--docker_registry"></a>
|
||||
### Nested Schema for `docker_registry`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `password` (String)
|
||||
- `server` (String)
|
||||
- `username` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--healthcheck_notifications"></a>
|
||||
### Nested Schema for `healthcheck_notifications`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `emails` (List of Object) (see [below for nested schema](#nestedobjatt--healthcheck_notifications--emails))
|
||||
|
||||
<a id="nestedobjatt--healthcheck_notifications--emails"></a>
|
||||
### Nested Schema for `healthcheck_notifications.emails`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `address` (String)
|
||||
- `enabled` (Boolean)
|
||||
|
||||
|
||||
|
||||
<a id="nestedatt--net_qos"></a>
|
||||
### Nested Schema for `net_qos`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `extnet` (List of Object) (see [below for nested schema](#nestedobjatt--net_qos--extnet))
|
||||
- `vins` (List of Object) (see [below for nested schema](#nestedobjatt--net_qos--vins))
|
||||
|
||||
<a id="nestedobjatt--net_qos--extnet"></a>
|
||||
### Nested Schema for `net_qos.extnet`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `e_rate` (Number)
|
||||
- `in_burst` (Number)
|
||||
- `in_rate` (Number)
|
||||
|
||||
|
||||
<a id="nestedobjatt--net_qos--vins"></a>
|
||||
### Nested Schema for `net_qos.vins`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `e_rate` (Number)
|
||||
- `in_burst` (Number)
|
||||
- `in_rate` (Number)
|
||||
|
||||
|
||||
|
||||
<a id="nestedatt--prometheus"></a>
|
||||
### Nested Schema for `prometheus`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `scrape_interval` (Number)
|
||||
33
docs/data-sources/cb_grid_get_status.md
Normal file
33
docs/data-sources/cb_grid_get_status.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_grid_get_status Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_grid_get_status (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `id` (String) The ID of this resource.
|
||||
- `status` (Boolean)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
114
docs/data-sources/cb_grid_list.md
Normal file
114
docs/data-sources/cb_grid_list.md
Normal file
@@ -0,0 +1,114 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_grid_list Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_grid_list (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `by_id` (Number) by id
|
||||
- `name` (String) name
|
||||
- `page` (Number) page number
|
||||
- `size` (Number) page size
|
||||
- `sort_by` (String) sort by one of supported fields, format +|-(field)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number) entry count
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) grid list (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `auth_broker` (List of String)
|
||||
- `flag` (String)
|
||||
- `gid` (Number)
|
||||
- `guid` (Number)
|
||||
- `id` (Number)
|
||||
- `location_code` (String)
|
||||
- `name` (String)
|
||||
- `network_modes` (List of String)
|
||||
- `resources` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources))
|
||||
- `sdn_support` (Boolean)
|
||||
|
||||
<a id="nestedobjatt--items--resources"></a>
|
||||
### Nested Schema for `items.resources`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `current` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--current))
|
||||
- `reserved` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--reserved))
|
||||
|
||||
<a id="nestedobjatt--items--resources--current"></a>
|
||||
### Nested Schema for `items.resources.current`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `ext_ips` (Number)
|
||||
- `ext_traffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--current--seps))
|
||||
|
||||
<a id="nestedobjatt--items--resources--current--seps"></a>
|
||||
### Nested Schema for `items.resources.current.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--resources--reserved"></a>
|
||||
### Nested Schema for `items.resources.reserved`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `ext_ips` (Number)
|
||||
- `ext_traffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--resources--reserved--seps))
|
||||
|
||||
<a id="nestedobjatt--items--resources--reserved--seps"></a>
|
||||
### Nested Schema for `items.resources.reserved.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
94
docs/data-sources/cb_grid_list_consumption.md
Normal file
94
docs/data-sources/cb_grid_list_consumption.md
Normal file
@@ -0,0 +1,94 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_grid_list_consumption Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_grid_list_consumption (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number) entry count
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of Object) grid list consumption (see [below for nested schema](#nestedatt--items))
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--items"></a>
|
||||
### Nested Schema for `items`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `consumed` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed))
|
||||
- `id` (Number)
|
||||
- `reserved` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved))
|
||||
|
||||
<a id="nestedobjatt--items--consumed"></a>
|
||||
### Nested Schema for `items.consumed`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `ext_ips` (Number)
|
||||
- `ext_traffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--consumed--seps))
|
||||
|
||||
<a id="nestedobjatt--items--consumed--seps"></a>
|
||||
### Nested Schema for `items.consumed.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
|
||||
|
||||
|
||||
<a id="nestedobjatt--items--reserved"></a>
|
||||
### Nested Schema for `items.reserved`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `cpu` (Number)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `ext_ips` (Number)
|
||||
- `ext_traffic` (Number)
|
||||
- `gpu` (Number)
|
||||
- `ram` (Number)
|
||||
- `seps` (List of Object) (see [below for nested schema](#nestedobjatt--items--reserved--seps))
|
||||
|
||||
<a id="nestedobjatt--items--reserved--seps"></a>
|
||||
### Nested Schema for `items.reserved.seps`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `data_name` (String)
|
||||
- `disk_size` (Number)
|
||||
- `disk_size_max` (Number)
|
||||
- `sep_id` (String)
|
||||
36
docs/data-sources/cb_grid_list_emails.md
Normal file
36
docs/data-sources/cb_grid_list_emails.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_grid_list_emails Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_grid_list_emails (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `page` (Number) page number
|
||||
- `size` (Number) page size
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `entry_count` (Number) entry count
|
||||
- `id` (String) The ID of this resource.
|
||||
- `items` (List of String) grid list emails
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
33
docs/data-sources/cb_grid_post_status.md
Normal file
33
docs/data-sources/cb_grid_post_status.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_grid_post_status Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_grid_post_status (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Optional
|
||||
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `id` (String) The ID of this resource.
|
||||
- `status` (Boolean)
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
101
docs/data-sources/cb_image.md
Normal file
101
docs/data-sources/cb_image.md
Normal file
@@ -0,0 +1,101 @@
|
||||
---
|
||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||
page_title: "decort_cb_image Data Source - terraform-provider-decort"
|
||||
subcategory: ""
|
||||
description: |-
|
||||
|
||||
---
|
||||
|
||||
# decort_cb_image (Data Source)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- schema generated by tfplugindocs -->
|
||||
## Schema
|
||||
|
||||
### Required
|
||||
|
||||
- `image_id` (Number) image id
|
||||
|
||||
### Optional
|
||||
|
||||
- `shared_with` (List of Number)
|
||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||
|
||||
### Read-Only
|
||||
|
||||
- `account_id` (Number) AccountId to make the image exclusive
|
||||
- `acl` (List of Object) (see [below for nested schema](#nestedatt--acl))
|
||||
- `architecture` (String) binary architecture of this image, one of X86_64
|
||||
- `boot_type` (String) Boot type of image bios or uefi
|
||||
- `bootable` (Boolean) Does this image boot OS
|
||||
- `cd_presented_to` (String)
|
||||
- `computeci_id` (Number)
|
||||
- `deleted_time` (Number)
|
||||
- `desc` (String)
|
||||
- `drivers` (List of String) List of types of compute suitable for image. Example: [ "KVM_X86" ]
|
||||
- `enabled` (Boolean)
|
||||
- `gid` (Number) grid (platform) ID where this template should be create in
|
||||
- `guid` (Number)
|
||||
- `history` (List of Object) (see [below for nested schema](#nestedatt--history))
|
||||
- `hot_resize` (Boolean) Does this machine supports hot resize
|
||||
- `id` (String) The ID of this resource.
|
||||
- `image_type` (String) Image type linux, windows or other
|
||||
- `last_modified` (Number)
|
||||
- `link_to` (Number)
|
||||
- `milestones` (Number)
|
||||
- `name` (String) Name of the rescue disk
|
||||
- `network_interface_naming` (String)
|
||||
- `password` (String) Optional password for the image
|
||||
- `pool_name` (String) pool for image create
|
||||
- `present_to` (Map of Number)
|
||||
- `provider_name` (String)
|
||||
- `purge_attempts` (Number)
|
||||
- `reference_id` (String)
|
||||
- `res_id` (String)
|
||||
- `res_name` (String)
|
||||
- `rescuecd` (Boolean)
|
||||
- `sep_id` (Number) storage endpoint provider ID
|
||||
- `size` (Number) image size
|
||||
- `snapshot_id` (String) snapshot id
|
||||
- `status` (String) status
|
||||
- `storage_policy_id` (Number)
|
||||
- `tech_status` (String) tech status
|
||||
- `to_clean` (Boolean)
|
||||
- `unc_path` (String) unc path
|
||||
- `url` (String) URL where to download media from
|
||||
- `username` (String) Optional username for the image
|
||||
- `version` (String) version
|
||||
|
||||
<a id="nestedblock--timeouts"></a>
|
||||
### Nested Schema for `timeouts`
|
||||
|
||||
Optional:
|
||||
|
||||
- `default` (String)
|
||||
- `read` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--acl"></a>
|
||||
### Nested Schema for `acl`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `explicit` (Boolean)
|
||||
- `guid` (String)
|
||||
- `right` (String)
|
||||
- `status` (String)
|
||||
- `type` (String)
|
||||
- `user_group_id` (String)
|
||||
|
||||
|
||||
<a id="nestedatt--history"></a>
|
||||
### Nested Schema for `history`
|
||||
|
||||
Read-Only:
|
||||
|
||||
- `guid` (String)
|
||||
- `id` (Number)
|
||||
- `timestamp` (Number)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user