Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/hashicorp/terraform-plugin-docs v0.24.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.38.2
github.com/robfig/cron v1.2.0
github.com/spectrocloud/palette-sdk-go v0.0.0-20260205062126-c4a2668955ec
github.com/spectrocloud/palette-sdk-go v0.0.0-20260209154431-4e969cc38478
github.com/stretchr/testify v1.11.1
gopkg.in/yaml.v3 v3.0.1
gotest.tools v2.2.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8=
github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY=
github.com/spectrocloud/palette-sdk-go v0.0.0-20260205062126-c4a2668955ec h1:DrhFYn9/83DzS7VjHl8HqKF+HDH16HStSiDckMeOKZc=
github.com/spectrocloud/palette-sdk-go v0.0.0-20260205062126-c4a2668955ec/go.mod h1:izLxNVNnE7JHh7C6piEVo9SLfa4vR8KfX7cEYa1fYXU=
github.com/spectrocloud/palette-sdk-go v0.0.0-20260209154431-4e969cc38478 h1:dlyDhjK5NSKdyM7DZA5bQce1Y0h0LjbsWDMPnkw0+GY=
github.com/spectrocloud/palette-sdk-go v0.0.0-20260209154431-4e969cc38478/go.mod h1:izLxNVNnE7JHh7C6piEVo9SLfa4vR8KfX7cEYa1fYXU=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
Expand Down
25 changes: 19 additions & 6 deletions spectrocloud/resource_cluster_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -665,14 +665,27 @@ func resolvePackUID(c *client.V1Client, name, tag, registryUID string) (string,
return "", fmt.Errorf("failed to get pack versions for name %s in registry %s: %w", name, registryUID, err)
}

if packVersions == nil || len(packVersions.Tags) == 0 {
return "", fmt.Errorf("no pack found with name %s in registry %s", name, registryUID)
// Path 1: Public registry — has Tags; resolve from Tags only.
if packVersions != nil && len(packVersions.Tags) > 0 {
for _, packTag := range packVersions.Tags {
if packTag.Version == tag {
return packTag.PackUID, nil
}
}
return "", fmt.Errorf("no pack found with name %s, tag %s in registry %s", name, tag, registryUID)
}

// Find the pack with matching tag/version
for _, packTag := range packVersions.Tags {
if packTag.Version == tag {
return packTag.PackUID, nil
// Path 2: Private registry — no Tags; do not use packVersions.Tags. Resolve via list/search.
registryFilter := "spec.registryUid=" + registryUID
packs, listErr := c.GetPacks([]string{registryFilter}, registryUID)
if listErr != nil {
return "", fmt.Errorf("no pack found with name %s in registry %s (list failed: %w)", name, registryUID, listErr)
}
for _, pack := range packs {
if pack.Spec != nil && pack.Spec.Name == name && pack.Spec.Version == tag {
if pack.Metadata != nil && pack.Metadata.UID != "" {
return pack.Metadata.UID, nil
}
}
}

Expand Down