1.1.0
This commit is contained in:
31
internal/service/cloudbroker/k8ci/input_checks.go
Normal file
31
internal/service/cloudbroker/k8ci/input_checks.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package k8ci
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/diag"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/ic"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/k8ci/models"
|
||||
)
|
||||
|
||||
func resourceK8CIInputChecks(ctx context.Context, plan *models.ResourceK8CIModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
diags := diag.Diagnostics{}
|
||||
|
||||
masterImageId := uint64(plan.MasterImageId.ValueInt64())
|
||||
workerImageId := uint64(plan.WorkerImageId.ValueInt64())
|
||||
images := make([]uint64, 0)
|
||||
images = append(images, masterImageId)
|
||||
if workerImageId != masterImageId {
|
||||
images = append(images, workerImageId)
|
||||
}
|
||||
tflog.Info(ctx, "resourceK8CIInputChecks: exist images check", map[string]any{"master_image_id": masterImageId, "worker_image_id": workerImageId})
|
||||
err := ic.ExistImages(ctx, images, c)
|
||||
if err != nil {
|
||||
diags.AddError(fmt.Sprintf("Cannot get info about images"), err.Error())
|
||||
}
|
||||
|
||||
return diags
|
||||
}
|
||||
Reference in New Issue
Block a user