Skip to content

Commit

Permalink
make CIDR immutable for network resource
Browse files Browse the repository at this point in the history
  • Loading branch information
uzaxirr committed Jun 23, 2024
1 parent 8a47734 commit dd943d6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions civo/network/resource_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package network

import (
"context"
"fmt"
"log"
"time"

Expand Down Expand Up @@ -96,6 +97,7 @@ func ResourceNetwork() *schema.Resource {
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
CustomizeDiff: customizeDiffNetwork,
}
}

Expand Down Expand Up @@ -259,3 +261,10 @@ func expandStringList(input interface{}) []string {
}
return result
}

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

0 comments on commit dd943d6

Please sign in to comment.