Skip to content

Commit

Permalink
Make applications feild immutable in clusters (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
uzaxirr authored Jul 18, 2024
1 parent c7c3c37 commit 7cbaf56
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions civo/kubernetes/resource_kubernetes_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package kubernetes

import (
"context"
"fmt"
"log"
"strings"
"time"
Expand Down Expand Up @@ -155,6 +156,7 @@ func ResourceKubernetesCluster() *schema.Resource {
Update: schema.DefaultTimeout(30 * time.Minute),
Delete: schema.DefaultTimeout(30 * time.Minute),
},
CustomizeDiff: customizeDiffKubernetesCluster,
}
}

Expand Down Expand Up @@ -452,3 +454,10 @@ func resourceKubernetesClusterDelete(_ context.Context, d *schema.ResourceData,

return nil
}

func customizeDiffKubernetesCluster(ctx context.Context, d *schema.ResourceDiff, meta interface{}) error {
if d.Id() != "" && d.HasChange("applications") {
return fmt.Errorf("the 'applications' field is immutable")
}
return nil
}

0 comments on commit 7cbaf56

Please sign in to comment.