Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 523d96189f |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,4 +2,4 @@ decort/vendor/
|
||||
examples/
|
||||
url_scrapping/
|
||||
terraform-provider-decort*
|
||||
.vscode/
|
||||
.vscode/
|
||||
31
CHANGELOG.md
31
CHANGELOG.md
@@ -1,30 +1,5 @@
|
||||
## Version 4.0.0
|
||||
|
||||
### Features
|
||||
- Updated provider to the newest DECORT version (3.8.6):
|
||||
- resource_k8s now has "network_plugin" required field
|
||||
- Added "start" argument to resource_k8s
|
||||
- data_source_bservice, resource_bservice "computes" and "groups" fields now have more in-depth information
|
||||
- resource_compute now has full boot disk information
|
||||
- data_source_extnet now has additional field "e_burst" inside "default_qos" substructure
|
||||
- data_source_rg_list, data_source_rg, resource_rg, resource_account and data_source_account now have two additional fields:
|
||||
- cpu_allocation_parameter
|
||||
- cpu_allocation_ratio
|
||||
- unnecessary fields were removed from all disks data sources && resources (except for unattached disks), to be exact:
|
||||
- boot_partition
|
||||
- guid
|
||||
- disk_path
|
||||
- iqn
|
||||
- login
|
||||
- milestones
|
||||
- password
|
||||
- purge_attempts
|
||||
- reality_device_number
|
||||
- reference_id
|
||||
- Removed automatic switch between cloudbroker/cloudapi (admin/user modes)
|
||||
## Version 4.0.1
|
||||
|
||||
## Bug Fix
|
||||
- Fixed resource_compute error when creating a new instance with EXTNET type network
|
||||
- Fixed quota record marshalling in decort_resgroup resource
|
||||
- Fixed GID validation for multiple resources
|
||||
- Fixed possible 'addUser' error when importing resource_account with already added user
|
||||
- Fixed incorrect state reading when creating/deleting port_forwarding in decort_kvmvm
|
||||
- Fixed possible segmentation fault with multiple concurrent resource manipulations
|
||||
|
||||
2
Makefile
2
Makefile
@@ -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.0.0
|
||||
VERSION=4.0.1
|
||||
#OS_ARCH=darwin_amd64
|
||||
OS_ARCH=windows_amd64
|
||||
#OS_ARCH=linux_amd64
|
||||
|
||||
2
go.mod
2
go.mod
@@ -9,7 +9,7 @@ require (
|
||||
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
golang.org/x/net v0.5.0
|
||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.4.0
|
||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.4.3
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
4
go.sum
4
go.sum
@@ -332,5 +332,5 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
|
||||
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.4.0 h1:y8F3bzEb8mROEYnoG495AxpbSTEkfSpFh97sZe42cJE=
|
||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.4.0/go.mod h1:YP57mpXh60xeRERVaCehn+l0S7Qe24trVll1EvrKzds=
|
||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.4.3 h1:jrBl90lRfp34bE3m30N3mYIDTSlaPySuo+pE7bK4eOI=
|
||||
repository.basistech.ru/BASIS/decort-golang-sdk v1.4.3/go.mod h1:szsTGa73O75ckCWVGJPvTtRbhA/ubuYrYhMkPjvHlmE=
|
||||
|
||||
@@ -217,7 +217,7 @@ func resourceK8sRead(ctx context.Context, d *schema.ResourceData, m interface{})
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
enableReq := k8s.DisabelEnableRequest{
|
||||
enableReq := k8s.DisableEnableRequest{
|
||||
K8SID: id,
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ func resourceK8sUpdate(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
enableReq := k8s.DisabelEnableRequest{
|
||||
enableReq := k8s.DisableEnableRequest{
|
||||
K8SID: id,
|
||||
}
|
||||
|
||||
|
||||
@@ -60,11 +60,28 @@ func resourceK8sWgCreate(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := k8s.WorkersGroupAddRequest{
|
||||
K8SID: uint64(d.Get("k8s_id").(int)),
|
||||
Name: d.Get("name").(string),
|
||||
WorkerNum: uint64(d.Get("num").(int)),
|
||||
WorkerCPU: uint64(d.Get("cpu").(int)),
|
||||
WorkerRAM: uint64(d.Get("ram").(int)),
|
||||
K8SID: uint64(d.Get("k8s_id").(int)),
|
||||
Name: d.Get("name").(string),
|
||||
WorkerNum: uint64(d.Get("num").(int)),
|
||||
WorkerCPU: uint64(d.Get("cpu").(int)),
|
||||
WorkerRAM: uint64(d.Get("ram").(int)),
|
||||
WorkerSEPID: uint64(d.Get("worker_sep_id").(int)),
|
||||
WorkerSEPPool: d.Get("worker_sep_pool").(string),
|
||||
}
|
||||
|
||||
labels, _ := d.Get("labels").([]interface{})
|
||||
for _, label := range labels {
|
||||
req.Labels = append(req.Labels, label.(string))
|
||||
}
|
||||
|
||||
annotations, _ := d.Get("annotations").([]interface{})
|
||||
for _, annotation := range annotations {
|
||||
req.Annotations = append(req.Annotations, annotation.(string))
|
||||
}
|
||||
|
||||
taints, _ := d.Get("taints").([]interface{})
|
||||
for _, taint := range taints {
|
||||
req.Taints = append(req.Taints, taint.(string))
|
||||
}
|
||||
|
||||
if d.Get("disk") == nil {
|
||||
@@ -111,6 +128,7 @@ func resourceK8sWgRead(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
} else {
|
||||
d.Set("k8s_id", d.Get("k8s_id"))
|
||||
}
|
||||
|
||||
d.SetId(strings.Split(d.Id(), "#")[0])
|
||||
|
||||
flattenWg(d, *wg, workersComputeList)
|
||||
@@ -234,6 +252,38 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "Worker node boot disk size. If unspecified or 0, size is defined by OS image size.",
|
||||
},
|
||||
"labels": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
},
|
||||
},
|
||||
"annotations": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
},
|
||||
},
|
||||
"taints": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
},
|
||||
},
|
||||
"worker_sep_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
},
|
||||
"worker_sep_pool": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
},
|
||||
"wg_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -246,31 +296,10 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
|
||||
Schema: detailedInfoSchemaMake(),
|
||||
},
|
||||
},
|
||||
"labels": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
},
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"annotations": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
},
|
||||
},
|
||||
"taints": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,8 +318,8 @@ func ResourceK8sWg() *schema.Resource {
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Create: &constants.Timeout600s,
|
||||
Read: &constants.Timeout300s,
|
||||
Update: &constants.Timeout300s,
|
||||
Read: &constants.Timeout600s,
|
||||
Update: &constants.Timeout600s,
|
||||
Delete: &constants.Timeout300s,
|
||||
Default: &constants.Timeout300s,
|
||||
},
|
||||
|
||||
@@ -373,7 +373,7 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
req := compute.PFWAddRequest{
|
||||
ComputeID: computeId,
|
||||
PublicPortStart: uint64(pfwItem["public_port_start"].(int)),
|
||||
PublicPortEnd: uint64(pfwItem["public_port_end"].(int)),
|
||||
PublicPortEnd: int64(pfwItem["public_port_end"].(int)),
|
||||
LocalBasePort: uint64(pfwItem["local_port"].(int)),
|
||||
Proto: pfwItem["proto"].(string),
|
||||
}
|
||||
@@ -630,6 +630,8 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
Force: true,
|
||||
}
|
||||
|
||||
warnings := dc.Warnings{}
|
||||
|
||||
oldCpu, newCpu := d.GetChange("cpu")
|
||||
if oldCpu.(int) != newCpu.(int) {
|
||||
resizeReq.CPU = uint64(newCpu.(int))
|
||||
@@ -1059,7 +1061,7 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
|
||||
_, err := c.CloudAPI().Compute().PFWDel(ctx, req)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
warnings.Add(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1071,7 +1073,7 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
req := compute.PFWAddRequest{
|
||||
ComputeID: computeRec.ID,
|
||||
PublicPortStart: uint64(pfwItem["public_port_start"].(int)),
|
||||
PublicPortEnd: uint64(pfwItem["public_port_end"].(int)),
|
||||
PublicPortEnd: int64(pfwItem["public_port_end"].(int)),
|
||||
LocalBasePort: uint64(pfwItem["local_port"].(int)),
|
||||
Proto: pfwItem["proto"].(string),
|
||||
}
|
||||
@@ -1311,7 +1313,8 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
|
||||
// we may reuse dataSourceComputeRead here as we maintain similarity
|
||||
// between Compute resource and Compute data source schemas
|
||||
return resourceComputeRead(ctx, d, m)
|
||||
defer resourceComputeRead(ctx, d, m)
|
||||
return warnings.Get()
|
||||
}
|
||||
|
||||
func isChangeDisk(els []interface{}, el interface{}) bool {
|
||||
@@ -1696,6 +1699,7 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
|
||||
"network": {
|
||||
Type: schema.TypeSet,
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
MinItems: 1,
|
||||
MaxItems: constants.MaxNetworksPerCompute,
|
||||
|
||||
@@ -57,7 +57,7 @@ func resourcePfwCreate(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
}
|
||||
|
||||
if portEnd, ok := d.GetOk("public_port_end"); ok {
|
||||
req.PublicPortEnd = uint64(portEnd.(int))
|
||||
req.PublicPortEnd = int64(portEnd.(int))
|
||||
}
|
||||
|
||||
pfwId, err := c.CloudAPI().Compute().PFWAdd(ctx, req)
|
||||
|
||||
@@ -55,7 +55,7 @@ func resourcePfwCreate(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
req.Proto = d.Get("proto").(string)
|
||||
|
||||
if portEnd, ok := d.GetOk("public_port_end"); ok {
|
||||
req.PublicPortEnd = uint64(portEnd.(int))
|
||||
req.PublicPortEnd = int64(portEnd.(int))
|
||||
}
|
||||
|
||||
pfwId, err := c.CloudBroker().Compute().PFWAdd(ctx, req)
|
||||
|
||||
Reference in New Issue
Block a user