Skip to content

Commit

Permalink
update (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
saamalik authored May 2, 2021
1 parent b0b7fb2 commit 30af03b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ resource "spectrocloud_cluster_profile" "profile" {
metadata:
labels:
app: wordpress
app3: wordpress7
app3: wordpress786
name: wordpress
EOT
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/client/cluster_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,23 @@ func (h *V1alpha1Client) UpdateClusterProfile(clusterProfile *models.V1alpha1Clu

packUpdateParams := make([]*models.V1alpha1PackManifestUpdateEntity, 0, 1)
for _, p := range clusterProfile.Spec.Template.Packs {
manifests := make([]*models.V1alpha1ManifestRefUpdateEntity, len(p.Manifests))
for i, m := range p.Manifests {
manifests[i] = &models.V1alpha1ManifestRefUpdateEntity{
Content: m.Content,
Name: ptr.StringPtr(m.Name),
// Seems backend already handles a not passed in UID
UID: "",
}
}
packUpdateParams = append(packUpdateParams, &models.V1alpha1PackManifestUpdateEntity{
Layer: p.Layer,
Name: p.Name,
Tag: p.Tag,
Type: p.Type,
UID: *p.UID,
Values: p.Values,
Manifests: manifests,
})
}

Expand Down
7 changes: 7 additions & 0 deletions spectrocloud/resource_cluster_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ func resourceClusterProfile() *schema.Resource {
"content" : {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
// UI strips the trailing newline on save
if strings.TrimSpace(old) == strings.TrimSpace(new) {
return true
}
return false
},
},
},
},
Expand Down

0 comments on commit 30af03b

Please sign in to comment.