Skip to content

Commit b9ff460

Browse files
SivaanandMdependabot[bot]manimaran89
authored
Platform Solution Week 51 Release (#739)
* PS-WEEK-49 (#731) * PLT-2026: Fixed add-on deployment resource taint issue. (#725) * PLT-2026: Fixed addon deployment resource taint issue. * reviewable fix * fixed addondeployment * PLT-1986: Added CloudStack support in terrafrom provider (#712) * chore: update gitignore and dependencies * refreshed sdk with palette-sdk for cloud stack * Draft working cloudstack support * gosec fixes Signed-off-by: Sivaanand Murugesan <[email protected]> * go sec * adeded vpc support Signed-off-by: Sivaanand Murugesan <[email protected]> * removed certificate support Signed-off-by: Sivaanand Murugesan <[email protected]> * fixed additional change according to api model change Signed-off-by: Sivaanand Murugesan <[email protected]> * refreshed sdk for api changes * new: add new field uid=501(sivaanandm) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae) network configuration for cloudstack cluster. Signed-off-by: Sivaanand Murugesan <[email protected]> * Fix: added support for zone id * Bump github.com/go-openapi/strfmt from 0.24.0 to 0.25.0 (#714) Bumps [github.com/go-openapi/strfmt](https://github.com/go-openapi/strfmt) from 0.24.0 to 0.25.0. - [Commits](go-openapi/strfmt@v0.24.0...v0.25.0) --- updated-dependencies: - dependency-name: github.com/go-openapi/strfmt dependency-version: 0.25.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * TF Provider Week 46 (#717) * draft * PLT-1976: Updated clear description for version update (#716) * PLT-2016:Updated default ami_type to 'AL2023_x86_64_STANDARD' (#713) * PLT-2016:Updated default ami_type to 'AL2023_x86_64_STANDARD' * PLT-1619: Added new resource for Cluster Templates & Upgrade Policy (#715) * updated .gitignore * Add cluster_config_template and cluster_config_policy resources - Added spectrocloud_cluster_config_template resource and data source - Added spectrocloud_cluster_config_policy resource and data source - Added unit tests for both resources - Added documentation and examples - Updated SDK to PLT-1986 branch with new CRUD methods * fix: completed dev test fix for cluster policy * added context support * dev fix for template * fix * Added cluster_template support in eks cluster * added cluster template support in aks * refreshed docs * unit test fix * Fix: cluster_template validation * Added upgrade now support * upgrade support * Fix: Fixed PLT-2025 datasource * removed cluster integration of cluster template * Fix: Added cluser template implementation for aks cluster * Fix: Updated cluster_template for all cluster resources * reviewable fix * PLT-2014: Added pod-identity credential support for aws account (#718) * Refreshed SDK * standardized attribute name for policy and cluster_profile * PLT-2039: Fixed cluster group config drift for cluster reference's. (#719) * PLT-2040: Fixed pod-identity validation issue for aws account resource (#720) * PLT-2040: Fixed pod-identity aws account validation. * refreshed sdk * Bump k8s.io/api from 0.34.1 to 0.34.2 (#723) Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.34.1 to 0.34.2. - [Commits](kubernetes/api@v0.34.1...v0.34.2) --- updated-dependencies: - dependency-name: k8s.io/api dependency-version: 0.34.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump kubevirt.io/api from 1.6.2 to 1.6.3 (#721) Bumps [kubevirt.io/api](https://github.com/kubevirt/api) from 1.6.2 to 1.6.3. - [Commits](kubevirt/api@v1.6.2...v1.6.3) --- updated-dependencies: - dependency-name: kubevirt.io/api dependency-version: 1.6.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixed cloudstack name to apache_cloudstack * Fix: unit fix * PLT-2057: Fixed system pcg support for apache cloudstack (#726) * PLT-2057: Fixed system pcg support for apache cloudstack * docs: fix * sec fix * fix * PLT-2059: Removed domain from cloud config (#727) * Fix: Fixed PLT-2060 * Fix: Fixed cloudstack import functionality (#730) --------- Signed-off-by: Sivaanand Murugesan <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: Sivaanand Murugesan <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * gosec issue fix Signed-off-by: Sivaanand Murugesan <[email protected]> * chore: refresh sdk * PLT-2071:Fixed instance_config issue in cloudstack (#736) Signed-off-by: Sivaanand Murugesan <[email protected]> * chore: refreshed sdk Signed-off-by: Sivaanand Murugesan <[email protected]> * fix update worker in paralel field in flatten * PLT-2068: Fixed cluster profile day2 operation terrafrom state issue's (#734) * PLT-2068: Fixed cluster profile day2 operation terrafrom state issue's Signed-off-by: Sivaanand Murugesan <[email protected]> * go sec fix --------- Signed-off-by: Sivaanand Murugesan <[email protected]> * PLT-2077: update schema for project in cloudconfig for cloudstack (#741) * PLT-2069: Fix for cross-resource issues between addon_deployment and Cluster Profile updates in a cluster has been completed. (#735) * PLT-2069: Fixed profile update stale operations. Signed-off-by: Sivaanand Murugesan <[email protected]> * fix: replace issue * fix: go sec issues upgrading go Signed-off-by: Sivaanand Murugesan <[email protected]> * fix: draft * refresh sdk * refresh sdk * fix: added support for multiple cluster addon profile in addon deployment resource Signed-off-by: Sivaanand Murugesan <[email protected]> --------- Signed-off-by: Sivaanand Murugesan <[email protected]> * fix: removed instance_config compute field * fix: added taint support cloudstack * PLT-2085: Fixed plugin crash for rabac operations (#752) * refresh sdk for week 51 Signed-off-by: Sivaanand Murugesan <[email protected]> * PLT-2086: Fixed cluster import cluster profile (#753) Signed-off-by: Sivaanand Murugesan <[email protected]> * Bump k8s.io/apimachinery from 0.34.2 to 0.34.3 (#750) Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.34.2 to 0.34.3. - [Commits](kubernetes/apimachinery@v0.34.2...v0.34.3) --- updated-dependencies: - dependency-name: k8s.io/apimachinery dependency-version: 0.34.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump k8s.io/api from 0.34.2 to 0.34.3 (#749) Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.34.2 to 0.34.3. - [Commits](kubernetes/api@v0.34.2...v0.34.3) --- updated-dependencies: - dependency-name: k8s.io/api dependency-version: 0.34.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sivaanand Murugesan <[email protected]> * Bump kubevirt.io/containerized-data-importer-api from 1.63.1 to 1.64.0 (#748) Bumps [kubevirt.io/containerized-data-importer-api](https://github.com/kubevirt/containerized-data-importer) from 1.63.1 to 1.64.0. - [Release notes](https://github.com/kubevirt/containerized-data-importer/releases) - [Changelog](https://github.com/kubevirt/containerized-data-importer/blob/main/doc/releases.md) - [Commits](kubevirt/containerized-data-importer@v1.63.1...v1.64.0) --- updated-dependencies: - dependency-name: kubevirt.io/containerized-data-importer-api dependency-version: 1.64.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * PLT-2058 Migrate to use TypeSet for Resource TF Provider spectrocloud_alert (#728) (#732) * Migrate to use TypeSet for Resource TF Provider spectrocloud_alert * Converting list to set for resource alert * Revert "Converting list to set for resource alert" Reverting back to Original changes from typeList to typeSet This reverts commit 581e060. * PLT-2048 Migrate to use TypeSet for Resource TF Provider spectrocloud_alert * PLT-2048 Migrate to use TypeSet for Resource TF Provider spectrocloud_alert * PLT-2048 Migrate to use TypeSet for Resource TF Provider spectrocloud_alert * PLT-2048 Migrate to use TypeSet for Resource TF Provider spectrocloud_alert * PLT-2058 Migrate to use TypeSet for Resource TF Provider spectrocloud_alert * PLT-2058 Migrate to use TypeSet for Resource TF Provider spectrocloud_alert * PLT-2058 Migrate to use TypeSet for Resource TF Provider spectrocloud_alert * PLT-2058 Migrate to use TypeSet for Resource TF Provider spectrocloud_alert * PLT-2058 Migrate to use TypeSet for Resource TF Provider spectrocloud_alert * PLT-2058 Migrate to use TypeSet for Resource TF Provider spectrocloud_alert * PLT-2058: Fixed alert functionality as par with palette UI * fix: updated go version for govul check. --------- Co-authored-by: Manimaran <[email protected]> * Fix: refreshed sdk * refresh sdk Signed-off-by: Sivaanand Murugesan <[email protected]> --------- Signed-off-by: Sivaanand Murugesan <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Manimaran <[email protected]>
1 parent a326696 commit b9ff460

File tree

13 files changed

+1196
-192
lines changed

13 files changed

+1196
-192
lines changed

docs/resources/addon_deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ description: |-
1818

1919
### Required
2020

21-
- `cluster_uid` (String)
21+
- `cluster_uid` (String) The UID of the cluster to attach the addon profile(s) to.
2222

2323
### Optional
2424

docs/resources/alert.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ resource "spectrocloud_alert" "alert_http" {
5151
- `component` (String) The component of the system that the alert is associated with. Currently, `ClusterHealth` is the only supported value.
5252
- `is_active` (Boolean) Indicates whether the alert is active. Set to `true` to activate the alert, or `false` to deactivate it.
5353
- `project` (String) The project to which the alert belongs to.
54-
- `type` (String) The type of alert mechanism to use. Can be either `email` for email alerts or `http` for sending HTTP requests.
5554

5655
### Optional
5756

@@ -61,6 +60,7 @@ resource "spectrocloud_alert" "alert_http" {
6160
- `identifiers` (Set of String) A set of unique identifiers to which the alert will be sent. This is used to target specific users or groups.
6261
- `status` (Block List) A status block representing the internal status of the alert. This is primarily for internal use and not utilized directly. (see [below for nested schema](#nestedblock--status))
6362
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
63+
- `type` (String) The type of alert mechanism to use. Can be `email` for email alerts, `http` for HTTP webhooks, or empty string to auto-detect based on provided configuration.
6464

6565
### Read-Only
6666

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/hashicorp/terraform-plugin-docs v0.24.0
1212
github.com/hashicorp/terraform-plugin-sdk/v2 v2.38.1
1313
github.com/robfig/cron v1.2.0
14-
github.com/spectrocloud/palette-sdk-go v0.0.0-20251215074243-9fbcfc1e9704
14+
github.com/spectrocloud/palette-sdk-go v0.0.0-20251218162546-85a50e19bc03
1515
github.com/stretchr/testify v1.11.1
1616
gopkg.in/yaml.v3 v3.0.1
1717
gotest.tools v2.2.0+incompatible

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
322322
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
323323
github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8=
324324
github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY=
325-
github.com/spectrocloud/palette-sdk-go v0.0.0-20251215074243-9fbcfc1e9704 h1:4grD/ubkSgh/A/DCYll9LkWxKNTq2l/XUH/KzdPQyCA=
326-
github.com/spectrocloud/palette-sdk-go v0.0.0-20251215074243-9fbcfc1e9704/go.mod h1:izLxNVNnE7JHh7C6piEVo9SLfa4vR8KfX7cEYa1fYXU=
325+
github.com/spectrocloud/palette-sdk-go v0.0.0-20251218162546-85a50e19bc03 h1:KJx6immGVySGmVf9Vv1j2ZbRBZ9iDl1KiHFDA5hh928=
326+
github.com/spectrocloud/palette-sdk-go v0.0.0-20251218162546-85a50e19bc03/go.mod h1:izLxNVNnE7JHh7C6piEVo9SLfa4vR8KfX7cEYa1fYXU=
327327
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
328328
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
329329
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=

spectrocloud/addon_deployment.go

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package spectrocloud
22

33
import (
4+
"log"
45
"strings"
56

67
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
@@ -12,6 +13,204 @@ import (
1213
"github.com/spectrocloud/terraform-provider-spectrocloud/types"
1314
)
1415

16+
// readAddonDeploymentMultiple reads multiple addon profiles from the cluster
17+
func readAddonDeploymentMultiple(c *client.V1Client, d *schema.ResourceData, cluster *models.V1SpectroCluster) (diag.Diagnostics, bool) {
18+
var diags diag.Diagnostics
19+
20+
// Get the profile UIDs from resource ID
21+
profileUIDs, err := getClusterProfileUIDs(d.Id())
22+
if err != nil {
23+
// Fallback to legacy single profile handling
24+
return readAddonDeployment(c, d, cluster)
25+
}
26+
27+
// Build a map of profile UIDs we're tracking
28+
trackedProfiles := make(map[string]bool)
29+
for _, uid := range profileUIDs {
30+
trackedProfiles[uid] = true
31+
}
32+
33+
// Get existing profiles from config to preserve pack configurations
34+
existingProfiles := d.Get("cluster_profile").([]interface{})
35+
existingProfilesMap := make(map[string]map[string]interface{})
36+
for _, p := range existingProfiles {
37+
if p == nil {
38+
continue
39+
}
40+
profile := p.(map[string]interface{})
41+
if id, ok := profile["id"].(string); ok && id != "" {
42+
existingProfilesMap[id] = profile
43+
}
44+
}
45+
46+
// Flatten all tracked profiles from cluster state
47+
clusterProfiles := make([]interface{}, 0)
48+
foundProfiles := make([]string, 0)
49+
50+
for _, template := range cluster.Spec.ClusterProfileTemplates {
51+
if template == nil {
52+
continue
53+
}
54+
55+
// Check if this profile is one we're tracking
56+
if !trackedProfiles[template.UID] {
57+
// Check by fetching the profile and matching by name (for version upgrades)
58+
found := false
59+
for trackedUID := range trackedProfiles {
60+
trackedProfile, err := c.GetClusterProfile(trackedUID)
61+
if err != nil {
62+
continue
63+
}
64+
if trackedProfile != nil && trackedProfile.Metadata != nil &&
65+
template.Name == trackedProfile.Metadata.Name {
66+
found = true
67+
break
68+
}
69+
}
70+
if !found {
71+
continue
72+
}
73+
}
74+
75+
// Flatten this profile
76+
profileData, err := flattenAddonDeploymentProfile(c, d, template, existingProfilesMap)
77+
if err != nil {
78+
log.Printf("Warning: failed to flatten profile %s: %v", template.UID, err)
79+
continue
80+
}
81+
82+
clusterProfiles = append(clusterProfiles, profileData)
83+
foundProfiles = append(foundProfiles, template.UID)
84+
}
85+
86+
// If no profiles found, mark resource as deleted
87+
if len(clusterProfiles) == 0 {
88+
d.SetId("")
89+
return diags, false
90+
}
91+
92+
// Update cluster_profile in state
93+
if err := d.Set("cluster_profile", clusterProfiles); err != nil {
94+
return diag.FromErr(err), false
95+
}
96+
97+
// Update resource ID with current profile UIDs
98+
clusterUid := d.Get("cluster_uid").(string)
99+
d.SetId(buildAddonDeploymentId(clusterUid, foundProfiles))
100+
101+
return diags, true
102+
}
103+
104+
// flattenAddonDeploymentProfile flattens a single profile template
105+
func flattenAddonDeploymentProfile(c *client.V1Client, d *schema.ResourceData, profile *models.V1ClusterProfileTemplate, existingProfilesMap map[string]map[string]interface{}) (map[string]interface{}, error) {
106+
clusterProfile := make(map[string]interface{})
107+
clusterProfile["id"] = profile.UID
108+
109+
// Check if user has defined packs in their config for this profile
110+
hasPacksInConfig := false
111+
if existingConfig, exists := existingProfilesMap[profile.UID]; exists {
112+
if packs, ok := existingConfig["pack"]; ok && packs != nil {
113+
packsList := packs.([]interface{})
114+
if len(packsList) > 0 {
115+
hasPacksInConfig = true
116+
}
117+
}
118+
}
119+
120+
// Only flatten packs if user has defined them in config
121+
if hasPacksInConfig {
122+
packManifests, diagResult, done := getPacksContent(profile.Packs, c, d)
123+
if done {
124+
log.Printf("Warning: error getting pack content for profile %s: %v", profile.UID, diagResult)
125+
} else {
126+
diagPacks := make([]*models.V1PackManifestEntity, 0)
127+
if existingConfig, exists := existingProfilesMap[profile.UID]; exists {
128+
if packsRaw, ok := existingConfig["pack"]; ok && packsRaw != nil {
129+
for _, pack := range packsRaw.([]interface{}) {
130+
if p, e := toAddonDeploymentPackCreate(pack); e == nil {
131+
diagPacks = append(diagPacks, p)
132+
}
133+
}
134+
}
135+
}
136+
137+
// Build registry maps for this profile
138+
registryNameMap := buildPackRegistryNameMapForProfile(existingProfilesMap[profile.UID])
139+
registryUIDMap := buildPackRegistryUIDMapForProfile(existingProfilesMap[profile.UID])
140+
141+
packs, err := flattenPacksWithRegistryMaps(c, diagPacks, profile.Packs, packManifests, registryNameMap, registryUIDMap)
142+
if err == nil {
143+
clusterProfile["pack"] = packs
144+
}
145+
}
146+
}
147+
148+
// Flatten profile variables
149+
clusterUID := d.Get("cluster_uid").(string)
150+
if clusterUID != "" {
151+
clusterVars, err := c.GetClusterVariables(clusterUID)
152+
if err == nil {
153+
for _, clusterVar := range clusterVars {
154+
if clusterVar.ProfileUID != nil && *clusterVar.ProfileUID == profile.UID && clusterVar.Variables != nil {
155+
vars := make(map[string]interface{})
156+
for _, v := range clusterVar.Variables {
157+
if v.Name != nil && v.Value != "" {
158+
vars[*v.Name] = v.Value
159+
}
160+
}
161+
if len(vars) > 0 {
162+
clusterProfile["variables"] = vars
163+
}
164+
break
165+
}
166+
}
167+
}
168+
}
169+
170+
return clusterProfile, nil
171+
}
172+
173+
// buildPackRegistryNameMapForProfile builds a registry name map for a single profile
174+
// Returns a map indicating which packs have registry_name set
175+
func buildPackRegistryNameMapForProfile(profileConfig map[string]interface{}) map[string]bool {
176+
registryNameMap := make(map[string]bool)
177+
if profileConfig == nil {
178+
return registryNameMap
179+
}
180+
181+
if packsRaw, ok := profileConfig["pack"]; ok && packsRaw != nil {
182+
for _, pack := range packsRaw.([]interface{}) {
183+
p := pack.(map[string]interface{})
184+
packName := p["name"].(string)
185+
if regName, ok := p["registry_name"]; ok && regName != nil && regName.(string) != "" {
186+
registryNameMap[packName] = true
187+
}
188+
}
189+
}
190+
return registryNameMap
191+
}
192+
193+
// buildPackRegistryUIDMapForProfile builds a registry UID map for a single profile
194+
// Returns a map indicating which packs have registry_uid set
195+
func buildPackRegistryUIDMapForProfile(profileConfig map[string]interface{}) map[string]bool {
196+
registryUIDMap := make(map[string]bool)
197+
if profileConfig == nil {
198+
return registryUIDMap
199+
}
200+
201+
if packsRaw, ok := profileConfig["pack"]; ok && packsRaw != nil {
202+
for _, pack := range packsRaw.([]interface{}) {
203+
p := pack.(map[string]interface{})
204+
packName := p["name"].(string)
205+
if regUID, ok := p["registry_uid"]; ok && regUID != nil && regUID.(string) != "" {
206+
registryUIDMap[packName] = true
207+
}
208+
}
209+
}
210+
return registryUIDMap
211+
}
212+
213+
// readAddonDeployment is the legacy function for reading a single addon profile (kept for backward compatibility)
15214
func readAddonDeployment(c *client.V1Client, d *schema.ResourceData, cluster *models.V1SpectroCluster) (diag.Diagnostics, bool) {
16215

17216
var diags diag.Diagnostics

spectrocloud/cluster_common_attachment.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,24 +107,29 @@ func resourceAddonDeploymentDelete(ctx context.Context, d *schema.ResourceData,
107107

108108
var diags diag.Diagnostics
109109
clusterUid := d.Get("cluster_uid").(string)
110-
//clusterContext := d.Get("context").(string)
110+
111111
cluster, err := c.GetCluster(clusterUid)
112112
if err != nil {
113113
return diag.FromErr(err)
114114
} else if cluster == nil {
115115
return diags
116116
}
117117

118-
profile_uids := make([]string, 0)
119-
profileId, err := getClusterProfileUID(d.Id())
118+
// Get all profile UIDs from the resource ID
119+
profileUIDs, err := getClusterProfileUIDs(d.Id())
120120
if err != nil {
121-
return diags
121+
// Fallback to legacy single profile ID extraction
122+
profileId, legacyErr := getClusterProfileUID(d.Id())
123+
if legacyErr != nil {
124+
return diags
125+
}
126+
profileUIDs = []string{profileId}
122127
}
123-
profile_uids = append(profile_uids, profileId)
124128

125-
if len(profile_uids) > 0 {
129+
if len(profileUIDs) > 0 {
130+
log.Printf("Deleting %d addon profiles from cluster %s: %v", len(profileUIDs), clusterUid, profileUIDs)
126131
err = c.DeleteAddonDeployment(clusterUid, &models.V1SpectroClusterProfilesDeleteEntity{
127-
ProfileUids: profile_uids,
132+
ProfileUids: profileUIDs,
128133
})
129134
if err != nil {
130135
return diag.FromErr(err)

0 commit comments

Comments
 (0)