Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a716edac3 | ||
|
|
cda317f4db | ||
|
|
299d606df0 | ||
|
|
3cd8c2e618 | ||
|
|
efea1af92a | ||
|
|
77d8d2e921 | ||
|
|
f1ec6d776a | ||
|
|
ff64840b13 | ||
|
|
13e6849328 | ||
|
|
964e85c34a | ||
|
|
92d96b13c6 |
@@ -1,5 +1,4 @@
|
|||||||
### Bug fixes
|
### New features
|
||||||
- k8s state import
|
- snapshot\_list datasource
|
||||||
|
- snapshot resource
|
||||||
### Minor changes
|
- k8s: extnet\_id parameter
|
||||||
- increased k8s and k8s\_wg create/update timeouts
|
|
||||||
|
|||||||
50
Jenkinsfile-sast
Normal file
50
Jenkinsfile-sast
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
kubernetes {
|
||||||
|
yaml '''
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: alpine
|
||||||
|
image: alpine:3.15
|
||||||
|
command:
|
||||||
|
- sleep
|
||||||
|
- infinity
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Dependency check') {
|
||||||
|
environment {
|
||||||
|
DEPCHECKDB = credentials('depcheck-postgres')
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
container('alpine') {
|
||||||
|
sh 'apk update && apk add openjdk11 java-postgresql-jdbc'
|
||||||
|
dependencyCheck additionalArguments: '-f JSON -f HTML \
|
||||||
|
--dbDriverName org.postgresql.Driver \
|
||||||
|
--dbDriverPath /usr/share/java/postgresql-jdbc.jar \
|
||||||
|
--dbUser $DEPCHECKDB_USR \
|
||||||
|
--dbPassword $DEPCHECKDB_PSW \
|
||||||
|
--connectionString jdbc:postgresql://postgres-postgresql.postgres/depcheck', odcInstallation: 'depcheck'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('SonarQube analysis') {
|
||||||
|
environment {
|
||||||
|
SONARSCANNER_HOME = tool 'sonarscanner'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
withSonarQubeEnv('sonarqube') {
|
||||||
|
sh '$SONARSCANNER_HOME/bin/sonar-scanner'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('SonarQube quality gate') {
|
||||||
|
steps {
|
||||||
|
waitForQualityGate webhookSecretId: 'sonar-webhook', abortPipeline: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,12 +10,12 @@ Terraform provider для платформы Digital Energy Cloud Orchestration
|
|||||||
- Работа с Compute instances,
|
- Работа с Compute instances,
|
||||||
- Работа с disks,
|
- Работа с disks,
|
||||||
- Работа с k8s,
|
- Работа с k8s,
|
||||||
- Работа с virtual network segments,
|
|
||||||
- Работа с image,
|
- Работа с image,
|
||||||
- Работа с reource groups,
|
- Работа с reource groups,
|
||||||
- Работа с VINS,
|
- Работа с VINS,
|
||||||
- Работа с pfw,
|
- Работа с pfw,
|
||||||
- Работа с accounts.
|
- Работа с accounts,
|
||||||
|
- Работа с snapshots.
|
||||||
|
|
||||||
Вики проекта: https://github.com/rudecs/terraform-provider-decort/wiki
|
Вики проекта: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ Linux:
|
|||||||
```
|
```
|
||||||
Windows:
|
Windows:
|
||||||
```powershell
|
```powershell
|
||||||
%APPDATA%\terraform.d\plugins\${host_name}/${namespace}/${type}/${version}/${target}
|
%APPDATA%\terraform.d\plugins\${host_name}\${namespace}\${type}\${version}\${target}
|
||||||
```
|
```
|
||||||
ВНИМАНИЕ: для ОС Windows `%APP_DATA%` является каталогом, в котором будут помещены будущие файлы terraform.
|
ВНИМАНИЕ: для ОС Windows `%APP_DATA%` является каталогом, в котором будут помещены будущие файлы terraform.
|
||||||
Где:
|
Где:
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ NOTE: provider rc-1.25 is designed for DECORT API 3.7.x. For older API versions
|
|||||||
- Work with Compute instances,
|
- Work with Compute instances,
|
||||||
- Work with disks,
|
- Work with disks,
|
||||||
- Work with k8s,
|
- Work with k8s,
|
||||||
- Work with virtual network segments,
|
|
||||||
- Work with image,
|
- Work with image,
|
||||||
- Work with reource groups,
|
- Work with reource groups,
|
||||||
- Work with VINS,
|
- Work with VINS,
|
||||||
- Work with pfw,
|
- Work with pfw,
|
||||||
- Work with accounts.
|
- Work with accounts,
|
||||||
|
- Work with snapshots.
|
||||||
|
|
||||||
This provider supports Import operations on pre-existing resources.
|
This provider supports Import operations on pre-existing resources.
|
||||||
|
|
||||||
|
|||||||
@@ -27,12 +27,14 @@ package decort
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
// "time"
|
// "time"
|
||||||
|
|
||||||
@@ -378,28 +380,31 @@ func (config *ControllerCfg) decortAPICall(method string, api_name string, url_v
|
|||||||
req.Header.Set("Authorization", fmt.Sprintf("bearer %s", config.jwt))
|
req.Header.Set("Authorization", fmt.Sprintf("bearer %s", config.jwt))
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := config.cc_client.Do(req)
|
for i := 0; i < 5; i++ {
|
||||||
if err != nil {
|
resp, err := config.cc_client.Do(req)
|
||||||
return "", err
|
if err != nil {
|
||||||
}
|
return "", err
|
||||||
defer resp.Body.Close()
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
log.Debugf("decortAPICall: %s %s\n %s", method, api_name, body)
|
resp.Body.Close()
|
||||||
|
log.Debugf("decortAPICall: %s %s\n %s", method, api_name, body)
|
||||||
|
|
||||||
if resp.StatusCode == http.StatusOK {
|
if resp.StatusCode == http.StatusOK {
|
||||||
return string(body), nil
|
return string(body), nil
|
||||||
} else {
|
} else {
|
||||||
return "", fmt.Errorf("decortAPICall: unexpected status code %d when calling API %q with request Body %q. Respone:\n%s",
|
if resp.StatusCode == http.StatusInternalServerError {
|
||||||
resp.StatusCode, req.URL, params_str, body)
|
log.Warnf("got 500, retrying %d/5", i+1)
|
||||||
}
|
time.Sleep(time.Second * 5)
|
||||||
|
continue
|
||||||
/*
|
|
||||||
if resp.StatusCode == StatusServiceUnavailable {
|
|
||||||
return nil, fmt.Errorf("decortAPICall method called for incompatible authorization mode %q.", config.auth_mode_txt)
|
|
||||||
}
|
}
|
||||||
*/
|
return "", fmt.Errorf("decortAPICall: unexpected status code %d when calling API %q with request Body %q. Respone:\n%s",
|
||||||
|
resp.StatusCode, req.URL, params_str, body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "", errors.New("number of retries exceeded")
|
||||||
}
|
}
|
||||||
|
|||||||
120
decort/data_source_snapshot_list.go
Normal file
120
decort/data_source_snapshot_list.go
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Author: Stanislav Solovev, <spsolovev@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 (
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
func flattenSnapshotList(gl SnapshotList) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, item := range gl {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"label": item.Label,
|
||||||
|
"guid": item.Guid,
|
||||||
|
"disks": item.Disks,
|
||||||
|
"timestamp": item.Timestamp,
|
||||||
|
}
|
||||||
|
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceSnapshotListRead(d *schema.ResourceData, m interface{}) error {
|
||||||
|
snapshotList, err := utilitySnapshotListCheckPresence(d, m)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
id := uuid.New()
|
||||||
|
d.SetId(id.String())
|
||||||
|
d.Set("items", flattenSnapshotList(snapshotList))
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceSnapshotListSchemaMake() map[string]*schema.Schema {
|
||||||
|
rets := map[string]*schema.Schema{
|
||||||
|
"compute_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Required: true,
|
||||||
|
ForceNew: true,
|
||||||
|
Description: "ID of the compute instance to create snapshot for.",
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Description: "snapshot list",
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: dataSourceSnapshotSchemaMake(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return rets
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceSnapshotSchemaMake() map[string]*schema.Schema {
|
||||||
|
return map[string]*schema.Schema{
|
||||||
|
"label": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
Description: "text label for snapshot. Must be unique among this compute snapshots.",
|
||||||
|
},
|
||||||
|
"disks": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Schema{
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"guid": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
Description: "guid of the snapshot",
|
||||||
|
},
|
||||||
|
"timestamp": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
Description: "timestamp",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceSnapshotList() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
Read: dataSourceSnapshotListRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &Timeout30s,
|
||||||
|
Default: &Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceSnapshotListSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -605,11 +605,27 @@ type K8sRecord struct {
|
|||||||
Masters K8sNodeRecord `json:"masters"`
|
Masters K8sNodeRecord `json:"masters"`
|
||||||
Workers []K8sNodeRecord `json:"workers"`
|
Workers []K8sNodeRecord `json:"workers"`
|
||||||
} `json:"k8sGroups"`
|
} `json:"k8sGroups"`
|
||||||
|
LbID int `json:"lbId"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
RgID int `json:"rgId"`
|
RgID int `json:"rgId"`
|
||||||
RgName string `json:"rgName"`
|
RgName string `json:"rgName"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//LbRecord represents load balancer instance
|
||||||
|
type LbRecord struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
RgID int `json:"rgId"`
|
||||||
|
VinsID int `json:"vinsId"`
|
||||||
|
ExtNetID int `json:"extnetId"`
|
||||||
|
PrimaryNode struct {
|
||||||
|
BackendIP string `json:"backendIp"`
|
||||||
|
ComputeID int `json:"computeId"`
|
||||||
|
FrontendIP string `json:"frontendIp"`
|
||||||
|
NetworkID int `json:"networkId"`
|
||||||
|
} `json:"primaryNode"`
|
||||||
|
}
|
||||||
|
|
||||||
const K8sCreateAPI = "/restmachine/cloudapi/k8s/create"
|
const K8sCreateAPI = "/restmachine/cloudapi/k8s/create"
|
||||||
const K8sGetAPI = "/restmachine/cloudapi/k8s/get"
|
const K8sGetAPI = "/restmachine/cloudapi/k8s/get"
|
||||||
const K8sUpdateAPI = "/restmachine/cloudapi/k8s/update"
|
const K8sUpdateAPI = "/restmachine/cloudapi/k8s/update"
|
||||||
@@ -623,6 +639,8 @@ const K8sWorkerDeleteAPI = "/restmachine/cloudapi/k8s/deleteWorkerFromGroup"
|
|||||||
|
|
||||||
const K8sGetConfigAPI = "/restmachine/cloudapi/k8s/getConfig"
|
const K8sGetConfigAPI = "/restmachine/cloudapi/k8s/getConfig"
|
||||||
|
|
||||||
|
const LbGetAPI = "/restmachine/cloudapi/lb/get"
|
||||||
|
|
||||||
//Blasphemous workaround for parsing Result value
|
//Blasphemous workaround for parsing Result value
|
||||||
type TaskResult int
|
type TaskResult int
|
||||||
|
|
||||||
@@ -799,3 +817,21 @@ type Grid struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GridList []Grid
|
type GridList []Grid
|
||||||
|
|
||||||
|
/////////////////////
|
||||||
|
/// SNAPSHOT API ///
|
||||||
|
/////////////////////
|
||||||
|
|
||||||
|
const snapshotCreateAPI = "/restmachine/cloudapi/compute/snapshotCreate"
|
||||||
|
const snapshotDeleteAPI = "/restmachine/cloudapi/compute/snapshotDelete"
|
||||||
|
const snapshotRollbackAPI = "/restmachine/cloudapi/compute/snapshotRollback"
|
||||||
|
const snapshotListAPI = "/restmachine/cloudapi/compute/snapshotList"
|
||||||
|
|
||||||
|
type Snapshot struct {
|
||||||
|
Disks []int `json:"disks"`
|
||||||
|
Guid string `json:"guid"`
|
||||||
|
Label string `json:"label"`
|
||||||
|
Timestamp uint64 `json:"timestamp"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SnapshotList []Snapshot
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ func Provider() *schema.Provider {
|
|||||||
"decort_virtual_image": resourceVirtualImage(),
|
"decort_virtual_image": resourceVirtualImage(),
|
||||||
"decort_cdrom_image": resourceCDROMImage(),
|
"decort_cdrom_image": resourceCDROMImage(),
|
||||||
"decort_delete_images": resourceDeleteImages(),
|
"decort_delete_images": resourceDeleteImages(),
|
||||||
|
"decort_snapshot": resourceSnapshot(),
|
||||||
},
|
},
|
||||||
|
|
||||||
DataSourcesMap: map[string]*schema.Resource{
|
DataSourcesMap: map[string]*schema.Resource{
|
||||||
@@ -123,6 +124,7 @@ func Provider() *schema.Provider {
|
|||||||
"decort_grid_list": dataSourceGridList(),
|
"decort_grid_list": dataSourceGridList(),
|
||||||
"decort_image_list": dataSourceImageList(),
|
"decort_image_list": dataSourceImageList(),
|
||||||
"decort_image_list_stacks": dataSourceImageListStacks(),
|
"decort_image_list_stacks": dataSourceImageListStacks(),
|
||||||
|
"decort_snapshot_list": dataSourceSnapshotList(),
|
||||||
// "decort_pfw": dataSourcePfw(),
|
// "decort_pfw": dataSourcePfw(),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -73,10 +73,11 @@ func resourceK8sCreate(d *schema.ResourceData, m interface{}) error {
|
|||||||
//}
|
//}
|
||||||
urlValues.Add("withLB", strconv.FormatBool(true))
|
urlValues.Add("withLB", strconv.FormatBool(true))
|
||||||
|
|
||||||
//if extNet, ok := d.GetOk("extnet_id"); ok {
|
if extNet, ok := d.GetOk("extnet_id"); ok {
|
||||||
//urlValues.Add("extnetId", strconv.Itoa(extNet.(int)))
|
urlValues.Add("extnetId", strconv.Itoa(extNet.(int)))
|
||||||
//}
|
} else {
|
||||||
urlValues.Add("extnetId", strconv.Itoa(0))
|
urlValues.Add("extnetId", "0")
|
||||||
|
}
|
||||||
|
|
||||||
//if desc, ok := d.GetOk("desc"); ok {
|
//if desc, ok := d.GetOk("desc"); ok {
|
||||||
//urlValues.Add("desc", desc.(string))
|
//urlValues.Add("desc", desc.(string))
|
||||||
@@ -121,6 +122,21 @@ func resourceK8sCreate(d *schema.ResourceData, m interface{}) error {
|
|||||||
|
|
||||||
d.Set("default_wg_id", k8s.Groups.Workers[0].ID)
|
d.Set("default_wg_id", k8s.Groups.Workers[0].ID)
|
||||||
|
|
||||||
|
urlValues = &url.Values{}
|
||||||
|
urlValues.Add("lbId", strconv.Itoa(k8s.LbID))
|
||||||
|
|
||||||
|
resp, err = controller.decortAPICall("POST", LbGetAPI, urlValues)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var lb LbRecord
|
||||||
|
if err := json.Unmarshal([]byte(resp), &lb); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
d.Set("extnet_id", lb.ExtNetID)
|
||||||
|
d.Set("lb_ip", lb.PrimaryNode.FrontendIP)
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
urlValues = &url.Values{}
|
||||||
urlValues.Add("k8sId", d.Id())
|
urlValues.Add("k8sId", d.Id())
|
||||||
kubeconfig, err := controller.decortAPICall("POST", K8sGetConfigAPI, urlValues)
|
kubeconfig, err := controller.decortAPICall("POST", K8sGetConfigAPI, urlValues)
|
||||||
@@ -151,6 +167,21 @@ func resourceK8sRead(d *schema.ResourceData, m interface{}) error {
|
|||||||
|
|
||||||
controller := m.(*ControllerCfg)
|
controller := m.(*ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
urlValues := &url.Values{}
|
||||||
|
urlValues.Add("lbId", strconv.Itoa(k8s.LbID))
|
||||||
|
|
||||||
|
resp, err := controller.decortAPICall("POST", LbGetAPI, urlValues)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var lb LbRecord
|
||||||
|
if err := json.Unmarshal([]byte(resp), &lb); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
d.Set("extnet_id", lb.ExtNetID)
|
||||||
|
d.Set("lb_ip", lb.PrimaryNode.FrontendIP)
|
||||||
|
|
||||||
|
urlValues = &url.Values{}
|
||||||
urlValues.Add("k8sId", d.Id())
|
urlValues.Add("k8sId", d.Id())
|
||||||
kubeconfig, err := controller.decortAPICall("POST", K8sGetConfigAPI, urlValues)
|
kubeconfig, err := controller.decortAPICall("POST", K8sGetConfigAPI, urlValues)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -303,13 +334,13 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
|
|||||||
//Description: "Create k8s with load balancer if true.",
|
//Description: "Create k8s with load balancer if true.",
|
||||||
//},
|
//},
|
||||||
|
|
||||||
//"extnet_id": {
|
"extnet_id": {
|
||||||
//Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
//Optional: true,
|
Optional: true,
|
||||||
//ForceNew: true,
|
Computed: true,
|
||||||
//Default: 0,
|
ForceNew: true,
|
||||||
//Description: "ID of the external network to connect workers to.",
|
Description: "ID of the external network to connect workers to. If omitted network will be chosen by the platfom.",
|
||||||
//},
|
},
|
||||||
|
|
||||||
//"desc": {
|
//"desc": {
|
||||||
//Type: schema.TypeString,
|
//Type: schema.TypeString,
|
||||||
@@ -317,6 +348,12 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
|
|||||||
//Description: "Text description of this instance.",
|
//Description: "Text description of this instance.",
|
||||||
//},
|
//},
|
||||||
|
|
||||||
|
"lb_ip": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
Description: "IP address of default load balancer.",
|
||||||
|
},
|
||||||
|
|
||||||
"default_wg_id": {
|
"default_wg_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
|||||||
203
decort/resource_snapshot.go
Normal file
203
decort/resource_snapshot.go
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Author: Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
|
||||||
|
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 (
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/helper/customdiff"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
func resourceSnapshotCreate(d *schema.ResourceData, m interface{}) error {
|
||||||
|
log.Debugf("resourceSnapshotCreate: called for snapshot %s", d.Get("label").(string))
|
||||||
|
|
||||||
|
controller := m.(*ControllerCfg)
|
||||||
|
urlValues := &url.Values{}
|
||||||
|
urlValues.Add("label", d.Get("label").(string))
|
||||||
|
urlValues.Add("computeId", strconv.Itoa(d.Get("compute_id").(int)))
|
||||||
|
|
||||||
|
snapshotId, err := controller.decortAPICall("POST", snapshotCreateAPI, urlValues)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
snapshotId = strings.ReplaceAll(snapshotId, "\"", "")
|
||||||
|
|
||||||
|
d.SetId(snapshotId)
|
||||||
|
d.Set("guid", snapshotId)
|
||||||
|
|
||||||
|
err = resourceSnapshotRead(d, m)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func resourceSnapshotRead(d *schema.ResourceData, m interface{}) error {
|
||||||
|
snapshot, err := utilitySnapshotCheckPresence(d, m)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
d.Set("timestamp", snapshot.Timestamp)
|
||||||
|
d.Set("guid", snapshot.Guid)
|
||||||
|
d.Set("disks", snapshot.Disks)
|
||||||
|
d.Set("label", snapshot.Label)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func resourceSnapshotDelete(d *schema.ResourceData, m interface{}) error {
|
||||||
|
log.Debugf("resourceSnapshotDelete: called for %s, id: %s", d.Get("label").(string), d.Id())
|
||||||
|
|
||||||
|
controller := m.(*ControllerCfg)
|
||||||
|
urlValues := &url.Values{}
|
||||||
|
urlValues.Add("computeId", strconv.Itoa(d.Get("compute_id").(int)))
|
||||||
|
urlValues.Add("label", d.Get("label").(string))
|
||||||
|
|
||||||
|
_, err := controller.decortAPICall("POST", snapshotDeleteAPI, urlValues)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
d.SetId("")
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func resourceSnapshotExists(d *schema.ResourceData, m interface{}) (bool, error) {
|
||||||
|
snapshot, err := utilitySnapshotCheckPresence(d, m)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if snapshot == nil {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func resourceSnapshotEdit(d *schema.ResourceData, m interface{}) error {
|
||||||
|
err := resourceSnapshotRead(d, m)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func resourceSnapshotRollback(d *schema.ResourceDiff, m interface{}) error {
|
||||||
|
c := m.(*ControllerCfg)
|
||||||
|
urlValues := &url.Values{}
|
||||||
|
|
||||||
|
urlValues.Add("computeId", strconv.Itoa(d.Get("compute_id").(int)))
|
||||||
|
urlValues.Add("label", d.Get("label").(string))
|
||||||
|
|
||||||
|
_, err := c.decortAPICall("POST", snapshotRollbackAPI, urlValues)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func resourceSnapshotSchemaMake() map[string]*schema.Schema {
|
||||||
|
return map[string]*schema.Schema{
|
||||||
|
"compute_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Required: true,
|
||||||
|
ForceNew: true,
|
||||||
|
Description: "ID of the compute instance to create snapshot for.",
|
||||||
|
},
|
||||||
|
"label": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Required: true,
|
||||||
|
ForceNew: true,
|
||||||
|
Description: "text label for snapshot. Must be unique among this compute snapshots.",
|
||||||
|
},
|
||||||
|
"rollback": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
Default: false,
|
||||||
|
Description: "is rollback the snapshot",
|
||||||
|
},
|
||||||
|
"disks": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Schema{
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"guid": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
Description: "guid of the snapshot",
|
||||||
|
},
|
||||||
|
"timestamp": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
Description: "timestamp",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func resourceSnapshot() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
Create: resourceSnapshotCreate,
|
||||||
|
Read: resourceSnapshotRead,
|
||||||
|
Update: resourceSnapshotEdit,
|
||||||
|
Delete: resourceSnapshotDelete,
|
||||||
|
Exists: resourceSnapshotExists,
|
||||||
|
|
||||||
|
Importer: &schema.ResourceImporter{
|
||||||
|
State: schema.ImportStatePassthrough,
|
||||||
|
},
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Create: &Timeout60s,
|
||||||
|
Read: &Timeout30s,
|
||||||
|
Update: &Timeout60s,
|
||||||
|
Delete: &Timeout60s,
|
||||||
|
Default: &Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
CustomizeDiff: customdiff.All(
|
||||||
|
customdiff.IfValueChange("rollback", func(old, new, meta interface{}) bool {
|
||||||
|
o := old.(bool)
|
||||||
|
if o != new.(bool) && o == false {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}, resourceSnapshotRollback),
|
||||||
|
),
|
||||||
|
|
||||||
|
Schema: resourceSnapshotSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
55
decort/utility_snapshot.go
Normal file
55
decort/utility_snapshot.go
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Author: Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
|
||||||
|
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 (
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
func utilitySnapshotCheckPresence(d *schema.ResourceData, m interface{}) (*Snapshot, error) {
|
||||||
|
snapShotList, err := utilitySnapshotListCheckPresence(d, m)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
findId := ""
|
||||||
|
|
||||||
|
if (d.Get("guid").(string)) != "" {
|
||||||
|
findId = d.Get("guid").(string)
|
||||||
|
} else {
|
||||||
|
findId = d.Id()
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, s := range snapShotList {
|
||||||
|
if s.Guid == findId {
|
||||||
|
return &s, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, errors.New("snapshot not found")
|
||||||
|
|
||||||
|
}
|
||||||
56
decort/utility_snapshot_list.go
Normal file
56
decort/utility_snapshot_list.go
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Author: Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
|
||||||
|
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"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
func utilitySnapshotListCheckPresence(d *schema.ResourceData, m interface{}) (SnapshotList, error) {
|
||||||
|
controller := m.(*ControllerCfg)
|
||||||
|
urlValues := &url.Values{}
|
||||||
|
urlValues.Add("computeId", strconv.Itoa(d.Get("compute_id").(int)))
|
||||||
|
|
||||||
|
resp, err := controller.decortAPICall("POST", snapshotListAPI, urlValues)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if resp == "" {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
snapshotList := SnapshotList{}
|
||||||
|
if err := json.Unmarshal([]byte(resp), &snapshotList); err != nil {
|
||||||
|
//return nil, errors.New(fmt.Sprint("Can not unmarshall data to snapshotList: ", resp, " ", snapshotList))
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return snapshotList, nil
|
||||||
|
}
|
||||||
50
docs/data-sources/snapshot_list.md
Normal file
50
docs/data-sources/snapshot_list.md
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "decort_snapshot_list Data Source - terraform-provider-decort"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# decort_snapshot_list (Data Source)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- **compute_id** (Number) ID of the compute instance to create snapshot for.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- **id** (String) The ID of this resource.
|
||||||
|
- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- **items** (List of Object) snapshot 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:
|
||||||
|
|
||||||
|
- **disks** (List of Number)
|
||||||
|
- **guid** (String)
|
||||||
|
- **label** (String)
|
||||||
|
- **timestamp** (Number)
|
||||||
|
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ description: |-
|
|||||||
|
|
||||||
### Optional
|
### Optional
|
||||||
|
|
||||||
|
- **extnet_id** (Number) ID of the external network to connect workers to. If omitted network will be chosen by the platfom.
|
||||||
- **id** (String) The ID of this resource.
|
- **id** (String) The ID of this resource.
|
||||||
- **masters** (Block List, Max: 1) Master node(s) configuration. (see [below for nested schema](#nestedblock--masters))
|
- **masters** (Block List, Max: 1) Master node(s) configuration. (see [below for nested schema](#nestedblock--masters))
|
||||||
- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||||
@@ -33,6 +34,7 @@ description: |-
|
|||||||
|
|
||||||
- **default_wg_id** (Number) ID of default workers group for this instace.
|
- **default_wg_id** (Number) ID of default workers group for this instace.
|
||||||
- **kubeconfig** (String) Kubeconfig for cluster access.
|
- **kubeconfig** (String) Kubeconfig for cluster access.
|
||||||
|
- **lb_ip** (String) IP address of default load balancer.
|
||||||
|
|
||||||
<a id="nestedblock--masters"></a>
|
<a id="nestedblock--masters"></a>
|
||||||
### Nested Schema for `masters`
|
### Nested Schema for `masters`
|
||||||
|
|||||||
46
docs/resources/snapshot.md
Normal file
46
docs/resources/snapshot.md
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "decort_snapshot Resource - terraform-provider-decort"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# decort_snapshot (Resource)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- **compute_id** (Number) ID of the compute instance to create snapshot for.
|
||||||
|
- **label** (String) text label for snapshot. Must be unique among this compute snapshots.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- **id** (String) The ID of this resource.
|
||||||
|
- **rollback** (Boolean) is rollback the snapshot
|
||||||
|
- **timeouts** (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- **disks** (List of Number)
|
||||||
|
- **guid** (String) guid of the snapshot
|
||||||
|
- **timestamp** (Number) timestamp
|
||||||
|
|
||||||
|
<a id="nestedblock--timeouts"></a>
|
||||||
|
### Nested Schema for `timeouts`
|
||||||
|
|
||||||
|
Optional:
|
||||||
|
|
||||||
|
- **create** (String)
|
||||||
|
- **default** (String)
|
||||||
|
- **delete** (String)
|
||||||
|
- **read** (String)
|
||||||
|
- **update** (String)
|
||||||
|
|
||||||
|
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
- image
|
- image
|
||||||
- image_list
|
- image_list
|
||||||
- image_list_stacks
|
- image_list_stacks
|
||||||
|
- snapshot_list
|
||||||
- resources:
|
- resources:
|
||||||
- image
|
- image
|
||||||
- virtual_image
|
- virtual_image
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
- delete_images
|
- delete_images
|
||||||
- k8s
|
- k8s
|
||||||
- k8s_wg
|
- k8s_wg
|
||||||
|
- snapshot
|
||||||
|
|
||||||
## Как пользоваться примерами
|
## Как пользоваться примерами
|
||||||
1. Установить terraform
|
1. Установить terraform
|
||||||
|
|||||||
40
samples/data_snapshot_list/main.tf
Normal file
40
samples/data_snapshot_list/main.tf
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
Пример использования
|
||||||
|
Получение списка snapshot
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#Расскомментируйте этот код,
|
||||||
|
#и внесите необходимые правки в версию и путь,
|
||||||
|
#чтобы работать с установленным вручную (не через hashicorp provider registry) провайдером
|
||||||
|
/*
|
||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
decort = {
|
||||||
|
version = "1.1"
|
||||||
|
source = "digitalenergy.online/decort/decort"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
provider "decort" {
|
||||||
|
authenticator = "oauth2"
|
||||||
|
#controller_url = <DECORT_CONTROLLER_URL>
|
||||||
|
controller_url = "https://mr4.digitalenergy.online"
|
||||||
|
#oauth2_url = <DECORT_SSO_URL>
|
||||||
|
oauth2_url = "https://sso.digitalenergy.online"
|
||||||
|
allow_unverified_ssl = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
data "decort_snapshot_list" "sl" {
|
||||||
|
#обязательный параметр
|
||||||
|
#id вычислительной мощности
|
||||||
|
#тип - число
|
||||||
|
compute_id = 24074
|
||||||
|
}
|
||||||
|
|
||||||
|
output "test" {
|
||||||
|
value = data.decort_snapshot_list.sl
|
||||||
|
}
|
||||||
56
samples/resource_snapshot/main.tf
Normal file
56
samples/resource_snapshot/main.tf
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
Пример использования
|
||||||
|
Ресурса snapshot
|
||||||
|
Ресурс позволяет:
|
||||||
|
1. Создавать snapshot
|
||||||
|
2. Удалять snapshot
|
||||||
|
3. Откатывать snapshot
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#Расскомментируйте этот код,
|
||||||
|
#и внесите необходимые правки в версию и путь,
|
||||||
|
#чтобы работать с установленным вручную (не через hashicorp provider registry) провайдером
|
||||||
|
/*
|
||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
decort = {
|
||||||
|
version = "1.1"
|
||||||
|
source = "digitalenergy.online/decort/decort"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
provider "decort" {
|
||||||
|
authenticator = "oauth2"
|
||||||
|
#controller_url = <DECORT_CONTROLLER_URL>
|
||||||
|
controller_url = "https://mr4.digitalenergy.online"
|
||||||
|
#oauth2_url = <DECORT_SSO_URL>
|
||||||
|
oauth2_url = "https://sso.digitalenergy.online"
|
||||||
|
allow_unverified_ssl = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
resource "decort_snapshot" "s" {
|
||||||
|
#обязательный параметр
|
||||||
|
#id вычислительной мощности
|
||||||
|
#тип - число
|
||||||
|
compute_id = 24074
|
||||||
|
|
||||||
|
#обязательный параметр
|
||||||
|
#наименование snapshot
|
||||||
|
#тип - строка
|
||||||
|
label = "test_ssht_3"
|
||||||
|
|
||||||
|
#опциональный параметр
|
||||||
|
#флаг отката
|
||||||
|
#тип - булев тип
|
||||||
|
#по-уолчанию - false
|
||||||
|
#если флаг был измеен с false на true, то произойдет откат
|
||||||
|
#rollback = false
|
||||||
|
}
|
||||||
|
|
||||||
|
output "test" {
|
||||||
|
value = decort_snapshot.s
|
||||||
|
}
|
||||||
7
sonar-project.properties
Normal file
7
sonar-project.properties
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
sonar.projectKey=terraform-provider-decort-sast
|
||||||
|
sonar.dependencyCheck.jsonReportPath=dependency-check-report.json
|
||||||
|
sonar.dependencyCheck.htmlReportPath=dependency-check-report.html
|
||||||
|
|
||||||
|
sonar.exclusions=dependency-check-report.*
|
||||||
|
|
||||||
|
sonar.language=go
|
||||||
Reference in New Issue
Block a user