@@ -391,10 +391,13 @@ func resourceRedisCloudProDatabaseCreate(ctx context.Context, d *schema.Resource
391391 By : redis .String (throughputMeasurementBy ),
392392 Value : redis .Int (throughputMeasurementValue ),
393393 },
394- Modules : createModules ,
395- Alerts : createAlerts ,
396- RemoteBackup : buildBackupPlan (d .Get ("remote_backup" ).([]interface {}), d .Get ("periodic_backup_path" )),
397- QueryPerformanceFactor : redis .String (queryPerformanceFactor ),
394+ Modules : createModules ,
395+ Alerts : createAlerts ,
396+ RemoteBackup : buildBackupPlan (d .Get ("remote_backup" ).([]interface {}), d .Get ("periodic_backup_path" )),
397+ }
398+
399+ if queryPerformanceFactor != "" {
400+ createDatabase .QueryPerformanceFactor = redis .String (queryPerformanceFactor )
398401 }
399402
400403 if password != "" {
@@ -597,11 +600,10 @@ func resourceRedisCloudProDatabaseRead(ctx context.Context, d *schema.ResourceDa
597600 if err := d .Set ("remote_backup" , flattenBackupPlan (db .Backup , d .Get ("remote_backup" ).([]interface {}), d .Get ("periodic_backup_path" ).(string ))); err != nil {
598601 return diag .FromErr (err )
599602 }
600-
601- ////query_performance_factor
602- //if err := d.Set("query_performance_factor", redis.String(*db.)); err != nil {
603- // return diag.FromErr(err)
604- //}
603+
604+ if err := d .Set ("query_performance_factor" , redis .String (* db .QueryPerformanceFactor )); err != nil {
605+ return diag .FromErr (err )
606+ }
605607
606608 if err := readTags (ctx , api , subId , dbId , d ); err != nil {
607609 return diag .FromErr (err )
@@ -677,13 +679,12 @@ func resourceRedisCloudProDatabaseUpdate(ctx context.Context, d *schema.Resource
677679 By : redis .String (d .Get ("throughput_measurement_by" ).(string )),
678680 Value : redis .Int (d .Get ("throughput_measurement_value" ).(int )),
679681 },
680- DataPersistence : redis .String (d .Get ("data_persistence" ).(string )),
681- DataEvictionPolicy : redis .String (d .Get ("data_eviction" ).(string )),
682- SourceIP : setToStringSlice (d .Get ("source_ips" ).(* schema.Set )),
683- Alerts : & alerts ,
684- RemoteBackup : buildBackupPlan (d .Get ("remote_backup" ).([]interface {}), d .Get ("periodic_backup_path" )),
685- EnableDefaultUser : redis .Bool (d .Get ("enable_default_user" ).(bool )),
686- QueryPerformanceFactor : redis .String (d .Get ("query_performance_factor" ).(string )),
682+ DataPersistence : redis .String (d .Get ("data_persistence" ).(string )),
683+ DataEvictionPolicy : redis .String (d .Get ("data_eviction" ).(string )),
684+ SourceIP : setToStringSlice (d .Get ("source_ips" ).(* schema.Set )),
685+ Alerts : & alerts ,
686+ RemoteBackup : buildBackupPlan (d .Get ("remote_backup" ).([]interface {}), d .Get ("periodic_backup_path" )),
687+ EnableDefaultUser : redis .Bool (d .Get ("enable_default_user" ).(bool )),
687688 }
688689
689690 // One of the following fields must be set, validation is handled in the schema (ExactlyOneOf)
@@ -700,6 +701,11 @@ func resourceRedisCloudProDatabaseUpdate(ctx context.Context, d *schema.Resource
700701 update .SourceIP = []* string {redis .String ("0.0.0.0/0" )}
701702 }
702703
704+ queryPerformanceFactor := d .Get ("query_performance_factor" ).(string )
705+ if queryPerformanceFactor != "" {
706+ update .QueryPerformanceFactor = redis .String (queryPerformanceFactor )
707+ }
708+
703709 if d .Get ("password" ).(string ) != "" {
704710 update .Password = redis .String (d .Get ("password" ).(string ))
705711 }
0 commit comments