55 "errors"
66 "fmt"
77 "log"
8+ "math"
89 "sort"
910 "strings"
1011 "time"
@@ -15,7 +16,6 @@ import (
1516 "github.com/spectrocloud/palette-sdk-go/api/models"
1617 "github.com/spectrocloud/palette-sdk-go/client"
1718
18- "github.com/spectrocloud/terraform-provider-spectrocloud/spectrocloud/constants"
1919 "github.com/spectrocloud/terraform-provider-spectrocloud/spectrocloud/schemas"
2020 "github.com/spectrocloud/terraform-provider-spectrocloud/types"
2121)
@@ -855,7 +855,7 @@ func toMachinePoolVsphere(machinePool interface{}) (*models.V1VsphereMachinePool
855855 memoryInt := ins ["memory_mb" ].(int )
856856 cpuInt := ins ["cpu" ].(int )
857857
858- if diskSizeInt > constants . Int32MaxValue || memoryInt > constants . Int64MaxValue || cpuInt > constants . Int32MaxValue {
858+ if uint64 ( diskSizeInt ) > math . MaxInt32 || uint64 ( memoryInt ) > math . MaxInt64 || uint64 ( cpuInt ) > math . MaxInt32 {
859859 return nil , fmt .Errorf ("instance type values out of range: disk_size_gb=%d, memory_mb=%d, cpu=%d" , diskSizeInt , memoryInt , cpuInt )
860860 }
861861
@@ -866,7 +866,7 @@ func toMachinePoolVsphere(machinePool interface{}) (*models.V1VsphereMachinePool
866866 }
867867
868868 countInt := m ["count" ].(int )
869- if countInt > constants . Int32MaxValue {
869+ if uint64 ( countInt ) > math . MaxInt32 {
870870 return nil , fmt .Errorf ("count value %d is out of range for int32" , countInt )
871871 }
872872
@@ -875,15 +875,15 @@ func toMachinePoolVsphere(machinePool interface{}) (*models.V1VsphereMachinePool
875875
876876 if m ["min" ] != nil {
877877 minInt := m ["min" ].(int )
878- if minInt > constants . Int32MaxValue {
878+ if uint64 ( minInt ) > math . MaxInt32 {
879879 return nil , fmt .Errorf ("min value %d is out of range for int32" , minInt )
880880 }
881881 min = SafeInt32 (minInt )
882882 }
883883
884884 if m ["max" ] != nil {
885885 maxInt := m ["max" ].(int )
886- if maxInt > constants . Int32MaxValue {
886+ if uint64 ( maxInt ) > math . MaxInt32 {
887887 return nil , fmt .Errorf ("max value %d is out of range for int32" , maxInt )
888888 }
889889 max = SafeInt32 (maxInt )
@@ -915,13 +915,13 @@ func toMachinePoolVsphere(machinePool interface{}) (*models.V1VsphereMachinePool
915915 if m ["node_repave_interval" ] != nil {
916916 nodeRepaveInterval = m ["node_repave_interval" ].(int )
917917 }
918- if nodeRepaveInterval > constants . Int32MaxValue {
918+ if uint64 ( nodeRepaveInterval ) > math . MaxInt32 {
919919 return nil , fmt .Errorf ("node_repave_interval value %d is out of range for int32" , nodeRepaveInterval )
920920 }
921921 mp .PoolConfig .NodeRepaveInterval = SafeInt32 (nodeRepaveInterval )
922922 } else {
923923 nodeRepaveInterval := m ["node_repave_interval" ].(int )
924- if nodeRepaveInterval > constants . Int32MaxValue {
924+ if uint64 ( nodeRepaveInterval ) > math . MaxInt32 {
925925 return nil , fmt .Errorf ("node_repave_interval value %d is out of range for int32" , nodeRepaveInterval )
926926 }
927927 err := ValidationNodeRepaveIntervalForControlPlane (nodeRepaveInterval )
0 commit comments