From 72d3f4a9e54e0b4d66f749389680bd862ba9d796 Mon Sep 17 00:00:00 2001 From: nikolay-spectro Date: Sun, 10 Dec 2023 19:18:41 -0800 Subject: [PATCH] PLT-822: Fixing issue with default values and validation function. --- spectrocloud/resource_cluster_azure.go | 4 +++- spectrocloud/resource_cluster_azure_test.go | 6 ++++-- spectrocloud/resource_cluster_edge_native.go | 9 ++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/spectrocloud/resource_cluster_azure.go b/spectrocloud/resource_cluster_azure.go index 94706f38..b8c72f2e 100644 --- a/spectrocloud/resource_cluster_azure.go +++ b/spectrocloud/resource_cluster_azure.go @@ -281,7 +281,9 @@ func resourceClusterAzure() *schema.Resource { Type: schema.TypeString, }, Description: "Availability zones for the machine pool. Check if your region provides availability zones on [the Azure documentation](https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support). Default value is `[\"\"]`.", - Default: []string{""}, + DefaultFunc: func() (any, error) { + return []string{""}, nil + }, }, "is_system_node_pool": { Type: schema.TypeBool, diff --git a/spectrocloud/resource_cluster_azure_test.go b/spectrocloud/resource_cluster_azure_test.go index 4a29f3a9..63c6db08 100644 --- a/spectrocloud/resource_cluster_azure_test.go +++ b/spectrocloud/resource_cluster_azure_test.go @@ -1,12 +1,14 @@ package spectrocloud import ( + "testing" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/spectrocloud/hapi/models" "github.com/spectrocloud/palette-sdk-go/client" - "github.com/spectrocloud/terraform-provider-spectrocloud/types" "github.com/stretchr/testify/assert" - "testing" + + "github.com/spectrocloud/terraform-provider-spectrocloud/types" ) func prepareAzureTestData() *schema.ResourceData { diff --git a/spectrocloud/resource_cluster_edge_native.go b/spectrocloud/resource_cluster_edge_native.go index e8a0b50d..144caf56 100644 --- a/spectrocloud/resource_cluster_edge_native.go +++ b/spectrocloud/resource_cluster_edge_native.go @@ -132,14 +132,13 @@ func resourceClusterEdgeNative() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "ssh_keys": { - Type: schema.TypeSet, - Optional: true, - Set: schema.HashString, - ConflictsWith: []string{"cloud_config.0.ssh_key"}, + Type: schema.TypeSet, + Optional: true, + Set: schema.HashString, Elem: &schema.Schema{ Type: schema.TypeString, }, - Description: "List of SSH (Secure Shell) to establish, administer, and communicate with remote clusters, `ssh_key & ssh_keys` are mutually exclusive.", + Description: "List of SSH (Secure Shell) to establish, administer, and communicate with remote clusters.", }, "vip": { Type: schema.TypeString,