diff --git a/civo/network/resource_network.go b/civo/network/resource_network.go index 096d1e7..d769fd3 100644 --- a/civo/network/resource_network.go +++ b/civo/network/resource_network.go @@ -2,6 +2,7 @@ package network import ( "context" + "fmt" "log" "time" @@ -96,6 +97,7 @@ func ResourceNetwork() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, + CustomizeDiff: customizeDiffNetwork, } } @@ -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 +}