gos_tech_4.4.3 4.2.4
Tim Tkachev 2 years ago
parent 6365f63fc1
commit f731cf246f

@ -1,4 +1,6 @@
## Version 4.2.3
## Version 4.2.4
## Bug Fixes
- Made "ipcidr" field in decort_vins resource optional
- Fixed incorrect network validation in decort_kvmvm resource
- Fixed inability to remove all networks at once in decort_kvmvm resource
- Deleted "check__ips" (duplicate) field in decort_extnet data source

@ -8,7 +8,7 @@ ZIPDIR = ./zip
BINARY=${NAME}.exe
WORKPATH= ./examples/terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAMESPACE}/${VERSION}/${OS_ARCH}
MAINPATH = ./cmd/decort/
VERSION=4.2.3
VERSION=4.2.4
#OS_ARCH=darwin_amd64
OS_ARCH=windows_amd64
#OS_ARCH=linux_amd64

@ -4,6 +4,7 @@ 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.

@ -4,6 +4,7 @@ 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.
@ -71,13 +72,6 @@ func dataSourceExtnetSchemaMake() map[string]*schema.Schema {
},
Description: "meta",
},
"check__ips": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"check_ips": {
Type: schema.TypeList,
Computed: true,

@ -9,7 +9,6 @@ import (
func flattenExtnet(d *schema.ResourceData, e *extnet.RecordExtNet) {
d.Set("ckey", e.CKey)
d.Set("meta", flattens.FlattenMeta(e.Meta))
d.Set("check__ips", e.CheckIPs)
d.Set("check_ips", e.CheckIps)
d.Set("default", e.Default)
d.Set("default_qos", flattenExtnetDefaultQos(e.DefaultQOS))

@ -4,6 +4,7 @@ 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.
@ -36,8 +37,8 @@ import (
"bytes"
"hash/fnv"
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/statefuncs"
log "github.com/sirupsen/logrus"
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/statefuncs"
"sort"

@ -4,6 +4,7 @@ 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.
@ -36,6 +37,7 @@ import (
"context"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
log "github.com/sirupsen/logrus"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/extnet"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/image"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/rg"
@ -91,43 +93,35 @@ func existExtNetIdInList(extId uint64, extList extnet.ListExtNets) bool {
return false
}
func existVinsId(ctx context.Context, d *schema.ResourceData, m interface{}) (int, bool) {
func existVinsId(ctx context.Context, m interface{}, id int) (int, bool) {
c := m.(*controller.ControllerCfg)
req := vins.ListRequest{IncludeDeleted: false}
vinsList, err := c.CloudAPI().VINS().List(ctx, req)
if err != nil {
log.Debugf("Unable to retrieve ViNS list, %s", err)
return 0, false
}
networks := d.Get("network").(*schema.Set).List()
for _, networkInterface := range networks {
networkItem := networkInterface.(map[string]interface{})
if !existVinsIdInList(uint64(networkItem["net_id"].(int)), vinsList) {
return networkItem["net_id"].(int), false
}
if !existVinsIdInList(uint64(id), vinsList) {
return id, false
}
return 0, true
}
func existExtNetId(ctx context.Context, d *schema.ResourceData, m interface{}) (int, bool) {
func existExtNetId(ctx context.Context, m interface{}, id int) (int, bool) {
c := m.(*controller.ControllerCfg)
req := extnet.ListRequest{}
extNetList, err := c.CloudAPI().ExtNet().List(ctx, req)
if err != nil {
log.Debugf("Unable to retrieve extnet list, %s", err)
return 0, false
}
networks := d.Get("network").(*schema.Set).List()
for _, networkInterface := range networks {
networkItem := networkInterface.(map[string]interface{})
if !existExtNetIdInList(uint64(networkItem["net_id"].(int)), extNetList) {
return networkItem["net_id"].(int), false
}
if !existExtNetIdInList(uint64(id), extNetList) {
return id, false
}
return 0, true

@ -4,6 +4,7 @@ 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.
@ -77,14 +78,22 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
}
if network, ok := d.GetOk("network"); ok {
networkData := network.(*schema.Set).List()[0].(map[string]interface{})
if networkData["net_type"].(string) == "VINS" {
if vinsId, ok := existVinsId(ctx, d, m); !ok {
return diag.Errorf("resourceComputeCreate: can't create compute because vins ID %d is not allowed or does not exist", vinsId)
}
} else if networkData["net_type"].(string) == "EXTNET" {
if extNetId, ok := existExtNetId(ctx, d, m); !ok {
return diag.Errorf("resourceComputeCreate: can't create compute because extnet ID %d is not allowed or does not exist", extNetId)
networkList := network.(*schema.Set).List()
for _, elem := range networkList {
networkData := elem.(map[string]interface{})
switch networkData["net_type"].(string) {
case "VINS":
if vinsId, ok := existVinsId(ctx, m, networkData["net_id"].(int)); !ok {
return diag.Errorf("resourceComputeCreate: can't create compute because vins ID %d is not allowed or does not exist", vinsId)
}
case "EXTNET":
if extNetId, ok := existExtNetId(ctx, m, networkData["net_id"].(int)); !ok {
return diag.Errorf("resourceComputeCreate: can't create compute because extnet ID %d is not allowed or does not exist", extNetId)
}
default:
continue
}
}
}
@ -557,14 +566,22 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
}
if network, ok := d.GetOk("network"); ok {
networkData := network.(*schema.Set).List()[0].(map[string]interface{})
if networkData["net_type"].(string) == "VINS" {
if vinsId, ok := existVinsId(ctx, d, m); !ok {
return diag.Errorf("resourceComputeUpdate: can't create update because vins ID %d is not allowed or does not exist", vinsId)
}
} else if networkData["net_type"].(string) == "EXTNET" {
if extNetId, ok := existExtNetId(ctx, d, m); !ok {
return diag.Errorf("resourceComputeUpdate: can't create update because extnet ID %d is not allowed or does not exist", extNetId)
networkList := network.(*schema.Set).List()
for _, elem := range networkList {
networkData := elem.(map[string]interface{})
switch networkData["net_type"].(string) {
case "VINS":
if vinsId, ok := existVinsId(ctx, m, networkData["net_id"].(int)); !ok {
return diag.Errorf("resourceComputeUpdate: can't update compute because vins ID %d is not allowed or does not exist", vinsId)
}
case "EXTNET":
if extNetId, ok := existExtNetId(ctx, m, networkData["net_id"].(int)); !ok {
return diag.Errorf("resourceComputeUpdate: can't update compute because extnet ID %d is not allowed or does not exist", extNetId)
}
default:
continue
}
}
}
@ -1704,7 +1721,6 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
"network": {
Type: schema.TypeSet,
Computed: true,
Optional: true,
MinItems: 1,
MaxItems: constants.MaxNetworksPerCompute,
@ -1714,18 +1730,6 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
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.",
},
*/
"tags": {
Type: schema.TypeSet,
Optional: true,

Loading…
Cancel
Save