From 0acb38ef4713a01616f4e7bd48dc7d0501ae2bdd Mon Sep 17 00:00:00 2001
From: Sivaanand Murugesan <sivaanand.m@gmail.com>
Date: Fri, 20 Dec 2024 12:54:32 +0530
Subject: [PATCH] PLT-1527:Added support custom cloud profile creation. (#556)

* PLT-1527:Added support custom cloud profile creation.

* ci fix

* ci fix

* removed edge in description
---
 .github/workflows/ci.yml                 |  5 +++++
 docs/resources/cluster_profile.md        |  2 +-
 spectrocloud/resource_cluster_profile.go | 13 +++++++------
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c89ddec7..a9573fb9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -23,6 +23,11 @@ jobs:
         with:
           go-version-file: go.mod
 
+      - name: Install Terraform CLI
+        uses: hashicorp/setup-terraform@v2
+        with:
+          terraform_wrapper: false
+
       - name: Ensure reviewable
         run: make check-diff
 
diff --git a/docs/resources/cluster_profile.md b/docs/resources/cluster_profile.md
index b464ec54..0097a888 100644
--- a/docs/resources/cluster_profile.md
+++ b/docs/resources/cluster_profile.md
@@ -379,7 +379,7 @@ Refer to the [Import section](/docs#import) to learn more.
 
 ### Optional
 
-- `cloud` (String) Specify the infrastructure provider the cluster profile is for. Only Palette supported infrastructure providers can be used. The  supported cloud types are - `all, aws, azure, gcp, vsphere, openstack, maas, virtual, baremetal, eks, aks, edge, edge-native, tencent, tke, generic, and gke`,If the value is set to `all`, then the type must be set to `add-on`. Otherwise, the cluster profile may be incompatible with other providers. Default value is `all`.
+- `cloud` (String) Specify the infrastructure provider the cluster profile is for. Only Palette supported infrastructure providers can be used. The supported cloud types are - `all, aws, azure, gcp, vsphere, openstack, maas, virtual, baremetal, eks, aks, edge-native, tencent, tke, generic, and gke` or any custom cloud provider registered in Palette, e.g., `nutanix`.If the value is set to `all`, then the type must be set to `add-on`. Otherwise, the cluster profile may be incompatible with other providers. Default value is `all`.
 - `context` (String) The context of the cluster profile. Allowed values are `project` or `tenant`. Default value is `project`. If  the `project` context is specified, the project name will sourced from the provider configuration parameter [`project_name`](https://registry.terraform.io/providers/spectrocloud/spectrocloud/latest/docs#schema).
 - `description` (String)
 - `pack` (Block List) For packs of type `spectro`, `helm`, and `manifest`, at least one pack must be specified. (see [below for nested schema](#nestedblock--pack))
diff --git a/spectrocloud/resource_cluster_profile.go b/spectrocloud/resource_cluster_profile.go
index 65caf1b3..66389c63 100644
--- a/spectrocloud/resource_cluster_profile.go
+++ b/spectrocloud/resource_cluster_profile.go
@@ -70,12 +70,13 @@ func resourceClusterProfile() *schema.Resource {
 				Optional: true,
 			},
 			"cloud": {
-				Type:         schema.TypeString,
-				Default:      "all",
-				Optional:     true,
-				ValidateFunc: validation.StringInSlice([]string{"all", "aws", "azure", "gcp", "vsphere", "openstack", "maas", "virtual", "baremetal", "eks", "aks", "edge", "edge-native", "tencent", "tke", "generic", "gke"}, false),
-				ForceNew:     true,
-				Description: "Specify the infrastructure provider the cluster profile is for. Only Palette supported infrastructure providers can be used. The  supported cloud types are - `all, aws, azure, gcp, vsphere, openstack, maas, virtual, baremetal, eks, aks, edge, edge-native, tencent, tke, generic, and gke`," +
+				Type:     schema.TypeString,
+				Default:  "all",
+				Optional: true,
+				// Removing validation to support custom clouds
+				// ValidateFunc: validation.StringInSlice([]string{"all", "aws", "azure", "gcp", "vsphere", "openstack", "maas", "virtual", "baremetal", "eks", "aks", "edge", "edge-native", "tencent", "tke", "generic", "gke"}, false),
+				ForceNew: true,
+				Description: "Specify the infrastructure provider the cluster profile is for. Only Palette supported infrastructure providers can be used. The supported cloud types are - `all, aws, azure, gcp, vsphere, openstack, maas, virtual, baremetal, eks, aks, edge-native, tencent, tke, generic, and gke` or any custom cloud provider registered in Palette, e.g., `nutanix`." +
 					"If the value is set to `all`, then the type must be set to `add-on`. Otherwise, the cluster profile may be incompatible with other providers. Default value is `all`.",
 			},
 			"type": {