@@ -958,9 +958,6 @@ func skipDiffIfIntervalIs12And12HourTimeDiff(k, oldValue, newValue string, d *sc
958958
959959func customizeDiff () schema.CustomizeDiffFunc {
960960 return func (ctx context.Context , diff * schema.ResourceDiff , meta interface {}) error {
961- if err := validateQueryPerformanceFactor ()(ctx , diff , meta ); err != nil {
962- return err
963- }
964961 if err := validateModulesForRedis8 ()(ctx , diff , meta ); err != nil {
965962 return err
966963 }
@@ -971,46 +968,6 @@ func customizeDiff() schema.CustomizeDiffFunc {
971968 }
972969}
973970
974- func validateQueryPerformanceFactor () schema.CustomizeDiffFunc {
975- return func (ctx context.Context , diff * schema.ResourceDiff , meta interface {}) error {
976- // Check if "query_performance_factor" is set
977- qpf , qpfExists := diff .GetOk ("query_performance_factor" )
978-
979- if qpfExists && qpf .(string ) != "" {
980- // Check if Redis version is 8.0 or later
981- redisVersion , _ := diff .GetOk ("redis_version" )
982- if redisVersion != nil && redisVersion .(string ) >= "8.0" {
983- // Redis 8.0+ has RediSearch bundled by default, no need to check modules
984- return nil
985- }
986-
987- // Ensure "modules" is explicitly defined in the HCL for Redis < 8.0
988- _ , modulesExists := diff .GetOkExists ("modules" )
989-
990- if ! modulesExists {
991- return fmt .Errorf (`"query_performance_factor" requires the "modules" key to be explicitly defined in HCL` )
992- }
993-
994- // Retrieve modules as a slice of interfaces
995- rawModules := diff .Get ("modules" ).(* schema.Set ).List ()
996-
997- // Convert modules to []map[string]interface{}
998- var modules []map [string ]interface {}
999- for _ , rawModule := range rawModules {
1000- if moduleMap , ok := rawModule .(map [string ]interface {}); ok {
1001- modules = append (modules , moduleMap )
1002- }
1003- }
1004-
1005- // Check if "RediSearch" exists
1006- if ! containsDBModule (modules , "RediSearch" ) {
1007- return fmt .Errorf (`"query_performance_factor" requires the "modules" list to contain "RediSearch"` )
1008- }
1009- }
1010- return nil
1011- }
1012- }
1013-
1014971// Helper function to check if a module exists
1015972func containsDBModule (modules []map [string ]interface {}, moduleName string ) bool {
1016973 for _ , module := range modules {
0 commit comments